diff --git a/LFPy-2.0.7/.github/workflows/pythonpublish.yml b/LFPy-2.0.7/.github/workflows/pythonpublish.yml deleted file mode 100644 index 7b5d7d7..0000000 --- a/LFPy-2.0.7/.github/workflows/pythonpublish.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Upload Python Package - -on: - release: - types: [created] - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools twine - - name: Build and publish to Test PYPI - env: - TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }} - run: | - python setup.py sdist - twine upload --repository-url https://test.pypi.org/legacy/ dist/* - - name: Build and publish to PYPI - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python setup.py sdist - twine upload dist/* diff --git a/LFPy-2.0.7/.readthedocs.yml b/LFPy-2.0.7/.readthedocs.yml deleted file mode 100644 index 34ba113..0000000 --- a/LFPy-2.0.7/.readthedocs.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: 2 - -sphinx: - configuration: doc/conf.py - -formats: all - -build: - image: latest - -conda: - environment: doc/environment.yml - -python: - version: 3 - install: - - method: pip - path: . diff --git a/LFPy-2.0.7/.travis.yml b/LFPy-2.0.7/.travis.yml deleted file mode 100644 index c93eaa8..0000000 --- a/LFPy-2.0.7/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: python -python: - - "2.7" - - "3.4" - - "3.5" - - "3.6" - - "3.7" - - "3.8" -addons: - apt: - packages: - - liblapack-dev - - libopenmpi-dev - - openmpi-bin - - libhdf5-serial-dev - - gfortran -install: - - travis_wait 30 pip install scipy -q - - pip install setuptools cython coveralls h5py matplotlib mpi4py -q - - pip install -r requirements.txt - - pip install -I pytest-cov==2.5.1 - - pip install pytest codecov - - source continuous_integration/install.sh -script: - - bash continuous_integration/test_script.sh -after_success: - coveralls - diff --git a/LFPy-2.0.7/Dockerfile b/LFPy-2.0.7/Dockerfile deleted file mode 100644 index de1bc0f..0000000 --- a/LFPy-2.0.7/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM continuumio/miniconda3 - -RUN conda config --add channels conda-forge - -RUN conda create -n lfpy python=3.7 lfpy ipython jupyter git matplotlib make gxx_linux-64 - -RUN echo "source activate lfpy" > ~/.bashrc -ENV PATH /opt/conda/envs/lfpy/bin:$PATH - -RUN git clone https://github.com/LFPy/LFPy.git /opt/LFPy diff --git a/LFPy-2.0.7/LFPy.egg-info/PKG-INFO b/LFPy-2.0.7/LFPy.egg-info/PKG-INFO deleted file mode 100644 index ed73e18..0000000 --- a/LFPy-2.0.7/LFPy.egg-info/PKG-INFO +++ /dev/null @@ -1,188 +0,0 @@ -Metadata-Version: 2.1 -Name: LFPy -Version: 2.0.7 -Summary: A module for modeling extracellular potentials of multicompartment neuron models built on NEURON -Home-page: http://LFPy.readthedocs.io -Maintainer: LFPy-team -Maintainer-email: lfpy@users.noreply.github.com -License: LICENSE -Download-URL: https://github.com/LFPy/LFPy/tarball/v2.0.7 -Description: LFPy - ==== - - LFPy is a Python-module for calculation of extracellular potentials from multicompartment neuron models. - It relies on the NEURON simulator (http://www.neuron.yale.edu/neuron) and uses the - Python interface (http://www.frontiersin.org/neuroinformatics/10.3389/neuro.11.001.2009/abstract) it provides. - - You can now test some LFPy examples online without installation: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/LFPy/LFPy_binder_examples/master) - - LFPy provides a set of easy-to-use Python classes for setting up your model, running your simulations and calculating the extracellular potentials arising from activity in your model neuron. If you have a model working in NEURON (www.neuron.yale.edu) - already, it is likely that it can be adapted to work with LFPy. - - The extracellular potentials are calculated from transmembrane currents in multi-compartment neuron models using the line-source method (Holt & Koch, J Comp Neurosci 1999), - but a simpler point-source method is also available. The calculations assume that the neuron are surrounded by an infinite extracellular medium with homogeneous and frequency - independent conductivity, and compartments are assumed to be at least at a minimal distance from the electrode (which can be specified by the user). For more information on - the biophysics underlying the numerical framework used see this coming book chapter: - - - K.H. Pettersen, H. Linden, A.M. Dale and G.T. Einevoll: Extracellular spikes and current-source density, in *Handbook of Neural Activity Measurement*, edited by R. Brette and A. Destexhe, Cambridge, to appear (preprint PDF, 5.7MB http://arken.umb.no/~gautei/forskning/PettersenLindenDaleEinevoll-BookChapter-revised.pdf - - The first release of LFPy (v1.x) was mainly designed for simulation extracellular potentials of single neurons, described in our paper on the package in Frontiers in Neuroinformatics entitled "LFPy: A tool for biophysical simulation of extracellular potentials generated by detailed model neurons". - The article can be found at http://dx.doi.org/10.3389%2Ffninf.2013.00041. - Since version 2 (LFPy v2.x), the tool also facilitates simulations of extracellular potentials and current dipole moment from ongoing activity in recurrently connected networks of multicompartment neurons, prediction of EEG scalp surface potentials, - MEG scalp surface magnetic fields, as described in the bioRXiv preprint "Multimodal modeling of neural network activity: computing LFP, ECoG, EEG and MEG signals with LFPy2.0" by Espen Hagen, Solveig Naess, Torbjoern V Ness, Gaute T Einevoll, found at https://doi.org/10.1101/281717. - - Citing LFPy: - - - LFPy v2.x: Hagen E, Næss S, Ness TV and Einevoll GT (2018) Multimodal Modeling of Neural Network Activity: Computing LFP, ECoG, EEG, and MEG Signals With LFPy 2.0. Front. Neuroinform. 12:92. doi: 10.3389/fninf.2018.00092. https://dx.doi.org/10.3389/fninf.2018.00092 - - LFPy v1.x: Linden H, Hagen E, Leski S, Norheim ES, Pettersen KH and Einevoll GT (2013). LFPy: A tool for biophysical simulation of extracellular potentials generated by detailed model neurons. Front. Neuroinform. 7:41. doi: 10.3389/fninf.2013.00041. https://dx.doi.org/10.3389/fninf.2013.00041 - - LFPy was developed in the Computational Neuroscience Group, Department of Mathemathical Sciences and Technology (http://www.nmbu.no/imt), - at the Norwegian University of Life Sciences (http://www.nmbu.no), - in collaboration with the Laboratory of Neuroinformatics (http://www.nencki.gov.pl/en/laboratory-of-neuroinformatics), - Nencki Institute of Experimental Biology (http://www.nencki.gov.pl), Warsaw, Poland. The effort was supported by - International Neuroinformatics Coordinating Facility (http://incf.org), the Research Council of Norway (http://www.forskningsradet.no/english) (eScience, NevroNor) and EU-FP7 (BrainScaleS, http://www.brainscales.org). - - For updated information on LFPy and online documentation, see the LFPy homepage (http://lfpy.readthedocs.io). - - This scientific software is released under the GNU Public License GPLv3. - - Code status - =========== - [![PyPI version](https://badge.fury.io/py/LFPy.svg)](https://badge.fury.io/py/LFPy) - [![Build Status](https://travis-ci.org/LFPy/LFPy.svg?branch=master)](https://travis-ci.org/LFPy/LFPy) - [![Coverage Status](https://coveralls.io/repos/github/LFPy/LFPy/badge.svg?branch=master)](https://coveralls.io/github/LFPy/LFPy?branch=master) - [![Documentation Status](https://readthedocs.org/projects/lfpy/badge/?version=latest)](http://lfpy.readthedocs.io/en/latest/?badge=latest) - [![DOI](https://zenodo.org/badge/78627256.svg)](https://zenodo.org/badge/latestdoi/78627256) - - Conda-forge release info - ======================== - - | Name | Downloads | Version | Platforms | - | --- | --- | --- | --- | - | [![Conda Recipe](https://img.shields.io/badge/recipe-lfpy-green.svg)](https://anaconda.org/conda-forge/lfpy) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/lfpy.svg)](https://anaconda.org/conda-forge/lfpy) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/lfpy.svg)](https://anaconda.org/conda-forge/lfpy) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/lfpy.svg)](https://anaconda.org/conda-forge/lfpy) | - - Requirements - ============ - - To install LFPy you will need the following: - - - Python modules numpy, scipy, matplotlib, h5py, mpi4py, Cython - - NEURON (from http://www.neuron.yale.edu, v7.6.4 or newer) and corresponding Python module. The following should execute without error in a Python console: - - import neuron - neuron.test() - - - Cython (C-extensions for python, http://cython.org) to speed up simulations of extracellular fields - - - Installation - ============ - - There are few options to install LFPy: - - 1. From the Python Package Index with only local access using pip: - - pip install LFPy --user - - as sudoer (in general not recommended as system Python files may be overwritten): - - sudo pip install LFPy - - Upgrading LFPy from the Python package index (without attempts at upgrading dependencies): - - pip install --upgrade --no-deps LFPy --user - - LFPy release candidates can be installed as: - - pip install --pre --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple LFPy --user - - - 2. From the Python Package Index with only local access using easy_install: - - easy_install --user LFPy - - As sudoer: - - sudo easy_install LFPy - - 3. From source: - - tar -xzf LFPy-x.x.tar.gz - cd LFPy-x.x - (sudo) python setup.py develop (--user) - - 4. Development version from the GitHub repository: - - git clone https://github.com/LFPy/LFPy.git - cd LFPy - (sudo) pip install -r requirements.txt (--user) # install dependencies - (sudo) python setup.py develop (--user) - - 5. Anaconda Python (macos/linux): - - conda install lfpy neuron=*=mpi* # installs LFPy and Neuron in the current conda environment - - or - - conda create -n lfpy lfpy neuron=*=mpi* # creates new conda environment with LFPy and Neuron - - Uninstall - ========= - - To remove installed LFPy files it should suffice to issue (repeat until no more LFPy files are found): - - (sudo) pip uninstall LFPy - - - Docker - ====== - - We provide a Docker (https://www.docker.com) container build file with LFPy. - To get started, install Docker and issue: - - docker build -t lfpy https://raw.githubusercontent.com/LFPy/LFPy/master/Dockerfile - docker run -it -p 5000:5000 lfpy - - Various LFPy example files can be found in the folder ``/opt/LFPy/examples/`` - when the container is running. Jupyter notebook servers running from within the - container can be accessed after invoking them by issuing: - - cd /opt/LFPy/examples/ - jupyter notebook --ip 0.0.0.0 --port=5000 --no-browser --allow-root - - and opening the resulting URL in a browser the host computer, similar to: - http://127.0.0.1:5000/?token=dcf8f859f859740fc858c568bdd5b015e0cf15bfc2c5b0c1 - - - Documentation - ============= - - To generate the html documentation using Sphinx, issue from the LFPy source code directory: - - sphinx-build -b html /doc - - The main html file is in ``/index.html``. Numpydoc and the ReadTheDocs theme may be needed: - - pip install numpydoc --user - pip install sphinx-rtd-theme --user - -Platform: UNKNOWN -Classifier: License :: OSI Approved :: GNU General Public License (GPL) -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Cython -Classifier: Operating System :: OS Independent -Classifier: Topic :: Scientific/Engineering -Classifier: Topic :: Scientific/Engineering :: Physics -Classifier: Topic :: Utilities -Classifier: Intended Audience :: Developers -Classifier: Intended Audience :: Science/Research -Classifier: Development Status :: 5 - Production/Stable -Provides: LFPy -Provides-Extra: tests -Provides-Extra: docs diff --git a/LFPy-2.0.7/LFPy.egg-info/SOURCES.txt b/LFPy-2.0.7/LFPy.egg-info/SOURCES.txt deleted file mode 100644 index fbc0d12..0000000 --- a/LFPy-2.0.7/LFPy.egg-info/SOURCES.txt +++ /dev/null @@ -1,107 +0,0 @@ -LICENSE -MANIFEST.in -README.md -setup.cfg -setup.py -LFPy/__init__.py -LFPy/alias_method.py -LFPy/alias_method.pyx -LFPy/cell.py -LFPy/eegmegcalc.py -LFPy/inputgenerators.py -LFPy/lfpcalc.py -LFPy/network.py -LFPy/pointprocess.py -LFPy/recextelectrode.py -LFPy/run_simulation.py -LFPy/run_simulation.pyx -LFPy/templatecell.py -LFPy/tools.py -LFPy.egg-info/PKG-INFO -LFPy.egg-info/SOURCES.txt -LFPy.egg-info/dependency_links.txt -LFPy.egg-info/requires.txt -LFPy.egg-info/top_level.txt -LFPy/test/__init__.py -LFPy/test/ball_and_stick_template.hoc -LFPy/test/ball_and_sticks.hoc -LFPy/test/ball_and_sticks_w_lists.hoc -LFPy/test/common.py -LFPy/test/expsyni.mod -LFPy/test/fem_mix_dip.npz -LFPy/test/sinsyn.mod -LFPy/test/stick.hoc -LFPy/test/stick_template.hoc -LFPy/test/sticks_not_connected_head_to_toe.hoc -LFPy/test/test_alias_method.py -LFPy/test/test_cell.py -LFPy/test/test_eegmegcalc.py -LFPy/test/test_inputgenerators.py -LFPy/test/test_lfpcalc.py -LFPy/test/test_misc.py -LFPy/test/test_network.py -LFPy/test/test_networkcell.py -LFPy/test/test_pointprocess.py -LFPy/test/test_recextelectrode.py -LFPy/test/test_templatecell.py -LFPy/test/test_tools.py -LFPy/test/x86_64/expsyni.c -LFPy/test/x86_64/expsyni.mod -LFPy/test/x86_64/mod_func.c -LFPy/test/x86_64/sinsyn.c -LFPy/test/x86_64/sinsyn.mod -examples/LFPy-example-1.ipynb -examples/LFPy-example-2.ipynb -examples/LFPy-example-3.ipynb -examples/LFPy-example-4.ipynb -examples/LFPy-example-5.ipynb -examples/LFPy-example-6.ipynb -examples/LFPy-example-7.ipynb -examples/LFPy-example-8.ipynb -examples/LFPy-example-9.ipynb -examples/LFPyCellTemplate.hoc -examples/active_declarations_example2.hoc -examples/active_declarations_example3.hoc -examples/create_rotation_file.py -examples/example_ECoG.py -examples/example_ECoG_4sphere.py -examples/example_EEG.py -examples/example_EPFL_neurons.py -examples/example_LFPyCellTemplate.py -examples/example_MEA.py -examples/example_anisotropy.py -examples/example_loadL5bPCmodelsEH.py -examples/example_mpi.py -examples/example_mpi_2.py -examples/example_suppl.py -examples/bioRxiv281717/example_parallel_network.py -examples/bioRxiv281717/example_parallel_network_methods.py -examples/bioRxiv281717/example_parallel_network_parameters.py -examples/bioRxiv281717/example_parallel_network_plotting.py -examples/bioRxiv281717/figure_2.py -examples/bioRxiv281717/figure_4.py -examples/bioRxiv281717/figure_5.py -examples/bioRxiv281717/figure_6.py -examples/bioRxiv281717/simplemorpho_modded.hoc -examples/bioRxiv281717/figure_7_8/example_parallel_network.py -examples/bioRxiv281717/figure_7_8/example_parallel_network_methods.py -examples/bioRxiv281717/figure_7_8/example_parallel_network_parameters.py -examples/bioRxiv281717/figure_7_8/example_parallel_network_parameterspace.py -examples/bioRxiv281717/figure_7_8/example_parallel_network_plotting.py -examples/bioRxiv281717/figure_7_8/figure_7_8.py -examples/example_network/BallAndStick.hoc -examples/example_network/BallAndStickTemplate.hoc -examples/example_network/example_network.py -examples/example_network/example_network_cell.py -examples/example_network/example_network_population.py -examples/mazzoni_example/int1.hoc -examples/mazzoni_example/pyr1.hoc -examples/mazzoni_example/ref_sim.py -examples/mazzoni_example/single_cell.py -examples/morphologies/L5_Mainen96_LFPy.hoc -examples/morphologies/L5_Mainen96_wAxon_LFPy.hoc -examples/morphologies/ball_and_stick.hoc -examples/morphologies/example_morphology.hoc -examples/morphologies/markram/hoc-version/C010398B-P2.hoc -examples/nsg_example/L5_Mainen96_wAxon_LFPy.hoc -examples/nsg_example/nsg_example.py \ No newline at end of file diff --git a/LFPy-2.0.7/LFPy.egg-info/dependency_links.txt b/LFPy-2.0.7/LFPy.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/LFPy-2.0.7/LFPy.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/LFPy-2.0.7/LFPy.egg-info/requires.txt b/LFPy-2.0.7/LFPy.egg-info/requires.txt deleted file mode 100644 index 5f116f1..0000000 --- a/LFPy-2.0.7/LFPy.egg-info/requires.txt +++ /dev/null @@ -1,12 +0,0 @@ -numpy>=1.8 -scipy>=0.14 -Cython>=0.20 -h5py>=2.5 - -[docs] -sphinx -numpydoc -sphinx_rtd_theme - -[tests] -pytest diff --git a/LFPy-2.0.7/LFPy.egg-info/top_level.txt b/LFPy-2.0.7/LFPy.egg-info/top_level.txt deleted file mode 100644 index b4c3ad3..0000000 --- a/LFPy-2.0.7/LFPy.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -LFPy diff --git a/LFPy-2.0.7/LFPy/__init__.py b/LFPy-2.0.7/LFPy/__init__.py deleted file mode 100644 index 0502e75..0000000 --- a/LFPy-2.0.7/LFPy/__init__.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -"""Initialization of LFPy, a Python module for simulating extracellular potentials. - -Group of Computational Neuroscience, -Department of Mathematical Sciences and Technology, -Norwegian University of Life Sciences. - -Copyright (C) 2012 Computational Neuroscience Group, NMBU. - -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. - -:Classes: - * Cell - The pythonic neuron object itself laying on top of NEURON representing cells - * TemplateCell - Similar to Cell, but for models using cell templates - * Synapse - Convenience class for inserting synapses onto Cell objects - * StimIntElectrode - Convenience class for inserting electrodes onto Cell objects - * PointProcess - Parent class of Synapse and StimIntElectrode - * RecExtElectrode - Class for performing simulations of extracellular potentials - * RecMEAElectrode - Class for performing simulations of in vitro (slice) extracellular potentials - * Network - Class for creating distributed populations of cells and handling connections between cells in populations - * NetworkCell - Similar to `TemplateCell` with some attributes and methods for spike communication between parallel RANKs - * NetworkPopulation - Class representing group of Cell objects distributed across MPI RANKs - * OneSphereVolumeConductor - For computing extracellular potentials within and outside a homogeneous sphere - * FourSphereVolumeConductor - For computing extracellular potentials in 4-sphere model (brain, CSF, skull, scalp) - * InfiniteVolumeConductor - To compute extracellular potentials with current dipoles in infinite volume conductor - * MEG - Class for computing magnetic field from current dipole moment -:Modules: - * lfpcalc - Functions used by RecExtElectrode class - * tools - Some convenient functions - * inputgenerators - Functions for synaptic input time generation - * eegcalc - Functions for calculating current dipole moment vector P and P_tot from currents and distances. - * run_simulations - Functions to run NEURON simulations -""" - -__version__ = "2.0.7" - -from .pointprocess import Synapse, PointProcess, StimIntElectrode -from .recextelectrode import RecExtElectrode, RecMEAElectrode -from .cell import Cell -from .templatecell import TemplateCell -from .network import NetworkCell, NetworkPopulation, Network -from .test import _test as run_tests -from .eegmegcalc import OneSphereVolumeConductor, FourSphereVolumeConductor, InfiniteVolumeConductor, get_current_dipole_moment, MEG -from . import lfpcalc -from . import tools -from . import inputgenerators -from . import run_simulation diff --git a/LFPy-2.0.7/LFPy/alias_method.c b/LFPy-2.0.7/LFPy/alias_method.c deleted file mode 100644 index 17d07cd..0000000 --- a/LFPy-2.0.7/LFPy/alias_method.c +++ /dev/null @@ -1,9162 +0,0 @@ -/* Generated by Cython 0.29.14 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. -#else -#define CYTHON_ABI "0_29_14" -#define CYTHON_HEX_VERSION 0x001D0EF0 -#define CYTHON_FUTURE_DIVISION 1 -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#define __PYX_COMMA , -#ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) - #define CYTHON_USE_PYTYPE_LOOKUP 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) - #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) - #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) - #endif - #ifndef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK - #ifdef SIZEOF_VOID_P - enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; - #endif -#endif -#ifndef __has_attribute - #define __has_attribute(x) 0 -#endif -#ifndef __has_cpp_attribute - #define __has_cpp_attribute(x) 0 -#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 -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) -#ifdef _MSC_VER - #ifndef _MSC_STDINT_H_ - #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; - #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; - #endif - #endif -#else - #include -#endif -#ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] - #endif - #endif - #ifndef CYTHON_FALLTHROUGH - #if __has_attribute(fallthrough) - #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) - #else - #define CYTHON_FALLTHROUGH - #endif - #endif - #if defined(__clang__ ) && defined(__apple_build_version__) - #if __apple_build_version__ < 7000000 - #undef CYTHON_FALLTHROUGH - #define CYTHON_FALLTHROUGH - #endif - #endif -#endif - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif 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 - -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#endif - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef METH_STACKLESS - #define METH_STACKLESS 0 -#endif -#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) - #ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - #endif - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); - typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast - #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#elif PY_VERSION_HEX >= 0x03060000 - #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() -#elif PY_VERSION_HEX >= 0x03000000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#else - #define __Pyx_PyThreadState_Current _PyThreadState_Current -#endif -#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) -#include "pythread.h" -#define Py_tss_NEEDS_INIT 0 -typedef int Py_tss_t; -static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { - *key = PyThread_create_key(); - return 0; -} -static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { - Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); - *key = Py_tss_NEEDS_INIT; - return key; -} -static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { - PyObject_Free(key); -} -static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { - return *key != Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { - PyThread_delete_key(*key); - *key = Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { - return PyThread_set_key_value(*key, value); -} -static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { - return PyThread_get_key_value(*key); -} -#endif -#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) -#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) -#else -#define __Pyx_PyDict_NewPresized(n) PyDict_New() -#endif -#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) -#else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact - #define PyObject_Unicode PyObject_Str -#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_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#if CYTHON_ASSUME_SAFE_MACROS - #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) -#else - #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef __Pyx_PyAsyncMethodsStruct - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__LFPy__alias_method -#define __PYX_HAVE_API__LFPy__alias_method -/* Early includes */ -#include -#include -#include "numpy/arrayobject.h" -#include "numpy/ufuncobject.h" -#include "math.h" -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { - return (size_t) i < (size_t) limit; -} -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) - #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const 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_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#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_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -#define __Pyx_PySequence_Tuple(obj)\ - (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_ASSUME_SAFE_MACROS -#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 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(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(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - 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) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(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 '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - 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(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ -static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } - -static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - -/* Header.proto */ -#if !defined(CYTHON_CCOMPLEX) - #if defined(__cplusplus) - #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) - #define CYTHON_CCOMPLEX 1 - #else - #define CYTHON_CCOMPLEX 0 - #endif -#endif -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #include - #else - #include - #endif -#endif -#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) - #undef _Complex_I - #define _Complex_I 1.0fj -#endif - - -static const char *__pyx_f[] = { - "LFPy/alias_method.pyx", - "__init__.pxd", - "type.pxd", -}; -/* BufferFormatStructs.proto */ -#define IS_UNSIGNED(type) (((type) -1) > 0) -struct __Pyx_StructField_; -#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) -typedef struct { - const char* name; - struct __Pyx_StructField_* fields; - size_t size; - size_t arraysize[8]; - int ndim; - char typegroup; - 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; - - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":776 - * # in Cython to enable them only on the right systems. - * - * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t - */ -typedef npy_int8 __pyx_t_5numpy_int8_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":777 - * - * ctypedef npy_int8 int8_t - * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< - * ctypedef npy_int32 int32_t - * ctypedef npy_int64 int64_t - */ -typedef npy_int16 __pyx_t_5numpy_int16_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":778 - * ctypedef npy_int8 int8_t - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< - * ctypedef npy_int64 int64_t - * #ctypedef npy_int96 int96_t - */ -typedef npy_int32 __pyx_t_5numpy_int32_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":779 - * ctypedef npy_int16 int16_t - * ctypedef npy_int32 int32_t - * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< - * #ctypedef npy_int96 int96_t - * #ctypedef npy_int128 int128_t - */ -typedef npy_int64 __pyx_t_5numpy_int64_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":783 - * #ctypedef npy_int128 int128_t - * - * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t - */ -typedef npy_uint8 __pyx_t_5numpy_uint8_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":784 - * - * ctypedef npy_uint8 uint8_t - * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< - * ctypedef npy_uint32 uint32_t - * ctypedef npy_uint64 uint64_t - */ -typedef npy_uint16 __pyx_t_5numpy_uint16_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":785 - * ctypedef npy_uint8 uint8_t - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< - * ctypedef npy_uint64 uint64_t - * #ctypedef npy_uint96 uint96_t - */ -typedef npy_uint32 __pyx_t_5numpy_uint32_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":786 - * ctypedef npy_uint16 uint16_t - * ctypedef npy_uint32 uint32_t - * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< - * #ctypedef npy_uint96 uint96_t - * #ctypedef npy_uint128 uint128_t - */ -typedef npy_uint64 __pyx_t_5numpy_uint64_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":790 - * #ctypedef npy_uint128 uint128_t - * - * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< - * ctypedef npy_float64 float64_t - * #ctypedef npy_float80 float80_t - */ -typedef npy_float32 __pyx_t_5numpy_float32_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":791 - * - * ctypedef npy_float32 float32_t - * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< - * #ctypedef npy_float80 float80_t - * #ctypedef npy_float128 float128_t - */ -typedef npy_float64 __pyx_t_5numpy_float64_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":800 - * # The int types are mapped a bit surprising -- - * # numpy.int corresponds to 'l' and numpy.long to 'q' - * ctypedef npy_long int_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong long_t - * ctypedef npy_longlong longlong_t - */ -typedef npy_long __pyx_t_5numpy_int_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":801 - * # numpy.int corresponds to 'l' and numpy.long to 'q' - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong longlong_t - * - */ -typedef npy_longlong __pyx_t_5numpy_long_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":802 - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t - * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< - * - * ctypedef npy_ulong uint_t - */ -typedef npy_longlong __pyx_t_5numpy_longlong_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":804 - * ctypedef npy_longlong longlong_t - * - * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulong_t - * ctypedef npy_ulonglong ulonglong_t - */ -typedef npy_ulong __pyx_t_5numpy_uint_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":805 - * - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulonglong_t - * - */ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":806 - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t - * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< - * - * ctypedef npy_intp intp_t - */ -typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":808 - * ctypedef npy_ulonglong ulonglong_t - * - * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< - * ctypedef npy_uintp uintp_t - * - */ -typedef npy_intp __pyx_t_5numpy_intp_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":809 - * - * ctypedef npy_intp intp_t - * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< - * - * ctypedef npy_double float_t - */ -typedef npy_uintp __pyx_t_5numpy_uintp_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":811 - * ctypedef npy_uintp uintp_t - * - * ctypedef npy_double float_t # <<<<<<<<<<<<<< - * ctypedef npy_double double_t - * ctypedef npy_longdouble longdouble_t - */ -typedef npy_double __pyx_t_5numpy_float_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":812 - * - * ctypedef npy_double float_t - * ctypedef npy_double double_t # <<<<<<<<<<<<<< - * ctypedef npy_longdouble longdouble_t - * - */ -typedef npy_double __pyx_t_5numpy_double_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":813 - * ctypedef npy_double float_t - * ctypedef npy_double double_t - * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< - * - * ctypedef npy_cfloat cfloat_t - */ -typedef npy_longdouble __pyx_t_5numpy_longdouble_t; - -/* "LFPy/alias_method.pyx":11 - * - * DTYPE = np.float64 - * ctypedef np.float64_t DTYPE_t # <<<<<<<<<<<<<< - * ctypedef Py_ssize_t LTYPE_t - * - */ -typedef __pyx_t_5numpy_float64_t __pyx_t_4LFPy_12alias_method_DTYPE_t; - -/* "LFPy/alias_method.pyx":12 - * DTYPE = np.float64 - * ctypedef np.float64_t DTYPE_t - * ctypedef Py_ssize_t LTYPE_t # <<<<<<<<<<<<<< - * - * cdef extern from "math.h": - */ -typedef Py_ssize_t __pyx_t_4LFPy_12alias_method_LTYPE_t; -/* Declarations.proto */ -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< float > __pyx_t_float_complex; - #else - typedef float _Complex __pyx_t_float_complex; - #endif -#else - typedef struct { float real, imag; } __pyx_t_float_complex; -#endif -static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); - -/* Declarations.proto */ -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< double > __pyx_t_double_complex; - #else - typedef double _Complex __pyx_t_double_complex; - #endif -#else - typedef struct { double real, imag; } __pyx_t_double_complex; -#endif -static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - - -/*--- Type declarations ---*/ - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":815 - * ctypedef npy_longdouble longdouble_t - * - * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< - * ctypedef npy_cdouble cdouble_t - * ctypedef npy_clongdouble clongdouble_t - */ -typedef npy_cfloat __pyx_t_5numpy_cfloat_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":816 - * - * ctypedef npy_cfloat cfloat_t - * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< - * ctypedef npy_clongdouble clongdouble_t - * - */ -typedef npy_cdouble __pyx_t_5numpy_cdouble_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":817 - * ctypedef npy_cfloat cfloat_t - * ctypedef npy_cdouble cdouble_t - * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< - * - * ctypedef npy_cdouble complex_t - */ -typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":819 - * ctypedef npy_clongdouble clongdouble_t - * - * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew1(a): - */ -typedef npy_cdouble __pyx_t_5numpy_complex_t; - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#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) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* IsLittleEndian.proto */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); - -/* BufferFormatCheck.proto */ -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type); - -/* BufferGetAndValidate.proto */ -#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\ - ((obj == Py_None || obj == NULL) ?\ - (__Pyx_ZeroBuffer(buf), 0) :\ - __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)) -static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj, - __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); -static void __Pyx_ZeroBuffer(Py_buffer* buf); -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; -static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -/* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); -#endif - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -#else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) -#endif - -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#define __Pyx_BUILD_ASSERT_EXPR(cond)\ - (sizeof(char [1 - 2*!(cond)]) - 1) -#ifndef Py_MEMBER_SIZE -#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) -#endif - static size_t __pyx_pyframe_localsplus_offset = 0; - #include "frameobject.h" - #define __Pxy_PyFrame_Initialize_Offsets()\ - ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ - (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) - #define __Pyx_PyFrame_GetLocalsplus(frame)\ - (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* IterFinish.proto */ -static CYTHON_INLINE int __Pyx_IterFinish(void); - -/* UnpackItemEndCheck.proto */ -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); - -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); - -/* BufferFallbackError.proto */ -static void __Pyx_RaiseBufferFallbackError(void); - -/* PyDictVersioning.proto */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif - -/* GetModuleGlobalName.proto */ -#if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ - (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ - __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ - PY_UINT64_T __pyx_dict_version;\ - PyObject *__pyx_dict_cached_value;\ - (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); -#else -#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) -#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); -#endif - -#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) -#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) -/* RaiseArgTupleInvalid.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); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* ArgTypeTest.proto */ -#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ - __Pyx__ArgTypeTest(obj, type, name, exact)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); - -/* DictGetItem.proto */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); -#define __Pyx_PyObject_Dict_GetItem(obj, name)\ - (likely(PyDict_CheckExact(obj)) ?\ - __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) -#else -#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) -#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) -#endif - -/* RaiseNoneIterError.proto */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -/* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 -}; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); -#endif - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* CLineInTraceback.proto */ -#ifdef CYTHON_CLINE_IN_TRACEBACK -#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) -#else -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); -#endif - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* BufferStructDeclare.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 - - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* RealImag.proto */ -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #define __Pyx_CREAL(z) ((z).real()) - #define __Pyx_CIMAG(z) ((z).imag()) - #else - #define __Pyx_CREAL(z) (__real__(z)) - #define __Pyx_CIMAG(z) (__imag__(z)) - #endif -#else - #define __Pyx_CREAL(z) ((z).real) - #define __Pyx_CIMAG(z) ((z).imag) -#endif -#if defined(__cplusplus) && CYTHON_CCOMPLEX\ - && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) - #define __Pyx_SET_CREAL(z,x) ((z).real(x)) - #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) -#else - #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) - #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) -#endif - -/* Arithmetic.proto */ -#if CYTHON_CCOMPLEX - #define __Pyx_c_eq_float(a, b) ((a)==(b)) - #define __Pyx_c_sum_float(a, b) ((a)+(b)) - #define __Pyx_c_diff_float(a, b) ((a)-(b)) - #define __Pyx_c_prod_float(a, b) ((a)*(b)) - #define __Pyx_c_quot_float(a, b) ((a)/(b)) - #define __Pyx_c_neg_float(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zero_float(z) ((z)==(float)0) - #define __Pyx_c_conj_float(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_abs_float(z) (::std::abs(z)) - #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zero_float(z) ((z)==0) - #define __Pyx_c_conj_float(z) (conjf(z)) - #if 1 - #define __Pyx_c_abs_float(z) (cabsf(z)) - #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); - static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); - #if 1 - static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); - #endif -#endif - -/* Arithmetic.proto */ -#if CYTHON_CCOMPLEX - #define __Pyx_c_eq_double(a, b) ((a)==(b)) - #define __Pyx_c_sum_double(a, b) ((a)+(b)) - #define __Pyx_c_diff_double(a, b) ((a)-(b)) - #define __Pyx_c_prod_double(a, b) ((a)*(b)) - #define __Pyx_c_quot_double(a, b) ((a)/(b)) - #define __Pyx_c_neg_double(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zero_double(z) ((z)==(double)0) - #define __Pyx_c_conj_double(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_abs_double(z) (::std::abs(z)) - #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zero_double(z) ((z)==0) - #define __Pyx_c_conj_double(z) (conj(z)) - #if 1 - #define __Pyx_c_abs_double(z) (cabs(z)) - #define __Pyx_c_pow_double(a, b) (cpow(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); - static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); - #if 1 - static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); - #endif -#endif - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* FastTypeChecks.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); -#else -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) -#endif -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - - -/* Module declarations from 'cpython.buffer' */ - -/* Module declarations from 'libc.string' */ - -/* Module declarations from 'libc.stdio' */ - -/* Module declarations from '__builtin__' */ - -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; - -/* Module declarations from 'cpython' */ - -/* Module declarations from 'cpython.object' */ - -/* Module declarations from 'cpython.ref' */ - -/* Module declarations from 'cpython.mem' */ - -/* Module declarations from 'numpy' */ - -/* Module declarations from 'numpy' */ -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ - -/* Module declarations from 'cython' */ - -/* Module declarations from 'LFPy.alias_method' */ -static PyArrayObject *__pyx_f_4LFPy_12alias_method_alias_method(PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_4LFPy_12alias_method_alias_setup(PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ -static __Pyx_TypeInfo __Pyx_TypeInfo_long = { "long", NULL, sizeof(long), { 0 }, 0, IS_UNSIGNED(long) ? 'U' : 'I', IS_UNSIGNED(long), 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_4LFPy_12alias_method_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_4LFPy_12alias_method_DTYPE_t), { 0 }, 0, 'R', 0, 0 }; -#define __Pyx_MODULE_NAME "LFPy.alias_method" -extern int __pyx_module_is_main_LFPy__alias_method; -int __pyx_module_is_main_LFPy__alias_method = 0; - -/* Implementation of 'LFPy.alias_method' */ -static PyObject *__pyx_builtin_AssertionError; -static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_builtin_RuntimeError; -static PyObject *__pyx_builtin_ImportError; -static const char __pyx_k_np[] = "np"; -static const char __pyx_k_idx[] = "idx"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_name[] = "__name__"; -static const char __pyx_k_nsyn[] = "nsyn"; -static const char __pyx_k_rand[] = "rand"; -static const char __pyx_k_size[] = "size"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_DTYPE[] = "DTYPE"; -static const char __pyx_k_dtype[] = "dtype"; -static const char __pyx_k_numpy[] = "numpy"; -static const char __pyx_k_probs[] = "probs"; -static const char __pyx_k_range[] = "range"; -static const char __pyx_k_zeros[] = "zeros"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_random[] = "random"; -static const char __pyx_k_float64[] = "float64"; -static const char __pyx_k_ValueError[] = "ValueError"; -static const char __pyx_k_ImportError[] = "ImportError"; -static const char __pyx_k_RuntimeError[] = "RuntimeError"; -static const char __pyx_k_AssertionError[] = "AssertionError"; -static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; -static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; -static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import"; -static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)"; -static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd"; -static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported"; -static const char __pyx_k_length_of_idx_and_probs_arrays_m[] = "length of idx and probs arrays must be equal"; -static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous"; -static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import"; -static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; -static PyObject *__pyx_n_s_AssertionError; -static PyObject *__pyx_n_s_DTYPE; -static PyObject *__pyx_kp_u_Format_string_allocated_too_shor; -static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2; -static PyObject *__pyx_n_s_ImportError; -static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor; -static PyObject *__pyx_n_s_RuntimeError; -static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_dtype; -static PyObject *__pyx_n_s_float64; -static PyObject *__pyx_n_s_idx; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_kp_s_length_of_idx_and_probs_arrays_m; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; -static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; -static PyObject *__pyx_n_s_np; -static PyObject *__pyx_n_s_nsyn; -static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; -static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; -static PyObject *__pyx_n_s_probs; -static PyObject *__pyx_n_s_rand; -static PyObject *__pyx_n_s_random; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_size; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; -static PyObject *__pyx_n_s_zeros; -static PyObject *__pyx_pf_4LFPy_12alias_method_alias_method(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_idx, PyArrayObject *__pyx_v_probs, int __pyx_v_nsyn); /* proto */ -static PyObject *__pyx_pf_4LFPy_12alias_method_2alias_setup(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_probs); /* 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 PyObject *__pyx_int_2; -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -/* Late includes */ - -/* "LFPy/alias_method.pyx":20 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef np.ndarray[long, ndim=1, negative_indices=False] alias_method(np.ndarray[long, ndim=1, negative_indices=False] idx, # <<<<<<<<<<<<<< - * np.ndarray[DTYPE_t, ndim=1, negative_indices=False] probs, - * int nsyn): - */ - -static PyObject *__pyx_pw_4LFPy_12alias_method_1alias_method(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyArrayObject *__pyx_f_4LFPy_12alias_method_alias_method(PyArrayObject *__pyx_v_idx, PyArrayObject *__pyx_v_probs, int __pyx_v_nsyn, CYTHON_UNUSED int __pyx_skip_dispatch) { - PyObject *__pyx_v_ae = NULL; - PyArrayObject *__pyx_v_J = 0; - PyArrayObject *__pyx_v_spc = 0; - PyArrayObject *__pyx_v_q = 0; - PyArrayObject *__pyx_v_rands = 0; - int __pyx_v_nn; - int __pyx_v_K; - int __pyx_v_kk; - __Pyx_LocalBuf_ND __pyx_pybuffernd_J; - __Pyx_Buffer __pyx_pybuffer_J; - __Pyx_LocalBuf_ND __pyx_pybuffernd_idx; - __Pyx_Buffer __pyx_pybuffer_idx; - __Pyx_LocalBuf_ND __pyx_pybuffernd_probs; - __Pyx_Buffer __pyx_pybuffer_probs; - __Pyx_LocalBuf_ND __pyx_pybuffernd_q; - __Pyx_Buffer __pyx_pybuffer_q; - __Pyx_LocalBuf_ND __pyx_pybuffernd_rands; - __Pyx_Buffer __pyx_pybuffer_rands; - __Pyx_LocalBuf_ND __pyx_pybuffernd_spc; - __Pyx_Buffer __pyx_pybuffer_spc; - PyArrayObject *__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; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *(*__pyx_t_12)(PyObject *); - PyArrayObject *__pyx_t_13 = NULL; - PyArrayObject *__pyx_t_14 = NULL; - PyArrayObject *__pyx_t_15 = NULL; - int __pyx_t_16; - int __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; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; - __Pyx_RefNannySetupContext("alias_method", 0); - __pyx_pybuffer_J.pybuffer.buf = NULL; - __pyx_pybuffer_J.refcount = 0; - __pyx_pybuffernd_J.data = NULL; - __pyx_pybuffernd_J.rcbuffer = &__pyx_pybuffer_J; - __pyx_pybuffer_spc.pybuffer.buf = NULL; - __pyx_pybuffer_spc.refcount = 0; - __pyx_pybuffernd_spc.data = NULL; - __pyx_pybuffernd_spc.rcbuffer = &__pyx_pybuffer_spc; - __pyx_pybuffer_q.pybuffer.buf = NULL; - __pyx_pybuffer_q.refcount = 0; - __pyx_pybuffernd_q.data = NULL; - __pyx_pybuffernd_q.rcbuffer = &__pyx_pybuffer_q; - __pyx_pybuffer_rands.pybuffer.buf = NULL; - __pyx_pybuffer_rands.refcount = 0; - __pyx_pybuffernd_rands.data = NULL; - __pyx_pybuffernd_rands.rcbuffer = &__pyx_pybuffer_rands; - __pyx_pybuffer_idx.pybuffer.buf = NULL; - __pyx_pybuffer_idx.refcount = 0; - __pyx_pybuffernd_idx.data = NULL; - __pyx_pybuffernd_idx.rcbuffer = &__pyx_pybuffer_idx; - __pyx_pybuffer_probs.pybuffer.buf = NULL; - __pyx_pybuffer_probs.refcount = 0; - __pyx_pybuffernd_probs.data = NULL; - __pyx_pybuffernd_probs.rcbuffer = &__pyx_pybuffer_probs; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 20, __pyx_L1_error) - } - __pyx_pybuffernd_idx.diminfo[0].strides = __pyx_pybuffernd_idx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx.diminfo[0].shape = __pyx_pybuffernd_idx.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probs.rcbuffer->pybuffer, (PyObject*)__pyx_v_probs, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_12alias_method_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 20, __pyx_L1_error) - } - __pyx_pybuffernd_probs.diminfo[0].strides = __pyx_pybuffernd_probs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probs.diminfo[0].shape = __pyx_pybuffernd_probs.rcbuffer->pybuffer.shape[0]; - - /* "LFPy/alias_method.pyx":42 - * - * """ - * try: # <<<<<<<<<<<<<< - * assert idx.size == probs.size - * except AssertionError as ae: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "LFPy/alias_method.pyx":43 - * """ - * try: - * assert idx.size == probs.size # <<<<<<<<<<<<<< - * except AssertionError as ae: - * raise ae('length of idx and probs arrays must be equal') - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_idx), __pyx_n_s_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_probs), __pyx_n_s_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 43, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 43, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) { - PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(0, 43, __pyx_L3_error) - } - } - #endif - - /* "LFPy/alias_method.pyx":42 - * - * """ - * try: # <<<<<<<<<<<<<< - * assert idx.size == probs.size - * except AssertionError as ae: - */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - __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; - - /* "LFPy/alias_method.pyx":44 - * try: - * assert idx.size == probs.size - * except AssertionError as ae: # <<<<<<<<<<<<<< - * raise ae('length of idx and probs arrays must be equal') - * - */ - __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AssertionError); - if (__pyx_t_8) { - __Pyx_AddTraceback("LFPy.alias_method.alias_method", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 44, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __pyx_v_ae = __pyx_t_5; - - /* "LFPy/alias_method.pyx":45 - * assert idx.size == probs.size - * except AssertionError as ae: - * raise ae('length of idx and probs arrays must be equal') # <<<<<<<<<<<<<< - * - * #C-declare variables - */ - __Pyx_INCREF(__pyx_v_ae); - __pyx_t_10 = __pyx_v_ae; __pyx_t_11 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - } - } - __pyx_t_9 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_kp_s_length_of_idx_and_probs_arrays_m) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_kp_s_length_of_idx_and_probs_arrays_m); - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 45, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_Raise(__pyx_t_9, 0, 0, 0); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 45, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "LFPy/alias_method.pyx":42 - * - * """ - * try: # <<<<<<<<<<<<<< - * assert idx.size == probs.size - * except AssertionError as ae: - */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; - } - - /* "LFPy/alias_method.pyx":54 - * - * # Construct the table. - * J, q = alias_setup(probs) # <<<<<<<<<<<<<< - * - * #output array - */ - __pyx_t_4 = __pyx_f_4LFPy_12alias_method_alias_setup(((PyArrayObject *)__pyx_v_probs), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { - PyObject* sequence = __pyx_t_4; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 54, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_6 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_12 = Py_TYPE(__pyx_t_9)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_12(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_6 = __pyx_t_12(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L11_unpacking_failed; - __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_9), 2) < 0) __PYX_ERR(0, 54, __pyx_L1_error) - __pyx_t_12 = 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_12 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 54, __pyx_L1_error) - __pyx_L12_unpacking_done:; - } - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 54, __pyx_L1_error) - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 54, __pyx_L1_error) - __pyx_t_13 = ((PyArrayObject *)__pyx_t_5); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_J.rcbuffer->pybuffer); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_J.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_8 < 0)) { - PyErr_Fetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_J.rcbuffer->pybuffer, (PyObject*)__pyx_v_J, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_1); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_3, __pyx_t_2, __pyx_t_1); - } - __pyx_t_3 = __pyx_t_2 = __pyx_t_1 = 0; - } - __pyx_pybuffernd_J.diminfo[0].strides = __pyx_pybuffernd_J.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_J.diminfo[0].shape = __pyx_pybuffernd_J.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 54, __pyx_L1_error) - } - __pyx_t_13 = 0; - __pyx_v_J = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_14 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_12alias_method_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_8 < 0)) { - PyErr_Fetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q.rcbuffer->pybuffer, (PyObject*)__pyx_v_q, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_12alias_method_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_1); Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_1, __pyx_t_2, __pyx_t_3); - } - __pyx_t_1 = __pyx_t_2 = __pyx_t_3 = 0; - } - __pyx_pybuffernd_q.diminfo[0].strides = __pyx_pybuffernd_q.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q.diminfo[0].shape = __pyx_pybuffernd_q.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 54, __pyx_L1_error) - } - __pyx_t_14 = 0; - __pyx_v_q = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - - /* "LFPy/alias_method.pyx":57 - * - * #output array - * spc = np.zeros(nsyn, dtype=int) # <<<<<<<<<<<<<< - * - * #prefetch random numbers, alias_draw needs nsyn x 2 numbers - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nsyn); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 57, __pyx_L1_error) - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 57, __pyx_L1_error) - __pyx_t_13 = ((PyArrayObject *)__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_spc.rcbuffer->pybuffer); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_spc.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_8 < 0)) { - PyErr_Fetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_spc.rcbuffer->pybuffer, (PyObject*)__pyx_v_spc, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_1); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_3, __pyx_t_2, __pyx_t_1); - } - __pyx_t_3 = __pyx_t_2 = __pyx_t_1 = 0; - } - __pyx_pybuffernd_spc.diminfo[0].strides = __pyx_pybuffernd_spc.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_spc.diminfo[0].shape = __pyx_pybuffernd_spc.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 57, __pyx_L1_error) - } - __pyx_t_13 = 0; - __pyx_v_spc = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; - - /* "LFPy/alias_method.pyx":60 - * - * #prefetch random numbers, alias_draw needs nsyn x 2 numbers - * rands = np.random.rand(nsyn, 2) # <<<<<<<<<<<<<< - * - * K = J.size - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_random); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rand); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nsyn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_int_2}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_int_2}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_t_5); - __Pyx_INCREF(__pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, __pyx_int_2); - __pyx_t_5 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 60, __pyx_L1_error) - __pyx_t_15 = ((PyArrayObject *)__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rands.rcbuffer->pybuffer); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rands.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_12alias_method_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); - if (unlikely(__pyx_t_8 < 0)) { - PyErr_Fetch(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rands.rcbuffer->pybuffer, (PyObject*)__pyx_v_rands, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_12alias_method_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_1); Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_3); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_1, __pyx_t_2, __pyx_t_3); - } - __pyx_t_1 = __pyx_t_2 = __pyx_t_3 = 0; - } - __pyx_pybuffernd_rands.diminfo[0].strides = __pyx_pybuffernd_rands.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rands.diminfo[0].shape = __pyx_pybuffernd_rands.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_rands.diminfo[1].strides = __pyx_pybuffernd_rands.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_rands.diminfo[1].shape = __pyx_pybuffernd_rands.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 60, __pyx_L1_error) - } - __pyx_t_15 = 0; - __pyx_v_rands = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; - - /* "LFPy/alias_method.pyx":62 - * rands = np.random.rand(nsyn, 2) - * - * K = J.size # <<<<<<<<<<<<<< - * # Generate variates using alias draw method - * for nn in range(nsyn): - */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_J), __pyx_n_s_size); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_K = __pyx_t_8; - - /* "LFPy/alias_method.pyx":64 - * K = J.size - * # Generate variates using alias draw method - * for nn in range(nsyn): # <<<<<<<<<<<<<< - * kk = floor(rands[nn, 0]*K) - * if rands[nn, 1] < q[kk]: - */ - __pyx_t_8 = __pyx_v_nsyn; - __pyx_t_16 = __pyx_t_8; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_nn = __pyx_t_17; - - /* "LFPy/alias_method.pyx":65 - * # Generate variates using alias draw method - * for nn in range(nsyn): - * kk = floor(rands[nn, 0]*K) # <<<<<<<<<<<<<< - * if rands[nn, 1] < q[kk]: - * spc[nn] = idx[kk] - */ - __pyx_t_18 = __pyx_v_nn; - __pyx_t_19 = 0; - __pyx_v_kk = floor(((*__Pyx_BufPtrStrided2d(__pyx_t_4LFPy_12alias_method_DTYPE_t *, __pyx_pybuffernd_rands.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_rands.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_rands.diminfo[1].strides)) * __pyx_v_K)); - - /* "LFPy/alias_method.pyx":66 - * for nn in range(nsyn): - * kk = floor(rands[nn, 0]*K) - * if rands[nn, 1] < q[kk]: # <<<<<<<<<<<<<< - * spc[nn] = idx[kk] - * else: - */ - __pyx_t_20 = __pyx_v_nn; - __pyx_t_21 = 1; - __pyx_t_22 = __pyx_v_kk; - __pyx_t_7 = (((*__Pyx_BufPtrStrided2d(__pyx_t_4LFPy_12alias_method_DTYPE_t *, __pyx_pybuffernd_rands.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_rands.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_rands.diminfo[1].strides)) < (*__Pyx_BufPtrStrided1d(__pyx_t_4LFPy_12alias_method_DTYPE_t *, __pyx_pybuffernd_q.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_q.diminfo[0].strides))) != 0); - if (__pyx_t_7) { - - /* "LFPy/alias_method.pyx":67 - * kk = floor(rands[nn, 0]*K) - * if rands[nn, 1] < q[kk]: - * spc[nn] = idx[kk] # <<<<<<<<<<<<<< - * else: - * spc[nn] = idx[J[kk]] - */ - __pyx_t_23 = __pyx_v_kk; - __pyx_t_24 = __pyx_v_nn; - *__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_spc.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_spc.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_idx.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_idx.diminfo[0].strides)); - - /* "LFPy/alias_method.pyx":66 - * for nn in range(nsyn): - * kk = floor(rands[nn, 0]*K) - * if rands[nn, 1] < q[kk]: # <<<<<<<<<<<<<< - * spc[nn] = idx[kk] - * else: - */ - goto __pyx_L15; - } - - /* "LFPy/alias_method.pyx":69 - * spc[nn] = idx[kk] - * else: - * spc[nn] = idx[J[kk]] # <<<<<<<<<<<<<< - * - * return spc - */ - /*else*/ { - __pyx_t_25 = __pyx_v_kk; - __pyx_t_26 = (*__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_J.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_J.diminfo[0].strides)); - __pyx_t_27 = __pyx_v_nn; - *__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_spc.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_spc.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_idx.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_idx.diminfo[0].strides)); - } - __pyx_L15:; - } - - /* "LFPy/alias_method.pyx":71 - * spc[nn] = idx[J[kk]] - * - * return spc # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_spc)); - __pyx_r = ((PyArrayObject *)__pyx_v_spc); - goto __pyx_L0; - - /* "LFPy/alias_method.pyx":20 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef np.ndarray[long, ndim=1, negative_indices=False] alias_method(np.ndarray[long, ndim=1, negative_indices=False] idx, # <<<<<<<<<<<<<< - * np.ndarray[DTYPE_t, ndim=1, negative_indices=False] probs, - * int nsyn): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_J.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_probs.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rands.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_spc.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("LFPy.alias_method.alias_method", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_J.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_probs.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rands.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_spc.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF(__pyx_v_ae); - __Pyx_XDECREF((PyObject *)__pyx_v_J); - __Pyx_XDECREF((PyObject *)__pyx_v_spc); - __Pyx_XDECREF((PyObject *)__pyx_v_q); - __Pyx_XDECREF((PyObject *)__pyx_v_rands); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4LFPy_12alias_method_1alias_method(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4LFPy_12alias_method_alias_method[] = "\n Alias method for drawing random numbers from a discrete probability\n distribution. See http://www.keithschwarz.com/darts-dice-coins/\n\n Parameters\n ----------\n idx : np.ndarray\n compartment indices as array of ints\n probs : np.ndarray\n compartment areas as array of floats\n nsyn : int\n number of randomized compartment indices\n\n Returns\n -------\n out : np.ndarray\n integer array of randomly drawn compartment indices\n\n "; -static PyObject *__pyx_pw_4LFPy_12alias_method_1alias_method(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_idx = 0; - PyArrayObject *__pyx_v_probs = 0; - int __pyx_v_nsyn; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("alias_method (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_probs,&__pyx_n_s_nsyn,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); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_probs)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("alias_method", 1, 3, 3, 1); __PYX_ERR(0, 20, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nsyn)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("alias_method", 1, 3, 3, 2); __PYX_ERR(0, 20, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alias_method") < 0)) __PYX_ERR(0, 20, __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_idx = ((PyArrayObject *)values[0]); - __pyx_v_probs = ((PyArrayObject *)values[1]); - __pyx_v_nsyn = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nsyn == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("alias_method", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 20, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LFPy.alias_method.alias_method", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx), __pyx_ptype_5numpy_ndarray, 1, "idx", 0))) __PYX_ERR(0, 20, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probs), __pyx_ptype_5numpy_ndarray, 1, "probs", 0))) __PYX_ERR(0, 21, __pyx_L1_error) - __pyx_r = __pyx_pf_4LFPy_12alias_method_alias_method(__pyx_self, __pyx_v_idx, __pyx_v_probs, __pyx_v_nsyn); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_4LFPy_12alias_method_alias_method(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_idx, PyArrayObject *__pyx_v_probs, int __pyx_v_nsyn) { - __Pyx_LocalBuf_ND __pyx_pybuffernd_idx; - __Pyx_Buffer __pyx_pybuffer_idx; - __Pyx_LocalBuf_ND __pyx_pybuffernd_probs; - __Pyx_Buffer __pyx_pybuffer_probs; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("alias_method", 0); - __pyx_pybuffer_idx.pybuffer.buf = NULL; - __pyx_pybuffer_idx.refcount = 0; - __pyx_pybuffernd_idx.data = NULL; - __pyx_pybuffernd_idx.rcbuffer = &__pyx_pybuffer_idx; - __pyx_pybuffer_probs.pybuffer.buf = NULL; - __pyx_pybuffer_probs.refcount = 0; - __pyx_pybuffernd_probs.data = NULL; - __pyx_pybuffernd_probs.rcbuffer = &__pyx_pybuffer_probs; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 20, __pyx_L1_error) - } - __pyx_pybuffernd_idx.diminfo[0].strides = __pyx_pybuffernd_idx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx.diminfo[0].shape = __pyx_pybuffernd_idx.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probs.rcbuffer->pybuffer, (PyObject*)__pyx_v_probs, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_12alias_method_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 20, __pyx_L1_error) - } - __pyx_pybuffernd_probs.diminfo[0].strides = __pyx_pybuffernd_probs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probs.diminfo[0].shape = __pyx_pybuffernd_probs.rcbuffer->pybuffer.shape[0]; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_4LFPy_12alias_method_alias_method(__pyx_v_idx, __pyx_v_probs, __pyx_v_nsyn, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_probs.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("LFPy.alias_method.alias_method", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_probs.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LFPy/alias_method.pyx":76 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef alias_setup(np.ndarray[DTYPE_t, ndim=1, negative_indices=False] probs): # <<<<<<<<<<<<<< - * """Set up function for alias method. - * See http://www.keithschwarz.com/darts-dice-coins/ - */ - -static PyObject *__pyx_pw_4LFPy_12alias_method_3alias_setup(PyObject *__pyx_self, PyObject *__pyx_v_probs); /*proto*/ -static PyObject *__pyx_f_4LFPy_12alias_method_alias_setup(PyArrayObject *__pyx_v_probs, CYTHON_UNUSED int __pyx_skip_dispatch) { - PyArrayObject *__pyx_v_q = 0; - PyArrayObject *__pyx_v_J = 0; - PyArrayObject *__pyx_v_smaller = 0; - PyArrayObject *__pyx_v_larger = 0; - long __pyx_v_K; - int __pyx_v_small; - int __pyx_v_large; - int __pyx_v_kk; - int __pyx_v_s_i; - int __pyx_v_l_i; - __Pyx_LocalBuf_ND __pyx_pybuffernd_J; - __Pyx_Buffer __pyx_pybuffer_J; - __Pyx_LocalBuf_ND __pyx_pybuffernd_larger; - __Pyx_Buffer __pyx_pybuffer_larger; - __Pyx_LocalBuf_ND __pyx_pybuffernd_probs; - __Pyx_Buffer __pyx_pybuffer_probs; - __Pyx_LocalBuf_ND __pyx_pybuffernd_q; - __Pyx_Buffer __pyx_pybuffer_q; - __Pyx_LocalBuf_ND __pyx_pybuffernd_smaller; - __Pyx_Buffer __pyx_pybuffer_smaller; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - long __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyArrayObject *__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 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - long __pyx_t_12; - Py_ssize_t __pyx_t_13; - int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - int __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; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - __Pyx_RefNannySetupContext("alias_setup", 0); - __pyx_pybuffer_q.pybuffer.buf = NULL; - __pyx_pybuffer_q.refcount = 0; - __pyx_pybuffernd_q.data = NULL; - __pyx_pybuffernd_q.rcbuffer = &__pyx_pybuffer_q; - __pyx_pybuffer_J.pybuffer.buf = NULL; - __pyx_pybuffer_J.refcount = 0; - __pyx_pybuffernd_J.data = NULL; - __pyx_pybuffernd_J.rcbuffer = &__pyx_pybuffer_J; - __pyx_pybuffer_smaller.pybuffer.buf = NULL; - __pyx_pybuffer_smaller.refcount = 0; - __pyx_pybuffernd_smaller.data = NULL; - __pyx_pybuffernd_smaller.rcbuffer = &__pyx_pybuffer_smaller; - __pyx_pybuffer_larger.pybuffer.buf = NULL; - __pyx_pybuffer_larger.refcount = 0; - __pyx_pybuffernd_larger.data = NULL; - __pyx_pybuffernd_larger.rcbuffer = &__pyx_pybuffer_larger; - __pyx_pybuffer_probs.pybuffer.buf = NULL; - __pyx_pybuffer_probs.refcount = 0; - __pyx_pybuffernd_probs.data = NULL; - __pyx_pybuffernd_probs.rcbuffer = &__pyx_pybuffer_probs; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probs.rcbuffer->pybuffer, (PyObject*)__pyx_v_probs, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_12alias_method_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 76, __pyx_L1_error) - } - __pyx_pybuffernd_probs.diminfo[0].strides = __pyx_pybuffernd_probs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probs.diminfo[0].shape = __pyx_pybuffernd_probs.rcbuffer->pybuffer.shape[0]; - - /* "LFPy/alias_method.pyx":100 - * cdef DTYPE_t prob - * - * K = probs.size # <<<<<<<<<<<<<< - * q = probs*K - * J = np.zeros(K, dtype=int) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_probs), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_K = __pyx_t_2; - - /* "LFPy/alias_method.pyx":101 - * - * K = probs.size - * q = probs*K # <<<<<<<<<<<<<< - * J = np.zeros(K, dtype=int) - * - */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_K); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_probs), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 101, __pyx_L1_error) - __pyx_t_4 = ((PyArrayObject *)__pyx_t_3); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_12alias_method_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q.rcbuffer->pybuffer, (PyObject*)__pyx_v_q, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_12alias_method_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); - } - __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0; - } - __pyx_pybuffernd_q.diminfo[0].strides = __pyx_pybuffernd_q.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q.diminfo[0].shape = __pyx_pybuffernd_q.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 101, __pyx_L1_error) - } - __pyx_t_4 = 0; - __pyx_v_q = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "LFPy/alias_method.pyx":102 - * K = probs.size - * q = probs*K - * J = np.zeros(K, dtype=int) # <<<<<<<<<<<<<< - * - * # Sort the data into the outcomes with probabilities - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_K); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 102, __pyx_L1_error) - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 102, __pyx_L1_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; - if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 102, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_10); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_J.rcbuffer->pybuffer); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_J.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_J.rcbuffer->pybuffer, (PyObject*)__pyx_v_J, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6); - } - __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0; - } - __pyx_pybuffernd_J.diminfo[0].strides = __pyx_pybuffernd_J.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_J.diminfo[0].shape = __pyx_pybuffernd_J.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 102, __pyx_L1_error) - } - __pyx_t_11 = 0; - __pyx_v_J = ((PyArrayObject *)__pyx_t_10); - __pyx_t_10 = 0; - - /* "LFPy/alias_method.pyx":106 - * # Sort the data into the outcomes with probabilities - * # that are larger and smaller than 1/K. - * smaller = np.zeros(K, dtype=int) # <<<<<<<<<<<<<< - * larger = np.zeros(K, dtype=int) - * s_i = 0 - */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyInt_From_long(__pyx_v_K); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 106, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __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_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 106, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_1); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_smaller.rcbuffer->pybuffer); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_smaller.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_smaller.rcbuffer->pybuffer, (PyObject*)__pyx_v_smaller, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); - } - __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0; - } - __pyx_pybuffernd_smaller.diminfo[0].strides = __pyx_pybuffernd_smaller.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_smaller.diminfo[0].shape = __pyx_pybuffernd_smaller.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error) - } - __pyx_t_11 = 0; - __pyx_v_smaller = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LFPy/alias_method.pyx":107 - * # that are larger and smaller than 1/K. - * smaller = np.zeros(K, dtype=int) - * larger = np.zeros(K, dtype=int) # <<<<<<<<<<<<<< - * s_i = 0 - * l_i = 0 - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_K); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 107, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __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_ERR(0, 107, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_3); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_larger.rcbuffer->pybuffer); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_larger.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_larger.rcbuffer->pybuffer, (PyObject*)__pyx_v_larger, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6); - } - __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0; - } - __pyx_pybuffernd_larger.diminfo[0].strides = __pyx_pybuffernd_larger.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_larger.diminfo[0].shape = __pyx_pybuffernd_larger.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 107, __pyx_L1_error) - } - __pyx_t_11 = 0; - __pyx_v_larger = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "LFPy/alias_method.pyx":108 - * smaller = np.zeros(K, dtype=int) - * larger = np.zeros(K, dtype=int) - * s_i = 0 # <<<<<<<<<<<<<< - * l_i = 0 - * for kk in range(K): - */ - __pyx_v_s_i = 0; - - /* "LFPy/alias_method.pyx":109 - * larger = np.zeros(K, dtype=int) - * s_i = 0 - * l_i = 0 # <<<<<<<<<<<<<< - * for kk in range(K): - * if q[kk] < 1: - */ - __pyx_v_l_i = 0; - - /* "LFPy/alias_method.pyx":110 - * s_i = 0 - * l_i = 0 - * for kk in range(K): # <<<<<<<<<<<<<< - * if q[kk] < 1: - * smaller[s_i] = kk - */ - __pyx_t_2 = __pyx_v_K; - __pyx_t_12 = __pyx_t_2; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_12; __pyx_t_5+=1) { - __pyx_v_kk = __pyx_t_5; - - /* "LFPy/alias_method.pyx":111 - * l_i = 0 - * for kk in range(K): - * if q[kk] < 1: # <<<<<<<<<<<<<< - * smaller[s_i] = kk - * s_i += 1 - */ - __pyx_t_13 = __pyx_v_kk; - __pyx_t_14 = (((*__Pyx_BufPtrStrided1d(__pyx_t_4LFPy_12alias_method_DTYPE_t *, __pyx_pybuffernd_q.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_q.diminfo[0].strides)) < 1.0) != 0); - if (__pyx_t_14) { - - /* "LFPy/alias_method.pyx":112 - * for kk in range(K): - * if q[kk] < 1: - * smaller[s_i] = kk # <<<<<<<<<<<<<< - * s_i += 1 - * else: - */ - __pyx_t_15 = __pyx_v_s_i; - *__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_smaller.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_smaller.diminfo[0].strides) = __pyx_v_kk; - - /* "LFPy/alias_method.pyx":113 - * if q[kk] < 1: - * smaller[s_i] = kk - * s_i += 1 # <<<<<<<<<<<<<< - * else: - * larger[l_i] = kk - */ - __pyx_v_s_i = (__pyx_v_s_i + 1); - - /* "LFPy/alias_method.pyx":111 - * l_i = 0 - * for kk in range(K): - * if q[kk] < 1: # <<<<<<<<<<<<<< - * smaller[s_i] = kk - * s_i += 1 - */ - goto __pyx_L5; - } - - /* "LFPy/alias_method.pyx":115 - * s_i += 1 - * else: - * larger[l_i] = kk # <<<<<<<<<<<<<< - * l_i += 1 - * - */ - /*else*/ { - __pyx_t_16 = __pyx_v_l_i; - *__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_larger.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_larger.diminfo[0].strides) = __pyx_v_kk; - - /* "LFPy/alias_method.pyx":116 - * else: - * larger[l_i] = kk - * l_i += 1 # <<<<<<<<<<<<<< - * - * s_i -= 1 - */ - __pyx_v_l_i = (__pyx_v_l_i + 1); - } - __pyx_L5:; - } - - /* "LFPy/alias_method.pyx":118 - * l_i += 1 - * - * s_i -= 1 # <<<<<<<<<<<<<< - * l_i -= 1 - * - */ - __pyx_v_s_i = (__pyx_v_s_i - 1); - - /* "LFPy/alias_method.pyx":119 - * - * s_i -= 1 - * l_i -= 1 # <<<<<<<<<<<<<< - * - * # Loop though and create little binary mixtures that - */ - __pyx_v_l_i = (__pyx_v_l_i - 1); - - /* "LFPy/alias_method.pyx":124 - * # appropriately allocate the larger outcomes over the - * # overall uniform mixture. - * while s_i >= 0 and l_i >= 0: # <<<<<<<<<<<<<< - * small = smaller[s_i] - * large = larger[l_i] - */ - while (1) { - __pyx_t_17 = ((__pyx_v_s_i >= 0) != 0); - if (__pyx_t_17) { - } else { - __pyx_t_14 = __pyx_t_17; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_17 = ((__pyx_v_l_i >= 0) != 0); - __pyx_t_14 = __pyx_t_17; - __pyx_L8_bool_binop_done:; - if (!__pyx_t_14) break; - - /* "LFPy/alias_method.pyx":125 - * # overall uniform mixture. - * while s_i >= 0 and l_i >= 0: - * small = smaller[s_i] # <<<<<<<<<<<<<< - * large = larger[l_i] - * - */ - __pyx_t_18 = __pyx_v_s_i; - __pyx_v_small = (*__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_smaller.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_smaller.diminfo[0].strides)); - - /* "LFPy/alias_method.pyx":126 - * while s_i >= 0 and l_i >= 0: - * small = smaller[s_i] - * large = larger[l_i] # <<<<<<<<<<<<<< - * - * J[small] = large - */ - __pyx_t_19 = __pyx_v_l_i; - __pyx_v_large = (*__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_larger.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_larger.diminfo[0].strides)); - - /* "LFPy/alias_method.pyx":128 - * large = larger[l_i] - * - * J[small] = large # <<<<<<<<<<<<<< - * q[large] = q[large] + q[small] - 1 - * - */ - __pyx_t_20 = __pyx_v_small; - *__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_J.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_J.diminfo[0].strides) = __pyx_v_large; - - /* "LFPy/alias_method.pyx":129 - * - * J[small] = large - * q[large] = q[large] + q[small] - 1 # <<<<<<<<<<<<<< - * - * s_i -= 1 - */ - __pyx_t_21 = __pyx_v_large; - __pyx_t_22 = __pyx_v_small; - __pyx_t_23 = __pyx_v_large; - *__Pyx_BufPtrStrided1d(__pyx_t_4LFPy_12alias_method_DTYPE_t *, __pyx_pybuffernd_q.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_q.diminfo[0].strides) = (((*__Pyx_BufPtrStrided1d(__pyx_t_4LFPy_12alias_method_DTYPE_t *, __pyx_pybuffernd_q.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_q.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_4LFPy_12alias_method_DTYPE_t *, __pyx_pybuffernd_q.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_q.diminfo[0].strides))) - 1.0); - - /* "LFPy/alias_method.pyx":131 - * q[large] = q[large] + q[small] - 1 - * - * s_i -= 1 # <<<<<<<<<<<<<< - * - * if q[large] < 1: - */ - __pyx_v_s_i = (__pyx_v_s_i - 1); - - /* "LFPy/alias_method.pyx":133 - * s_i -= 1 - * - * if q[large] < 1: # <<<<<<<<<<<<<< - * s_i += 1 - * l_i -= 1 - */ - __pyx_t_24 = __pyx_v_large; - __pyx_t_14 = (((*__Pyx_BufPtrStrided1d(__pyx_t_4LFPy_12alias_method_DTYPE_t *, __pyx_pybuffernd_q.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_q.diminfo[0].strides)) < 1.0) != 0); - if (__pyx_t_14) { - - /* "LFPy/alias_method.pyx":134 - * - * if q[large] < 1: - * s_i += 1 # <<<<<<<<<<<<<< - * l_i -= 1 - * smaller[s_i] = large - */ - __pyx_v_s_i = (__pyx_v_s_i + 1); - - /* "LFPy/alias_method.pyx":135 - * if q[large] < 1: - * s_i += 1 - * l_i -= 1 # <<<<<<<<<<<<<< - * smaller[s_i] = large - * - */ - __pyx_v_l_i = (__pyx_v_l_i - 1); - - /* "LFPy/alias_method.pyx":136 - * s_i += 1 - * l_i -= 1 - * smaller[s_i] = large # <<<<<<<<<<<<<< - * - * return J, q - */ - __pyx_t_25 = __pyx_v_s_i; - *__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_smaller.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_smaller.diminfo[0].strides) = __pyx_v_large; - - /* "LFPy/alias_method.pyx":133 - * s_i -= 1 - * - * if q[large] < 1: # <<<<<<<<<<<<<< - * s_i += 1 - * l_i -= 1 - */ - } - } - - /* "LFPy/alias_method.pyx":138 - * smaller[s_i] = large - * - * return J, q # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_J)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_J)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_J)); - __Pyx_INCREF(((PyObject *)__pyx_v_q)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_q)); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_q)); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "LFPy/alias_method.pyx":76 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef alias_setup(np.ndarray[DTYPE_t, ndim=1, negative_indices=False] probs): # <<<<<<<<<<<<<< - * """Set up function for alias method. - * See http://www.keithschwarz.com/darts-dice-coins/ - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_J.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_larger.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_probs.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_smaller.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("LFPy.alias_method.alias_setup", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_J.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_larger.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_probs.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_smaller.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_q); - __Pyx_XDECREF((PyObject *)__pyx_v_J); - __Pyx_XDECREF((PyObject *)__pyx_v_smaller); - __Pyx_XDECREF((PyObject *)__pyx_v_larger); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4LFPy_12alias_method_3alias_setup(PyObject *__pyx_self, PyObject *__pyx_v_probs); /*proto*/ -static char __pyx_doc_4LFPy_12alias_method_2alias_setup[] = "Set up function for alias method.\n See http://www.keithschwarz.com/darts-dice-coins/\n\n Parameters\n ----------\n probs : np.ndarray\n float array of compartment areas\n\n Returns\n -------\n J : np.ndarray\n array of ints\n q : np.ndarray\n array of floats\n\n "; -static PyObject *__pyx_pw_4LFPy_12alias_method_3alias_setup(PyObject *__pyx_self, PyObject *__pyx_v_probs) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("alias_setup (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probs), __pyx_ptype_5numpy_ndarray, 1, "probs", 0))) __PYX_ERR(0, 76, __pyx_L1_error) - __pyx_r = __pyx_pf_4LFPy_12alias_method_2alias_setup(__pyx_self, ((PyArrayObject *)__pyx_v_probs)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_4LFPy_12alias_method_2alias_setup(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_probs) { - __Pyx_LocalBuf_ND __pyx_pybuffernd_probs; - __Pyx_Buffer __pyx_pybuffer_probs; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("alias_setup", 0); - __pyx_pybuffer_probs.pybuffer.buf = NULL; - __pyx_pybuffer_probs.refcount = 0; - __pyx_pybuffernd_probs.data = NULL; - __pyx_pybuffernd_probs.rcbuffer = &__pyx_pybuffer_probs; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probs.rcbuffer->pybuffer, (PyObject*)__pyx_v_probs, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_12alias_method_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 76, __pyx_L1_error) - } - __pyx_pybuffernd_probs.diminfo[0].strides = __pyx_pybuffernd_probs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probs.diminfo[0].shape = __pyx_pybuffernd_probs.rcbuffer->pybuffer.shape[0]; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_4LFPy_12alias_method_alias_setup(__pyx_v_probs, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_probs.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("LFPy.alias_method.alias_setup", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_probs.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":258 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fulfill the PEP. - */ - -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_i; - int __pyx_v_ndim; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - int __pyx_v_t; - char *__pyx_v_f; - PyArray_Descr *__pyx_v_descr = 0; - int __pyx_v_offset; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - PyArray_Descr *__pyx_t_7; - PyObject *__pyx_t_8 = NULL; - char *__pyx_t_9; - if (__pyx_v_info == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":265 - * - * cdef int i, ndim - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - */ - __pyx_v_endian_detector = 1; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":266 - * cdef int i, ndim - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * - * ndim = PyArray_NDIM(self) - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":268 - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - */ - __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":270 - * ndim = PyArray_NDIM(self) - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":271 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not C contiguous") - * - */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":270 - * ndim = PyArray_NDIM(self) - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - if (unlikely(__pyx_t_1)) { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":272 - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __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_ERR(1, 272, __pyx_L1_error) - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":270 - * ndim = PyArray_NDIM(self) - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":274 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L7_bool_binop_done; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":275 - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not Fortran contiguous") - * - */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L7_bool_binop_done:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":274 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - if (unlikely(__pyx_t_1)) { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":276 - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< - * - * info.buf = PyArray_DATA(self) - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __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_ERR(1, 276, __pyx_L1_error) - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":274 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":278 - * raise ValueError(u"ndarray is not Fortran contiguous") - * - * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< - * info.ndim = ndim - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":279 - * - * info.buf = PyArray_DATA(self) - * info.ndim = ndim # <<<<<<<<<<<<<< - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * # Allocate new buffer for strides and shape info. - */ - __pyx_v_info->ndim = __pyx_v_ndim; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":280 - * info.buf = PyArray_DATA(self) - * info.ndim = ndim - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. - * # This is allocated as one block, strides first. - */ - __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); - if (__pyx_t_1) { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":283 - * # Allocate new buffer for strides and shape info. - * # This is allocated as one block, strides first. - * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) # <<<<<<<<<<<<<< - * info.shape = info.strides + ndim - * for i in range(ndim): - */ - __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim)))); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":284 - * # This is allocated as one block, strides first. - * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) - * info.shape = info.strides + ndim # <<<<<<<<<<<<<< - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - */ - __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":285 - * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) - * info.shape = info.strides + ndim - * for i in range(ndim): # <<<<<<<<<<<<<< - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] - */ - __pyx_t_4 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":286 - * info.shape = info.strides + ndim - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":287 - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< - * else: - * info.strides = PyArray_STRIDES(self) - */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":280 - * info.buf = PyArray_DATA(self) - * info.ndim = ndim - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. - * # This is allocated as one block, strides first. - */ - goto __pyx_L9; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":289 - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - */ - /*else*/ { - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":290 - * else: - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); - } - __pyx_L9:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":291 - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) - */ - __pyx_v_info->suboffsets = NULL; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":292 - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< - * info.readonly = not PyArray_ISWRITEABLE(self) - * - */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":293 - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< - * - * cdef int t - */ - __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":296 - * - * cdef int t - * cdef char* f = NULL # <<<<<<<<<<<<<< - * cdef dtype descr = PyArray_DESCR(self) - * cdef int offset - */ - __pyx_v_f = NULL; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":297 - * cdef int t - * cdef char* f = NULL - * cdef dtype descr = PyArray_DESCR(self) # <<<<<<<<<<<<<< - * cdef int offset - * - */ - __pyx_t_7 = PyArray_DESCR(__pyx_v_self); - __pyx_t_3 = ((PyObject *)__pyx_t_7); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":300 - * cdef int offset - * - * info.obj = self # <<<<<<<<<<<<<< - * - * if not PyDataType_HASFIELDS(descr): - */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":302 - * info.obj = self - * - * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<< - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or - */ - __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0); - if (__pyx_t_1) { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":303 - * - * if not PyDataType_HASFIELDS(descr): - * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): - */ - __pyx_t_4 = __pyx_v_descr->type_num; - __pyx_v_t = __pyx_t_4; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":304 - * if not PyDataType_HASFIELDS(descr): - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0); - if (!__pyx_t_2) { - goto __pyx_L15_next_or; - } else { - } - __pyx_t_2 = (__pyx_v_little_endian != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L14_bool_binop_done; - } - __pyx_L15_next_or:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":305 - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or - * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" - */ - __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L14_bool_binop_done; - } - __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L14_bool_binop_done:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":304 - * if not PyDataType_HASFIELDS(descr): - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - if (unlikely(__pyx_t_1)) { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":306 - * if ((descr.byteorder == c'>' and little_endian) or - * (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" - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __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_ERR(1, 306, __pyx_L1_error) - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":304 - * if not PyDataType_HASFIELDS(descr): - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":307 - * (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" - */ - switch (__pyx_v_t) { - case NPY_BYTE: - __pyx_v_f = ((char *)"b"); - break; - case NPY_UBYTE: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":308 - * 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_v_f = ((char *)"B"); - break; - case NPY_SHORT: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":309 - * 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_v_f = ((char *)"h"); - break; - case NPY_USHORT: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":310 - * 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_v_f = ((char *)"H"); - break; - case NPY_INT: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":311 - * 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_v_f = ((char *)"i"); - break; - case NPY_UINT: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":312 - * 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_v_f = ((char *)"I"); - break; - case NPY_LONG: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":313 - * 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_v_f = ((char *)"l"); - break; - case NPY_ULONG: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":314 - * 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_v_f = ((char *)"L"); - break; - case NPY_LONGLONG: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":315 - * 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_v_f = ((char *)"q"); - break; - case NPY_ULONGLONG: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":316 - * 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_v_f = ((char *)"Q"); - break; - case NPY_FLOAT: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":317 - * 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_v_f = ((char *)"f"); - break; - case NPY_DOUBLE: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":318 - * 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_v_f = ((char *)"d"); - break; - case NPY_LONGDOUBLE: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":319 - * 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_v_f = ((char *)"g"); - break; - case NPY_CFLOAT: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":320 - * 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_v_f = ((char *)"Zf"); - break; - case NPY_CDOUBLE: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":321 - * 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_v_f = ((char *)"Zd"); - break; - case NPY_CLONGDOUBLE: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":322 - * 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_v_f = ((char *)"Zg"); - break; - case NPY_OBJECT: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":323 - * 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_v_f = ((char *)"O"); - break; - default: - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":325 - * elif t == NPY_OBJECT: f = "O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * info.format = f - * return - */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__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_ERR(1, 325, __pyx_L1_error) - break; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":326 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f # <<<<<<<<<<<<<< - * return - * else: - */ - __pyx_v_info->format = __pyx_v_f; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":327 - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f - * return # <<<<<<<<<<<<<< - * else: - * info.format = PyObject_Malloc(_buffer_format_string_len) - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":302 - * info.obj = self - * - * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<< - * t = descr.type_num - * if ((descr.byteorder == c'>' and little_endian) or - */ - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":329 - * return - * else: - * info.format = PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 - */ - /*else*/ { - __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF)); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":330 - * else: - * info.format = PyObject_Malloc(_buffer_format_string_len) - * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< - * offset = 0 - * f = _util_dtypestring(descr, info.format + 1, - */ - (__pyx_v_info->format[0]) = '^'; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":331 - * info.format = PyObject_Malloc(_buffer_format_string_len) - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 # <<<<<<<<<<<<<< - * f = _util_dtypestring(descr, info.format + 1, - * info.format + _buffer_format_string_len, - */ - __pyx_v_offset = 0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":332 - * info.format[0] = c'^' # Native data types, manual alignment - * offset = 0 - * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<< - * info.format + _buffer_format_string_len, - * &offset) - */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 332, __pyx_L1_error) - __pyx_v_f = __pyx_t_9; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":335 - * info.format + _buffer_format_string_len, - * &offset) - * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - */ - (__pyx_v_f[0]) = '\x00'; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":258 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fulfill the PEP. - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":337 - * f[0] = c'\0' # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * PyObject_Free(info.format) - */ - -/* Python wrapper */ -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)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__", 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":338 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * PyObject_Free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); - if (__pyx_t_1) { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":339 - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): - * PyObject_Free(info.format) # <<<<<<<<<<<<<< - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * PyObject_Free(info.strides) - */ - PyObject_Free(__pyx_v_info->format); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":338 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * PyObject_Free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":340 - * if PyArray_HASFIELDS(self): - * PyObject_Free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * PyObject_Free(info.strides) - * # info.shape was stored after info.strides in the same block - */ - __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); - if (__pyx_t_1) { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":341 - * PyObject_Free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * PyObject_Free(info.strides) # <<<<<<<<<<<<<< - * # info.shape was stored after info.strides in the same block - * - */ - PyObject_Free(__pyx_v_info->strides); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":340 - * if PyArray_HASFIELDS(self): - * PyObject_Free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * PyObject_Free(info.strides) - * # info.shape was stored after info.strides in the same block - */ - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":337 - * f[0] = c'\0' # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * PyObject_Free(info.format) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":821 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":822 - * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew2(a, b): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":821 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":824 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":825 - * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":824 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":827 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":828 - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":827 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":830 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":831 - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 831, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":830 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":833 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":834 - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< - * - * cdef inline tuple PyDataType_SHAPE(dtype d): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":833 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":836 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":837 - * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape - * else: - */ - __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); - if (__pyx_t_1) { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":838 - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape # <<<<<<<<<<<<<< - * else: - * return () - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); - __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); - goto __pyx_L0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":837 - * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape - * else: - */ - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":840 - * return d.subarray.shape - * else: - * return () # <<<<<<<<<<<<<< - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_empty_tuple); - __pyx_r = __pyx_empty_tuple; - goto __pyx_L0; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":836 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":842 - * return () - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< - * # Recursive utility function used in __getbuffer__ to get format - * # string. The new location in the format string is returned. - */ - -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child = 0; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - PyObject *__pyx_v_fields = 0; - PyObject *__pyx_v_childname = NULL; - PyObject *__pyx_v_new_offset = NULL; - PyObject *__pyx_v_t = NULL; - char *__pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - long __pyx_t_8; - char *__pyx_t_9; - __Pyx_RefNannySetupContext("_util_dtypestring", 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":847 - * - * cdef dtype child - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * cdef tuple fields - */ - __pyx_v_endian_detector = 1; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":848 - * cdef dtype child - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * cdef tuple fields - * - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":851 - * cdef tuple fields - * - * for childname in descr.names: # <<<<<<<<<<<<<< - * fields = descr.fields[childname] - * child, new_offset = fields - */ - if (unlikely(__pyx_v_descr->names == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(1, 851, __pyx_L1_error) - } - __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - for (;;) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 851, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); - __pyx_t_3 = 0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":852 - * - * for childname in descr.names: - * fields = descr.fields[childname] # <<<<<<<<<<<<<< - * child, new_offset = fields - * - */ - if (unlikely(__pyx_v_descr->fields == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 852, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __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 %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 852, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":853 - * for childname in descr.names: - * fields = descr.fields[childname] - * child, new_offset = fields # <<<<<<<<<<<<<< - * - * if (end - f) - (new_offset - offset[0]) < 15: - */ - if (likely(__pyx_v_fields != Py_None)) { - PyObject* sequence = __pyx_v_fields; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 853, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error) - } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); - __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); - __pyx_t_4 = 0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":855 - * child, new_offset = fields - * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - */ - __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0); - if (unlikely(__pyx_t_6)) { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":856 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == c'>' and little_endian) or - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __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_ERR(1, 856, __pyx_L1_error) - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":855 - * child, new_offset = fields - * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - */ - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":858 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); - if (!__pyx_t_7) { - goto __pyx_L8_next_or; - } else { - } - __pyx_t_7 = (__pyx_v_little_endian != 0); - if (!__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L7_bool_binop_done; - } - __pyx_L8_next_or:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":859 - * - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError(u"Non-native byte order not supported") - * # One could encode it in the format string and have Cython - */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); - if (__pyx_t_7) { - } else { - __pyx_t_6 = __pyx_t_7; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0); - __pyx_t_6 = __pyx_t_7; - __pyx_L7_bool_binop_done:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":858 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - if (unlikely(__pyx_t_6)) { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":860 - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __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_ERR(1, 860, __pyx_L1_error) - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":858 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":870 - * - * # Output padding bytes - * while offset[0] < new_offset: # <<<<<<<<<<<<<< - * f[0] = 120 # "x"; pad byte - * f += 1 - */ - while (1) { - __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 870, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 870, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_6) break; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":871 - * # Output padding bytes - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< - * f += 1 - * offset[0] += 1 - */ - (__pyx_v_f[0]) = 0x78; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":872 - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte - * f += 1 # <<<<<<<<<<<<<< - * offset[0] += 1 - * - */ - __pyx_v_f = (__pyx_v_f + 1); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":873 - * f[0] = 120 # "x"; pad byte - * f += 1 - * offset[0] += 1 # <<<<<<<<<<<<<< - * - * offset[0] += child.itemsize - */ - __pyx_t_8 = 0; - (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1); - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":875 - * offset[0] += 1 - * - * offset[0] += child.itemsize # <<<<<<<<<<<<<< - * - * if not PyDataType_HASFIELDS(child): - */ - __pyx_t_8 = 0; - (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":877 - * offset[0] += child.itemsize - * - * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< - * t = child.type_num - * if end - f < 5: - */ - __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); - if (__pyx_t_6) { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":878 - * - * if not PyDataType_HASFIELDS(child): - * t = child.type_num # <<<<<<<<<<<<<< - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") - */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); - __pyx_t_4 = 0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":879 - * if not PyDataType_HASFIELDS(child): - * t = child.type_num - * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short.") - * - */ - __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); - if (unlikely(__pyx_t_6)) { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":880 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(1, 880, __pyx_L1_error) - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":879 - * if not PyDataType_HASFIELDS(child): - * t = child.type_num - * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short.") - * - */ - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":883 - * - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 98; - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":884 - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 66; - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":885 - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 885, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x68; - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":886 - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 886, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 72; - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":887 - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 887, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x69; - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":888 - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 888, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 73; - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":889 - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 889, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x6C; - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":890 - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 76; - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":891 - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 891, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x71; - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":892 - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 892, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 81; - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":893 - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 893, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x66; - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":894 - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 894, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x64; - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":895 - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 895, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 0x67; - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":896 - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 896, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 0x66; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":897 - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 897, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 0x64; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":898 - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 898, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 0x67; - __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":899 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 899, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (likely(__pyx_t_6)) { - (__pyx_v_f[0]) = 79; - goto __pyx_L15; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":901 - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * f += 1 - * else: - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 901, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__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_ERR(1, 901, __pyx_L1_error) - } - __pyx_L15:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":902 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * f += 1 # <<<<<<<<<<<<<< - * else: - * # Cython ignores struct boundary information ("T{...}"), - */ - __pyx_v_f = (__pyx_v_f + 1); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":877 - * offset[0] += child.itemsize - * - * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< - * t = child.type_num - * if end - f < 5: - */ - goto __pyx_L13; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":906 - * # Cython ignores struct boundary information ("T{...}"), - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< - * return f - * - */ - /*else*/ { - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 906, __pyx_L1_error) - __pyx_v_f = __pyx_t_9; - } - __pyx_L13:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":851 - * cdef tuple fields - * - * for childname in descr.names: # <<<<<<<<<<<<<< - * fields = descr.fields[childname] - * child, new_offset = fields - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":907 - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) - * return f # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_f; - goto __pyx_L0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":842 - * return () - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< - * # Recursive utility function used in __getbuffer__ to get format - * # string. The new location in the format string is returned. - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_child); - __Pyx_XDECREF(__pyx_v_fields); - __Pyx_XDECREF(__pyx_v_childname); - __Pyx_XDECREF(__pyx_v_new_offset); - __Pyx_XDECREF(__pyx_v_t); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1022 - * int _import_umath() except -1 - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) - */ - -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_array_base", 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1023 - * - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< - * PyArray_SetBaseObject(arr, base) - * - */ - Py_INCREF(__pyx_v_base); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1024 - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< - * - * cdef inline object get_array_base(ndarray arr): - */ - (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1022 - * int _import_umath() except -1 - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1026 - * PyArray_SetBaseObject(arr, base) - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_v_base; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base", 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1027 - * - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< - * if base is NULL: - * return None - */ - __pyx_v_base = PyArray_BASE(__pyx_v_arr); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1028 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base - */ - __pyx_t_1 = ((__pyx_v_base == NULL) != 0); - if (__pyx_t_1) { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1029 - * base = PyArray_BASE(arr) - * if base is NULL: - * return None # <<<<<<<<<<<<<< - * return base - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1028 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base - */ - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1030 - * if base is NULL: - * return None - * return base # <<<<<<<<<<<<<< - * - * # Versions of the import_* functions which are more suitable for - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_base)); - __pyx_r = ((PyObject *)__pyx_v_base); - goto __pyx_L0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1026 - * PyArray_SetBaseObject(arr, base) - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1034 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * _import_array() - */ - -static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { - int __pyx_r; - __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; - __Pyx_RefNannySetupContext("import_array", 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1035 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * _import_array() - * except Exception: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1036 - * cdef inline int import_array() except -1: - * try: - * _import_array() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") - */ - __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error) - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1035 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * _import_array() - * except Exception: - */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1037 - * try: - * _import_array() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.multiarray failed to import") - * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1038 - * _import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< - * - * cdef inline int import_umath() except -1: - */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 1038, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1035 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * _import_array() - * except Exception: - */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1034 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * _import_array() - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1040 - * raise ImportError("numpy.core.multiarray failed to import") - * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() - */ - -static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { - int __pyx_r; - __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; - __Pyx_RefNannySetupContext("import_umath", 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1041 - * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1042 - * cdef inline int import_umath() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") - */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error) - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1041 - * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1043 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") - * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1044 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< - * - * cdef inline int import_ufunc() except -1: - */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 1044, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1041 - * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1040 - * raise ImportError("numpy.core.multiarray failed to import") - * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1046 - * raise ImportError("numpy.core.umath failed to import") - * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() - */ - -static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { - int __pyx_r; - __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; - __Pyx_RefNannySetupContext("import_ufunc", 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1047 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1048 - * cdef inline int import_ufunc() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") - */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error) - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1047 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1049 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1050 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< - */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 1050, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1047 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; - } - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1046 - * raise ImportError("numpy.core.umath failed to import") - * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyMethodDef __pyx_methods[] = { - {"alias_method", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4LFPy_12alias_method_1alias_method, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4LFPy_12alias_method_alias_method}, - {"alias_setup", (PyCFunction)__pyx_pw_4LFPy_12alias_method_3alias_setup, METH_O, __pyx_doc_4LFPy_12alias_method_2alias_setup}, - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_alias_method(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_alias_method}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "alias_method", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - #define CYTHON_SMALL_CODE __attribute__((cold)) -#else - #define CYTHON_SMALL_CODE -#endif -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1}, - {&__pyx_n_s_DTYPE, __pyx_k_DTYPE, sizeof(__pyx_k_DTYPE), 0, 0, 1, 1}, - {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0}, - {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0}, - {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, - {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0}, - {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, - {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_kp_s_length_of_idx_and_probs_arrays_m, __pyx_k_length_of_idx_and_probs_arrays_m, sizeof(__pyx_k_length_of_idx_and_probs_arrays_m), 0, 0, 1, 0}, - {&__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_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0}, - {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0}, - {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, - {&__pyx_n_s_nsyn, __pyx_k_nsyn, sizeof(__pyx_k_nsyn), 0, 0, 1, 1}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, - {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, - {&__pyx_n_s_probs, __pyx_k_probs, sizeof(__pyx_k_probs), 0, 0, 1, 1}, - {&__pyx_n_s_rand, __pyx_k_rand, sizeof(__pyx_k_rand), 0, 0, 1, 1}, - {&__pyx_n_s_random, __pyx_k_random, sizeof(__pyx_k_random), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0}, - {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(0, 44, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 64, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error) - __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":272 - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":276 - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< - * - * info.buf = PyArray_DATA(self) - */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":306 - * if ((descr.byteorder == c'>' and little_endian) or - * (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" - */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":856 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == c'>' and little_endian) or - */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":880 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 880, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1038 - * _import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< - * - * cdef inline int import_umath() except -1: - */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 1038, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1044 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< - * - * cdef inline int import_ufunc() except -1: - */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 1044, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ - -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", - #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), - #else - sizeof(PyHeapTypeObject), - #endif - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 206, __pyx_L1_error) - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 229, __pyx_L1_error) - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 233, __pyx_L1_error) - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 242, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 918, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - - -#if PY_MAJOR_VERSION < 3 -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC void -#else -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#endif -#else -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#endif -#endif - - -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC initalias_method(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC initalias_method(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_alias_method(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_alias_method(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { - result = PyDict_SetItemString(moddict, to_name, value); - } - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; - } - return result; -} -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - if (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; -} - - -static CYTHON_SMALL_CODE int __pyx_pymod_exec_alias_method(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module 'alias_method' has already been imported. Re-initialisation is not supported."); - return -1; - } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_alias_method(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("alias_method", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __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_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_LFPy__alias_method) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "LFPy.alias_method")) { - if (unlikely(PyDict_SetItemString(modules, "LFPy.alias_method", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error; - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error; - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - (void)__Pyx_modinit_type_init_code(); - if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error; - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "LFPy/alias_method.pyx":6 - * - * from __future__ import division - * import numpy as np # <<<<<<<<<<<<<< - * cimport numpy as np - * cimport cython - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LFPy/alias_method.pyx":10 - * cimport cython - * - * DTYPE = np.float64 # <<<<<<<<<<<<<< - * ctypedef np.float64_t DTYPE_t - * ctypedef Py_ssize_t LTYPE_t - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DTYPE, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LFPy/alias_method.pyx":1 - * #!/usr/bin/env python # <<<<<<<<<<<<<< - * # -*- coding: utf-8 -*- - * # cython: language_level=2 - */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1046 - * raise ImportError("numpy.core.umath failed to import") - * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() - */ - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init LFPy.alias_method", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_CLEAR(__pyx_m); - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init LFPy.alias_method"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -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); -} -#endif - -/* GetBuiltinName */ -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 '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* IsLittleEndian */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) -{ - union { - uint32_t u32; - uint8_t u8[4]; - } S; - S.u32 = 0x01020304; - return S.u8[0] == 4; -} - -/* BufferFormatCheck */ -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) - 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 '?': return "'bool'"; - 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 '?': 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 '?': 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; - while (1) { - if (field == &ctx->root) { - ctx->head = NULL; - if (ctx->enc_count != 0) { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - break; - } - 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; - 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 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 != ')') { - switch (*ts) { - case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; - default: break; - } - 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 '\r': - case '\n': - ++ts; - break; - case '<': - if (!__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '>': - case '!': - if (__Pyx_Is_Little_Endian()) { - 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': - { - 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; - 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 '}': - { - size_t alignment = ctx->struct_alignment; - ++ts; - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - 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; - } - CYTHON_FALLTHROUGH; - case '?': 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 'p': - if (ctx->enc_type == *ts && got_Z == ctx->is_complex && - ctx->enc_packmode == ctx->new_packmode) { - ctx->enc_count += ctx->new_count; - ctx->new_count = 1; - got_Z = 0; - ++ts; - break; - } - CYTHON_FALLTHROUGH; - case 's': - 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; - } - } - } -} - -/* BufferGetAndValidate */ - static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { - if (unlikely(info->buf == NULL)) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(info); -} -static 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 int __Pyx__GetBufferAndValidate( - Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, - int nd, int cast, __Pyx_BufFmt_StackElem* stack) -{ - buf->buf = NULL; - if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) { - __Pyx_ZeroBuffer(buf); - return -1; - } - if (unlikely(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 (unlikely((size_t)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_SafeReleaseBuffer(buf); - return -1; -} - -/* GetTopmostException */ - #if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * -__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) -{ - _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && - exc_info->previous_item != NULL) - { - exc_info = exc_info->previous_item; - } - return exc_info; -} -#endif - -/* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - *type = exc_info->exc_type; - *value = exc_info->exc_value; - *tb = exc_info->exc_traceback; - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - #endif - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = type; - exc_info->exc_value = value; - exc_info->exc_traceback = tb; - #else - 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; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -#endif - -/* PyErrExceptionMatches */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; icurexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); -} -#endif - -/* GetException */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) -#endif -{ - PyObject *local_type, *local_value, *local_tb; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#else - PyErr_Fetch(&local_type, &local_value, &local_tb); -#endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) -#else - if (unlikely(PyErr_Occurred())) -#endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; - } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - #if CYTHON_USE_EXC_INFO_STACK - { - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = local_type; - exc_info->exc_value = local_value; - exc_info->exc_traceback = local_tb; - } - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(local_type, local_value, local_tb); -#endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; -} - -/* PyCFunctionFastCall */ - #if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); - } -} -#endif - -/* PyFunctionFastCall */ - #if CYTHON_FAST_PYCALL -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif -#endif - -/* PyObjectCall */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCall2Args */ - static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} - -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* RaiseException */ - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - 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 (PyType_Check(type)) { -#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; - 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; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -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) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - 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 (cause) { - 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 { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* RaiseTooManyValuesToUnpack */ - 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); -} - -/* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* IterFinish */ - static CYTHON_INLINE int __Pyx_IterFinish(void) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* exc_type = tstate->curexc_type; - if (unlikely(exc_type)) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) { - PyObject *exc_value, *exc_tb; - exc_value = tstate->curexc_value; - exc_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - Py_DECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_tb); - return 0; - } else { - return -1; - } - } - return 0; -#else - if (unlikely(PyErr_Occurred())) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { - PyErr_Clear(); - return 0; - } else { - return -1; - } - } - return 0; -#endif -} - -/* UnpackItemEndCheck */ - static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { - if (unlikely(retval)) { - Py_DECREF(retval); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } else { - return __Pyx_IterFinish(); - } - return 0; -} - -/* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(__Pyx_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - -/* BufferFallbackError */ - static void __Pyx_RaiseBufferFallbackError(void) { - PyErr_SetString(PyExc_ValueError, - "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); -} - -/* PyDictVersioning */ - #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); -} -#endif - -/* GetModuleGlobalName */ - #if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); -#endif - return __Pyx_GetBuiltinName(name); -} - -/* RaiseArgTupleInvalid */ - 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, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* RaiseDoubleKeywords */ - 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 -} - -/* ParseKeywords */ - 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, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* ArgTypeTest */ - static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - -/* DictGetItem */ - #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) { - if (unlikely(PyTuple_Check(key))) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) { - PyErr_SetObject(PyExc_KeyError, args); - Py_DECREF(args); - } - } else { - PyErr_SetObject(PyExc_KeyError, key); - } - } - return NULL; - } - Py_INCREF(value); - return value; -} -#endif - -/* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -/* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, enum __Pyx_ImportType_CheckSize check_size) -{ - PyObject *result = 0; - char warning[200]; - Py_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; -#endif - result = PyObject_GetAttrString(module, class_name); - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#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 ((size_t)basicsize < size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; - } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; - } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(result); - return NULL; -} -#endif - -/* Import */ - 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_MAJOR_VERSION < 3 - 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_MAJOR_VERSION >= 3 - if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* CLineInTraceback */ - #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { - PyObject *use_cline; - PyObject *ptype, *pvalue, *ptraceback; -#if CYTHON_COMPILING_IN_CPYTHON - PyObject **cython_runtime_dict; -#endif - if (unlikely(!__pyx_cython_runtime)) { - return c_line; - } - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); -#if CYTHON_COMPILING_IN_CPYTHON - cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); - if (likely(cython_runtime_dict)) { - __PYX_PY_DICT_LOOKUP_IF_MODIFIED( - use_cline, *cython_runtime_dict, - __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) - } else -#endif - { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); - if (use_cline_obj) { - use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; - Py_DECREF(use_cline_obj); - } else { - PyErr_Clear(); - use_cline = NULL; - } - } - if (!use_cline) { - c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); - } - else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { - c_line = 0; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - return c_line; -} -#endif - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - if (c_line) { - c_line = __Pyx_CLineForTraceback(tstate, c_line); - } - py_code = __pyx_find_code_object(c_line ? -c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); - } - py_frame = PyFrame_New( - tstate, /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -#if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { - if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); - if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); - PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name); - return -1; -} -static void __Pyx_ReleaseBuffer(Py_buffer *view) { - PyObject *obj = view->obj; - if (!obj) return; - if (PyObject_CheckBuffer(obj)) { - PyBuffer_Release(view); - return; - } - if ((0)) {} - else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); - view->obj = NULL; - Py_DECREF(obj); -} -#endif - - - /* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* Declarations */ - #if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return ::std::complex< float >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return x + y*(__pyx_t_float_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - __pyx_t_float_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -/* Arithmetic */ - #if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - #if 1 - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - if (b.imag == 0) { - return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); - } else if (fabsf(b.real) >= fabsf(b.imag)) { - if (b.real == 0 && b.imag == 0) { - return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); - } else { - float r = b.imag / b.real; - float s = (float)(1.0) / (b.real + b.imag * r); - return __pyx_t_float_complex_from_parts( - (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); - } - } else { - float r = b.real / b.imag; - float s = (float)(1.0) / (b.imag + b.real * r); - return __pyx_t_float_complex_from_parts( - (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); - } - } - #else - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - if (b.imag == 0) { - return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); - } else { - float denom = b.real * b.real + b.imag * b.imag; - return __pyx_t_float_complex_from_parts( - (a.real * b.real + a.imag * b.imag) / denom, - (a.imag * b.real - a.real * b.imag) / denom); - } - } - #endif - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } - #if 1 - static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { - #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrtf(z.real*z.real + z.imag*z.imag); - #else - return hypotf(z.real, z.imag); - #endif - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float r, lnr, theta, z_r, z_theta; - if (b.imag == 0 && b.real == (int)b.real) { - if (b.real < 0) { - float denom = a.real * a.real + a.imag * a.imag; - a.real = a.real / denom; - a.imag = -a.imag / denom; - b.real = -b.real; - } - switch ((int)b.real) { - case 0: - z.real = 1; - z.imag = 0; - return z; - case 1: - return a; - case 2: - return __Pyx_c_prod_float(a, a); - case 3: - z = __Pyx_c_prod_float(a, a); - return __Pyx_c_prod_float(z, a); - case 4: - z = __Pyx_c_prod_float(a, a); - return __Pyx_c_prod_float(z, z); - } - } - if (a.imag == 0) { - if (a.real == 0) { - return a; - } else if (b.imag == 0) { - z.real = powf(a.real, b.real); - z.imag = 0; - return z; - } else if (a.real > 0) { - r = a.real; - theta = 0; - } else { - r = -a.real; - theta = atan2f(0.0, -1.0); - } - } else { - r = __Pyx_c_abs_float(a); - theta = atan2f(a.imag, a.real); - } - lnr = logf(r); - z_r = expf(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cosf(z_theta); - z.imag = z_r * sinf(z_theta); - return z; - } - #endif -#endif - -/* Declarations */ - #if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return ::std::complex< double >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return x + y*(__pyx_t_double_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - __pyx_t_double_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -/* Arithmetic */ - #if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - #if 1 - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - if (b.imag == 0) { - return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); - } else if (fabs(b.real) >= fabs(b.imag)) { - if (b.real == 0 && b.imag == 0) { - return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); - } else { - double r = b.imag / b.real; - double s = (double)(1.0) / (b.real + b.imag * r); - return __pyx_t_double_complex_from_parts( - (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); - } - } else { - double r = b.real / b.imag; - double s = (double)(1.0) / (b.imag + b.real * r); - return __pyx_t_double_complex_from_parts( - (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); - } - } - #else - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - if (b.imag == 0) { - return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); - } else { - double denom = b.real * b.real + b.imag * b.imag; - return __pyx_t_double_complex_from_parts( - (a.real * b.real + a.imag * b.imag) / denom, - (a.imag * b.real - a.real * b.imag) / denom); - } - } - #endif - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } - #if 1 - static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { - #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrt(z.real*z.real + z.imag*z.imag); - #else - return hypot(z.real, z.imag); - #endif - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double r, lnr, theta, z_r, z_theta; - if (b.imag == 0 && b.real == (int)b.real) { - if (b.real < 0) { - double denom = a.real * a.real + a.imag * a.imag; - a.real = a.real / denom; - a.imag = -a.imag / denom; - b.real = -b.real; - } - switch ((int)b.real) { - case 0: - z.real = 1; - z.imag = 0; - return z; - case 1: - return a; - case 2: - return __Pyx_c_prod_double(a, a); - case 3: - z = __Pyx_c_prod_double(a, a); - return __Pyx_c_prod_double(z, a); - case 4: - z = __Pyx_c_prod_double(a, a); - return __Pyx_c_prod_double(z, z); - } - } - if (a.imag == 0) { - if (a.real == 0) { - return a; - } else if (b.imag == 0) { - z.real = pow(a.real, b.real); - z.imag = 0; - return z; - } else if (a.real > 0) { - r = a.real; - theta = 0; - } else { - r = -a.real; - theta = atan2(0.0, -1.0); - } - } else { - r = __Pyx_c_abs_double(a); - theta = atan2(a.imag, a.real); - } - lnr = log(r); - z_r = exp(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cos(z_theta); - z.imag = z_r * sin(z_theta); - return z; - } - #endif -#endif - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { - const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(enum NPY_TYPES) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(enum NPY_TYPES) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(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 (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(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 (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* FastTypeChecks */ - #if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = a->tp_base; - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; -} -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(a, b); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } - return res; -} -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; ip) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - if (PyObject_Hash(*t->p) == -1) - return -1; - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -#if !CYTHON_PEP393_ENABLED -static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - 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 - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -} -#else -static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (likely(PyUnicode_IS_ASCII(o))) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -} -#endif -#endif -static CYTHON_INLINE const 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)) { - return __Pyx_PyUnicode_AsStringAndSize(o, length); - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(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 int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { - int retval; - if (unlikely(!x)) return -1; - retval = __Pyx_PyObject_IsTrue(x); - Py_DECREF(x); - return retval; -} -static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { -#if PY_MAJOR_VERSION >= 3 - if (PyLong_Check(result)) { - if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { - Py_DECREF(result); - return NULL; - } - return result; - } -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); - Py_DECREF(result); - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x) || PyLong_Check(x))) -#else - if (likely(PyLong_Check(x))) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = m->nb_int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = m->nb_long(x); - } - #else - if (likely(m && m->nb_int)) { - name = "int"; - res = m->nb_int(x); - } - #endif -#else - if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { - res = PyNumber_Int(x); - } -#endif - if (likely(res)) { -#if PY_MAJOR_VERSION < 3 - if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { -#else - if (unlikely(!PyLong_CheckExact(res))) { -#endif - return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(b); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { - return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/LFPy-2.0.7/LFPy/alias_method.py b/LFPy-2.0.7/LFPy/alias_method.py deleted file mode 100644 index 7c45a48..0000000 --- a/LFPy-2.0.7/LFPy/alias_method.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import division -import numpy as np - - -def alias_method(idx, probs, nsyn): - """ - Alias method for drawing random numbers from a discrete probability - distribution. See http://www.keithschwarz.com/darts-dice-coins/ - - Parameters - ---------- - idx : np.ndarray - compartment indices as array of ints - probs : np.ndarray - compartment areas as array of floats - nsyn : int - number of randomized compartment indices - - Returns - ------- - out : np.ndarray - integer array of randomly drawn compartment indices - - """ - try: - assert idx.size == probs.size - except AssertionError as ae: - raise ae('length of idx and probs arrays must be equal') - - # Construct the table. - J, q = alias_setup(probs) - - #output array - spc = np.zeros(nsyn, dtype=int) - - #prefetch random numbers, alias_draw needs nsyn x 2 numbers - rands = np.random.rand(nsyn, 2) - - K = J.size - # Generate variates using alias draw method - for nn in range(nsyn): - kk = np.floor(rands[nn, 0]*K).astype(int) - if rands[nn, 1] < q[kk]: - spc[nn] = idx[kk] - else: - spc[nn] = idx[J[kk]] - - return spc - - -def alias_setup(probs): - """Set up function for alias method. - See http://www.keithschwarz.com/darts-dice-coins/ - - Parameters - ---------- - probs : np.ndarray - float array of compartment areas - - Returns - ------- - J : np.ndarray - array of ints - q : np.ndarray - array of floats - - """ - K = probs.size - q = probs*K - J = np.zeros(K, dtype=int) - - # Sort the data into the outcomes with probabilities - # that are larger and smaller than 1/K. - smaller = np.zeros(K, dtype=int) - larger = np.zeros(K, dtype=int) - s_i = 0 - l_i = 0 - for kk in range(K): - if q[kk] < 1: - smaller[s_i] = kk - s_i += 1 - else: - larger[l_i] = kk - l_i += 1 - - s_i -= 1 - l_i -= 1 - - # Loop though and create little binary mixtures that - # appropriately allocate the larger outcomes over the - # overall uniform mixture. - while s_i >= 0 and l_i >= 0: - small = smaller[s_i] - large = larger[l_i] - - J[small] = large - q[large] = q[large] + q[small] - 1 - - s_i -= 1 - - if q[large] < 1: - s_i += 1 - l_i -= 1 - smaller[s_i] = large - - return J, q - diff --git a/LFPy-2.0.7/LFPy/alias_method.pyx b/LFPy-2.0.7/LFPy/alias_method.pyx deleted file mode 100644 index 45856de..0000000 --- a/LFPy-2.0.7/LFPy/alias_method.pyx +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# cython: language_level=2 - -from __future__ import division -import numpy as np -cimport numpy as np -cimport cython - -DTYPE = np.float64 -ctypedef np.float64_t DTYPE_t -ctypedef Py_ssize_t LTYPE_t - -cdef extern from "math.h": - int floor(DTYPE_t x) - - -@cython.boundscheck(False) -@cython.wraparound(False) -cpdef np.ndarray[long, ndim=1, negative_indices=False] alias_method(np.ndarray[long, ndim=1, negative_indices=False] idx, - np.ndarray[DTYPE_t, ndim=1, negative_indices=False] probs, - int nsyn): - """ - Alias method for drawing random numbers from a discrete probability - distribution. See http://www.keithschwarz.com/darts-dice-coins/ - - Parameters - ---------- - idx : np.ndarray - compartment indices as array of ints - probs : np.ndarray - compartment areas as array of floats - nsyn : int - number of randomized compartment indices - - Returns - ------- - out : np.ndarray - integer array of randomly drawn compartment indices - - """ - try: - assert idx.size == probs.size - except AssertionError as ae: - raise ae('length of idx and probs arrays must be equal') - - #C-declare variables - cdef np.ndarray[long, ndim=1, negative_indices=False] J, spc - cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] q - cdef np.ndarray[DTYPE_t, ndim=2, negative_indices=False] rands - cdef int nn, j, ad, K, kk - - # Construct the table. - J, q = alias_setup(probs) - - #output array - spc = np.zeros(nsyn, dtype=int) - - #prefetch random numbers, alias_draw needs nsyn x 2 numbers - rands = np.random.rand(nsyn, 2) - - K = J.size - # Generate variates using alias draw method - for nn in range(nsyn): - kk = floor(rands[nn, 0]*K) - if rands[nn, 1] < q[kk]: - spc[nn] = idx[kk] - else: - spc[nn] = idx[J[kk]] - - return spc - - -@cython.boundscheck(False) -@cython.wraparound(False) -cpdef alias_setup(np.ndarray[DTYPE_t, ndim=1, negative_indices=False] probs): - """Set up function for alias method. - See http://www.keithschwarz.com/darts-dice-coins/ - - Parameters - ---------- - probs : np.ndarray - float array of compartment areas - - Returns - ------- - J : np.ndarray - array of ints - q : np.ndarray - array of floats - - """ - #C-declare variables - cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] q - cdef np.ndarray[long, ndim=1, negative_indices=False] J, smaller, larger - cdef long K - cdef int small, large, kk, s_i, l_i - cdef DTYPE_t prob - - K = probs.size - q = probs*K - J = np.zeros(K, dtype=int) - - # Sort the data into the outcomes with probabilities - # that are larger and smaller than 1/K. - smaller = np.zeros(K, dtype=int) - larger = np.zeros(K, dtype=int) - s_i = 0 - l_i = 0 - for kk in range(K): - if q[kk] < 1: - smaller[s_i] = kk - s_i += 1 - else: - larger[l_i] = kk - l_i += 1 - - s_i -= 1 - l_i -= 1 - - # Loop though and create little binary mixtures that - # appropriately allocate the larger outcomes over the - # overall uniform mixture. - while s_i >= 0 and l_i >= 0: - small = smaller[s_i] - large = larger[l_i] - - J[small] = large - q[large] = q[large] + q[small] - 1 - - s_i -= 1 - - if q[large] < 1: - s_i += 1 - l_i -= 1 - smaller[s_i] = large - - return J, q diff --git a/LFPy-2.0.7/LFPy/cell.py b/LFPy-2.0.7/LFPy/cell.py deleted file mode 100644 index 5d73b5a..0000000 --- a/LFPy-2.0.7/LFPy/cell.py +++ /dev/null @@ -1,2428 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Copyright (C) 2012 Computational Neuroscience Group, NMBU. -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. -""" - -from __future__ import division -import os -import neuron -import numpy as np -import scipy.stats -import sys -import posixpath -from warnings import warn -import pickle -from .run_simulation import _run_simulation, _run_simulation_with_electrode -from .run_simulation import _collect_geometry_neuron -from .alias_method import alias_method - -# check neuron version: -try: - try: - assert(neuron.version >= '7.6.4') - except: - warn('LFPy could not read NEURON version info. v7.6.4 or newer required') -except AssertionError: - warn('LFPy requires NEURON v7.6.4 or newer. Found v{}'.format(neuron.version)) - - -class Cell(object): - """ - The main cell class used in LFPy. - Parameters - ---------- - morphology : str or neuron.h.SectionList - File path of morphology on format that NEURON can understand (w. file - ending .hoc, .asc, .swc or .xml), or neuron.h.SectionList instance - filled with references to neuron.h.Section instances. - v_init : float - Initial membrane potential. Defaults to -70 mV. - Ra : float - Axial resistance. Defaults to 35.4 Ohm*cm - cm : float - Membrane capacitance. Defaults to 1.0 uF/cm2. - passive : bool - Passive mechanisms are initialized if True. Defaults to False - passive_parameters : dict - parameter dictionary with values for the passive membrane mechanism in - NEURON ('pas'). The dictionary must contain keys 'g_pas' [S/cm^2] and - 'e_pas' [mV], like the default: - passive_parameters=dict(g_pas=0.001, e_pas=-70) - extracellular : bool - Switch for NEURON's extracellular mechanism. Defaults to False - dt : float - simulation timestep. Defaults to 2^-4 ms - tstart : float - Initialization time for simulation <= 0 ms. Defaults to 0. - tstop : float - Stop time for simulation > 0 ms. Defaults to 100 ms. - nsegs_method : 'lambda100' or 'lambda_f' or 'fixed_length' or None - nseg rule, used by NEURON to determine number of compartments. - Defaults to 'lambda100' - max_nsegs_length : float or None - Maximum segment length for method 'fixed_length'. Defaults to None - lambda_f : int - AC frequency for method 'lambda_f'. Defaults to 100 - d_lambda : float - Parameter for d_lambda rule. Defaults to 0.1 - delete_sections : bool - Delete pre-existing section-references. Defaults to True - custom_code : list or None - List of model-specific code files ([.py/.hoc]). Defaults to None - custom_fun : list or None - List of model-specific functions with args. Defaults to None - custom_fun_args : list or None - List of args passed to custom_fun functions. Defaults to None - pt3d : bool - Use pt3d-info of the cell geometries switch. Defaults to False - celsius : float or None - Temperature in celsius. If nothing is specified here - or in custom code it is 6.3 celcius - verbose : bool - Verbose output switch. Defaults to False - Examples - -------- - Simple example of how to use the Cell class with a passive-circuit - morphology (modify morphology path accordingly): - >>> import os - >>> import LFPy - >>> cellParameters = { - >>> 'morphology' : os.path.join('examples', 'morphologies', 'L5_Mainen96_LFPy.hoc'), - >>> 'v_init' : -65., - >>> 'cm' : 1.0, - >>> 'Ra' : 150, - >>> 'passive' : True, - >>> 'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65}, - >>> 'dt' : 2**-3, - >>> 'tstart' : 0, - >>> 'tstop' : 50, - >>> } - >>> cell = LFPy.Cell(**cellParameters) - >>> cell.simulate() - >>> print(cell.somav) - """ - def __init__(self, morphology, - v_init=-70., - Ra=35.4, - cm=1.0, - passive=False, - passive_parameters = dict( - g_pas=0.001, - e_pas=-70.), - extracellular=False, - tstart=0., - tstop=100., - dt = 2**-4, - nsegs_method='lambda100', - lambda_f = 100, - d_lambda = 0.1, - max_nsegs_length=None, - delete_sections = True, - custom_code=None, - custom_fun=None, - custom_fun_args=None, - pt3d=False, - celsius=None, - verbose=False, - **kwargs): - """ - Initialization of the Cell object. - """ - self.verbose = verbose - self.pt3d = pt3d - - # raise Exceptions on deprecated input arguments - for key in ['timeres_NEURON', 'timeres_python']: - if key in kwargs.keys(): - raise DeprecationWarning('cell parameter {} is deprecated. Use dt=float instead'.format(key)) - if 'tstartms' in kwargs.keys(): - raise DeprecationWarning('cell parameter tstartms is deprecated. Use tstart=float instead') - if 'tstopms' in kwargs.keys(): - raise DeprecationWarning('cell parameter tstopms is deprecated. Use tstop=float instead') - if 'rm' in kwargs.keys(): - raise DeprecationWarning('Cell parameter rm is deprecated, set parameter passive_parameters=dict(g_pas=1/rm, e_pas=e_pas) instead') - if 'e_pas' in kwargs.keys(): - raise DeprecationWarning('Cell parameter e_pas is deprecated, set parameter passive_parameters=dict(g_pas=1/rm, e_pas=e_pas) instead') - - # check if there are un-used keyword arguments present in kwargs - for key, value in kwargs.items(): - raise ValueError('The keyword and argument {}={} is not valid input to class LFPy.Cell'.format(key, value)) - - if passive: - try: - assert(type(passive_parameters) is dict) - except AssertionError: - raise AssertionError('passive_parameters must be a dictionary') - for key in ['g_pas', 'e_pas']: - try: - assert(key in passive_parameters.keys()) - except AssertionError: - raise AssertionError('key {} not found in passive_parameters'.format(key)) - - - if not hasattr(neuron.h, 'd_lambda'): - neuron.h.load_file('stdlib.hoc') #NEURON std. library - neuron.h.load_file('import3d.hoc') #import 3D morphology lib - - if delete_sections: - numsec = 0 - for numsec, sec in enumerate(neuron.h.allsec()): - pass - if numsec > 0 and self.verbose: - print('%s existing sections deleted from memory' % numsec) - neuron.h('forall delete_section()') - - #print a warning if neuron have existing sections - numsec = 0 - for numsec, sec in enumerate(neuron.h.allsec()): - pass - if numsec > 0 and self.verbose: - mssg = "%s sections detected! " % numsec + \ - "Consider setting 'delete_sections=True'" - warn(mssg) - - #load morphology - try: - assert(morphology is not None) - except AssertionError: - raise AssertionError('deprecated keyword argument morphology==None, value must be a file path or neuron.h.SectionList instance with neuron.h.Section instances') - if "win32" in sys.platform and type(morphology) is str: - # fix Path on windows - morphology = morphology.replace(os.sep, posixpath.sep) - self.morphology = morphology - if type(self.morphology) is str: - if os.path.isfile(self.morphology): - self._load_geometry() - else: - raise Exception('non-existent file %s' % self.morphology) - else: - try: - assert(type(self.morphology) is type(neuron.h.SectionList)) - # #will try to import top level cell and create sectionlist, - # #in case there were no morphology file loaded - # neuron.h.define_shape() - # self._create_sectionlists() - except AssertionError: - raise Exception("Could not recognize Cell keyword argument morphology as neuron.h.SectionList instance") - - # instantiate 3D geometry of all sections - neuron.h.define_shape() - # set some additional attributes - self._create_sectionlists_from_morphology_value() - - - - #Some parameters and lists initialised - try: - assert(tstart <= 0) - except AssertionError: - raise AssertionError('tstart must be <= 0.') - - try: - assert(dt in 2.**np.arange(-16, -1)) - except AssertionError: - if tstart == 0.: - if self.verbose: - print('int(1./dt) not factorizable in base 2. ' - 'cell.tvec errors may occur, continuing initialization.') - elif tstart < 0: - raise AssertionError('int(1./dt) must be factorizable in base 2 if tstart < 0.') - - self.dt = dt - - self.tstart = tstart - self.tstop = tstop - - self.synapses = [] - self.synidx = [] - self.pointprocesses = [] - self.pointprocess_idx = [] - - self.v_init = v_init - - self.default_rotation = self._get_rotation() - - if passive: - #Set passive properties, insert passive on all segments - self.Ra = Ra - self.cm = cm - self.passive_parameters = passive_parameters - self._set_passive() - else: - self.Ra = Ra - self.cm = cm - self.passive_parameters = passive_parameters - if self.verbose: - print('No passive properties added') - - #run user specified code and functions if argument given - if custom_code is not None or custom_fun is not None: - self._run_custom_codes(custom_code, custom_fun, custom_fun_args) - - #Insert extracellular mech on all segments - self.extracellular = extracellular - if self.extracellular: - self._set_extracellular() - else: - if self.verbose: - print("no extracellular mechanism inserted") - - #set number of segments accd to rule, and calculate the number - self._set_nsegs(nsegs_method, lambda_f, d_lambda, max_nsegs_length) - self.totnsegs = self._calc_totnsegs() - if self.verbose: - print("Total number of segments: %i" % self.totnsegs) - - #extract pt3d info from NEURON, and set these with the same rotation - #and position in space as in our simulations, assuming RH rule, which - #NEURON do NOT use in shape plot - if self.pt3d: - self.x3d, self.y3d, self.z3d, self.diam3d = self._collect_pt3d() - - #Gather geometry, set position and rotation of morphology - if self.pt3d: - self._update_pt3d() - else: # self._update_pt3d itself makes a call to self._collect_geometry() - self._collect_geometry() - if hasattr(self, 'somapos'): - self.set_pos() - else: - if self.verbose: - print('no soma, using the midpoint if initial segment.') - self.set_rotation(**self.default_rotation) - - if celsius is not None: - if neuron.h.celsius != 6.3: - print("Overwriting custom temperature of %1.2f. New temperature is %1.2f" - % (neuron.h.celsius, celsius)) - neuron.h.celsius = celsius - - # initialize membrane voltage in all segments. - neuron.h.finitialize(self.v_init) - - - def _load_geometry(self): - """Load the morphology-file in NEURON""" - try: - neuron.h.sec_counted = 0 - except LookupError: - neuron.h('sec_counted = 0') - - #import the morphology, try and determine format - fileEnding = self.morphology.split('.')[-1] - if fileEnding == 'hoc' or fileEnding == 'HOC': - neuron.h.load_file(1, self.morphology) - else: - neuron.h('objref this') - if fileEnding == 'asc' or fileEnding == 'ASC': - Import = neuron.h.Import3d_Neurolucida3() - if not self.verbose: - Import.quiet = 1 - elif fileEnding == 'swc' or fileEnding == 'SWC': - Import = neuron.h.Import3d_SWC_read() - elif fileEnding == 'xml' or fileEnding == 'XML': - Import = neuron.h.Import3d_MorphML() - else: - raise ValueError('%s is not a recognised morphology file format!' - ).with_traceback( - 'Should be either .hoc, .asc, .swc, .xml!' % self.morphology) - - #assuming now that morphologies file is the correct format - try: - Import.input(self.morphology) - except: - if not hasattr(neuron, 'neuroml'): - raise Exception('Can not import, try and copy the ' + - 'nrn/share/lib/python/neuron/neuroml ' + - 'folder into %s' % neuron.__path__[0]) - else: - raise Exception('something wrong with file, see output') - try: - imprt = neuron.h.Import3d_GUI(Import, 0) - except: - raise Exception('See output, try to correct the file') - imprt.instantiate(neuron.h.this) - - neuron.h.define_shape() - self._create_sectionlists() - - - def _run_custom_codes(self, custom_code, custom_fun, custom_fun_args): - """Execute custom model code and functions with arguments""" - # load custom codes - if custom_code is not None: - for code in custom_code: - if "win32" in sys.platform: - code = code.replace(os.sep, posixpath.sep) - if code.split('.')[-1] == 'hoc': - try: - neuron.h.xopen(code) - except RuntimeError: - ERRMSG = '\n'.join(['', - 'Could not load custom model code (%s)' %code, - 'while creating a Cell object.', - 'One possible cause is the NEURON mechanisms have', - 'not been compiled, ', - 'try running nrnivmodl or mknrndll (Windows) in ', - 'the mod-file-containing folder. ',]) - raise Exception(ERRMSG) - elif code.split('.')[-1] == 'py': - if sys.version >= "3.4": - exec(code, globals()) - else: - exec(code) - else: - raise Exception('%s not a .hoc- nor .py-file' % code) - - # run custom functions with arguments - i = 0 - if custom_fun is not None: - for fun in custom_fun: - fun(**custom_fun_args[i]) - i += 1 - - #recreate sectionlists in case something changed - neuron.h.define_shape() - self._create_sectionlists() - - - def _set_nsegs(self, nsegs_method, lambda_f, d_lambda, max_nsegs_length): - """Set number of segments per section according to the lambda-rule, - or according to maximum length of segments""" - if nsegs_method == 'lambda100': - self._set_nsegs_lambda100(d_lambda) - elif nsegs_method == 'lambda_f': - self._set_nsegs_lambda_f(lambda_f, d_lambda) - elif nsegs_method == 'fixed_length': - self._set_nsegs_fixed_length(max_nsegs_length) - else: - if self.verbose: - print('No nsegs_method applied (%s)' % nsegs_method) - - def _get_rotation(self): - """Check if there exists a corresponding file - with rotation angles""" - if type(self.morphology) is str: - base = os.path.splitext(self.morphology)[0] - if os.path.isfile(base+'.rot'): - rotation_file = base+'.rot' - rotation_data = open(rotation_file) - rotation = {} - for line in rotation_data: - var, val = line.split('=') - val = val.strip() - val = float(str(val)) - rotation[var] = val - else: - rotation = {} - else: - rotation = {} - return rotation - - def _create_sectionlists(self): - """Create section lists for different kinds of sections""" - #list with all sections - self.allsecnames = [] - self.allseclist = neuron.h.SectionList() - for sec in neuron.h.allsec(): - self.allsecnames.append(sec.name()) - self.allseclist.append(sec=sec) - - - #list of soma sections, assuming it is named on the format "soma*" - self.nsomasec = 0 - self.somalist = neuron.h.SectionList() - for sec in neuron.h.allsec(): - if sec.name().find('soma') >= 0: - self.somalist.append(sec=sec) - self.nsomasec += 1 - - def _create_sectionlists_from_morphology_value(self): - """Variant of Cell._create_sectionlists() used if keyword argument - morphology is a neuron.h.SectionList instance""" - #list with all sections - self.allsecnames = [] - self.allseclist = self.morphology - for sec in self.allseclist: - self.allsecnames.append(sec.name()) - - #list of soma sections, assuming it is named on the format "soma*" - self.nsomasec = 0 - self.somalist = neuron.h.SectionList() - for sec in self.allseclist: - if sec.name().find('soma') >= 0: - self.somalist.append(sec=sec) - self.nsomasec += 1 - - - - def _get_idx(self, seclist): - """Return boolean vector which indexes where segments in seclist - matches segments in neuron.h.allsec(), rewritten from - LFPy.hoc function get_idx()""" - if neuron.h.allsec() == seclist: - return np.ones(self.totnsegs, dtype=bool) - else: - idxvec = np.zeros(self.totnsegs, dtype=bool) - #get sectionnames from seclist - seclistnames = [] - for sec in seclist: - seclistnames.append(sec.name()) - seclistnames = np.array(seclistnames, dtype='|S128') - segnames = np.empty(self.totnsegs, dtype='|S128') - i = 0 - for sec in self.allseclist: - secname = sec.name() - for seg in sec: - segnames[i] = secname - i += 1 - for name in seclistnames: - idxvec[segnames == name] = True - - return idxvec - - def _set_nsegs_lambda_f(self, frequency=100, d_lambda=0.1): - """Set the number of segments for section according to the - d_lambda-rule for a given input frequency - Parameters - ---------- - frequency : float - frequency at which AC length constant is computed - d_lambda : float - """ - for sec in self.allseclist: - sec.nseg = int((sec.L / (d_lambda*neuron.h.lambda_f(frequency, - sec=sec)) + .9) / 2)*2 + 1 - if self.verbose: - print("set nsegs using lambda-rule with frequency %i." % frequency) - - def _set_nsegs_lambda100(self, d_lambda=0.1): - """Set the numbers of segments using d_lambda(100)""" - self._set_nsegs_lambda_f(frequency=100, d_lambda=d_lambda) - - def _set_nsegs_fixed_length(self, maxlength): - """Set nseg for sections so that every segment L < maxlength""" - for sec in self.allseclist: - sec.nseg = int(sec.L / maxlength) + 1 - - def _calc_totnsegs(self): - """Calculate the number of segments in the allseclist""" - i = 0 - for sec in self.allseclist: - i += sec.nseg - - return i - - def _check_currents(self): - """Check that the sum of all membrane and electrode currents over all - segments is sufficiently close to zero""" - raise NotImplementedError('this function need to be written') - - def _set_passive(self): - """Insert passive mechanism on all segments""" - for sec in self.allseclist: - sec.insert('pas') - sec.Ra = self.Ra - sec.cm = self.cm - sec.g_pas = self.passive_parameters['g_pas'] - sec.e_pas = self.passive_parameters['e_pas'] - - def _set_extracellular(self): - """Insert extracellular mechanism on all sections - to set an external potential V_ext as boundary condition. - """ - - for sec in self.allseclist: - sec.insert('extracellular') - - def set_synapse(self, idx, syntype, - record_current=False, - record_potential=False, - weight=None, **kwargs): - """Insert synapse on cell segment - Parameters - ---------- - idx : int - Index of compartment where synapse is inserted - syntype : str - Type of synapse. Built-in types in NEURON: ExpSyn, Exp2Syn - record_current : bool - If True, record synapse current - record_potential : bool - If True, record postsynaptic potential seen by the synapse - weight : float - Strength of synapse - kwargs - arguments passed on from class Synapse - """ - if not hasattr(self, 'synlist'): - self.synlist = neuron.h.List() - if not hasattr(self, 'synireclist'): - self.synireclist = neuron.h.List() - if not hasattr(self, 'synvreclist'): - self.synvreclist = neuron.h.List() - if not hasattr(self, 'netstimlist'): - self.netstimlist = neuron.h.List() - if not hasattr(self, 'netconlist'): - self.netconlist = neuron.h.List() - if not hasattr(self, 'sptimeslist'): - self.sptimeslist = neuron.h.List() - - i = 0 - cmd = 'syn = neuron.h.{}(seg.x, sec=sec)' - for sec in self.allseclist: - for seg in sec: - if i == idx: - command = cmd.format(syntype) - if sys.version >= "3.4": - exec(command, locals(), globals()) - else: - exec(command) - for param in list(kwargs.keys()): - try: - if sys.version >= "3.4": - exec('syn.' + param + '=' + str(kwargs[param]), - locals(), globals()) - else: - exec('syn.' + param + '=' + str(kwargs[param])) - except: - pass - self.synlist.append(syn) - - #create NetStim (generator) and NetCon (connection) objects - self.netstimlist.append(neuron.h.NetStim(0.5)) - self.netstimlist[-1].number = 0 - - nc = neuron.h.NetCon(self.netstimlist[-1], syn) - nc.weight[0] = weight - self.netconlist.append(nc) - - #record currents - if record_current: - synirec = neuron.h.Vector(int(self.tstop // - self.dt+1)) - synirec.record(syn._ref_i, self.dt) - self.synireclist.append(synirec) - else: - synirec = neuron.h.Vector(0) - self.synireclist.append(synirec) - - #record potential - if record_potential: - synvrec = neuron.h.Vector(int(self.tstop // - self.dt+1)) - synvrec.record(seg._ref_v, self.dt) - self.synvreclist.append(synvrec) - else: - synvrec = neuron.h.Vector(0) - self.synvreclist.append(synvrec) - - i += 1 - - return self.synlist.count() - 1 - - def set_point_process(self, idx, pptype, record_current=False, - record_potential=False, **kwargs): - """Insert pptype-electrode type pointprocess on segment numbered - idx on cell object - Parameters - ---------- - idx : int - Index of compartment where point process is inserted - pptype : str - Type of pointprocess. Examples: SEClamp, VClamp, - IClamp, SinIClamp, ChirpIClamp - record_current : bool - Decides if current is stored - kwargs - Parameters passed on from class StimIntElectrode - """ - - if not hasattr(self, 'stimlist'): - self.stimlist = neuron.h.List() - if not hasattr(self, 'stimireclist'): - self.stimireclist = neuron.h.List() - if not hasattr(self, 'stimvreclist'): - self.stimvreclist = neuron.h.List() - - i = 0 - cmd1 = 'stim = neuron.h.' - cmd2 = '(seg.x, sec=sec)' - for sec in self.allseclist: - for seg in sec: - if i == idx: - command = cmd1 + pptype + cmd2 - if sys.version >= "3.4": - exec(command, locals(), globals()) - else: - exec(command) - for param in list(kwargs.keys()): - try: - if sys.version >= "3.4": - exec('stim.' + param + '=' + str(kwargs[param]), - locals(), globals()) - else: - exec('stim.' + param + '=' + str(kwargs[param])) - except SyntaxError: - ERRMSG = ''.join(['', - 'Point process type "{0}" might not '.format( - pptype), - 'recognize attribute "{0}". '.format(param), - 'Check for misspellings']) - raise Exception(ERRMSG) - self.stimlist.append(stim) - - #record current - if record_current: - stimirec = neuron.h.Vector(int(self.tstop / - self.dt+1)) - stimirec.record(stim._ref_i, self.dt) - self.stimireclist.append(stimirec) - else: - stimirec = neuron.h.Vector(0) - self.stimireclist.append(stimirec) - - - # record potential - if record_potential: - stimvrec = neuron.h.Vector(int(self.tstop / - self.dt+1)) - stimvrec.record(seg._ref_v, self.dt) - self.stimvreclist.append(stimvrec) - else: - stimvrec = neuron.h.Vector(0) - self.stimvreclist.append(stimvrec) - - - i += 1 - - return self.stimlist.count() - 1 - - def _collect_geometry(self): - """Collects x, y, z-coordinates from NEURON""" - #None-type some attributes if they do not exis: - if not hasattr(self, 'xstart'): - self.xstart = None - self.ystart = None - self.zstart = None - self.xend = None - self.yend = None - self.zend = None - self.area = None - self.diam = None - self.length = None - - _collect_geometry_neuron(self) - self._calc_midpoints() - - self.somaidx = self.get_idx(section='soma') - - if self.somaidx.size > 1: - xmids = self.xmid[self.somaidx] - ymids = self.ymid[self.somaidx] - zmids = self.zmid[self.somaidx] - self.somapos = np.zeros(3) - self.somapos[0] = xmids.mean() - self.somapos[1] = ymids.mean() - self.somapos[2] = zmids.mean() - elif self.somaidx.size == 1: - self.somapos = np.zeros(3) - self.somapos[0] = self.xmid[self.somaidx] - self.somapos[1] = self.ymid[self.somaidx] - self.somapos[2] = self.zmid[self.somaidx] - elif self.somaidx.size == 0: - if self.verbose: - print('There is no soma!') - print('using first segment as root point') - self.somaidx = np.array([0]) - self.somapos = np.zeros(3) - self.somapos[0] = self.xmid[self.somaidx] - self.somapos[1] = self.ymid[self.somaidx] - self.somapos[2] = self.zmid[self.somaidx] - else: - raise Exception('Huh?!') - - def _calc_midpoints(self): - """Calculate midpoints of each segment""" - self.xmid = .5*(self.xstart+self.xend).flatten() - self.ymid = .5*(self.ystart+self.yend).flatten() - self.zmid = .5*(self.zstart+self.zend).flatten() - - def get_idx(self, section='allsec', z_min=-np.inf, z_max=np.inf): - """Returns compartment idx of segments from sections with names that match - the pattern defined in input section on interval [z_min, z_max]. - Parameters - ---------- - section : str - Any entry in cell.allsecnames or just 'allsec'. - z_min : float - Depth filter. Specify minimum z-position - z_max : float - Depth filter. Specify maximum z-position - Examples - -------- - >>> idx = cell.get_idx(section='allsec') - >>> print(idx) - >>> idx = cell.get_idx(section=['soma', 'dend', 'apic']) - >>> print(idx) - """ - - if section == 'allsec': - seclist = neuron.h.allsec() - else: - seclist = neuron.h.SectionList() - if type(section) == str: - for sec in self.allseclist: - if sec.name().find(section) >= 0: - seclist.append(sec=sec) - elif type(section) == list: - for secname in section: - for sec in self.allseclist: - if sec.name().find(secname) >= 0: - seclist.append(sec=sec) - else: - if self.verbose: - print('%s did not match any section name' % str(section)) - - idx = self._get_idx(seclist) - sel_z_idx = (self.zmid[idx] > z_min) & (self.zmid[idx] < z_max) - return np.arange(self.totnsegs)[idx][sel_z_idx] - - def get_closest_idx(self, x=0., y=0., z=0., section='allsec'): - """Get the index number of a segment in specified section which - midpoint is closest to the coordinates defined by the user - Parameters - ---------- - x: float - x-coordinate - y: float - y-coordinate - z: float - z-coordinate - section: str - String matching a section-name. Defaults to 'allsec'. - """ - idx = self.get_idx(section) - dist = ((self.xmid[idx] - x)**2 + - (self.ymid[idx] - y)**2 + - (self.zmid[idx] - z)**2) - return idx[np.argmin(dist)] - - def get_rand_idx_area_norm(self, section='allsec', nidx=1, - z_min=-1E6, z_max=1E6): - """Return nidx segment indices in section with random probability - normalized to the membrane area of segment on - interval [z_min, z_max] - Parameters - ---------- - section : str - String matching a section-name - nidx : int - Number of random indices - z_min : float - Depth filter - z_max : float - Depth filter - """ - poss_idx = self.get_idx(section=section, z_min=z_min, z_max=z_max) - if nidx < 1: - print('nidx < 1, returning empty array') - return np.array([]) - elif poss_idx.size == 0: - print('No possible segment idx match enquire! returning empty array') - return np.array([]) - else: - area = self.area[poss_idx] - area /= area.sum() - return alias_method(poss_idx, area, nidx) - - - def get_rand_idx_area_and_distribution_norm(self, section='allsec', nidx=1, - z_min=-1E6, z_max=1E6, - fun=scipy.stats.norm, - funargs=dict(loc=0, scale=100), - funweights=None): - """ - Return nidx segment indices in section with random probability - normalized to the membrane area of each segment multiplied by - the value of the probability density function of "fun", a function - in the scipy.stats module with corresponding function arguments - in "funargs" on the interval [z_min, z_max] - Parameters - ---------- - section: str - string matching a section-name - nidx: int - number of random indices - z_min: float - depth filter - z_max: float - depth filter - fun : function or str, or iterable of function or str - if function a scipy.stats method, if str, must be method in - scipy.stats module with the same name (like 'norm'), - if iterable (list, tuple, numpy.array) of function or str some - probability distribution in scipy.stats module - funargs : dict or iterable - iterable (list, tuple, numpy.array) of dict, arguments to fun.pdf - method (e.g., w. keys 'loc' and 'scale') - funweights : None or iterable - iterable (list, tuple, numpy.array) of floats, scaling of each - individual fun (i.e., introduces layer specificity) - Examples - -------- - >>> import LFPy - >>> import numpy as np - >>> import scipy.stats as ss - >>> import matplotlib.pyplot as plt - >>> from os.path import join - >>> cell = LFPy.Cell(morphology=join('cells', 'cells', 'j4a.hoc')) - >>> cell.set_rotation(x=4.99, y=-4.33, z=3.14) - >>> idx = cell.get_rand_idx_area_and_distribution_norm(nidx=10000, - fun=ss.norm, - funargs=dict(loc=0, scale=200)) - >>> bins = np.arange(-30, 120)*10 - >>> plt.hist(cell.zmid[idx], bins=bins, alpha=0.5) - >>> plt.show() - """ - poss_idx = self.get_idx(section=section, z_min=z_min, z_max=z_max) - if nidx < 1: - print('nidx < 1, returning empty array') - return np.array([]) - elif poss_idx.size == 0: - print('No possible segment idx match enquire! returning empty array') - return np.array([]) - else: - p = self.area[poss_idx] - # scale with density function - if type(fun) in [list, tuple, np.ndarray]: - assert(type(funargs) in [list, tuple, np.ndarray]) - assert(type(funweights) in [list, tuple, np.ndarray]) - assert((len(fun) == len(funargs)) & (len(fun) == len(funweights))) - mod = np.zeros(poss_idx.shape) - for f, args, scl in zip(fun, funargs, funweights): - if type(f) is str and f in dir(scipy.stats): - f = getattr(scipy.stats, f) - df = f(**args) - mod += df.pdf(x=self.zmid[poss_idx])*scl - p *= mod - else: - if type(fun) is str and fun in dir(scipy.stats): - fun = getattr(scipy.stats, fun) - df = fun(**funargs) - p *= df.pdf(x=self.zmid[poss_idx]) - # normalize - p /= p.sum() - return alias_method(poss_idx, p, nidx) - - - def simulate(self, electrode=None, rec_imem=False, rec_vmem=False, - rec_ipas=False, rec_icap=False, - rec_current_dipole_moment=False, - rec_variables=[], variable_dt=False, atol=0.001, - to_memory=True, to_file=False, file_name=None, - dotprodcoeffs=None, **kwargs): - """ - This is the main function running the simulation of the NEURON model. - Start NEURON simulation and record variables specified by arguments. - Parameters - ---------- - electrode : :obj: or list, optional - Either an LFPy.RecExtElectrode object or a list of such. - If supplied, LFPs will be calculated at every time step - and accessible as `electrode.LFP`. If a list of objects - is given, accessible as `electrode[0].LFP` etc. - rec_imem : bool - If true, segment membrane currents will be recorded - If no electrode argument is given, it is necessary to - set rec_imem=True in order to calculate LFP later on. - Units of (nA). - rec_vmem : bool - Record segment membrane voltages (mV) - rec_ipas : bool - Record passive segment membrane currents (nA) - rec_icap : bool - Record capacitive segment membrane currents (nA) - rec_current_dipole_moment : bool - If True, compute and record current-dipole moment from - transmembrane currents as in Linden et al. (2010) J Comput Neurosci, - DOI: 10.1007/s10827-010-0245-4. Will set the `LFPy.Cell` attribute - `current_dipole_moment` as n_timesteps x 3 `np.ndarray` where the - last dimension contains the x,y,z components of the dipole moment. - rec_variables : list - List of variables to record, i.e arg=['cai', ] - variable_dt : bool - Use variable timestep in NEURON - atol : float - Absolute tolerance used with NEURON variable timestep - to_memory : bool - Only valid with electrode, store lfp in -> electrode.LFP - to_file : bool - Only valid with electrode, save LFPs in hdf5 file format - file_name : str - Name of hdf5 file, '.h5' is appended if it doesnt exist - dotprodcoeffs : list - List of N x Nseg ndarray. These arrays will at - every timestep be multiplied by the membrane currents. - Presumably useful for memory efficient csd or lfp calcs - """ - for key in kwargs.keys(): - if key in ['rec_isyn', 'rec_vmemsyn', 'rec_istim', 'rec_vmemstim']: - raise DeprecationWarning('Cell.simulate parameter {} is deprecated.'.format(key)) - - - self._set_soma_volt_recorder() - self._collect_tvec() - - # set up integrator, use the CVode().fast_imem method by default - # as it doesn't hurt sim speeds much if at all. - cvode = neuron.h.CVode() - try: - cvode.use_fast_imem(1) - except AttributeError as ae: - raise Exception('neuron.h.CVode().use_fast_imem() method not found. Please update NEURON to v.7.4 or newer') - - if rec_imem: - self._set_imem_recorders() - if rec_vmem: - self._set_voltage_recorders() - if rec_ipas: - self._set_ipas_recorders() - if rec_icap: - self._set_icap_recorders() - if rec_current_dipole_moment: - self._set_current_dipole_moment_array() - if len(rec_variables) > 0: - self._set_variable_recorders(rec_variables) - - - #run fadvance until t >= tstop, and calculate LFP if asked for - if electrode is None and dotprodcoeffs is None and not rec_current_dipole_moment: - if not rec_imem and self.verbose: - print("rec_imem = %s, membrane currents will not be recorded!" - % str(rec_imem)) - _run_simulation(self, cvode, variable_dt, atol) - - else: - #allow using both electrode and additional coefficients: - _run_simulation_with_electrode(self, cvode, electrode, variable_dt, atol, - to_memory, to_file, file_name, - dotprodcoeffs, - rec_current_dipole_moment) - # somatic trace - if self.nsomasec >= 1: - self.somav = np.array(self.somav) - - if rec_imem: - self._calc_imem() - if rec_ipas: - self._calc_ipas() - if rec_icap: - self._calc_icap() - if rec_vmem: - self._collect_vmem() - self._collect_isyn() - self._collect_vsyn() - self._collect_istim() - self._collect_vstim() - if len(rec_variables) > 0: - self._collect_rec_variables(rec_variables) - if hasattr(self, 'netstimlist'): - del self.netstimlist - - def _collect_tvec(self): - """ - Set the tvec to be a monotonically increasing numpy array after sim. - """ - self.tvec = np.arange(self.tstop / self.dt + 1) * self.dt - - def _calc_imem(self): - """ - Fetch the vectors from the memireclist and calculate self.imem - containing all the membrane currents. - """ - self.imem = np.array(self.memireclist) - self.memireclist = None - del self.memireclist - - def _calc_ipas(self): - """ - Get the passive currents - """ - self.ipas = np.array(self.memipasreclist) - for i in range(self.ipas.shape[0]): - self.ipas[i, ] *= self.area[i] * 1E-2 - self.memipasreclist = None - del self.memipasreclist - - def _calc_icap(self): - """ - Get the capacitive currents - """ - self.icap = np.array(self.memicapreclist) - for i in range(self.icap.shape[0]): - self.icap[i, ] *= self.area[i] * 1E-2 - self.memicapreclist = None - del self.memicapreclist - - def _collect_vmem(self): - """ - Get the membrane currents - """ - self.vmem = np.array(self.memvreclist) - self.memvreclist = None - del self.memvreclist - - def _collect_isyn(self): - """ - Get the synaptic currents - """ - for syn in self.synapses: - if syn.record_current: - syn.collect_current(self) - self.synireclist = None - del self.synireclist - - def _collect_vsyn(self): - """ - Collect the membrane voltage of segments with synapses - """ - for syn in self.synapses: - if syn.record_potential: - syn.collect_potential(self) - self.synvreclist = None - del self.synvreclist - - def _collect_istim(self): - """ - Get the pointprocess currents - """ - for pp in self.pointprocesses: - if pp.record_current: - pp.collect_current(self) - self.stimireclist = None - del self.stimireclist - - def _collect_vstim(self): - """ - Collect the membrane voltage of segments with stimulus - """ - for pp in self.pointprocesses: - if pp.record_potential: - pp.collect_potential(self) - self.stimvreclist = None - del self.stimvreclist - - def _collect_rec_variables(self, rec_variables): - """ - Create dict of np.arrays from recorded variables, each dictionary - element named as the corresponding recorded variable name, i.e 'cai' - """ - self.rec_variables = {} - i = 0 - for values in self.recvariablesreclist: - self.rec_variables.update({rec_variables[i] : np.array(values)}) - if self.verbose: - print('collected recorded variable %s' % rec_variables[i]) - i += 1 - del self.recvariablesreclist - - def _loadspikes(self): - """ - Initialize spiketimes from netcon if they exist - """ - if hasattr(self, 'synlist'): - if len(self.synlist) == len(self.sptimeslist): - for i in range(int(self.synlist.count())): - for ii in range(int(self.sptimeslist.o(i).size)): - self.netconlist.o(i).event(float(self.sptimeslist.o(i)[ii])) - - def _set_soma_volt_recorder(self): - """Record somatic membrane potential""" - - if self.nsomasec == 0: - if self.verbose: - warn('Cell instance appears to have no somatic section. ' - 'No somav attribute will be set.') - elif self.nsomasec == 1: - self.somav = neuron.h.Vector(int(self.tstop / self.dt+1)) - for sec in self.somalist: - self.somav.record(sec(0.5)._ref_v, self.dt) - elif self.nsomasec > 1: - self.somav = neuron.h.Vector(int(self.tstop / self.dt+1)) - nseg = self.get_idx('soma').size - i, j = divmod(nseg, 2) - k = 1 - for sec in self.somalist: - for seg in sec: - if nseg==2 and k == 1: - #if 2 segments, record from the first one: - self.somav.record(seg._ref_v, self.dt) - else: - if k == i*2: - #record from one of the middle segments: - self.somav.record(seg._ref_v, self.dt) - k += 1 - - def _set_imem_recorders(self): - """ - Record membrane currents for all segments - """ - self.memireclist = neuron.h.List() - for sec in self.allseclist: - for seg in sec: - memirec = neuron.h.Vector(int(self.tstop / self.dt+1)) - memirec.record(seg._ref_i_membrane_, self.dt) - self.memireclist.append(memirec) - - - def _set_ipas_recorders(self): - """ - Record passive membrane currents for all segments - """ - self.memipasreclist = neuron.h.List() - for sec in self.allseclist: - for seg in sec: - memipasrec = neuron.h.Vector(int(self.tstop / self.dt+1)) - memipasrec.record(seg._ref_i_pas, self.dt) - self.memipasreclist.append(memipasrec) - - def _set_icap_recorders(self): - """ - Record capacitive membrane currents for all segments - """ - self.memicapreclist = neuron.h.List() - for sec in self.allseclist: - for seg in sec: - memicaprec = neuron.h.Vector(int(self.tstop / self.dt+1)) - memicaprec.record(seg._ref_i_cap, self.dt) - self.memicapreclist.append(memicaprec) - - def _set_voltage_recorders(self): - """ - Record membrane potentials for all segments - """ - self.memvreclist = neuron.h.List() - for sec in self.allseclist: - for seg in sec: - memvrec = neuron.h.Vector(int(self.tstop / self.dt+1)) - memvrec.record(seg._ref_v, self.dt) - self.memvreclist.append(memvrec) - - def _set_current_dipole_moment_array(self): - """ - Creates container for current dipole moment, an empty - n_timesteps x 3 `numpy.ndarray` that will be filled with values during - the course of each simulation - """ - self.current_dipole_moment = np.zeros((self.tvec.size, 3)) - - def _set_variable_recorders(self, rec_variables): - """ - Create a recorder for each variable name in list - rec_variables - Variables is stored in nested list self.recvariablesreclist - """ - self.recvariablesreclist = neuron.h.List() - for variable in rec_variables: - variablereclist = neuron.h.List() - self.recvariablesreclist.append(variablereclist) - for sec in self.allseclist: - for seg in sec: - recvector = neuron.h.Vector(int(self.tstop / self.dt + 1)) - try: - recvector.record(getattr(seg, '_ref_%s' % variable), - self.dt) - except(NameError, AttributeError): - print('non-existing variable %s, section %s.%f' % - (variable, sec.name(), seg.x)) - variablereclist.append(recvector) - - - def set_pos(self, x=0., y=0., z=0.): - """Set the cell position. - Move the cell geometry so that midpoint of soma section is - in (x, y, z). If no soma pos, use the first segment - Parameters - ---------- - x : float - x position defaults to 0.0 - y : float - y position defaults to 0.0 - z : float - z position defaults to 0.0 - """ - diffx = x-self.somapos[0] - diffy = y-self.somapos[1] - diffz = z-self.somapos[2] - - #also update the pt3d_pos: - if self.pt3d and hasattr(self, 'x3d'): - self._set_pt3d_pos(diffx, diffy, diffz) - else: - self.somapos[0] = x - self.somapos[1] = y - self.somapos[2] = z - - self.xstart += diffx - self.ystart += diffy - self.zstart += diffz - - self.xend += diffx - self.yend += diffy - self.zend += diffz - - self._calc_midpoints() - self._update_synapse_positions() - - def strip_hoc_objects(self): - """Destroy any NEURON hoc objects in the cell object""" - for varname in dir(self): - if type(getattr(self, varname)) == type(neuron.h.List()): - setattr(self, varname, None) - if self.verbose: - print('None-typed %s in cell instance' % varname) - - def cellpickler(self, filename, pickler=pickle.dump): - """Save data in cell to filename, using cPickle. It will however destroy - any neuron.h objects upon saving, as c-objects cannot be pickled - Parameters - ---------- - filename : str - Where to save cell - Examples - -------- - To save a cell, use: - >>> cell.cellpickler('cell.cpickle') - To load this cell again in another session: - >>> import cPickle - >>> f = file('cell.cpickle', 'rb') - >>> cell = cPickle.load(f) - >>> f.close() - alternatively: - >>> import LFPy - >>> cell = LFPy.tools.load('cell.cpickle') - """ - self.strip_hoc_objects() - if pickler==pickle.dump: - filen = open(filename, 'wb') - pickle.dump(self, filen, protocol=2) - filen.close() - return None - elif pickler==pickle.dumps: - return pickle.dumps(self) - - def _update_synapse_positions(self): - """ - Update synapse positions after rotation of morphology - """ - for i in range(len(self.synapses)): - self.synapses[i].update_pos(self) - - def set_rotation(self, x=None, y=None, z=None, rotation_order='xyz'): - """ - Rotate geometry of cell object around the x-, y-, z-axis in the order - described by rotation_order parameter. - rotation_order should be a string with 3 elements containing x, y, and z - e.g. 'xyz', 'zyx' - Input should be angles in radians. - using rotation matrices, takes dict with rot. angles, - where x, y, z are the rotation angles around respective axes. - All rotation angles are optional. - Examples - -------- - >>> cell = LFPy.Cell(**kwargs) - >>> rotation = {'x' : 1.233, 'y' : 0.236, 'z' : np.pi} - >>> cell.set_rotation(**rotation) - """ - if type(rotation_order) is not str: - raise AttributeError('rotation_order must be a string') - elif 'x' not in rotation_order or 'y' not in rotation_order or 'z' not in rotation_order: - raise AttributeError("'x', 'y', and 'z' must be in rotation_order") - elif len(rotation_order) != 3: - raise AttributeError("rotation_order should have 3 elements (e.g. 'zyx')") - - for ax in rotation_order: - if ax == 'x' and x is not None: - theta = -x - rotation_x = np.array([[1, 0, 0], - [0, np.cos(theta), -np.sin(theta)], - [0, np.sin(theta), np.cos(theta)]]) - - rel_start, rel_end = self._rel_positions() - - rel_start = np.dot(rel_start, rotation_x) - rel_end = np.dot(rel_end, rotation_x) - - self._real_positions(rel_start, rel_end) - if self.verbose: - print('Rotated geometry %g radians around x-axis' % (-theta)) - else: - if self.verbose: - print('Geometry not rotated around x-axis') - - if ax == 'y' and y is not None: - phi = -y - rotation_y = np.array([[np.cos(phi), 0, np.sin(phi)], - [0, 1, 0], - [-np.sin(phi), 0, np.cos(phi)]]) - - rel_start, rel_end = self._rel_positions() - - rel_start = np.dot(rel_start, rotation_y) - rel_end = np.dot(rel_end, rotation_y) - - self._real_positions(rel_start, rel_end) - if self.verbose: - print('Rotated geometry %g radians around y-axis' % (-phi)) - else: - if self.verbose: - print('Geometry not rotated around y-axis') - - if ax == 'z' and z is not None: - gamma = -z - rotation_z = np.array([[np.cos(gamma), -np.sin(gamma), 0], - [np.sin(gamma), np.cos(gamma), 0], - [0, 0, 1]]) - - rel_start, rel_end = self._rel_positions() - - rel_start = np.dot(rel_start, rotation_z) - rel_end = np.dot(rel_end, rotation_z) - - self._real_positions(rel_start, rel_end) - if self.verbose: - print('Rotated geometry %g radians around z-axis' % (-gamma)) - else: - if self.verbose: - print('Geometry not rotated around z-axis') - - #rotate the pt3d geometry accordingly - if self.pt3d and hasattr(self, 'x3d'): - self._set_pt3d_rotation(x, y, z, rotation_order) - - def chiral_morphology(self, axis='x'): - """ - Mirror the morphology around given axis, (default x-axis), - useful to introduce more heterogeneouties in morphology shapes - Parameters - ---------- - axis : str - 'x' or 'y' or 'z' - """ - #morphology relative to soma-position - rel_start, rel_end = self._rel_positions() - if axis == 'x': - rel_start[:, 0] = -rel_start[:, 0] - rel_end[:, 0] = -rel_end[:, 0] - elif axis == 'y': - rel_start[:, 1] = -rel_start[:, 1] - rel_end[:, 1] = -rel_end[:, 1] - elif axis == 'z': - rel_start[:, 2] = -rel_start[:, 2] - rel_end[:, 2] = -rel_end[:, 2] - else: - raise Exception("axis must be either 'x', 'y' or 'z'") - - if self.verbose: - print('morphology mirrored across %s-axis' % axis) - - #set the proper 3D positions - self._real_positions(rel_start, rel_end) - - def _squeeze_me_macaroni(self): - """ - Reducing the dimensions of the morphology matrices from 3D->1D - """ - self.xstart = np.array(self.xstart).flatten() - self.xend = np.array(self.xend).flatten() - - self.ystart = np.array(self.ystart).flatten() - self.yend = np.array(self.yend).flatten() - - self.zstart = np.array(self.zstart).flatten() - self.zend = np.array(self.zend).flatten() - - def _rel_positions(self): - """ - Morphology relative to soma position - """ - rel_start = np.array([self.xstart-self.somapos[0], - self.ystart-self.somapos[1], - self.zstart-self.somapos[2]]).T - rel_end = np.array([self.xend-self.somapos[0], - self.yend-self.somapos[1], - self.zend-self.somapos[2]]).T - - return rel_start, rel_end - - def _real_positions(self, rel_start, rel_end): - """ - Morphology coordinates relative to Origo - """ - self.xstart = rel_start[:, 0] + self.somapos[0] - self.ystart = rel_start[:, 1] + self.somapos[1] - self.zstart = rel_start[:, 2] + self.somapos[2] - - self.xend = rel_end[:, 0] + self.somapos[0] - self.yend = rel_end[:, 1] + self.somapos[1] - self.zend = rel_end[:, 2] + self.somapos[2] - - self._squeeze_me_macaroni() - self._calc_midpoints() - self._update_synapse_positions() - - def get_rand_prob_area_norm(self, section='allsec', - z_min=-10000, z_max=10000): - """ - Return the probability (0-1) for synaptic coupling on segments - in section sum(prob)=1 over all segments in section. - Probability normalized by area. - Parameters - ---------- - section : str - string matching a section-name. Defaults to 'allsec' - z_min : float - depth filter - z_max : float - depth filter - """ - idx = self.get_idx(section=section, z_min=z_min, z_max = z_max) - prob = self.area[idx] / sum(self.area[idx]) - return prob - - def get_rand_prob_area_norm_from_idx(self, idx=np.array([0])): - """ - Return the normalized probability (0-1) for synaptic coupling on - segments in idx-array. - Normalised probability determined by area of segments. - Parameters - ---------- - idx : ndarray, dtype=int. - array of segment indices - """ - prob = self.area[idx] / sum(self.area[idx]) - return prob - - def get_intersegment_vector(self, idx0=0, idx1=0): - """Return the distance between midpoints of two segments with index - idx0 and idx1. The argument returned is a vector [x, y, z], where - x = self.xmid[idx1] - self.xmid[idx0] etc. - Parameters - ---------- - idx0 : int - idx1 : int - """ - vector = [] - try: - if idx1 < 0 or idx0 < 0: - raise Exception('idx0 < 0 or idx1 < 0') - vector.append(self.xmid[idx1] - self.xmid[idx0]) - vector.append(self.ymid[idx1] - self.ymid[idx0]) - vector.append(self.zmid[idx1] - self.zmid[idx0]) - return vector - except: - ERRMSG = 'idx0 and idx1 must be ints on [0, %i]' % self.totnsegs - raise ValueError(ERRMSG) - - def get_intersegment_distance(self, idx0=0, idx1=0): - """ - Return the Euclidean distance between midpoints of two segments. - Parameters - ---------- - idx0 : int - idx1 : int - Returns - ------- - float - Will return a float in unit of micrometers. - """ - try: - vector = np.array(self.get_intersegment_vector(idx0, idx1)) - return np.sqrt((vector**2).sum()) - except: - ERRMSG = 'idx0 and idx1 must be ints on [0, %i]' % self.totnsegs - raise ValueError(ERRMSG) - - def get_idx_children(self, parent="soma[0]"): - """Get the idx of parent's children sections, i.e. compartments ids - of sections connected to parent-argument - Parameters - ---------- - parent : str - name-pattern matching a sectionname. Defaults to "soma[0]" - """ - idxvec = np.zeros(self.totnsegs) - secnamelist = [] - childseclist = [] - #filling list of sectionnames for all sections, one entry per segment - for sec in self.allseclist: - for seg in sec: - secnamelist.append(sec.name()) - #filling list of children section-names - sref = neuron.h.SectionRef(parent) - for sec in sref.child: - childseclist.append(sec.name()) - #idxvec=1 where both coincide - i = 0 - for sec in secnamelist: - for childsec in childseclist: - if sec == childsec: - idxvec[i] += 1 - i += 1 - - [idx] = np.where(idxvec) - return idx - - def get_idx_parent_children(self, parent="soma[0]"): - """ - Get all idx of segments of parent and children sections, i.e. segment - idx of sections connected to parent-argument, and also of the parent - segments - Parameters - ---------- - parent : str - name-pattern matching a sectionname. Defaults to "soma[0]" - """ - seclist = [parent] - sref = neuron.h.SectionRef(parent) - for sec in sref.child: - seclist.append(sec.name()) - - return self.get_idx(section=seclist) - - def get_idx_name(self, idx=np.array([0], dtype=int)): - ''' - Return NEURON convention name of segments with index idx. - The returned argument is a list of tuples with corresponding - segment idx, section name, and position along the section, like; - [(0, 'neuron.h.soma[0]', 0.5),] - kwargs: - :: - idx : ndarray, dtype int - segment indices, must be between 0 and cell.totnsegs - ''' - #ensure idx is array-like, or convert - if type(idx) == int or np.int64: - idx = np.array([idx]) - elif len(idx) == 0: - return - else: - idx = np.array(idx).astype(int) - - #ensure all idx are valid - if np.any(idx >= self.totnsegs): - wrongidx = idx[np.where(idx >= self.totnsegs)] - raise Exception('idx %s >= number of compartments' % str(wrongidx)) - - #create list of seg names: - allsegnames = [] - segidx = 0 - for sec in self.allseclist: - for seg in sec: - allsegnames.append((segidx, '%s' % sec.name(), seg.x)) - segidx += 1 - - return np.array(allsegnames, dtype=object)[idx][0] - - def _collect_pt3d(self): - """collect the pt3d info, for each section""" - x = [] - y = [] - z = [] - d = [] - - for sec in self.allseclist: - n3d = int(neuron.h.n3d()) - x_i, y_i, z_i = np.zeros(n3d), np.zeros(n3d), np.zeros(n3d), - d_i = np.zeros(n3d) - for i in range(n3d): - x_i[i] = neuron.h.x3d(i) - y_i[i] = neuron.h.y3d(i) - z_i[i] = neuron.h.z3d(i) - d_i[i] = neuron.h.diam3d(i) - - - x.append(x_i) - y.append(y_i) - z.append(z_i) - d.append(d_i) - - #remove offsets which may be present if soma is centred in Origo - if len(x) > 1: - xoff = x[0].mean() - yoff = y[0].mean() - zoff = z[0].mean() - for i in range(len(x)): - x[i] -= xoff - y[i] -= yoff - z[i] -= zoff - - return x, y, z, d - - def _update_pt3d(self): - """ - update the locations in neuron.hoc.space using neuron.h.pt3dchange() - """ - for i, sec in enumerate(self.allseclist): - n3d = int(neuron.h.n3d()) - for n in range(n3d): - neuron.h.pt3dchange(n, - self.x3d[i][n], - self.y3d[i][n], - self.z3d[i][n], - self.diam3d[i][n]) - #let NEURON know about the changes we just did: - neuron.h.define_shape() - #must recollect the geometry, otherwise we get roundoff errors! - self._collect_geometry() - - def _set_pt3d_pos(self, diffx=0, diffy=0, diffz=0): - """ - Offset pt3d geometry with differential displacement - indicated in Cell.set_pos() - """ - for i in range(len(self.x3d)): - self.x3d[i] += diffx - self.y3d[i] += diffy - self.z3d[i] += diffz - self._update_pt3d() - - - def _set_pt3d_rotation(self, x=None, y=None, z=None, rotation_order='xyz'): - """ - Rotate pt3d geometry of cell object around the x-, y-, z-axis - in the order described by rotation_order parameter. - rotation_order should be a string with 3 elements containing x, y, and z - e.g. 'xyz', 'zyx' - Input should be angles in radians. - using rotation matrices, takes dict with rot. angles, - where x, y, z are the rotation angles around respective axes. - All rotation angles are optional. - Examples - -------- - >>> cell = LFPy.Cell(**kwargs) - >>> rotation = {'x' : 1.233, 'y' : 0.236, 'z' : np.pi} - >>> cell.set_pt3d_rotation(**rotation) - """ - for ax in rotation_order: - if ax == 'x' and x is not None: - theta = -x - rotation_x = np.array([[1, 0, 0], - [0, np.cos(theta), -np.sin(theta)], - [0, np.sin(theta), np.cos(theta)]]) - for i in range(len(self.x3d)): - rel_pos = self._rel_pt3d_positions(self.x3d[i], - self.y3d[i], self.z3d[i]) - - rel_pos = np.dot(rel_pos, rotation_x) - - self.x3d[i], self.y3d[i], self.z3d[i] = \ - self._real_pt3d_positions(rel_pos) - if self.verbose: - print(('Rotated geometry %g radians around x-axis' % (-theta))) - else: - if self.verbose: - print('Geometry not rotated around x-axis') - - if ax == 'y' and y is not None: - phi = -y - rotation_y = np.array([[np.cos(phi), 0, np.sin(phi)], - [0, 1, 0], - [-np.sin(phi), 0, np.cos(phi)]]) - for i in range(len(self.x3d)): - rel_pos = self._rel_pt3d_positions(self.x3d[i], - self.y3d[i], self.z3d[i]) - - rel_pos = np.dot(rel_pos, rotation_y) - - self.x3d[i], self.y3d[i], self.z3d[i] = \ - self._real_pt3d_positions(rel_pos) - if self.verbose: - print('Rotated geometry %g radians around y-axis' % (-phi)) - else: - if self.verbose: - print('Geometry not rotated around y-axis') - - if ax == 'z' and z is not None: - gamma = -z - rotation_z = np.array([[np.cos(gamma), -np.sin(gamma), 0], - [np.sin(gamma), np.cos(gamma), 0], - [0, 0, 1]]) - for i in range(len(self.x3d)): - rel_pos = self._rel_pt3d_positions(self.x3d[i], - self.y3d[i], self.z3d[i]) - - rel_pos = np.dot(rel_pos, rotation_z) - - self.x3d[i], self.y3d[i], self.z3d[i] = \ - self._real_pt3d_positions(rel_pos) - if self.verbose: - print('Rotated geometry %g radians around z-axis' % (-gamma)) - else: - if self.verbose: - print('Geometry not rotated around z-axis') - self._update_pt3d() - - def _rel_pt3d_positions(self, x, y, z): - """Morphology relative to soma position """ - rel_pos = np.transpose(np.array([x - self.somapos[0], - y - self.somapos[1], - z - self.somapos[2]])) - - return rel_pos - - def _real_pt3d_positions(self, rel_pos): - """Morphology coordinates relative to Origo """ - x = rel_pos[:, 0] + self.somapos[0] - y = rel_pos[:, 1] + self.somapos[1] - z = rel_pos[:, 2] + self.somapos[2] - - x = np.array(x).flatten() - y = np.array(y).flatten() - z = np.array(z).flatten() - - return x, y, z - - def _create_polygon(self, i, projection=('x', 'z')): - """create a polygon to fill for each section""" - x = getattr(self, projection[0]+'3d')[i] - y = getattr(self, projection[1]+'3d')[i] - #x = self.x3d[i] - #z = self.z3d[i] - d = self.diam3d[i] - - #calculate angles - dx = np.diff(x) - dy = np.diff(y) - theta = np.arctan2(dy, dx) - - x = np.r_[x, x[::-1]] - y = np.r_[y, y[::-1]] - - theta = np.r_[theta, theta[::-1]] - d = np.r_[d, d[::-1]] - - #1st corner: - x[0] -= 0.5 * d[0] * np.sin(theta[0]) - y[0] += 0.5 * d[0] * np.cos(theta[0]) - - ##pt3d points between start and end of section, first side - x[1:dx.size] -= 0.25 * d[1:dx.size] * ( - np.sin(theta[:dx.size-1]) + np.sin(theta[1:dx.size])) - y[1:dy.size] += 0.25 * d[1:dy.size] * ( - np.cos(theta[:dy.size-1]) + np.cos(theta[1:dx.size])) - - #end of section, first side - x[dx.size] -= 0.5 * d[dx.size] * np.sin(theta[dx.size]) - y[dy.size] += 0.5 * d[dy.size] * np.cos(theta[dy.size]) - - #other side - #end of section, second side - x[dx.size+1] += 0.5 * d[dx.size+1] * np.sin(theta[dx.size]) - y[dy.size+1] -= 0.5 * d[dy.size+1] * np.cos(theta[dy.size]) - - ##pt3d points between start and end of section, second side - x[::-1][1:dx.size] += 0.25 * d[::-1][1:dx.size] * ( - np.sin(theta[::-1][:dx.size-1]) + np.sin(theta[::-1][1:dx.size])) - y[::-1][1:dy.size] -= 0.25 * d[::-1][1:dy.size] * ( - np.cos(theta[::-1][:dy.size-1]) + np.cos(theta[::-1][1:dx.size])) - - #last corner: - x[-1] += 0.5 * d[-1] * np.sin(theta[-1]) - y[-1] -= 0.5 * d[-1] * np.cos(theta[-1]) - - return x, y - - def get_pt3d_polygons(self, projection=('x', 'z')): - """For each section create a polygon in the plane determined by keyword - argument projection=('x', 'z'), that can be - visualized using e.g., plt.fill() - Returns - ------- - list - list of (x, z) tuples giving the trajectory - of each section that can be plotted using PolyCollection - Examples - -------- - >>> from matplotlib.collections import PolyCollection - >>> import matplotlib.pyplot as plt - >>> cell = LFPy.Cell(morphology='PATH/TO/MORPHOLOGY') - >>> zips = [] - >>> for x, z in cell.get_pt3d_polygons(projection=('x', 'z')): - >>> zips.append(zip(x, z)) - >>> polycol = PolyCollection(zips, - >>> edgecolors='none', - >>> facecolors='gray') - >>> fig = plt.figure() - >>> ax = fig.add_subplot(111) - >>> ax.add_collection(polycol) - >>> ax.axis(ax.axis('equal')) - >>> plt.show() - """ - if len(projection) != 2: - raise ValueError("projection arg be a tuple like ('x', 'y')") - if 'x' in projection and 'y' in projection: - pass - elif 'x' in projection and 'z' in projection: - pass - elif 'y' in projection and 'z' in projection: - pass - else: - mssg = "projection must be a length 2 tuple of 'x', 'y' or 'z'!" - raise ValueError(mssg) - - try: - assert(self.pt3d is True) - except AssertionError: - raise AssertionError('Cell keyword argument pt3d != True') - polygons = [] - for i in range(len(self.x3d)): - polygons.append(self._create_polygon(i, projection)) - - return polygons - - def _create_segment_polygon(self, i, projection=('x', 'z')): - """Create a polygon to fill for segment i, in the plane - determined by kwarg projection""" - x = [getattr(self, projection[0]+'start')[i], - getattr(self, projection[0]+'end')[i]] - z = [getattr(self, projection[1]+'start')[i], - getattr(self, projection[1]+'end')[i]] - #x = [self.xstart[i], self.xend[i]] - #z = [self.zstart[i], self.zend[i]] - d = self.diam[i] - - #calculate angles - dx = np.diff(x) - dz = np.diff(z) - theta = np.arctan2(dz, dx) - - x = np.r_[x, x[::-1]] - z = np.r_[z, z[::-1]] - - #1st corner: - x[0] -= 0.5 * d * np.sin(theta) - z[0] += 0.5 * d * np.cos(theta) - - #end of section, first side - x[1] -= 0.5 * d * np.sin(theta) - z[1] += 0.5 * d * np.cos(theta) - - #other side - #end of section, second side - x[2] += 0.5 * d * np.sin(theta) - z[2] -= 0.5 * d * np.cos(theta) - - #last corner: - x[3] += 0.5 * d * np.sin(theta) - z[3] -= 0.5 * d * np.cos(theta) - - return x, z - - def get_idx_polygons(self, projection=('x', 'z')): - """For each segment idx in cell create a polygon in the plane - determined by the projection kwarg (default ('x', 'z')), - that can be visualized using plt.fill() or - mpl.collections.PolyCollection - Parameters - ---------- - projection : tuple of strings - Determining projection. Defaults to ('x', 'z') - Returns - ------- - polygons : list - list of (ndarray, ndarray) tuples - giving the trajectory of each section - Examples - -------- - The most efficient way of using this would be something like - >>> from matplotlib.collections import PolyCollection - >>> import matplotlib.pyplot as plt - >>> cell = LFPy.Cell(morphology='PATH/TO/MORPHOLOGY') - >>> zips = [] - >>> for x, z in cell.get_idx_polygons(projection=('x', 'z')): - >>> zips.append(zip(x, z)) - >>> polycol = PolyCollection(zips, - >>> edgecolors='none', - >>> facecolors='gray') - >>> fig = plt.figure() - >>> ax = fig.add_subplot(111) - >>> ax.add_collection(polycol) - >>> ax.axis(ax.axis('equal')) - >>> plt.show() - """ - if len(projection) != 2: - raise ValueError("projection arg be a tuple like ('x', 'y')") - if 'x' in projection and 'y' in projection: - pass - elif 'x' in projection and 'z' in projection: - pass - elif 'y' in projection and 'z' in projection: - pass - else: - mssg = "projection must be a length 2 tuple of 'x', 'y' or 'z'!" - raise ValueError(mssg) - - polygons = [] - for i in np.arange(self.totnsegs): - polygons.append(self._create_segment_polygon(i, projection)) - - return polygons - - def insert_v_ext(self, v_ext, t_ext): - """Set external extracellular potential around cell. - Playback of some extracellular potential v_ext on each cell.totnseg - compartments. Assumes that the "extracellular"-mechanism is inserted - on each compartment. - Can be used to study ephaptic effects and similar - The inputs will be copied and attached to the cell object as - cell.v_ext, cell.t_ext, and converted - to (list of) neuron.h.Vector types, to allow playback into each - compartment e_extracellular reference. - Can not be deleted prior to running cell.simulate() - Parameters - ---------- - v_ext : ndarray - Numpy array of size cell.totnsegs x t_ext.size, unit mV - t_ext : ndarray - Time vector of v_ext - Examples - -------- - >>> import LFPy - >>> import numpy as np - >>> import matplotlib.pyplot as plt - >>> #create cell - >>> cell = LFPy.Cell(morphology='morphologies/example_morphology.hoc', - >>> passive=True) - >>> #time vector and extracellular field for every segment: - >>> t_ext = np.arange(cell.tstop / cell.dt+ 1) * cell.dt - >>> v_ext = np.random.rand(cell.totnsegs, t_ext.size)-0.5 - >>> #insert potentials and record response: - >>> cell.insert_v_ext(v_ext, t_ext) - >>> cell.simulate(rec_imem=True, rec_vmem=True) - >>> fig = plt.figure() - >>> ax1 = fig.add_subplot(311) - >>> ax2 = fig.add_subplot(312) - >>> ax3 = fig.add_subplot(313) - >>> eim = ax1.matshow(np.array(cell.v_ext), cmap='spectral') - >>> cb1 = fig.colorbar(eim, ax=ax1) - >>> cb1.set_label('v_ext') - >>> ax1.axis(ax1.axis('tight')) - >>> iim = ax2.matshow(cell.imem, cmap='spectral') - >>> cb2 = fig.colorbar(iim, ax=ax2) - >>> cb2.set_label('imem') - >>> ax2.axis(ax2.axis('tight')) - >>> vim = ax3.matshow(cell.vmem, cmap='spectral') - >>> ax3.axis(ax3.axis('tight')) - >>> cb3 = fig.colorbar(vim, ax=ax3) - >>> cb3.set_label('vmem') - >>> ax3.set_xlabel('tstep') - >>> plt.show() - """ - - #test dimensions of input - try: - if v_ext.shape[0] != self.totnsegs: - raise ValueError("v_ext.shape[0] != cell.totnsegs") - if v_ext.shape[1] != t_ext.size: - raise ValueError('v_ext.shape[1] != t_ext.size') - except: - raise ValueError('v_ext, t_ext must both be np.array types') - - if not self.extracellular: - raise Exception('LFPy.Cell arg extracellular != True') - - #create list of extracellular potentials on each segment, time vector - self.t_ext = neuron.h.Vector(t_ext) - self.v_ext = [] - for v in v_ext: - self.v_ext.append(neuron.h.Vector(v)) - #play v_ext into e_extracellular reference - i = 0 - for sec in self.allseclist: - for seg in sec: - self.v_ext[i].play(seg._ref_e_extracellular, self.t_ext) - i += 1 - - return - - def get_axial_currents_from_vmem(self, timepoints=None): - """Compute axial currents from cell sim: get current magnitude, - distance vectors and position vectors. - Parameters - ---------- - timepoints : ndarray, dtype=int - array of timepoints in simulation at which you want to compute - the axial currents. Defaults to False. If not given, - all simulation timesteps will be included. - Returns - ------- - i_axial : ndarray, dtype=float - Shape ((cell.totnsegs-1)*2, len(timepoints)) array of axial current - magnitudes I in units of (nA) in cell at all timesteps in timepoints, - or at all timesteps of the simulation if timepoints=None. - Contains two current magnitudes per segment, - (except for the root segment): 1) the current from the mid point of - the segment to the segment start point, and 2) the current from - the segment start point to the mid point of the parent segment. - d_vectors : ndarray, dtype=float - Shape ((cell.totnsegs-1)*2, 3) array of distance vectors traveled by - each axial current in i_axial in units of (µm). The indices of the - first axis, correspond to the first axis of i_axial and pos_vectors. - pos_vectors : ndarray, dtype=float - Shape ((cell.totnsegs-1)*2, 3) array of position vectors pointing to - the mid point of each axial current in i_axial in units of (µm). The - indices of the first axis, correspond to the first axis - of i_axial and d_vectors. - - Raises - ------ - AttributeError - Raises an exeption if the cell.vmem attribute cannot be found - """ - if not hasattr(self, 'vmem'): - raise AttributeError('no vmem, run cell.simulate(rec_vmem=True)') - i_axial = [] - d_vectors = [] - pos_vectors = [] - dseg = np.c_[self.xmid - self.xstart, - self.ymid - self.ystart, - self.zmid - self.zstart] - dpar = np.c_[self.xend - self.xmid, - self.yend - self.ymid, - self.zend - self.zmid] - - children_dict = self.get_dict_of_children_idx() - for sec in self.allseclist: - if not neuron.h.SectionRef(sec.name()).has_parent(): - if sec.nseg == 1: - # skip soma, since soma is an orphan - continue - else: - # the first segment has more than one segment, - # need to compute axial currents within this section. - seg_idx = 1 - parent_idx = 0 - bottom_seg = False - first_sec = True - branch = False - parentsec = None - children_dict = None - connection_dict = None - conn_point = 1 - else: - # section has parent section - first_sec = False - bottom_seg = True - secref = neuron.h.SectionRef(sec.name()) - parentseg = secref.parent() - parentsec = parentseg.sec - children_dict = self.get_dict_of_children_idx() - branch = len(children_dict[parentsec.name()]) > 1 - connection_dict = self.get_dict_parent_connections() - conn_point = connection_dict[sec.name()] - # find parent index - if conn_point == 1 or parentsec.nseg == 1: - internal_parent_idx = -1 # last seg in sec - elif conn_point == 0: - internal_parent_idx = 0 # first seg in sec - else: - # if parentseg is not first or last seg in parentsec - segment_xlist = np.array([segment.x for segment in parentsec]) - internal_parent_idx = np.abs(segment_xlist - conn_point).argmin() - parent_idx = self.get_idx(section=parentsec.name())[internal_parent_idx] - # find segment index - seg_idx = self.get_idx(section=sec.name())[0] - for _ in sec: - if first_sec: - first_sec = False - continue - iseg, ipar = self._parent_and_segment_current(seg_idx, - parent_idx, - bottom_seg, - branch, - parentsec, - children_dict, - connection_dict, - conn_point, - timepoints - ) - - if bottom_seg: - # if a seg is connected to soma, it is - # connected to the middle of soma, - # and dpar needs to be altered. - par_dist = np.array([(self.xstart[seg_idx] - - self.xmid[parent_idx]), - (self.ystart[seg_idx] - - self.ymid[parent_idx]), - (self.zstart[seg_idx] - - self.zmid[parent_idx])]) - - else: - par_dist = dpar[parent_idx] - d_vectors.append(par_dist) - d_vectors.append(dseg[seg_idx]) - i_axial.append(ipar) - i_axial.append(iseg) - - pos_par = np.array([self.xstart[seg_idx], - self.ystart[seg_idx], - self.zstart[seg_idx]]) - 0.5*par_dist - - pos_seg = np.array([self.xmid[seg_idx], - self.ymid[seg_idx], - self.zmid[seg_idx]]) - 0.5*dseg[seg_idx] - pos_vectors.append(pos_par) - pos_vectors.append(pos_seg) - - parent_idx = seg_idx - seg_idx += 1 - branch = False - bottom_seg = False - parent_ri = 0 - return np.array(i_axial), np.array(d_vectors), np.array(pos_vectors) - - def get_axial_resistance(self): - """ - Return NEURON axial resistance for all cell compartments. - Returns - ------- - ri_list : ndarray, dtype=float - Shape (cell.totnsegs, ) array containing neuron.h.ri(seg.x) in units - of (MOhm) for all segments in cell calculated using the - neuron.h.ri(seg.x) method. neuron.h.ri(seg.x) returns the - axial resistance from the middle of the segment to the middle of - the parent segment. Note: If seg is the first segment in a section, - i.e. the parent segment belongs to a different section or there is - no parent section, then neuron.h.ri(seg.x) returns the axial - resistance from the middle of the segment to the node connecting the - segment to the parent section (or a ghost node if there is no - parent) - """ - - ri_list = np.zeros(self.totnsegs) - comp = 0 - for sec in self.allseclist: - for seg in sec: - ri_list[comp] = neuron.h.ri(seg.x) - comp += 1 - - return ri_list - - def get_dict_of_children_idx(self): - """ - Return dictionary with children segment indices for all sections. - Returns - ------- - children_dict : dictionary - Dictionary containing a list for each section, - with the segment index of all the section's children. - The dictionary is needed to find the - sibling of a segment. - """ - children_dict = {} - for sec in self.allseclist: - children_dict[sec.name()] = [] - for child in neuron.h.SectionRef(sec.name()).child: - # add index of first segment of each child - children_dict[sec.name()].append(int(self.get_idx( - section=child.name())[0])) - - return children_dict - - def get_dict_parent_connections(self): - """ - Return dictionary with parent connection point for all sections. - Returns - ------- - connection_dict : dictionary - Dictionary containing a float in range [0, 1] for each section - in cell. The float gives the location on the parent segment - to which the section is connected. - The dictionary is needed for computing axial currents. - """ - connection_dict = {} - for sec in self.allseclist: - connection_dict[sec.name()] = neuron.h.parent_connection() - return connection_dict - - def _parent_and_segment_current(self, seg_idx, parent_idx, bottom_seg, - branch=False, parentsec=None, - children_dict=None, connection_dict=None, - conn_point=1, timepoints=None): - """ - Return axial current from segment (seg_idx) mid to segment start, - and current from parent segment (parent_idx) end to parent segment mid. - Parameters - ---------- - seg_idx : int - Segment index - parent_idx : int - Parent index - parent_ri : float - Axial resistance from parent end to mid in units of (MΩ) - bottom_seg : boolean - branch : boolean - parentsec : neuron.Section object - timepoints : ndarray, dtype=int - array of timepoints in simulation at which you want to compute - the axial currents. Defaults to None. If not given, - all simulation timesteps will be included. - Returns - ------- - iseg : dtype=float - Axial current in units of (nA) - from segment mid point to segment start point. - ipar : dtype=float - Axial current in units of (nA) - from parent segment end point to parent segment mid point. - """ - # list of axial resistance between segments - ri_list = self.get_axial_resistance() - # axial resistance between segment mid and parent node - seg_ri = ri_list[seg_idx] - vmem = self.vmem - if timepoints is not None: - vmem = self.vmem[:,timepoints] - vpar = vmem[parent_idx] - vseg = vmem[seg_idx] - # if segment is the first in its section and it is connected to - # top or bottom of parent section, we need to find parent_ri explicitly - if bottom_seg and (conn_point == 0 or conn_point == 1): - if conn_point == 0: - parent_ri = ri_list[parent_idx] - else: - parent_ri = neuron.h.ri(0) - if not branch: - ri = parent_ri + seg_ri - iseg = (vpar - vseg) / ri - ipar = iseg - else: - # if branch, need to compute iseg and ipar separately - [sib_idcs] = np.take(children_dict[parentsec.name()], - np.where(children_dict[parentsec.name()] - != seg_idx)) - sibs = [self.get_idx_name(sib_idcs)[i][1] for i in range(len(sib_idcs))] - # compute potential in branch point between parent and siblings - v_branch_num = vpar/parent_ri + vseg/seg_ri - v_branch_denom = 1./parent_ri + 1./seg_ri - for sib_idx, sib in zip(sib_idcs, sibs): - sib_conn_point = connection_dict[sib] - if sib_conn_point == conn_point: - v_branch_num += vmem[sib_idx]/ri_list[sib_idx] - v_branch_denom += 1./ ri_list[sib_idx] - v_branch = v_branch_num/v_branch_denom - iseg = (v_branch - vseg)/seg_ri - # set ipar=iseg - # only fraction of total current into parent is added per sibling - ipar = iseg - else: - iseg = (vpar - vseg) / seg_ri - ipar = iseg - return iseg, ipar - - def distort_geometry(self, factor=0., axis='z', nu=0.0): - """ - Distorts cellular morphology with a relative factor along a chosen axis - preserving Poisson's ratio. A ratio nu=0.5 assumes uncompressible and - isotropic media that embeds the cell. A ratio nu=0 will only affect - geometry along the chosen axis. A ratio nu=-1 will isometrically scale - the neuron geometry along each axis. - This method does not affect the underlying cable properties of the cell, - only predictions of extracellular measurements (by affecting the - relative locations of sources representing the compartments). - Parameters - ---------- - factor : float - relative compression/stretching factor of morphology. Default is 0 - (no compression/stretching). Positive values implies a compression - along the chosen axis. - axis : str - which axis to apply compression/stretching. Default is "z". - nu : float - Poisson's ratio. Ratio between axial and transversal - compression/stretching. Default is 0. - """ - try: - assert(abs(factor) < 1.) - except AssertionError: - raise AssertionError('abs(factor) >= 1, factor must be in <-1, 1>') - try: - assert(axis in ['x', 'y', 'z']) - except AssertionError: - raise AssertionError('axis={} not "x", "y" or "z"'.format(axis)) - - for pos, dir_ in zip(self.somapos, 'xyz'): - geometry = np.c_[getattr(self, dir_+'start'), - getattr(self, dir_+'mid'), - getattr(self, dir_+'end')] - if dir_ == axis: - geometry -= pos - geometry *= (1. - factor) - geometry += pos - else: - geometry -= pos - geometry *= (1. + factor*nu) - geometry += pos - - setattr(self, dir_+'start', geometry[:, 0]) - setattr(self, dir_+'mid', geometry[:, 1]) - setattr(self, dir_+'end', geometry[:, 2]) - - # recompute length of each segment - self.length = np.sqrt((self.xend - self.xstart)**2 + - (self.yend - self.ystart)**2 + - (self.zend - self.zstart)**2) - - def get_multi_current_dipole_moments(self, timepoints=None): - ''' - Return 3D current dipole moment vector and middle position vector - from each axial current in space. - Parameters - ---------- - timepoints : ndarray, dtype=int - array of timepoints at which you want to compute - the current dipole moments. Defaults to None. If not given, - all simulation timesteps will be included. - Returns - ------- - multi_dipoles : ndarray, dtype = float - Shape (n_axial_currents, n_timepoints, 3) array - containing the x-,y-,z-components of the current dipole moment - from each axial current in cell, at all timepoints. - The number of axial currents, n_axial_currents = (cell.totnsegs-1)*2 - and the number of timepoints, n_timepoints = cell.tvec.size. - The current dipole moments are given in units of (nA µm). - pos_axial : ndarray, dtype = float - Shape (n_axial_currents, 3) array containing the x-, y-, and - z-components giving the mid position in space of each multi_dipole - in units of (µm). - Examples - -------- - Get all current dipole moments and positions from all axial currents in a - single neuron simulation. - >>> import LFPy - >>> import numpy as np - >>> cell = LFPy.Cell('PATH/TO/MORPHOLOGY', extracellular=False) - >>> syn = LFPy.Synapse(cell, idx=cell.get_closest_idx(0,0,1000), - >>> syntype='ExpSyn', e=0., tau=1., weight=0.001) - >>> syn.set_spike_times(np.mgrid[20:100:20]) - >>> cell.simulate(rec_vmem=True, rec_imem=False) - >>> timepoints = np.array([1,2,3,4]) - >>> multi_dipoles, dipole_locs = cell.get_multi_current_dipole_moments(timepoints=timepoints) - ''' - i_axial, d_axial, pos_axial = self.get_axial_currents_from_vmem(timepoints=timepoints) - Ni, Nt = i_axial.shape - multi_dipoles = np.array([i_axial[i][:, np.newaxis]*d_axial[i] for i in range(Ni)]) - - return multi_dipoles, pos_axial diff --git a/LFPy-2.0.7/LFPy/eegmegcalc.py b/LFPy-2.0.7/LFPy/eegmegcalc.py deleted file mode 100644 index 99bfa09..0000000 --- a/LFPy-2.0.7/LFPy/eegmegcalc.py +++ /dev/null @@ -1,1437 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Copyright (C) 2017 Computational Neuroscience Group, NMBU. -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. -""" - -from __future__ import division -from scipy.special import eval_legendre, lpmv, legendre -import numpy as np -from warnings import warn - - -class OneSphereVolumeConductor(object): - """ - Computes extracellular potentials within and outside a spherical volume- - conductor model that assumes homogeneous, isotropic, linear (frequency - independent) conductivity in and outside the sphere with a radius R. The - conductivity in and outside the sphere must be greater than 0, and the - current source(s) must be located within the radius R. - - The implementation is based on the description of electric potentials of - point charge in an dielectric sphere embedded in dielectric media, which is - mathematically equivalent to a current source in conductive media, as - published by Deng (2008), Journal of Electrostatics 66:549-560 - - Parameters - ---------- - r : ndarray, dtype=float - shape(3, n_points) observation points in space in spherical coordinates - (radius, theta, phi) relative to the center of the sphere. - R : float - sphere radius (µm) - sigma_i : float - electric conductivity for radius r <= R (S/m) - sigma_o : float - electric conductivity for radius r > R (S/m) - - Examples - -------- - Compute the potential for a single monopole along the x-axis: - - >>> # import modules - >>> from LFPy import OneSphereVolumeConductor - >>> import numpy as np - >>> import matplotlib.pyplot as plt - >>> # observation points in spherical coordinates (flattened) - >>> X, Y = np.mgrid[-15000:15100:1000., -15000:15100:1000.] - >>> r = np.array([np.sqrt(X**2 + Y**2).flatten(), - >>> np.arctan2(Y, X).flatten(), - >>> np.zeros(X.size)]) - >>> # set up class object and compute electric potential in all locations - >>> sphere = OneSphereVolumeConductor(r, R=10000., - >>> sigma_i=0.3, sigma_o=0.03) - >>> Phi = sphere.calc_potential(rs=8000, I=1.).reshape(X.shape) - >>> # plot - >>> fig, ax = plt.subplots(1,1) - >>> im=ax.contourf(X, Y, Phi, - >>> levels=np.linspace(Phi.min(), np.median(Phi[np.isfinite(Phi)])*4, 30)) - >>> circle = plt.Circle(xy=(0,0), radius=sphere.R, fc='none', ec='k') - >>> ax.add_patch(circle) - >>> fig.colorbar(im, ax=ax) - >>> plt.show() - """ - def __init__(self, - r, - R=10000., - sigma_i=0.3, - sigma_o=0.03): - """initialize class OneSphereVolumeConductor""" - # check inputs - try: - assert(r.shape[0] == 3) - assert(r.ndim == 2) - except AssertionError as ae: - raise AssertionError('r must be a shape (3, n_points) ndarray') - try: - assert((type(R) is float) or (type(R) is int)) - except AssertionError as ae: - raise AssertionError('sphere radius R must be a float value') - try: - assert((sigma_i > 0) & (sigma_o > 0)) - except AssertionError as ae: - raise AssertionError('sigma_i and sigma_o must both be positive values') - - self.r = r - self.R = R - self.sigma_i = sigma_i - self.sigma_o = sigma_o - - - def calc_potential(self, rs, I, min_distance=1., n_max=1000): - """ - Return the electric potential at observation points for source current - with magnitude I as function of time. - - Parameters - ---------- - rs : float - monopole source location along the horizontal x-axis (µm) - I : float or ndarray, dtype float - float or shape (n_tsteps, ) array containing source current (nA) - min_distance : None or float - minimum distance between source location and observation point (µm) - (in order to avoid singular values) - n_max : int - Number of elements in polynomial expansion to sum over - (see Deng 2008). - - Returns - ------- - Phi : ndarray - shape (n-points, ) ndarray of floats if I is float like. If I is - an 1D ndarray, and shape (n-points, I.size) ndarray is returned. - Unit (mV). - """ - try: - assert(type(rs) in [int, float, np.float64]) - assert(abs(rs) < self.R) - except AssertionError as ae: - raise AssertionError('source location rs must be a float value and |rs| must be less than sphere radius R') - try: - assert((min_distance is None) or (type(min_distance) in [float, int, np.float64])) - except AssertionError: - raise AssertionError('min_distance must be None or a float') - - r = self.r[0] - theta = self.r[1] - - - # add harmonical contributions due to inhomogeneous media - inds_i = r <= self.R - inds_o = r > self.R - - # observation points r <= R - phi_i = np.zeros(r.size) - for j, (theta_i, r_i) in enumerate(zip(theta[inds_i], r[inds_i])): - coeffs_i = np.zeros(n_max) - for n in range(n_max): - coeffs_i[n] = ((self.sigma_i - self.sigma_o)*(n+1)) / (self.sigma_i*n + self.sigma_o*(n+1)) * ((r_i*rs)/self.R**2)**n - poly_i = np.polynomial.legendre.Legendre(coeffs_i) - phi_i[np.where(inds_i)[0][j]] = poly_i(np.cos(theta_i)) - phi_i[inds_i] *= 1./self.R - - # observation points r > R - phi_o = np.zeros(r.size) - for j, (theta_o, r_o) in enumerate(zip(theta[inds_o], r[inds_o])): - coeffs_o = np.zeros(n_max) - for n in range(n_max): - coeffs_o[n] = (self.sigma_i*(2*n+1) ) / (self.sigma_i*n + self.sigma_o*(n+1)) * (rs / r_o)**n - poly_o = np.polynomial.legendre.Legendre(coeffs_o) - phi_o[np.where(inds_o)[0][j]] = poly_o(np.cos(theta_o)) - phi_o[inds_o] *= 1./r[inds_o] - - # potential in homogeneous media - if min_distance is None: - phi_i[inds_i] += 1. / np.sqrt(r[r <= self.R]**2 + rs**2 - 2*r[inds_i]*rs*np.cos(theta[inds_i])) - else: - denom = np.sqrt(r[inds_i]**2 + rs**2 - 2*r[inds_i]*rs*np.cos(theta[inds_i])) - denom[denom < min_distance] = min_distance - phi_i[inds_i] += 1./denom - - - - if type(I) is np.ndarray: - try: - assert(np.all(np.isfinite(I))) - assert(np.all(np.isreal(I))) - assert(I.ndim == 1) - except AssertionError: - raise AssertionError('input argument I must be float or 1D ndarray with float values') - - return np.dot((phi_i + phi_o).reshape((1, -1)).T, - I.reshape((1, -1))) / (4.*np.pi*self.sigma_i) - else: - try: - assert(np.isfinite(I)) and (np.shape(I) == ()) - except AssertionError: - raise AssertionError('input argument I must be float or 1D ndarray with float values') - return I / (4.*np.pi*self.sigma_i)*(phi_i + phi_o) - - - def calc_mapping(self, cell, n_max=1000): - """ - Compute linear mapping between transmembrane currents of LFPy.Cell like - object instantiation and extracellular potential in and outside of - sphere. Cell position must be set in space, using the method - ``Cell.set_pos(**kwargs)``. - - Parameters - ---------- - cell : LFPy.Cell like instance - Instantiation of class LFPy.Cell, TemplateCell or NetworkCell. - n_max : int - Number of elements in polynomial expansion to sum over - (see Deng 2008). - - Examples - -------- - Compute extracellular potential in one-sphere volume conductor model - from LFPy.Cell object: - - >>> # import modules - >>> import LFPy - >>> import os - >>> import numpy as np - >>> import matplotlib.pyplot as plt - >>> from matplotlib.collections import PolyCollection - >>> # create cell - >>> cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc'), - >>> tstop=10.) - >>> cell.set_pos(z=9800.) - >>> # stimulus - >>> syn = LFPy.Synapse(cell, idx=cell.totnsegs-1, syntype='Exp2Syn', weight=0.01) - >>> syn.set_spike_times(np.array([1.])) - >>> # simulate - >>> cell.simulate(rec_imem=True) - >>> # observation points in spherical coordinates (flattened) - >>> X, Z = np.mgrid[-500:501:10., 9500:10501:10.] - >>> Y = np.zeros(X.shape) - >>> r = np.array([np.sqrt(X**2 + Z**2).flatten(), - >>> np.arccos(Z / np.sqrt(X**2 + Z**2)).flatten(), - >>> np.arctan2(Y, X).flatten()]) - >>> # set up class object and compute mapping between segment currents - >>> # and electric potential in space - >>> sphere = LFPy.OneSphereVolumeConductor(r=r, R=10000., - >>> sigma_i=0.3, sigma_o=0.03) - >>> mapping = sphere.calc_mapping(cell, n_max=1000) - >>> # pick out some time index for the potential and compute potential - >>> ind = cell.tvec==2. - >>> Phi = np.dot(mapping, cell.imem)[:, ind].reshape(X.shape) - >>> # plot potential - >>> fig, ax = plt.subplots(1,1) - >>> zips = [] - >>> for x, z in cell.get_idx_polygons(projection=('x', 'z')): - >>> zips.append(zip(x, z)) - >>> polycol = PolyCollection(zips, - >>> edgecolors='none', - >>> facecolors='gray') - >>> vrange = 1E-3 # limits for color contour plot - >>> im=ax.contour(X, Z, Phi, - >>> levels=np.linspace(-vrange, vrange, 41)) - >>> circle = plt.Circle(xy=(0,0), radius=sphere.R, fc='none', ec='k') - >>> ax.add_collection(polycol) - >>> ax.add_patch(circle) - >>> ax.axis(ax.axis('equal')) - >>> ax.set_xlim(X.min(), X.max()) - >>> ax.set_ylim(Z.min(), Z.max()) - >>> fig.colorbar(im, ax=ax) - >>> plt.show() - - Returns - ------- - ndarray - Shape (n_points, n_compartments) mapping between individual - segments and extracellular potential in extracellular locations - - Notes - ----- - Each segment is treated as a point source in space. The minimum - source to measurement site distance will be set to the diameter of - each segment - - """ - # midpoint position of compartments in spherical coordinates - radius = np.sqrt(cell.xmid**2 + cell.ymid**2 + cell.zmid**2) - theta = np.arccos(cell.zmid/radius) - phi = np.arctan2(cell.ymid, cell.xmid) - diam = cell.diam - - # since the sources must be located on the x-axis, we keep a copy - # of the unrotated coordinate system for the contact points: - r_orig = np.copy(self.r) - - # unit current amplitude - I = 1. - - # initialize mapping array - mapping = np.zeros((self.r.shape[1], radius.size)) - - # compute the mapping for each compartment - for i, (radius_i, theta_i, _, diam_i) in enumerate(zip(radius, theta, phi, diam)): - self.r = np.array([r_orig[0], # radius unchanged - r_orig[1] - theta_i, # rotate relative to source location - r_orig[2]]) # phi unchanged (don't enter equations) - mapping[:, i] = self.calc_potential(radius_i, I=I, min_distance=diam_i, n_max=n_max) - - # reset measurement locations - self.r = r_orig - - # return mapping between segment currents and contrib in each - # measurement location - return mapping - - -class FourSphereVolumeConductor(object): - """ - Main class for computing extracellular potentials in a four-sphere - volume conductor model that assumes homogeneous, isotropic, linear - (frequency independent) conductivity within the inner sphere and outer - shells. The conductance outside the outer shell is 0 (air). - - Parameters - ---------- - radii : list, dtype=float - Len 4 list with the outer radii in units of (µm) for the 4 - concentric shells in the four-sphere model: brain, csf, skull and - scalp, respectively. - sigmas : list, dtype=float - Len 4 list with the electrical conductivity in units of (S/m) of - the four shells in the four-sphere model: brain, csf, skull and - scalp, respectively. - r_electrodes : ndarray, dtype=float - Shape (n_contacts, 3) array containing n_contacts electrode locations - in cartesian coordinates in units of (µm). - All ``r_el`` in ``r_electrodes`` must be less than or equal to scalp - radius and larger than the distance between dipole and sphere - center: ``|rz| < r_el <= radii[3]``. - - Examples - -------- - Compute extracellular potential from current dipole moment in four-sphere - head model: - - >>> import LFPy - >>> import numpy as np - >>> radii = [79000., 80000., 85000., 90000.] - >>> sigmas = [0.3, 1.5, 0.015, 0.3] - >>> r = np.array([[0., 0., 90000.], [0., 85000., 0.]]) - >>> rz = np.array([0., 0., 78000.]) - >>> sphere_model = LFPy.FourSphereVolumeConductor(radii, sigmas, r) - >>> # current dipole moment - >>> p = np.array([[10., 10., 10.]]*10) # 10 timesteps - >>> # compute potential - >>> potential = sphere_model.calc_potential(p, rz) - - """ - - def __init__(self, radii, sigmas, r_electrodes, iter_factor = 2./99.*1e-6): - """Initialize class FourSphereVolumeConductor""" - self.r1 = float(radii[0]) - self.r2 = float(radii[1]) - self.r3 = float(radii[2]) - self.r4 = float(radii[3]) - - self.sigma1 = float(sigmas[0]) - self.sigma2 = float(sigmas[1]) - self.sigma3 = float(sigmas[2]) - self.sigma4 = float(sigmas[3]) - - self.r12 = self.r1 / self.r2 - self.r21 = self.r2 / self.r1 - self.r23 = self.r2 / self.r3 - self.r32 = self.r3 / self.r2 - self.r34 = self.r3 / self.r4 - self.r43 = self.r4 / self.r3 - - self.sigma12 = self.sigma1 / self.sigma2 - self.sigma21 = self.sigma2 / self.sigma1 - self.sigma23 = self.sigma2 / self.sigma3 - self.sigma32 = self.sigma3 / self.sigma2 - self.sigma34 = self.sigma3 / self.sigma4 - self.sigma43 = self.sigma4 / self.sigma3 - - self.rxyz = r_electrodes - self.r = np.sqrt(np.sum(r_electrodes ** 2, axis=1)) - - self.iteration_stop_factor = iter_factor - self._check_params() - - def _check_params(self): - """Check that radii, sigmas and r contain reasonable values""" - if (self.r1 < 0) or (self.r1 > self.r2) or (self.r2 > self.r3) or (self.r3 > self.r4): - raise RuntimeError('Radii of brain (radii[0]), CSF (radii[1]), ' - 'skull (radii[2]) and scalp (radii[3]) ' - 'must be positive ints or floats such that ' - '0 < radii[0] < radii[1] < radii[2] < radii[3].') - - if (self.sigma1 < 0) or (self.sigma2 < 0) or (self.sigma3 < 0) or (self.sigma4 < 0): - raise RuntimeError('Conductivities (sigmas), must contain positive' - ' ints or floats.') - - if any(r > self.r4 for r in self.r): - raise ValueError('Electrode located outside head model.' - 'r > radii[3]. r = %s, r4 = %s', - self.r, self.r4) - - def _rz_params(self, rz): - """Define dipole location vector, and check that dipole is located in - the brain, closer to the center than any measurement location.""" - self._rzloc = rz - self._rz = np.sqrt(np.sum(rz ** 2)) - self._z = self._rzloc/self._rz - if self._rz == 0: - raise RuntimeError('Placing dipole in center of head model causes division by zero.') - - self._rz1 = self._rz / self.r1 - - if self._rz1 >= 1: - raise RuntimeError('Dipole should be placed inside brain, i.e. |rz| < |r1|') - - elif self._rz1 > 0.99999: - warn('Dipole should be placed minimum ~1µm away from brain surface, ' - 'to avoid extremely slow convergence.') - - elif self._rz1 > 0.9999: - warn('Computation time might be long due to slow convergence. ' - 'Can be avoided by placing dipole further away from brain surface.') - - if any(r < self._rz for r in self.r): - raise RuntimeError('Electrode must be farther away from ' - 'brain center than dipole: r > rz.' - 'r = %s, rz = %s', self.r, self._rz) - - # compute theta angle between rzloc and rxyz - self._theta = self.calc_theta() - - - def calc_potential(self, p, rz): - """ - Return electric potential from current dipole moment p. - - Parameters - ---------- - p : ndarray, dtype=float - Shape (n_timesteps, 3) array containing the x,y,z components of the - current dipole moment in units of (nA*µm) for all timesteps. - rz : ndarray, dtype=float - Shape (3, ) array containing the position of the current dipole in - cartesian coordinates. Units of (µm). - - Returns - ------- - potential : ndarray, dtype=float - Shape (n_contacts, n_timesteps) array containing the electric - potential at contact point(s) FourSphereVolumeConductor.r in units - of (mV) for all timesteps of current dipole moment p. - - """ - - self._rz_params(rz) - n_contacts = self.r.shape[0] - n_timesteps = p.shape[0] - - if np.linalg.norm(p) != 0: - p_rad, p_tan = self._decompose_dipole(p) - else: - p_rad = np.zeros((n_timesteps, 3)) - p_tan = np.zeros((n_timesteps, 3)) - if np.linalg.norm(p_rad) != 0.: - pot_rad = self._calc_rad_potential(p_rad) - else: - pot_rad = np.zeros((n_contacts, n_timesteps)) - - if np.linalg.norm(p_tan) != 0.: - pot_tan = self._calc_tan_potential(p_tan) - else: - pot_tan = np.zeros((n_contacts, n_timesteps)) - - pot_tot = pot_rad + pot_tan - return pot_tot - - def calc_potential_from_multi_dipoles(self, cell, timepoints=None): - """ - Return electric potential from multiple current dipoles from cell. - - By multiple current dipoles we mean the dipoles computed from all - axial currents in a neuron simulation, typically two - axial currents per compartment, except for the root compartment. - - Parameters - ---------- - cell : LFPy Cell object, LFPy.Cell - timepoints : ndarray, dtype=int - array of timepoints at which you want to compute - the electric potential. Defaults to None. If not given, - all simulation timesteps will be included. - - Returns - ------- - potential : ndarray, dtype=float - Shape (n_contacts, n_timesteps) array containing the electric - potential at contact point(s) electrode_locs in units - of (mV) for all timesteps of neuron simulation. - - Examples - -------- - Compute extracellular potential from neuron simulation in - four-sphere head model. Instead of simplifying the neural activity to - a single dipole, we compute the contribution from every multi dipole - from all axial currents in neuron simulation: - - >>> import LFPy - >>> import numpy as np - >>> cell = LFPy.Cell('PATH/TO/MORPHOLOGY', extracellular=False) - >>> syn = LFPy.Synapse(cell, idx=cell.get_closest_idx(0,0,100), - >>> syntype='ExpSyn', e=0., tau=1., weight=0.001) - >>> syn.set_spike_times(np.mgrid[20:100:20]) - >>> cell.simulate(rec_vmem=True, rec_imem=False) - >>> radii = [200., 300., 400., 500.] - >>> sigmas = [0.3, 1.5, 0.015, 0.3] - >>> electrode_locs = np.array([[50., -50., 250.]]) - >>> timepoints = np.array([0,100]) - >>> MD_4s = LFPy.FourSphereVolumeConductor(radii, - >>> sigmas, - >>> electrode_locs) - >>> phi = MD_4s.calc_potential_from_multi_dipoles(cell, - >>> timepoints) - """ - multi_p, multi_p_locs = cell.get_multi_current_dipole_moments(timepoints) - N_elec = self.rxyz.shape[0] - Ni, Nt, Nd = multi_p.shape - potential = np.zeros((N_elec, Nt)) - for i in range(Ni): - pot = self.calc_potential(multi_p[i], multi_p_locs[i]) - potential += pot - return potential - - def _decompose_dipole(self, p): - """ - Decompose current dipole moment vector in radial and tangential terms - - Parameters - ---------- - p : ndarray, dtype=float - Shape (n_timesteps, 3) array containing the x,y,z-components of the - current dipole moment in units of (nA*µm) for all timesteps - - Returns: - ------- - p_rad : ndarray, dtype=float - Shape (n_timesteps, 3) array, radial part of p, parallel to self._rz - p_tan : ndarray, dtype=float - Shape (n_timesteps, 3) array, tangential part of p, - orthogonal to self._rz - """ - z_ = np.expand_dims(self._z, -1) # reshape z-axis vector - p_rad = np.dot(np.dot(p, z_), z_.T) - p_tan = p - p_rad - return p_rad, p_tan - - def _calc_rad_potential(self, p_rad): - """ - Return potential from radial dipole p_rad at location rz measured at r - - Parameters - ---------- - p_rad : ndarray, dtype=float - Shape (n_timesteps, 3) array, radial part of p - in units of (nA*µm), parallel to self._rz - - Returns - ------- - potential : ndarray, dtype=float - Shape (n_contacts, n_timesteps) array containing the extracecllular - potential at n_contacts contact point(s) FourSphereVolumeConductor.r - in units of (mV) for all timesteps of p_rad - """ - - p_tot = np.linalg.norm(p_rad, axis=1) - s_vector = self._sign_rad_dipole(p_rad) - phi_const = s_vector * p_tot / (4 * np.pi * self.sigma1 * self._rz ** 2) - n_terms = np.zeros((len(self.r), len(p_tot))) - for el_point in range(len(self.r)): - r_point = self.r[el_point] - theta_point = self._theta[el_point] - if r_point <= self.r1: - n_terms[el_point] = self._potential_brain_rad(r_point, - theta_point) - elif r_point <= self.r2: - n_terms[el_point] = self._potential_csf_rad(r_point, - theta_point) - elif r_point <= self.r3: - n_terms[el_point] = self._potential_skull_rad(r_point, - theta_point) - else: - n_terms[el_point] = self._potential_scalp_rad(r_point, - theta_point) - potential = phi_const * n_terms - return potential - - def _calc_tan_potential(self, p_tan): - """ - Return potential from tangential dipole P at location rz measured at r - - Parameters - ---------- - p_tan : ndarray, dtype=float - Shape (n_timesteps, 3) array, tangential part of p - in units of (nA*µm), orthogonal to self._rz - - Returns - _______ - potential : ndarray, dtype=float - Shape (n_contacts, n_timesteps) array containing the extracecllular - potential at n_contacts contact point(s) FourSphereVolumeConductor.r - in units of (mV) for all timesteps of p_tan - """ - phi = self.calc_phi(p_tan) - p_tot = np.linalg.norm(p_tan, axis=1) - phi_hom = - p_tot / (4 * np.pi * self.sigma1 * self._rz ** 2) * np.sin(phi) - n_terms = np.zeros((len(self.r),1)) - for el_point in range(len(self.r)): - r_point = self.r[el_point] - theta_point = self._theta[el_point] - # if r_electrode is orthogonal to p_tan, i.e. theta = 0 or theta = pi, - # there is no contribution to electric potential from p_tan - if (theta_point == 0.) or (theta_point == np.pi): - n_terms[el_point] = 0 - elif r_point <= self.r1: - n_terms[el_point] = self._potential_brain_tan(r_point, theta_point) - elif r_point <= self.r2: - n_terms[el_point] = self._potential_csf_tan(r_point, theta_point) - elif r_point <= self.r3: - n_terms[el_point] = self._potential_skull_tan(r_point, theta_point) - else: - n_terms[el_point] = self._potential_scalp_tan(r_point, theta_point) - potential = n_terms * phi_hom - - return potential - - def calc_theta(self): - """ - Return polar angle(s) between rzloc and contact point location(s) - - Returns - ------- - theta : ndarray, dtype=float - Shape (n_contacts, ) array containing polar angle - in units of (radians) between z-axis and n_contacts contact - point location vector(s) in FourSphereVolumeConductor.rxyz - z-axis is defined in the direction of rzloc and the radial dipole. - """ - cos_theta = np.dot(self.rxyz, self._rzloc) / (np.linalg.norm(self.rxyz, axis=1) * np.linalg.norm(self._rzloc)) - theta = np.arccos(cos_theta) - return theta - - def calc_phi(self, p_tan): - """ - Return azimuthal angle between x-axis and contact point locations(s) - - Parameters - ---------- - p_tan : ndarray, dtype=float - Shape (n_timesteps, 3) array containing - tangential component of current dipole moment in units of (nA*µm) - - Returns - ------- - phi : ndarray, dtype=float - Shape (n_contacts, n_timesteps) array containing azimuthal angle - in units of (radians) between x-axis vector(s) and projection of - contact point location vector(s) rxyz into xy-plane. - z-axis is defined in the direction of rzloc. - y-axis is defined in the direction of p_tan (orthogonal to rzloc). - x-axis is defined as cross product between p_tan and rzloc (x). - """ - - # project rxyz onto z-axis (rzloc) - proj_rxyz_rz = self.rxyz*self._z - # find projection of rxyz in xy-plane - rxy = self.rxyz - proj_rxyz_rz - # define x-axis - x = np.cross(p_tan, self._z) - - phi = np.zeros((len(self.rxyz), len(p_tan))) - # create masks to avoid computing phi when phi is not defined - mask = np.ones(phi.shape, dtype=bool) - # phi is not defined when theta= 0,pi or |p_tan| = 0 - mask[(self._theta == 0) | (self._theta == np.pi)] = np.zeros(len(p_tan)) - mask[:,np.abs(np.linalg.norm(p_tan, axis=1)) == 0] = 0 - - cos_phi = np.zeros(phi.shape) - # compute cos_phi using mask to avoid zerodivision - cos_phi[mask] = np.dot(rxy, x.T)[mask] / np.outer(np.linalg.norm(rxy, - axis=1), np.linalg.norm(x, axis=1))[mask] - - # compute phi in [0, pi] - phi[mask] = np.arccos(cos_phi[mask]) - - # nb: phi in [-pi, pi]. since p_tan defines direction of y-axis, - # phi < 0 when rxy*p_tan < 0 - phi[np.dot(rxy, p_tan.T) < 0] *= -1 - - return phi - - def _sign_rad_dipole(self, p): - """ - Determine whether radial dipoles are pointing inwards or outwards - - Parameters - ---------- - p : ndarray, dtype=float - Shape (n_timesteps, 3) array containing the current dipole moment - in cartesian coordinates for all n_timesteps in units of (nA*µm) - - Returns - ------- - sign_vector : ndarray - Shape (n_timesteps, ) array containing +/-1 for all - current dipole moments in p. - If radial part of p[i] points outwards, sign_vector[i] = 1. - If radial part of p[i] points inwards, sign_vector[i] = -1. - - """ - sign_vector = np.sign(np.dot(p, self._rzloc)) - return sign_vector - - def _potential_brain_rad(self, r, theta): - """ - Return factor for calculation of potential in brain from rad. dipole - - Parameters - ---------- - r : float - Distance from origin to brain electrode location in units of (µm) - theta : float - Polar angle between brain electrode location and - dipole location vector rzloc in units of (radians) - - Returns - ------- - pot_sum : float - Summationfactor for calculation of electrical potential in brain - from radial current dipole moment. (unitless) - """ - n = 1 - const = 1. - coeff_sum = 0. - consts = [] - # while const > self.iteration_stop_factor*coeff_sum: - while const > 2./99.*1e-12*coeff_sum: - c1n = self._calc_c1n(n) - const = n*(c1n * (r / self.r1) ** n + (self._rz / r) ** (n + 1)) - coeff_sum += const - consts.append(const) - n += 1 - consts = np.insert(consts, 0, 0) # since the legendre function starts with P0 - leg_consts = np.polynomial.legendre.Legendre(consts) - pot_sum = leg_consts(np.cos(theta)) - return pot_sum - - def _potential_csf_rad(self, r, theta): - """ - Return factor for calculation of potential in CSF from rad. dipole - - Parameters - ---------- - r : float - Distance from origin to CSF electrode location in units of (µm) - theta : float - Polar angle between CSF electrode location and - dipole location vector rzloc in units of (radians) - - Returns - ------- - pot_sum : float - Summation factor for calculation of electrical potential in CSF - from radial current dipole moment. (unitless) - """ - n = 1 - const = 1. - coeff_sum = 0. - consts = [] - # while const > self.iteration_stop_factor*coeff_sum: - while const > 2./99.*1e-6*coeff_sum: - term1 = self._calc_csf_term1(n,r) - term2 = self._calc_csf_term2(n,r) - const = n*(term1 + term2) - coeff_sum += const - consts.append(const) - n += 1 - consts = np.insert(consts, 0, 0) # since the legendre function starts with P0 - leg_consts = np.polynomial.legendre.Legendre(consts) - pot_sum = leg_consts(np.cos(theta)) - return pot_sum - - def _potential_skull_rad(self, r, theta): - """ - Return factor for calculation of potential in skull from rad. dipole - - Parameters - ---------- - r : float - Distance from origin to skull electrode location in units of (µm) - theta : float - Polar angle between skull electrode location and - dipole location vector rzloc in units of (radians) - - Returns - ------- - pot_sum : float - Summation factor for calculation of electrical potential in skull - from radial current dipole moment. (unitless) - """ - n = 1 - const = 1. - coeff_sum = 0. - consts = [] - # while const > self.iteration_stop_factor*coeff_sum: - while const > 2./99.*1e-6*coeff_sum: - c3n = self._calc_c3n(n) - d3n = self._calc_d3n(n, c3n) - const = n*(c3n * (r / self.r3) ** n + d3n * (self.r3 / r) ** (n + 1)) - coeff_sum += const - consts.append(const) - n += 1 - consts = np.insert(consts, 0, 0) # since the legendre function starts with P0 - leg_consts = np.polynomial.legendre.Legendre(consts) - pot_sum = leg_consts(np.cos(theta)) - return pot_sum - - def _potential_scalp_rad(self, r, theta): - """ - Return factor for calculation of potential in scalp from radial dipole - - Parameters - ---------- - r : float - Distance from origin to scalp electrode location in units of (µm) - theta : float - Polar angle between scalp electrode location and - dipole location vector rzloc in units of (radians) - - Returns - ------- - pot_sum : float - Summation factor for calculation of electrical potential in scalp - from radial current dipole moment. (unitless) - """ - n = 1 - const = 1. - coeff_sum = 0. - consts = [] - # while const > self.iteration_stop_factor*coeff_sum: - while const > 2./99.*1e-6*coeff_sum: - c4n = self._calc_c4n(n) - d4n = self._calc_d4n(n, c4n) - const = n*(c4n * (r / self.r4) ** n + d4n * (self.r4 / r) ** (n + 1)) - coeff_sum += const - consts.append(const) - n += 1 - consts = np.insert(consts, 0, 0) # since the legendre function starts with P0 - leg_consts = np.polynomial.legendre.Legendre(consts) - pot_sum = leg_consts(np.cos(theta)) - return pot_sum - - def _potential_brain_tan(self, r, theta): - """ - Return factor for calculation of potential in brain from tan. dipole - - Parameters - ---------- - r : float - Distance from origin to brain electrode location in units of (µm) - theta : float - Polar angle between brain electrode location and - dipole location vector rzloc in units of (radians) - - Returns - ------- - pot_sum : float - Summation factor for calculation of electrical potential in brain - from tangential current dipole moment. (unitless) - """ - n = 1 - const = 1. - coeff_sum = 0. - consts = [] - while const > self.iteration_stop_factor*coeff_sum: - c1n = self._calc_c1n(n) - const = (c1n * (r / self.r1) ** n + (self._rz / r) ** (n + 1)) - coeff_sum += const - consts.append(const) - n += 1 - pot_sum = np.sum([c*lpmv(1, i, np.cos(theta)) for c,i in zip(consts,np.arange(1,n))]) - return pot_sum - - def _potential_csf_tan(self, r, theta): - """ - Return factor for calculation of potential in CSF from tan. dipole - - Parameters - ---------- - r : float - Distance from origin to CSF electrode location in units of (µm) - theta : float - Polar angle between CSF electrode location and - dipole location vector rzloc in units of (radians) - - Returns - ------- - pot_sum : float - Summation factor for calculation of electrical potential in CSF - from tangential current dipole moment. (unitless) - """ - n = 1 - const = 1. - coeff_sum = 0. - consts = [] - while const > self.iteration_stop_factor*coeff_sum: - term1 = self._calc_csf_term1(n,r) - term2 = self._calc_csf_term2(n,r) - const = term1 + term2 - coeff_sum += const - consts.append(const) - n += 1 - pot_sum = np.sum([c*lpmv(1, i, np.cos(theta)) for c,i in zip(consts,np.arange(1,n))]) - return pot_sum - - def _potential_skull_tan(self, r, theta): - """ - Return factor for calculation of potential in skull from tan. dipole - - Parameters - ---------- - r : float - Distance from origin to skull electrode location in units of (µm) - theta : float - Polar angle between skull electrode location and - dipole location vector rzloc in units of (radians) - - Returns - ------- - pot_sum : float - Summation factor for calculation of electrical potential in skull - from tangential current dipole moment. (unitless) - """ - n = 1 - const = 1. - coeff_sum = 0. - consts = [] - while const > self.iteration_stop_factor*coeff_sum: - c3n = self._calc_c3n(n) - d3n = self._calc_d3n(n, c3n) - const = c3n * (r / self.r3) ** n + d3n * (self.r3 / r) ** (n + 1) - coeff_sum += const - consts.append(const) - n += 1 - pot_sum = np.sum([c*lpmv(1, i, np.cos(theta)) for c,i in zip(consts,np.arange(1,n))]) - return pot_sum - - def _potential_scalp_tan(self, r, theta): - """ - Return factor for calculation of potential in scalp from tan. dipole - - Parameters - ---------- - r : float - Distance from origin to scalp electrode location in units of (µm) - theta : float - Polar angle between scalp electrode location and - dipole location vector rzloc in units of (radians) - - Returns - ------- - pot_sum : float - Summation factor for calculation of electrical potential in scalp - from tangential current dipole moment. (unitless) - """ - n = 1 - const = 1. - coeff_sum = 0. - consts = [] - while const > self.iteration_stop_factor*coeff_sum: - c4n = self._calc_c4n(n) - d4n = self._calc_d4n(n, c4n) - const = c4n * (r / self.r4) ** n + d4n * (self.r4 / r) ** (n + 1) - coeff_sum += const - consts.append(const) - n += 1 - pot_sum = np.sum([c*lpmv(1, i, np.cos(theta)) for c,i in zip(consts,np.arange(1,n))]) - return pot_sum - - def _calc_vn(self, n): - r_const = ((self.r34 ** (2*n + 1) - 1) / - ((n + 1) / n * self.r34 ** (2*n + 1) + 1)) - if self.sigma23 + r_const == 0.0: - v = 1e12 - else: - v = (n / (n + 1) * self.sigma34 - r_const) / (self.sigma34 + r_const) - return v - - def _calc_yn(self, n): - vn = self._calc_vn(n) - r_const = ((n / (n + 1) * self.r23 ** (2*n + 1) - vn) / - (self.r23 ** (2*n + 1) + vn)) - if self.sigma23 + r_const == 0.0: - y = 1e12 - else: - y = (n / (n + 1) * self.sigma23 - r_const) / (self.sigma23 + r_const) - return y - - def _calc_zn(self, n): - yn = self._calc_yn(n) - z = (self.r12 ** (2*n+1) - (n + 1) / n * yn) / (self.r12 ** (2*n+1) + yn) - return z - - def _calc_c1n(self, n): - zn = self._calc_zn(n) - c1 = (((n + 1) / n * self.sigma12 + zn) / (self.sigma12 - zn) * self._rz1**(n+1)) - return c1 - - def _calc_c2n(self, n): - yn = self._calc_yn(n) - c1 = self._calc_c1n(n) - c2 = ((c1 + self._rz1**(n+1)) * self.r12 ** (n + 1) / - (self.r12 ** (2 * n + 1) + yn)) - return c2 - - def _calc_d2n(self, n, c2): - yn = self._calc_yn(n) - d2 = yn * c2 - return d2 - - def _calc_c3n(self, n): - vn = self._calc_vn(n) - c2 = self._calc_c2n(n) - d2 = self._calc_d2n(n, c2) - c3 = (c2 + d2) * self.r23 ** (n + 1) / (self.r23 ** (2*n + 1) + vn) - return c3 - - def _calc_d3n(self, n, c3): - vn = self._calc_vn(n) - d3 = vn * c3 - return d3 - - def _calc_c4n(self, n): - c3 = self._calc_c3n(n) - d3 = self._calc_d3n(n, c3) - c4 = ((n + 1) / n * self.r34 ** (n + 1) * (c3 + d3) / - ((n + 1) / n * self.r34 ** (2*n + 1) + 1)) - return c4 - - def _calc_d4n(self, n, c4): - d4 = n / (n + 1) * c4 - return d4 - - def _calc_csf_term1(self, n, r): - yn = self._calc_yn(n) - c1 = self._calc_c1n(n) - term1 = ((c1 + self._rz1 ** (n + 1)) * self.r12*((self.r1*r)/ - (self.r2 ** 2)) **n / (self.r12**(2*n+1) + yn)) - return term1 - - def _calc_csf_term2(self, n, r): - yn = self._calc_yn(n) - c1 = self._calc_c1n(n) - term2 = (yn*(c1 + self._rz1 ** (n + 1))/ - (r/self.r2*((self.r1 * r) / self.r2**2) ** n + - (r / self.r1) ** (n+1)*yn)) - return term2 - - -class InfiniteVolumeConductor(object): - """ - Main class for computing extracellular potentials with current dipole - approximation in an infinite 3D volume conductor model that assumes - homogeneous, isotropic, linear (frequency independent) conductivity - - Parameters - ---------- - sigma : float - Electrical conductivity in extracellular space in units of (S/cm) - - Examples - -------- - Computing the potential from dipole moment valid in the far field limit. - Theta correspond to the dipole alignment angle from the vertical z-axis: - - >>> import LFPy - >>> import numpy as np - >>> inf_model = LFPy.InfiniteVolumeConductor(sigma=0.3) - >>> p = np.array([[10., 10., 10.]]) - >>> r = np.array([[1000., 0., 5000.]]) - >>> phi_p = inf_model.get_dipole_potential(p, r) - - """ - - def __init__(self, sigma=0.3): - "Initialize class InfiniteVolumeConductor" - self.sigma = sigma - - def get_dipole_potential(self, p, r): - """ - Return electric potential from current dipole with current dipole - approximation - - p : ndarray, dtype=float - Shape (n_timesteps, 3) array containing the x,y,z components of the - current dipole moment in units of (nA*µm) for all timesteps - r : ndarray, dtype=float - Shape (n_contacts, 3) array contaning the displacement vectors - from dipole location to measurement location - - Returns - ------- - potential : ndarray, dtype=float - Shape (n_contacts, n_timesteps) array containing the electric - potential at contact point(s) FourSphereVolumeConductor.r in units - of (mV) for all timesteps of current dipole moment p - - """ - dotprod = np.dot(r, p.T) - r_factor = np.linalg.norm(r, axis=1)**3 - phi = 1./(4*np.pi*self.sigma)*(dotprod.T/ r_factor).T - return phi - - def get_multi_dipole_potential(self, cell, electrode_locs, timepoints=None): - """ - Return electric potential from multiple current dipoles from cell - - By multiple current dipoles we mean the dipoles computed from all - axial currents in a neuron simulation, typically two - axial currents per compartment, except for the root compartment. - - Parameters - ---------- - cell : Cell object from LFPy - electrode_locs : ndarray, dtype=float - Shape (n_contacts, 3) array containing n_contacts electrode - locations in cartesian coordinates in units of (µm). - All ``r_el`` in electrode_locs must be placed so that ``|r_el|`` is - less than or equal to scalp radius and larger than - the distance between dipole and sphere - center: ``|rz| < |r_el| <= radii[3]``. - timepoints : ndarray, dtype=int - array of timepoints at which you want to compute - the electric potential. Defaults to None. If not given, - all simulation timesteps will be included. - - Returns - ------- - potential : ndarray, dtype=float - Shape (n_contacts, n_timesteps) array containing the electric - potential at contact point(s) electrode_locs in units - of (mV) for all timesteps of neuron simulation - - Examples - -------- - Compute extracellular potential from neuron simulation in - four-sphere head model. Instead of simplifying the neural activity to - a single dipole, we compute the contribution from every multi dipole - from all axial currents in neuron simulation: - - >>> import LFPy - >>> import numpy as np - >>> cell = LFPy.Cell('PATH/TO/MORPHOLOGY', extracellular=False) - >>> syn = LFPy.Synapse(cell, idx=cell.get_closest_idx(0,0,100), - >>> syntype='ExpSyn', e=0., tau=1., weight=0.001) - >>> syn.set_spike_times(np.mgrid[20:100:20]) - >>> cell.simulate(rec_vmem=True, rec_imem=False) - >>> sigma = 0.3 - >>> timepoints = np.array([10, 20, 50, 100]) - >>> electrode_locs = np.array([[50., -50., 250.]]) - >>> MD_INF = LFPy.InfiniteVolumeConductor(sigma) - >>> phi = MD_INF.get_multi_dipole_potential(cell, electrode_locs, - >>> timepoints = timepoints) - """ - - multi_p, multi_p_locs = cell.get_multi_current_dipole_moments(timepoints=timepoints) - N_elec = electrode_locs.shape[0] - Ni, Nt, Nd = multi_p.shape - potentials = np.zeros((N_elec, Nt)) - for i in range(Ni): - p = multi_p[i] - r = electrode_locs - multi_p_locs[i] - pot = self.get_dipole_potential(p, r) - potentials += pot - return potentials - -def get_current_dipole_moment(dist, current): - """ - Return current dipole moment vector P and P_tot of cell. - - Parameters - ---------- - current : ndarray, dtype=float - Either an array containing all transmembrane currents - from all compartments of the cell, or an array of all - axial currents between compartments in cell in units of nA - dist : ndarray, dtype=float - When input current is an array of axial currents, - dist is the length of each axial current. - When current is an array of transmembrane - currents, dist is the position vector of each - compartment middle. Unit is (µm). - - Returns - ------- - P : ndarray, dtype=float - Array containing the current dipole moment for all - timesteps in the x-, y- and z-direction in units of (nA*µm) - P_tot : ndarray, dtype=float - Array containing the magnitude of the - current dipole moment vector for all timesteps in units of (nA*µm) - - Examples - -------- - Get current dipole moment vector and scalar moment from axial currents - computed from membrane potentials: - - >>> import LFPy - >>> import numpy as np - >>> cell = LFPy.Cell('PATH/TO/MORPHOLOGY', extracellular=False) - >>> syn = LFPy.Synapse(cell, idx=cell.get_closest_idx(0,0,1000), - >>> syntype='ExpSyn', e=0., tau=1., weight=0.001) - >>> syn.set_spike_times(np.mgrid[20:100:20]) - >>> cell.simulate(rec_vmem=True, rec_imem=False) - >>> d_list, i_axial = cell.get_axial_currents() - >>> P_ax, P_ax_tot = LFPy.get_current_dipole_moment(d_list, i_axial) - - Get current dipole moment vector and scalar moment from transmembrane - currents using the extracellular mechanism in NEURON: - - >>> import LFPy - >>> import numpy as np - >>> cell = LFPy.Cell('PATH/TO/MORPHOLOGY', extracellular=True) - >>> syn = LFPy.Synapse(cell, idx=cell.get_closest_idx(0,0,1000), - >>> syntype='ExpSyn', e=0., tau=1., weight=0.001) - >>> syn.set_spike_times(np.mgrid[20:100:20]) - >>> cell.simulate(rec_vmem=False, rec_imem=True) - >>> P_imem, P_imem_tot = LFPy.get_current_dipole_moment(np.c_[cell.xmid, - >>> cell.ymid, - >>> cell.zmid], - >>> cell.imem) - - """ - P = np.dot(current.T, dist) - P_tot = np.sqrt(np.sum(P**2, axis=1)) - return P, P_tot - -class MEG(object): - """ - Basic class for computing magnetic field from current dipole moment. - For this purpose we use the Biot-Savart law derived from Maxwell's equations - under the assumption of negligible magnetic induction effects (Nunez and - Srinivasan, Oxford University Press, 2006): - - .. math:: \mathbf{H} = \\frac{\\mathbf{p} \\times \\mathbf{R}}{4 \pi R^3} - - where :math:`\mathbf{p}` is the current dipole moment, :math:`\mathbf{R}` - the vector between dipole source location and measurement location, and - :math:`R=|\mathbf{R}|` - - Note that the magnetic field :math:`\mathbf{H}` is related to the magnetic - field :math:`\mathbf{B}` as :math:`\mu_0 \mathbf{H} = \mathbf{B}-\mathbf{M}` - where :math:`\mu_0` is the permeability of free space (very close to - permebility of biological tissues). :math:`\mathbf{M}` denotes material - magnetization (also ignored) - - - Parameters - ---------- - sensor_locations : ndarray, dtype=float - shape (n_locations x 3) array with x,y,z-locations of measurement - devices where magnetic field of current dipole moments is calculated. - In unit of (µm) - mu : float - Permeability. Default is permeability of vacuum (mu_0 = 4*pi*1E-7 T*m/A) - - - Examples - -------- - Define cell object, create synapse, compute current dipole moment: - - >>> import LFPy, os, numpy as np, matplotlib.pyplot as plt - >>> cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc'), - >>> passive=True) - >>> cell.set_pos(0., 0., 0.) - >>> syn = LFPy.Synapse(cell, idx=0, syntype='ExpSyn', weight=0.01, record_current=True) - >>> syn.set_spike_times_w_netstim() - >>> cell.simulate(rec_current_dipole_moment=True) - - Compute the dipole location as an average of segment locations weighted by membrane area: - - >>> dipole_location = (cell.area * np.c_[cell.xmid, cell.ymid, cell.zmid].T / cell.area.sum()).sum(axis=1) - - Instantiate the LFPy.MEG object, compute and plot the magnetic signal in a sensor location: - - >>> sensor_locations = np.array([[1E4, 0, 0]]) - >>> meg = LFPy.MEG(sensor_locations) - >>> H = meg.calculate_H(cell.current_dipole_moment, dipole_location) - >>> plt.subplot(311) - >>> plt.plot(cell.tvec, cell.somav) - >>> plt.subplot(312) - >>> plt.plot(cell.tvec, syn.i) - >>> plt.subplot(313) - >>> plt.plot(cell.tvec, H[0]) - - Raises - ------ - AssertionError - If dimensionality of sensor_locations is wrong - """ - def __init__(self, sensor_locations, mu=4*np.pi*1E-7): - """ - Initialize class MEG - """ - try: - assert(sensor_locations.ndim == 2) - except AssertionError: - raise AssertionError('sensor_locations.ndim != 2') - try: - assert(sensor_locations.shape[1] == 3) - except AssertionError: - raise AssertionError('sensor_locations.shape[1] != 3') - - # set attributes - self.sensor_locations = sensor_locations - self.mu = mu - - - def calculate_H(self, current_dipole_moment, dipole_location): - """ - Compute magnetic field H from single current-dipole moment localized - somewhere in space - - Parameters - ---------- - current_dipole_moment : ndarray, dtype=float - shape (n_timesteps x 3) array with x,y,z-components of current- - dipole moment time series data in units of (nA µm) - dipole_location : ndarray, dtype=float - shape (3, ) array with x,y,z-location of dipole in units of (µm) - - Returns - ------- - ndarray, dtype=float - shape (n_locations x n_timesteps x 3) array with x,y,z-components - of the magnetic field :math:`\\mathbf{H}` in units of (nA/µm) - - Raises - ------ - AssertionError - If dimensionality of current_dipole_moment and/or dipole_location - is wrong - """ - try: - assert(current_dipole_moment.ndim == 2) - except AssertionError: - raise AssertionError('current_dipole_moment.ndim != 2') - try: - assert(current_dipole_moment.shape[1] == 3) - except AssertionError: - raise AssertionError('current_dipole_moment.shape[1] != 3') - try: - assert(dipole_location.shape == (3, )) - except AssertionError: - raise AssertionError('dipole_location.shape != (3, )') - - - # container - H = np.empty((self.sensor_locations.shape[0], - current_dipole_moment.shape[0], - 3)) - # iterate over sensor locations - for i, r in enumerate(self.sensor_locations): - R = r - dipole_location - assert(R.ndim==1 and R.size == 3) - try: - assert(np.allclose(R, np.zeros(3)) == False) - except AssertionError: - raise AssertionError('Identical dipole and sensor location.') - H[i, ] = np.cross(current_dipole_moment, - R) / (4 * np.pi * np.sqrt((R**2).sum())**3) - - return H - - - def calculate_H_from_iaxial(self, cell): - """ - Computes the magnetic field in space from axial currents computed from - membrane potential values and axial resistances of multicompartment - cells. - - See: - Blagoev et al. (2007) Modelling the magnetic signature of neuronal - tissue. NeuroImage 37 (2007) 137–148 - DOI: 10.1016/j.neuroimage.2007.04.033 - - for details on the biophysics governing magnetic fields from axial - currents. - - Parameters - ---------- - cell : object - LFPy.Cell-like object. Must have attribute vmem containing recorded - membrane potentials in units of mV - - Examples - -------- - Define cell object, create synapse, compute current dipole moment: - - >>> import LFPy, os, numpy as np, matplotlib.pyplot as plt - >>> cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc'), - >>> passive=True) - >>> cell.set_pos(0., 0., 0.) - >>> syn = LFPy.Synapse(cell, idx=0, syntype='ExpSyn', weight=0.01, record_current=True) - >>> syn.set_spike_times_w_netstim() - >>> cell.simulate(rec_vmem=True) - - Instantiate the LFPy.MEG object, compute and plot the magnetic signal in a sensor location: - - >>> sensor_locations = np.array([[1E4, 0, 0]]) - >>> meg = LFPy.MEG(sensor_locations) - >>> H = meg.calculate_H_from_iaxial(cell) - >>> plt.subplot(311) - >>> plt.plot(cell.tvec, cell.somav) - >>> plt.subplot(312) - >>> plt.plot(cell.tvec, syn.i) - >>> plt.subplot(313) - >>> plt.plot(cell.tvec, H[0]) - - Returns - ------- - H : ndarray, dtype=float - shape (n_locations x n_timesteps x 3) array with x,y,z-components - of the magnetic field :math:`\\mathbf{H}` in units of (nA/µm) - """ - i_axial, d_vectors, pos_vectors = cell.get_axial_currents_from_vmem() - R = self.sensor_locations - H = np.zeros((R.shape[0], cell.tvec.size, 3)) - - for i, R_ in enumerate(R): - for i_, d_, r_ in zip(i_axial, d_vectors, pos_vectors): - r_rel = R_ - r_ - H[i, :, :] += np.dot(i_.reshape((-1, 1)), - np.cross(d_, r_rel).reshape((1, -1)) - ) / (4*np.pi*np.sqrt((r_rel**2).sum())**3) - return H diff --git a/LFPy-2.0.7/LFPy/inputgenerators.py b/LFPy-2.0.7/LFPy/inputgenerators.py deleted file mode 100644 index 042f8f9..0000000 --- a/LFPy-2.0.7/LFPy/inputgenerators.py +++ /dev/null @@ -1,106 +0,0 @@ -"""Copyright (C) 2012 Computational Neuroscience Group, NMBU. - -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. - -""" - -from __future__ import division -import numpy as np -import scipy.stats -import warnings - -def get_activation_times_from_distribution(n, tstart=0., tstop=1.E6, - distribution=scipy.stats.expon, - rvs_args=dict(loc=0, scale=1), - maxiter=1E6): - """ - Construct a length n list of ndarrays containing continously increasing - random numbers on the interval [tstart, tstop], with intervals drawn from - a chosen continuous random variable distribution subclassed from - scipy.stats.rv_continous, e.g., scipy.stats.expon or scipy.stats.gamma. - - The most likely initial first entry is - ``tstart + method.rvs(size=inf, **rvs_args).mean()`` - - Parameters - ---------- - n : int - number of ndarrays in list - tstart : float - minimum allowed value in ndarrays - tstop : float - maximum allowed value in ndarrays - distribution : object - subclass of scipy.stats.rv_continous. Distributions - producing negative values should be avoided if continously increasing - values should be obtained, i.e., the probability density function - ``(distribution.pdf(**rvs_args))`` should be ``0`` for ``x < 0``, but this is not - explicitly tested for. - rvs_args : dict - parameters for method.rvs method. If "size" is in dict, then tstop will - be ignored, and each ndarray in output list will be - ``distribution.rvs(**rvs_args).cumsum() + tstart``. If size is not given in dict, - then values up to tstop will be included - maxiter : int - maximum number of iterations - - - Returns - ------- - list of ndarrays - length n list of arrays containing data - - Raises - ------ - AssertionError - if distribution does not have the 'rvs' attribute - StopIteration - if number of while-loop iterations reaches maxiter - - - Examples - -------- - Create n sets of activation times with intervals drawn from the exponential - distribution, with rate expectation lambda 10 s^-1 (thus - scale=1000 / lambda). Here we assume output in units of ms - - >>> from LFPy.inputgenerators import get_activation_times_from_distribution - >>> import scipy.stats as st - >>> import matplotlib.pyplot as plt - >>> times = get_activation_times_from_distribution(n=10, tstart=0., tstop=1000., - >>> distribution=st.expon, - >>> rvs_args=dict(loc=0., - >>> scale=100.)) - """ - try: - assert hasattr(distribution, 'rvs') - except AssertionError: - raise AssertionError('distribution={} must have the attribute "rvs"'.format(distribution)) - - times = [] - if 'size' in rvs_args.keys(): - for i in range(n): - times += [distribution.rvs(**rvs_args).cumsum() + tstart] - else: - for i in range(n): - values = distribution.rvs(size=1000, **rvs_args).cumsum() + tstart - iter = 0 - while values[-1] < tstop and iter < maxiter: - values = np.r_[values, distribution.rvs(size=1000, **rvs_args).cumsum() + values[-1]] - iter += 1 - - if iter == maxiter: - raise StopIteration('maximum number of iterations reach. Con') - - times += [values[values < tstop]] - - return times - diff --git a/LFPy-2.0.7/LFPy/lfpcalc.py b/LFPy-2.0.7/LFPy/lfpcalc.py deleted file mode 100644 index 716088f..0000000 --- a/LFPy-2.0.7/LFPy/lfpcalc.py +++ /dev/null @@ -1,847 +0,0 @@ -# -*- coding: utf-8 -*- -"""Copyright (C) 2012 Computational Neuroscience Group, NMBU. - -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. - -""" - -from __future__ import division -import numpy as np - - -def return_dist_from_segments(xstart, ystart, zstart, xend, yend, zend, p): - """ - Returns distance and closest point on line segments from point p - """ - px = xend-xstart - py = yend-ystart - pz = zend-zstart - - delta = px*px + py*py + pz*pz - u = ((p[0] - xstart) * px + (p[1] - ystart) * py + (p[2] - zstart) * pz) / delta - u[u > 1] = 1.0 - u[u < 0] = 0.0 - - closest_point = np.array([xstart + u * px, - ystart + u * py, - zstart + u * pz]) - dist = np.sqrt(np.sum((closest_point.T - p)**2, axis=1)) - return dist, closest_point - - -def calc_lfp_linesource_anisotropic(cell, x, y, z, sigma, r_limit): - """Calculate electric field potential using the line-source method, all - compartments treated as line sources, even soma. - - Parameters - ---------- - cell: obj - LFPy.Cell or LFPy.TemplateCell instance - x : float - extracellular position, x-axis - y : float - extracellular position, y-axis - z : float - extracellular position, z-axis - sigma : array - extracellular conductivity [sigma_x, sigma_y, sigma_z] - r_limit : np.ndarray - minimum distance to source current for each compartment - """ - - #some variables for h, r2, r_soma calculations - xstart = cell.xstart - xend = cell.xend - ystart = cell.ystart - yend = cell.yend - zstart = cell.zstart - zend = cell.zend - l_vecs = np.array([xend - xstart, - yend - ystart, - zend - zstart]) - - pos = np.array([x, y, z]) - - rs, closest_points = return_dist_from_segments(xstart, ystart, zstart, - xend, yend, zend, pos) - - dx2 = (xend - xstart)**2 - dy2 = (yend - ystart)**2 - dz2 = (zend - zstart)**2 - a = (sigma[1] * sigma[2] * dx2 + - sigma[0] * sigma[2] * dy2 + - sigma[0] * sigma[1] * dz2) - - b = -2 * (sigma[1] * sigma[2] * (x - xstart) * (xend - xstart) + - sigma[0] * sigma[2] * (y - ystart) * (yend - ystart) + - sigma[0] * sigma[1] * (z - zstart) * (zend - zstart)) - c = (sigma[1] * sigma[2] * (x - xstart)**2 + - sigma[0] * sigma[2] * (y - ystart)**2 + - sigma[0] * sigma[1] * (z - zstart)**2) - - for idx in np.where(rs < r_limit)[0]: - r, closest_point, l_vec = rs[idx], closest_points[:, idx], l_vecs[:, idx] - - p_ = pos.copy() - if np.abs(r) < 1e-12: - if np.abs(l_vec[0]) < 1e-12: - p_[0] += r_limit[idx] - elif np.abs(l_vec[1]) < 1e-12: - p_[1] += r_limit[idx] - elif np.abs(l_vec[2]) < 1e-12: - p_[2] += r_limit[idx] - else: - displace_vec = np.array([-l_vec[1], l_vec[0], 0]) - displace_vec = displace_vec / np.sqrt(np.sum(displace_vec**2)) * r_limit[idx] - p_[:] += displace_vec - else: - p_[:] = pos + (pos - closest_point) * (r_limit[idx] - r) / r - - if np.sqrt(np.sum((p_ - closest_point)**2)) - r_limit[idx] > 1e-9: - print(p_, closest_point) - - raise RuntimeError("Segment adjustment not working") - - b[idx] = -2 * (sigma[1] * sigma[2] * (p_[0] - xstart[idx]) * (xend[idx] - xstart[idx]) + - sigma[0] * sigma[2] * (p_[1] - ystart[idx]) * (yend[idx] - ystart[idx]) + - sigma[0] * sigma[1] * (p_[2] - zstart[idx]) * (zend[idx] - zstart[idx])) - c[idx] = (sigma[1] * sigma[2] * (p_[0] - xstart[idx])**2 + - sigma[0] * sigma[2] * (p_[1] - ystart[idx])**2 + - sigma[0] * sigma[1] * (p_[2] - zstart[idx])**2) - - [i] = np.where(np.abs(b) <= 1e-6) - [iia] = np.where(np.bitwise_and(np.abs(4 * a * c - b*b) < 1e-6, np.abs(a - c) < 1e-6)) - [iib] = np.where(np.bitwise_and(np.abs(4 * a * c - b*b) < 1e-6, np.abs(a - c) >= 1e-6)) - [iii] = np.where(np.bitwise_and(4 * a * c - b*b < -1e-6, np.abs(b) > 1e-6)) - [iiii] = np.where(np.bitwise_and(4 * a * c - b*b > 1e-6, np.abs(b) > 1e-6)) - - if len(i) + len(iia) + len(iib) + len(iii) + len(iiii) != cell.totnsegs: - print(a, b, c) - print(i, iia, iib, iii, iiii) - raise RuntimeError - - mapping = np.zeros(cell.totnsegs) - mapping[i] = _anisotropic_line_source_case_i(a[i], c[i]) - mapping[iia] = _anisotropic_line_source_case_iia(a[iia], c[iia]) - mapping[iib] = _anisotropic_line_source_case_iib(a[iib], b[iib], c[iib]) - mapping[iii] = _anisotropic_line_source_case_iii(a[iii], b[iii], c[iii]) - mapping[iiii] = _anisotropic_line_source_case_iiii(a[iiii], b[iiii], c[iiii]) - - if np.isnan(mapping).any(): - raise RuntimeError("NaN") - - return 1 / (4 * np.pi) * mapping / np.sqrt(a) - - -def calc_lfp_soma_as_point_anisotropic(cell, x, y, z, sigma, r_limit): - """Calculate electric field potential, soma is treated as point source, all - compartments except soma are treated as line sources. - - Parameters - ---------- - cell: obj - LFPy.Cell or LFPy.TemplateCell instance - x : float - extracellular position, x-axis - y : float - extracellular position, y-axis - z : float - extracellular position, z-axis - sigma : array - extracellular conductivity [sigma_x, sigma_y, sigma_z] - r_limit : np.ndarray - minimum distance to source current for each compartment - """ - - xstart = cell.xstart - xend = cell.xend - ystart = cell.ystart - yend = cell.yend - zstart = cell.zstart - zend = cell.zend - l_vecs = np.array([xend - xstart, yend - ystart, zend - zstart]) - - pos = np.array([x, y, z]) - - rs, closest_points = return_dist_from_segments(xstart, ystart, zstart, xend, yend, zend, pos) - - dx2 = (xend - xstart)**2 - dy2 = (yend - ystart)**2 - dz2 = (zend - zstart)**2 - a = (sigma[1] * sigma[2] * dx2 + - sigma[0] * sigma[2] * dy2 + - sigma[0] * sigma[1] * dz2) - - b = -2 * (sigma[1] * sigma[2] * (x - xstart) * (xend - xstart) + - sigma[0] * sigma[2] * (y - ystart) * (yend - ystart) + - sigma[0] * sigma[1] * (z - zstart) * (zend - zstart)) - c = (sigma[1] * sigma[2] * (x - xstart)**2 + - sigma[0] * sigma[2] * (y - ystart)**2 + - sigma[0] * sigma[1] * (z - zstart)**2) - - for idx in np.where(rs < r_limit)[0]: - r, closest_point, l_vec = rs[idx], closest_points[:, idx], l_vecs[:, idx] - - p_ = pos.copy() - if np.abs(r) < 1e-12: - if np.abs(l_vec[0]) < 1e-12: - p_[0] += r_limit[idx] - elif np.abs(l_vec[1]) < 1e-12: - p_[1] += r_limit[idx] - elif np.abs(l_vec[2]) < 1e-12: - p_[2] += r_limit[idx] - else: - displace_vec = np.array([-l_vec[1], l_vec[0], 0]) - displace_vec = displace_vec / np.sqrt(np.sum(displace_vec**2)) * r_limit[idx] - p_[:] += displace_vec - else: - p_[:] = pos + (pos - closest_point) * (r_limit[idx] - r) / r - - if np.sqrt(np.sum((p_ - closest_point)**2)) - r_limit[idx] > 1e-9: - print(p_, closest_point) - - raise RuntimeError("Segment adjustment not working") - - b[idx] = -2 * (sigma[1] * sigma[2] * (p_[0] - xstart[idx]) * (xend[idx] - xstart[idx]) + - sigma[0] * sigma[2] * (p_[1] - ystart[idx]) * (yend[idx] - ystart[idx]) + - sigma[0] * sigma[1] * (p_[2] - zstart[idx]) * (zend[idx] - zstart[idx])) - c[idx] = (sigma[1] * sigma[2] * (p_[0] - xstart[idx])**2 + - sigma[0] * sigma[2] * (p_[1] - ystart[idx])**2 + - sigma[0] * sigma[1] * (p_[2] - zstart[idx])**2) - - [i] = np.where(np.abs(b) <= 1e-6) - [iia] = np.where(np.bitwise_and(np.abs(4 * a * c - b*b) < 1e-6, np.abs(a - c) < 1e-6)) - [iib] = np.where(np.bitwise_and(np.abs(4 * a * c - b*b) < 1e-6, np.abs(a - c) >= 1e-6)) - [iii] = np.where(np.bitwise_and(4 * a * c - b*b < -1e-6, np.abs(b) > 1e-6)) - [iiii] = np.where(np.bitwise_and(4 * a * c - b*b > 1e-6, np.abs(b) > 1e-6)) - - if len(i) + len(iia) + len(iib) + len(iii) + len(iiii) != cell.totnsegs: - print(a, b, c) - print(i, iia, iib, iii, iiii) - raise RuntimeError - - mapping = np.zeros(cell.totnsegs) - mapping[i] = _anisotropic_line_source_case_i(a[i], c[i]) - mapping[iia] = _anisotropic_line_source_case_iia(a[iia], c[iia]) - mapping[iib] = _anisotropic_line_source_case_iib(a[iib], b[iib], c[iib]) - mapping[iii] = _anisotropic_line_source_case_iii(a[iii], b[iii], c[iii]) - mapping[iiii] = _anisotropic_line_source_case_iiii(a[iiii], b[iiii], c[iiii]) - - if np.isnan(mapping).any(): - raise RuntimeError("NaN") - - mapping /= np.sqrt(a) - - # Get compartment indices for somatic compartments (to be treated as point - # sources) - try: - somainds = cell.get_idx("soma") - except Exception: - raise Exception('Call {}.get_idx("soma") failed in method LFPy.lfpcalc.calc_lfp_soma_as_point'.format(cell)) - - dx2_soma = (cell.xmid[somainds] - x)**2 - dy2_soma = (cell.ymid[somainds] - y)**2 - dz2_soma = (cell.zmid[somainds] - z)**2 - - r2_soma = dx2_soma + dy2_soma + dz2_soma - - # Go through and correct all (if any) somatic idxs that are too close - for close_idx in np.where(np.abs(r2_soma) < 1e-6)[0]: - dx2_soma[close_idx] += 0.001 - r2_soma[close_idx] += 0.001 - - for close_idx in np.where(r2_soma < r_limit[somainds]**2)[0]: - # For anisotropic media, the direction in which to move points matter. - # Radial distance between point source and electrode is scaled to r_limit - r2_scale_factor = r_limit[somainds[close_idx]]*r_limit[somainds[close_idx]] / r2_soma[close_idx] - dx2_soma[close_idx] *= r2_scale_factor - dy2_soma[close_idx] *= r2_scale_factor - dz2_soma[close_idx] *= r2_scale_factor - - mapping[somainds] = 1/np.sqrt(sigma[1] * sigma[2] * dx2_soma - + sigma[0] * sigma[2] * dy2_soma - + sigma[0] * sigma[1] * dz2_soma) - - return 1. / (4 * np.pi) * mapping - - -def _anisotropic_line_source_case_i(a, c): - return np.log(np.sqrt(a / c) + np.sqrt(a / c + 1)) - - -def _anisotropic_line_source_case_iia(a, c): - return np.log(np.abs(1 + np.sqrt(a / c))) - - -def _anisotropic_line_source_case_iib(a, b, c): - return np.abs(np.log(np.abs(np.sign(b) * np.sqrt(a/c) + 1))) - - -def _anisotropic_line_source_case_iii(a, b, c): - return np.log(np.abs((2 * a + b + 2 * np.sqrt(a * (a + b + c))) - / (b + 2 * np.sqrt(a * c)))) - - -def _anisotropic_line_source_case_iiii(a, b, c): - return (np.arcsinh((2 * a + b) / np.sqrt(4 * a * c - b*b)) - - np.arcsinh(b / np.sqrt(4 * a * c - b*b))) - - -def calc_lfp_linesource(cell, x, y, z, sigma, r_limit): - - """Calculate electric field potential using the line-source method, all - compartments treated as line sources, including soma. - - Parameters - ---------- - cell: obj - LFPy.Cell or LFPy.TemplateCell like instance - x : float - extracellular position, x-axis - y : float - extracellular position, y-axis - z : float - extracellular position, z-axis - sigma : float - extracellular conductivity - r_limit : np.ndarray - minimum distance to source current for each compartment - """ - - #some variables for h, r2, r_soma calculations - xstart = cell.xstart - xend = cell.xend - ystart = cell.ystart - yend = cell.yend - zstart = cell.zstart - zend = cell.zend - - deltaS = _deltaS_calc(xstart, xend, ystart, yend, zstart, zend) - h = _h_calc(xstart, xend, ystart, yend, zstart, zend, deltaS, x, y, z) - r2 = _r2_calc(xend, yend, zend, x, y, z, h) - - too_close_idxs = np.where(r2 < r_limit*r_limit)[0] - r2[too_close_idxs] = r_limit[too_close_idxs]**2 - l = h + deltaS - hnegi = h < 0 - hposi = h >= 0 - lnegi = l < 0 - lposi = l >= 0 - - mapping = np.zeros(len(cell.xstart)) - - #case i, h < 0, l < 0 - [i] = np.where(hnegi & lnegi) - #case ii, h < 0, l >= 0 - [ii] = np.where(hnegi & lposi) - #case iii, h >= 0, l >= 0 - [iii] = np.where(hposi & lposi) - - - mapping[i] = _linesource_calc_case1(l[i], r2[i], h[i]) - mapping[ii] = _linesource_calc_case2(l[ii], r2[ii], h[ii]) - mapping[iii] = _linesource_calc_case3(l[iii], r2[iii], h[iii]) - return 1 / (4 * np.pi * sigma * deltaS) * mapping - - -def calc_lfp_soma_as_point(cell, x, y, z, sigma, r_limit): - - """Calculate electric field potential using the line-source method, - soma is treated as point/sphere source - - Parameters - ---------- - cell: obj - `LFPy.Cell` or `LFPy.TemplateCell` like instance - x : float - extracellular position, x-axis - y : float - extracellular position, y-axis - z : float - extracellular position, z-axis - sigma : float - extracellular conductivity in S/m - r_limit : np.ndarray - minimum distance to source current for each compartment. - """ - # get compartment indices for somatic compartments (to be treated as point - # sources) - try: - somainds = cell.get_idx("soma") - except Exception: - raise Exception('Call {}.get_idx("soma") failed in method LFPy.lfpcalc.calc_lfp_soma_as_point'.format(cell)) - - #some variables for h, r2, r_soma calculations - xstart = cell.xstart - xmid = cell.xmid[somainds] - xend = cell.xend - ystart = cell.ystart - ymid = cell.ymid[somainds] - yend = cell.yend - zstart = cell.zstart - zmid = cell.zmid[somainds] - zend = cell.zend - - deltaS = _deltaS_calc(xstart, xend, ystart, yend, zstart, zend) - h = _h_calc(xstart, xend, ystart, yend, zstart, zend, deltaS, x, y, z) - r2 = _r2_calc(xend, yend, zend, x, y, z, h) - r_soma = _r_soma_calc(xmid, ymid, zmid, x, y, z) - if np.any(r_soma < r_limit[somainds]): - print('Adjusting r-distance to soma segments') - r_soma[r_soma < r_limit[somainds] - ] = r_limit[somainds][r_soma < r_limit[somainds]] - - too_close_idxs = np.where(r2 < r_limit*r_limit)[0] - r2[too_close_idxs] = r_limit[too_close_idxs]**2 - l = h + deltaS - - hnegi = h < 0 - hposi = h >= 0 - lnegi = l < 0 - lposi = l >= 0 - - # Ensuring that soma is not treated as line-source - hnegi[somainds] = hposi[somainds] = lnegi[somainds] = lposi[somainds] = False - - #Line sources - #case i, h < 0, l < 0 - i = np.where(hnegi & lnegi) - #case ii, h < 0, l >= 0 - ii = np.where(hnegi & lposi) - #case iii, h >= 0, l >= 0 - iii = np.where(hposi & lposi) - - #Summarizing all potential contributions - mapping = np.zeros(cell.totnsegs) - mapping[somainds] = 1 / r_soma - deltaS[somainds] = 1. - - mapping[i] = _linesource_calc_case1(l[i], r2[i], h[i]) - mapping[ii] = _linesource_calc_case2(l[ii], r2[ii], h[ii]) - mapping[iii] = _linesource_calc_case3(l[iii], r2[iii], h[iii]) - - return 1 / (4 * np.pi * sigma * deltaS) * mapping - - -def _linesource_calc_case1(l_i, r2_i, h_i): - """Calculates linesource contribution for case i""" - bb = np.sqrt(h_i*h_i + r2_i) - h_i - cc = np.sqrt(l_i*l_i + r2_i) - l_i - dd = np.log(bb / cc) - return dd - - -def _linesource_calc_case2(l_ii, r2_ii, h_ii): - """Calculates linesource contribution for case ii""" - bb = np.sqrt(h_ii*h_ii + r2_ii) - h_ii - cc = (l_ii + np.sqrt(l_ii*l_ii + r2_ii)) / r2_ii - dd = np.log(bb * cc) - return dd - - -def _linesource_calc_case3(l_iii, r2_iii, h_iii): - """Calculates linesource contribution for case iii""" - bb = np.sqrt(l_iii*l_iii + r2_iii) + l_iii - cc = np.sqrt(h_iii*h_iii + r2_iii) + h_iii - dd = np.log(bb / cc) - return dd - - -def _deltaS_calc(xstart, xend, ystart, yend, zstart, zend): - """Returns length of each segment""" - deltaS = np.sqrt((xstart - xend)**2 + (ystart - yend)**2 + - (zstart-zend)**2) - return deltaS - - -def _h_calc(xstart, xend, ystart, yend, zstart, zend, deltaS, x, y, z): - """Subroutine used by calc_lfp_*()""" - aa = np.array([x - xend, y - yend, z-zend]) - bb = np.array([xend - xstart, yend - ystart, zend - zstart]) - cc = np.sum(aa*bb, axis=0) - hh = cc / deltaS - return hh - - -def _r2_calc(xend, yend, zend, x, y, z, h): - """Subroutine used by calc_lfp_*()""" - r2 = (x-xend)**2 + (y-yend)**2 + (z-zend)**2 - h**2 - return abs(r2) - - -def _r_soma_calc(xmid, ymid, zmid, x, y, z): - """calculate the distance to soma midpoint""" - r_soma = np.sqrt((x - xmid)**2 + (y - ymid)**2 + (z - zmid)**2) - return r_soma - - -def calc_lfp_pointsource(cell, x, y, z, sigma, r_limit): - """Calculate extracellular potentials using the point-source - equation on all compartments - - Parameters - ---------- - cell: obj - LFPy.Cell or LFPy.TemplateCell like instance - x : float - extracellular position, x-axis - y : float - extracellular position, y-axis - z : float - extracellular position, z-axis - sigma : float - extracellular conductivity - r_limit : np.ndarray - minimum distance to source current for each compartment - """ - - r2 = (cell.xmid - x)**2 + (cell.ymid - y)**2 + (cell.zmid - z)**2 - r2 = _check_rlimit_point(r2, r_limit) - mapping = 1 / (4 * np.pi * sigma * np.sqrt(r2)) - return mapping - - -def calc_lfp_pointsource_anisotropic(cell, x, y, z, sigma, r_limit): - """Calculate extracellular potentials using the anisotropic point-source - equation on all compartments - - Parameters - ---------- - cell: obj - LFPy.Cell or LFPy.TemplateCell instance - x : float - extracellular position, x-axis - y : float - extracellular position, y-axis - z : float - extracellular position, z-axis - sigma : array - extracellular conductivity in [x,y,z]-direction - r_limit : np.ndarray - minimum distance to source current for each compartment - """ - - dx2 = (cell.xmid - x)**2 - dy2 = (cell.ymid - y)**2 - dz2 = (cell.zmid - z)**2 - - r2 = dx2 + dy2 + dz2 - if (np.abs(r2) < 1e-6).any(): - dx2[np.abs(r2) < 1e-6] += 0.001 - r2[np.abs(r2) < 1e-6] += 0.001 - - close_idxs = r2 < r_limit*r_limit - - # For anisotropic media, the direction in which to move points matter. - # Radial distance between point source and electrode is scaled to r_limit - r2_scale_factor = r_limit[close_idxs]*r_limit[close_idxs] / r2[close_idxs] - dx2[close_idxs] *= r2_scale_factor - dy2[close_idxs] *= r2_scale_factor - dz2[close_idxs] *= r2_scale_factor - - sigma_r = np.sqrt(sigma[1] * sigma[2] * dx2 - + sigma[0] * sigma[2] * dy2 - + sigma[0] * sigma[1] * dz2) - - mapping = 1 / (4 * np.pi * sigma_r) - return mapping - - -def _check_rlimit_point(r2, r_limit): - """Correct r2 so that r2 >= r_limit**2 for all values""" - inds = r2 < r_limit*r_limit - r2[inds] = r_limit[inds]*r_limit[inds] - return r2 - - -def calc_lfp_pointsource_moi(cell, x, y, z, sigma_T, sigma_S, sigma_G, - steps, h, r_limit, **kwargs): - """Calculate extracellular potentials using the point-source - equation on all compartments for in vitro Microelectrode Array (MEA) slices - - Parameters - ---------- - cell: obj - LFPy.Cell or LFPy.TemplateCell like instance - x : float - extracellular position, x-axis - y : float - extracellular position, y-axis - z : float - extracellular position, z-axis - sigma_T : float - extracellular conductivity in tissue slice - sigma_G : float - Conductivity of MEA glass electrode plane. - Should normally be zero for MEA set up. - sigma_S : float - Conductivity of saline bath that tissue slice is immersed in - steps : int - Number of steps to average over the in technically infinite sum - h : float - Slice thickness in um. - r_limit : np.ndarray - minimum distance to source current for each compartment - """ - - dx2 = (x - cell.xmid)**2 - dy2 = (y - cell.ymid)**2 - dz2 = (z - cell.zmid)**2 - - dL2 = dx2 + dy2 - inds = np.where(dL2 + dz2 < r_limit*r_limit)[0] - dL2[inds] = r_limit[inds]*r_limit[inds] - dz2[inds] - - def _omega(dz): - return 1/np.sqrt(dL2 + dz*dz) - - WTS = (sigma_T - sigma_S)/(sigma_T + sigma_S) - WTG = (sigma_T - sigma_G)/(sigma_T + sigma_G) - - mapping = _omega(z - cell.zmid) - mapping += (WTS * _omega(z + cell.zmid - 2*h) + - WTG * _omega(z + cell.zmid)) - - n = np.arange(1, steps) - a = (WTS*WTG)**n[:, None] * (WTS * _omega(z + cell.zmid - 2*(n[:, None] + 1)*h) + - WTG * _omega(z + cell.zmid + 2*n[:, None]*h) + - _omega(z - cell.zmid + 2*n[:, None]*h) + - _omega(z - cell.zmid - 2*n[:, None]*h)) - mapping += np.sum(a, axis=0) - mapping *= 1/(4*np.pi*sigma_T) - - return mapping - - -def calc_lfp_linesource_moi(cell, x, y, z, sigma_T, sigma_S, sigma_G, - steps, h, r_limit, **kwargs): - """Calculate extracellular potentials using the line-source - equation on all compartments for in vitro Microelectrode Array (MEA) slices - - Parameters - ---------- - cell: obj - LFPy.Cell or LFPy.TemplateCell like instance - x : float - extracellular position, x-axis - y : float - extracellular position, y-axis - z : float - extracellular position, z-axis - sigma_T : float - extracellular conductivity in tissue slice - sigma_G : float - Conductivity of MEA glass electrode plane. - Should normally be zero for MEA set up, and for this method, - only zero valued sigma_G is supported. - sigma_S : float - Conductivity of saline bath that tissue slice is immersed in - steps : int - Number of steps to average over the in technically infinite sum - h : float - Slice thickness in um. - r_limit : np.ndarray - minimum distance to source current for each compartment - """ - - if np.abs(z) > 1e-9: - raise RuntimeError("This method can only handle electrodes " - "at the MEA plane z=0") - if np.abs(sigma_G) > 1e-9: - raise RuntimeError("This method can only handle sigma_G=0, i.e.," - "a non-conducting MEA glass electrode plane.") - - xstart = cell.xstart - xend = cell.xend - ystart = cell.ystart - yend = cell.yend - zstart = cell.zstart - zend = cell.zend - x0, y0, z0 = cell.xstart, cell.ystart, cell.zstart - x1, y1, z1 = cell.xend, cell.yend, cell.zend - - pos = np.array([x, y, z]) - rs, closest_points = return_dist_from_segments(xstart, ystart, zstart, - xend, yend, zend, pos) - z0_ = z0.copy() - z0_[np.where(rs < r_limit)] = r_limit[np.where(rs < r_limit)] - - ds = _deltaS_calc(xstart, xend, ystart, yend, zstart, zend) - factor_a = ds*ds - dx = x1 - x0 - dy = y1 - y0 - dz = z1 - z0 - a_x = x - x0 - a_y = y - y0 - W = (sigma_T - sigma_S)/(sigma_T + sigma_S) - num = np.zeros(factor_a.shape) - den = np.zeros(factor_a.shape) - - def _omega(a_z): - #See Rottman integration formula 46) page 137 for explanation - - factor_b = - a_x*dx - a_y*dy - a_z*dz - factor_c = a_x*a_x + a_y*a_y + a_z*a_z - b_2_ac = factor_b*factor_b - factor_a * factor_c - - case1_idxs = np.where(np.abs(b_2_ac) <= 1e-12) - case2_idxs = np.where(np.abs(b_2_ac) > 1e-12) - - if not len(case1_idxs) == 0: - num[case1_idxs] = factor_a[case1_idxs] + factor_b[case1_idxs] - den[case1_idxs] = factor_b[case1_idxs] - if not len(case2_idxs) == 0: - num[case2_idxs] = (factor_a[case2_idxs] + factor_b[case2_idxs] + - ds[case2_idxs]*np.sqrt(factor_a[case2_idxs] + - 2*factor_b[case2_idxs] + factor_c[case2_idxs])) - den[case2_idxs] = (factor_b[case2_idxs] + - ds[case2_idxs]*np.sqrt(factor_c[case2_idxs])) - return np.log(num/den) - - mapping = _omega(-z0_) - n = 1 - while n < steps: - mapping += W**n * (_omega(2*n*h - z0_) + _omega(-2*n*h - z0_)) - n += 1 - - mapping *= 2/(4*np.pi*sigma_T * ds) - - return mapping - - -def calc_lfp_soma_as_point_moi(cell, x, y, z, sigma_T, sigma_S, sigma_G, - steps, h, r_limit, **kwargs): - """Calculate extracellular potentials for in vitro - Microelectrode Array (MEA) slices, where soma (compartment zero) is - treated as a point source, and all other compartments as line sources. - - Parameters - ---------- - cell: obj - LFPy.Cell or LFPy.TemplateCell like instance - x : float - extracellular position, x-axis - y : float - extracellular position, y-axis - z : float - extracellular position, z-axis - sigma_T : float - extracellular conductivity in tissue slice - sigma_G : float - Conductivity of MEA glass electrode plane. - Should normally be zero for MEA set up, and for this method, - only zero valued sigma_G is supported. - sigma_S : float - Conductivity of saline bath that tissue slice is immersed in - steps : int - Number of steps to average over the in technically infinite sum - h : float - Slice thickness in um. - r_limit : np.ndarray - minimum distance to source current for each compartment - """ - - if np.abs(z) > 1e-9: - raise RuntimeError("This method can only handle electrodes " - "at the MEA plane z=0") - if np.abs(sigma_G) > 1e-9: - raise RuntimeError("This method can only handle sigma_G=0, i.e.," - "a non-conducting MEA glass electrode plane.") - - xstart = cell.xstart - xend = cell.xend - ystart = cell.ystart - yend = cell.yend - zstart = cell.zstart - zend = cell.zend - x0, y0, z0 = cell.xstart, cell.ystart, cell.zstart - x1, y1, z1 = cell.xend, cell.yend, cell.zend - - pos = np.array([x, y, z]) - rs, closest_points = return_dist_from_segments(xstart, ystart, zstart, - xend, yend, zend, pos) - z0_ = np.array(z0) - if np.any(rs < r_limit): - z0_[rs < r_limit] = r_limit - - - ds = _deltaS_calc(xstart, xend, ystart, yend, zstart, zend) - factor_a = ds*ds - dx = x1 - x0 - dy = y1 - y0 - dz = z1 - z0 - a_x = x - x0 - a_y = y - y0 - W = (sigma_T - sigma_S)/(sigma_T + sigma_S) - num = np.zeros(factor_a.shape) - den = np.zeros(factor_a.shape) - - def _omega(a_z): - #See Rottman integration formula 46) page 137 for explanation - - factor_b = - a_x*dx - a_y*dy - a_z*dz - factor_c = a_x*a_x + a_y*a_y + a_z*a_z - b_2_ac = factor_b*factor_b - factor_a * factor_c - - case1_idxs = np.where(np.abs(b_2_ac) <= 1e-12) - case2_idxs = np.where(np.abs(b_2_ac) > 1e-12) - - if not len(case1_idxs) == 0: - num[case1_idxs] = factor_a[case1_idxs] + factor_b[case1_idxs] - den[case1_idxs] = factor_b[case1_idxs] - if not len(case2_idxs) == 0: - num[case2_idxs] = (factor_a[case2_idxs] + factor_b[case2_idxs] + - ds[case2_idxs]*np.sqrt(factor_a[case2_idxs] + - 2*factor_b[case2_idxs] + factor_c[case2_idxs])) - den[case2_idxs] = (factor_b[case2_idxs] + - ds[case2_idxs]*np.sqrt(factor_c[case2_idxs])) - return np.log(num/den) - - mapping = _omega(-z0_) - n = 1 - while n < steps: - mapping += W**n * (_omega(2*n*h - z0) + _omega(-2*n*h - z0)) - n += 1 - - mapping *= 2/(4*np.pi*sigma_T * ds) - - # NOW DOING SOMA - - # get compartment indices for somatic compartments (to be treated as point - # sources) - try: - somainds = cell.get_idx("soma") - except Exception: - raise Exception('Call {}.get_idx("soma") failed in method LFPy.lfpcalc.calc_lfp_soma_as_point'.format(cell)) - - dx2 = (x - cell.xmid[somainds])**2 - dy2 = (y - cell.ymid[somainds])**2 - dz2 = (z - cell.zmid[somainds])**2 - - dL2 = dx2 + dy2 - inds = np.where(dL2 + dz2 < r_limit[somainds]*r_limit[somainds])[0] - dL2[inds] = r_limit[inds]*r_limit[inds] - dz2[inds] - - def _omega(dz): - return 1/np.sqrt(dL2 + dz*dz) - - mapping[somainds] = _omega(z - cell.zmid[somainds]) - mapping[somainds] += (W * _omega(cell.zmid[somainds] - 2*h) + - _omega(cell.zmid[somainds])) - - n = np.arange(1, steps) - a = (W)**n[:, None] * (W * _omega(+ cell.zmid[somainds] - 2*(n[:, None] + 1)*h) + - 2 * _omega(+ cell.zmid[somainds] + 2*n[:, None]*h) + - _omega(+ cell.zmid[somainds] - 2*n[:, None]*h)) - mapping[somainds] += np.sum(a, axis=0) - mapping[somainds] *= 1/(4*np.pi*sigma_T) - - return mapping \ No newline at end of file diff --git a/LFPy-2.0.7/LFPy/network.py b/LFPy-2.0.7/LFPy/network.py deleted file mode 100644 index 661705b..0000000 --- a/LFPy-2.0.7/LFPy/network.py +++ /dev/null @@ -1,1626 +0,0 @@ -# -*- coding: utf-8 -*- -"""Defines classes and methods used by example_parallel_network.py script - -Copyright (C) 2012 Computational Neuroscience Group, NMBU. - -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. - -""" -from __future__ import division -import numpy as np -import os -import scipy.stats as stats -import h5py -from mpi4py import MPI -import neuron -from .templatecell import TemplateCell -import scipy.sparse as ss - -# set up MPI environment -COMM = MPI.COMM_WORLD -SIZE = COMM.Get_size() -RANK = COMM.Get_rank() - - -flattenlist = lambda lst: [item for sublist in lst for item in sublist] - - -################################################################################ -# NetworkCell class that has a create_synapse method that -# creates a synapse on the target cell, and a create_spike_detector method that -# allows for connecting to a synapse on a target cell. All other methods and -# attributes are inherited from the standard LFPy.TemplateCell class -################################################################################ -class NetworkCell(TemplateCell): - """ - class NetworkCell - - Similar to `LFPy.TemplateCell` with the addition of some attributes and - methods allowing for spike communication between parallel RANKs. - - This class allow using NEURON templates with some limitations. - - This takes all the same parameters as the Cell class, but requires three - more template related parameters - - Parameters - ---------- - morphology : str - path to morphology file - templatefile : str - File with cell template definition(s) - templatename : str - Cell template-name used for this cell object - templateargs : str - Parameters provided to template-definition - v_init : float - Initial membrane potential. Default to -65. - Ra : float - axial resistance. Defaults to 150. - cm : float - membrane capacitance. Defaults to 1.0 - passive : bool - Passive mechanisms are initialized if True. Defaults to True - passive_parameters : dict - parameter dictionary with values for the passive membrane mechanism in - NEURON ('pas'). The dictionary must contain keys 'g_pas' and 'e_pas', - like the default: passive_parameters=dict(g_pas=0.001, e_pas=-70) - extracellular : bool - switch for NEURON's extracellular mechanism. Defaults to False - dt: float - Simulation time step. Defaults to 2**-4 - tstart : float - initialization time for simulation <= 0 ms. Defaults to 0. - tstop : float - stop time for simulation > 0 ms. Defaults to 100. - nsegs_method : 'lambda100' or 'lambda_f' or 'fixed_length' or None - nseg rule, used by NEURON to determine number of compartments. - Defaults to 'lambda100' - max_nsegs_length : float or None - max segment length for method 'fixed_length'. Defaults to None - lambda_f : int - AC frequency for method 'lambda_f'. Defaults to 100 - d_lambda : float - parameter for d_lambda rule. Defaults to 0.1 - delete_sections : bool - delete pre-existing section-references. Defaults to True - custom_code : list or None - list of model-specific code files ([.py/.hoc]). Defaults to None - custom_fun : list or None - list of model-specific functions with args. Defaults to None - custom_fun_args : list or None - list of args passed to custom_fun functions. Defaults to None - pt3d : bool - use pt3d-info of the cell geometries switch. Defaults to False - celsius : float or None - Temperature in celsius. If nothing is specified here - or in custom code it is 6.3 celcius - verbose : bool - verbose output switch. Defaults to False - - Examples - -------- - - >>> import LFPy - >>> cellParameters = { - >>> 'morphology' : '', - >>> 'templatefile' : '' - >>> 'templatename' : 'templatename' - >>> 'templateargs' : None - >>> 'v_init' : -65, - >>> 'cm' : 1.0, - >>> 'Ra' : 150, - >>> 'passive' : True, - >>> 'passive_parameters' : {'g_pas' : 0.001, 'e_pas' : -65.}, - >>> 'dt' : 2**-3, - >>> 'tstart' : 0, - >>> 'tstop' : 50, - >>> } - >>> cell = LFPy.NetworkCell(**cellParameters) - >>> cell.simulate() - - - """ - def __init__(self, **args): - """ - Initialization of class LFPy.NetworkCell. - - """ - TemplateCell.__init__(self, **args) - - # create list netconlist for spike detecting NetCon object(s) - self.sd_netconlist = neuron.h.List() - # create list of recording device for action potentials - self.spikes = [] - # create list of random number generators used with synapse model - self.rng_list = [] - - # create separate list for networked synapses - self.netconsynapses = [] - - # create recording device for membrane voltage - self.somav = neuron.h.Vector() - for sec in self.somalist: - self.somav.record(sec(0.5)._ref_v) - - - def create_synapse(self, cell, sec, x=0.5, syntype=neuron.h.ExpSyn, - synparams=dict(tau=2., e=0.), - assert_syn_values=False): - """ - Create synapse object of type syntype on sec(x) of cell and - append to list cell.netconsynapses - - TODO: Use LFPy.Synapse class if possible. - - Parameters - ---------- - cell : object - instantiation of class NetworkCell or similar - sec : neuron.h.Section object, - section reference on cell - x : float in [0, 1], - relative position along section - syntype : hoc.HocObject - NEURON synapse model reference, e.g., neuron.h.ExpSyn - synparams : dict - parameters for syntype, e.g., for neuron.h.ExpSyn we have: - tau : float, synapse time constant - e : float, synapse reversal potential - assert_syn_values : bool - if True, raise AssertionError if synapse attribute values do not - match the values in the synparams dictionary - - Raises - ------ - AssertionError - """ - # create a synapse object on the target cell - syn = syntype(x, sec=sec) - if hasattr(syn, 'setRNG'): - # Create the random number generator for the synapse - rng = neuron.h.Random() - # not sure if this is how it is supposed to be set up... - rng.MCellRan4(np.random.randint(0, 2**32-1), np.random.randint(0, 2**32-1)) - rng.uniform(0, 1) - syn.setRNG(rng) # used for e.g., stochastic synapse mechanisms (cf. BBP microcircuit portal files) - cell.rng_list.append(rng) # must store ref to rng object - cell.netconsynapses.append(syntype(x, sec=sec)) - - for key, value in synparams.items(): - exec("cell.netconsynapses[-1].{} = {}".format(key, value)) - # check that synapses are parameterized correctly - if assert_syn_values: - try: - np.testing.assert_almost_equal(getattr(cell.netconsynapses[-1], key), value) - except AssertionError: - raise AssertionError('{} = {} != {}'.format(key, - getattr(cell.netconsynapses[-1], key), - value)) - - - def create_spike_detector(self, target=None, threshold=-10., - weight=0.0, delay=0.0): - """ - Create spike-detecting NetCon object attached to the cell's soma - midpoint, but this could be extended to having multiple spike-detection - sites. The NetCon object created is attached to the cell's sd_netconlist - attribute, and will be used by the Network class when creating - connections between all presynaptic cells and postsynaptic cells on - each local RANK. - - Parameters - ---------- - target : None (default) or a NEURON point process - threshold : float - spike detection threshold - weight : float - connection weight (not used unless target is a point process) - delay : float - connection delay (not used unless target is a point process) - """ - # create new NetCon objects for the connections. Activation times will - # be triggered on the somatic voltage with a given threshold. - for sec in self.somalist: - self.sd_netconlist.append(neuron.h.NetCon(sec(0.5)._ref_v, - target, - sec=sec)) - self.sd_netconlist[-1].threshold = threshold - self.sd_netconlist[-1].weight[0] = weight - self.sd_netconlist[-1].delay = delay - - -class DummyCell(object): - def __init__(self, totnsegs=0, - imem=np.array([[]]), - xstart=np.array([]), xmid=np.array([]), xend=np.array([]), - ystart=np.array([]), ymid=np.array([]), yend=np.array([]), - zstart=np.array([]), zmid=np.array([]), zend=np.array([]), - diam=np.array([]), area=np.array([]), somainds=np.array([])): - """ - Dummy Cell object initialized with all attributes needed for LFP - calculations using the LFPy.RecExtElectrode class and methods. This cell - can be imagined as one "super" cell containing transmembrane currents - generated by all NetworkCell segments on this RANK at once. - - - Parameters - ---------- - totnsegs : int - total number of segments - imem : ndarray - totnsegs x ntimesteps array with transmembrane currents in nA - xstart, ystart, zstart : ndarray - arrays of length totnsegs with start (x,y,z) coordinate of segments - in units of um - xmid, ymid, zmid : ndarray - midpoint coordinates of segments - xend, yend, zend : ndarray - endpoint coordinateso of segments - diam : ndarray - array of length totnsegs with segment diameters - area : ndarray - array of segment surface areas - """ - # set attributes - self.totnsegs = totnsegs - self.imem = imem - self.xstart = xstart - self.xmid = xmid - self.xend = xend - self.ystart = ystart - self.ymid = ymid - self.yend = yend - self.zstart = zstart - self.zmid = zmid - self.zend = zend - self.diam = diam - self.area = area - self.somainds = somainds - - def get_idx(self, section="soma"): - if section=="soma": - return self.somainds - else: - raise ValueError('section argument must be "soma"') - - -class NetworkPopulation(object): - def __init__(self, CWD=None, CELLPATH=None, first_gid=0, Cell=NetworkCell, - POP_SIZE=4, name='L5PC', - cell_args=dict(), pop_args=dict(), - rotation_args=dict(), - OUTPUTPATH='example_parallel_network'): - """ - NetworkPopulation class representing a group of Cell objects distributed - across RANKs. - - Parameters - ---------- - CWD : path or None - Current working directory - CELLPATH: path or None - Relative path from CWD to source files for cell model (morphology, hoc routines etc.) - first_gid : int - The global identifier of the first cell created in this population - instance. The first_gid in the first population created should be 0 - and cannot exist in previously created NetworkPopulation instances - Cell : class - class defining a Cell object, see class NetworkCell above - POP_SIZE : int - number of cells in population - name : str - population name reference - cell_args : dict - keys and values for Cell object - pop_args : dict - keys and values for Network.draw_rand_pos assigning cell positions - rotation_arg : dict - default cell rotations around x and y axis on the form - { 'x' : np.pi/2, 'y' : 0 }. Can only have the keys 'x' and 'y'. - Cells are randomly rotated around z-axis using the Cell.set_rotation - method. - OUTPUTPATH : str - path to output file destination - """ - # set class attributes - self.CWD = CWD - self.CELLPATH = CELLPATH - self.first_gid = first_gid - self.Cell = Cell - self.POP_SIZE = POP_SIZE - self.name = name - self.cell_args = cell_args - self.pop_args = pop_args - self.rotation_args = rotation_args - self.OUTPUTPATH = OUTPUTPATH - - # create folder for output if it does not exist - if RANK == 0: - if not os.path.isdir(OUTPUTPATH): - os.mkdir(OUTPUTPATH) - COMM.Barrier() - - # container of Vector objects used to record times of action potentials - self.spike_vectors = [] - - # set up population of cells on this RANK - self.gids = [(i+first_gid) for i in range(POP_SIZE) if (i+first_gid) % SIZE == RANK] - - # we have to enter the cell's corresponding file directory to - # create cell because how EPFL set their code up - if CWD is not None: - os.chdir(os.path.join(CWD, CELLPATH, self.name)) - self.cells = [Cell(**cell_args) for gid in self.gids] - os.chdir(CWD) - else: - self.cells = [Cell(**cell_args) for gid in self.gids] - # position each cell's soma in space - self.soma_pos = self.draw_rand_pos(POP_SIZE=len(self.gids), **pop_args) - for i, cell in enumerate(self.cells): - cell.set_pos(**self.soma_pos[i]) - - # assign a random rotation around the z-axis of each cell - self.rotations = np.random.uniform(0, np.pi*2, len(self.gids)) - assert('z' not in self.rotation_args.keys()) - for i, cell in enumerate(self.cells): - cell.set_rotation(z=self.rotations[i], **self.rotation_args) - - # assign gid to each cell - for gid, cell in zip(self.gids, self.cells): - cell.gid = gid - - - # gather gids, soma positions and cell rotations to RANK 0, and write - # as structured array. - if RANK == 0: - populationData = flattenlist(COMM.gather(zip(self.gids, self.soma_pos, self.rotations))) - - # create structured array for storing data - dtype = [('gid', 'i8'), ('x', float), ('y', float), ('z', float), - ('x_rot', float), ('y_rot', float), ('z_rot', float)] - popDataArray = np.empty((len(populationData, )), dtype=dtype) - for i, (gid, pos, z_rot) in enumerate(populationData): - popDataArray[i]['gid'] = gid - popDataArray[i]['x'] = pos['x'] - popDataArray[i]['y'] = pos['y'] - popDataArray[i]['z'] = pos['z'] - popDataArray[i]['x_rot'] = np.pi/2 - popDataArray[i]['y_rot'] = 0. - popDataArray[i]['z_rot'] = z_rot - - # Dump to hdf5 file, append to file if it exists - f = h5py.File(os.path.join(self.OUTPUTPATH, - 'cell_positions_and_rotations.h5'), 'a') - # delete old entry if it exist - if self.name in f.keys(): - del f[self.name] - try: - assert self.name not in f.keys() - except AssertionError: - raise AssertionError - f[self.name] = popDataArray - f.close() - else: - COMM.gather(zip(self.gids, self.soma_pos, self.rotations)) - - # sync - COMM.Barrier() - - - def draw_rand_pos(self, POP_SIZE, radius, loc, scale, cap=None): - """ - Draw some random location for POP_SIZE cells within radius radius, - at mean depth loc and standard deviation scale. - - Returned argument is a list of dicts [{'x', 'y', 'z'},]. - - - Parameters - ---------- - POP_SIZE : int - Population size - radius : float - Radius of population. - loc : float - expected mean depth of somas of population. - scale : float - expected standard deviation of depth of somas of population. - cap : None, float or length to list of floats - if float, cap distribution between [loc-cap, loc+cap), - if list, cap distribution between [loc-cap[0], loc+cap[1]] - - - Returns - ------- - soma_pos : list - List of dicts of len POP_SIZE - where dict have keys x, y, z specifying - xyz-coordinates of cell at list entry `i`. - - - """ - - x = np.empty(POP_SIZE) - y = np.empty(POP_SIZE) - z = np.empty(POP_SIZE) - for i in range(POP_SIZE): - x[i] = (np.random.rand()-0.5) * radius*2 - y[i] = (np.random.rand()-0.5) * radius*2 - while np.sqrt(x[i]**2 + y[i]**2) >= radius: - x[i] = (np.random.rand()-0.5)*radius*2 - y[i] = (np.random.rand()-0.5)*radius*2 - z = np.random.normal(loc=loc, scale=scale, size=POP_SIZE) - if cap is not None: - if type(cap) in [float, np.float, np.float32, np.float64]: - while not np.all((z >= loc-cap) & (z < loc+cap)): - inds = (z < loc-cap) ^ (z > loc+cap) - z[inds] = np.random.normal(loc=loc, scale=scale, - size=inds.sum()) - elif type(cap) is list: - try: - assert(len(cap) == 2) - except AssertionError: - raise AssertionError('cap = {} is not a length 2 list'.format(float)) - while not np.all((z >= loc-cap[0]) & (z < loc+cap[1])): - inds = (z < loc-cap[0]) ^ (z > loc+cap[1]) - z[inds] = np.random.normal(loc=loc, scale=scale, - size=inds.sum()) - else: - raise Exception('cap = {} is not None, a float or length 2 list of floats'.format(float)) - - soma_pos = [] - for i in range(POP_SIZE): - soma_pos.append({'x' : x[i], 'y' : y[i], 'z' : z[i]}) - - return soma_pos - - -class Network(object): - def __init__(self, dt=0.1, tstart=0., tstop=1000., v_init=-65., celsius=6.3, - OUTPUTPATH='example_parallel_network', - verbose=False): - """ - Network class, creating distributed populations of cells of - type Cell and handling connections between cells in the respective - populations. - - Parameters - ---------- - dt : float - Simulation timestep size - tstart : float - Start time of simulation - tstop : float - End time of simulation - v_init : float - Membrane potential set at first timestep across all cells - celsius : float - Global control of temperature, affect channel kinetics. - It will also be forced when creating the different Cell objects, as - LFPy.Cell and LFPy.TemplateCell also accept the same keyword - argument. - verbose : bool - if True, print out misc. messages - - - """ - # set attributes - self.dt = dt - self.tstart = tstart - self.tstop = tstop - self.v_init = v_init - self.celsius = celsius - self.OUTPUTPATH = OUTPUTPATH - self.verbose = verbose - - # we need NEURON's ParallelContext for communicating NetCon events - self.pc = neuron.h.ParallelContext() - - # create empty list for connections between cells (not to be confused - # with each cell's list of netcons) - self.netconlist = neuron.h.List() - - - # The different populations in the Network will be collected in - # a dictionary of NetworkPopulation object, where the keys represent the - # population name. The names are also put in a list ordered according to - # order populations are created in (as some operations rely on this) - self.populations = dict() - self.population_names = [] - - - - def create_population(self, CWD=None, CELLPATH=None, Cell=NetworkCell, - POP_SIZE=4, name='L5PC', - cell_args=dict(), pop_args=dict(), - rotation_args=dict()): - """ - Create and append a distributed POP_SIZE-sized population of cells of - type Cell with the corresponding name. Cell-object references, gids on - this RANK, population size POP_SIZE and names will be added to the lists - Network.gids, Network.cells, Network.sizes and Network.names, - respectively - - Parameters - ---------- - CWD : path - Current working directory - CELLPATH: path - Relative path from CWD to source files for cell model (morphology, hoc routines etc.) - Cell : class - class defining a Cell-like object, see class NetworkCell - POP_SIZE : int - number of cells in population - name : str - population name reference - cell_args : dict - keys and values for Cell object - pop_args : dict - keys and values for Network.draw_rand_pos assigning cell positions - rotation_arg : dict - default cell rotations around x and y axis on the form - { 'x' : np.pi/2, 'y' : 0 }. Can only have the keys 'x' and 'y'. - Cells are randomly rotated around z-axis using the Cell.set_rotation - method. - - """ - try: - assert name not in self.populations.keys() - except AssertionError: - raise AssertionError('population name {} already taken'.format(name)) - - # compute the first global id of this new population, based - # on population sizes of existing populations - first_gid = 0 - for p in self.populations.values(): - first_gid += p.POP_SIZE - - # create NetworkPopulation object - population = NetworkPopulation(CWD=CWD, CELLPATH=CELLPATH, first_gid=first_gid, - Cell=Cell, - POP_SIZE=POP_SIZE, name=name, - cell_args=cell_args, pop_args=pop_args, - rotation_args=rotation_args, - OUTPUTPATH=self.OUTPUTPATH) - - # associate gids of cells on this RANK such that NEURON can look up - # at which RANK different cells are created when connecting the network - for gid in population.gids: - self.pc.set_gid2node(gid, RANK) - - # Prepare connection targets by iterating over local neurons in pop. - for gid, cell in zip(population.gids, population.cells): - # attach NetCon source (spike detektor) to each cell's soma with no - # target to cell gid - cell.create_spike_detector(None) - # assosiate cell gid with the NetCon source - self.pc.cell(gid, cell.sd_netconlist[-1]) - - # record spike events - population.spike_vectors.append(neuron.h.Vector()) - cell.sd_netconlist[-1].record(population.spike_vectors[-1]) - - # add population object to dictionary of populations - self.populations[name] = population - - # append population name to list (Network.populations.keys() not unique) - self.population_names.append(name) - - - def get_connectivity_rand(self, pre='L5PC', post='L5PC', connprob = 0.2): - """ - Dummy function creating a (boolean) cell to cell connectivity matrix - between pre and postsynaptic populations. - - Connections are drawn randomly between presynaptic cell gids in - population 'pre' and postsynaptic cell gids in 'post' on this RANK with - a fixed connection probability. self-connections are disabled if - presynaptic and postsynaptic populations are the same. - - Parameters - ---------- - pre : str - presynaptic population name - post : str - postsynaptic population name - connprob : float in [0, 1] - connection probability, connections are drawn on random - - Returns - ------- - ndarray, dtype bool - n_pre x n_post array of connections between n_pre presynaptic - neurons and n_post postsynaptic neurons on this RANK. Entries - with True denotes a connection. - """ - n_pre = self.populations[pre].POP_SIZE - gids = np.array(self.populations[post].gids).astype(int) - - # first check if there are any postsyn cells on this RANK - if gids.size > 0: - # define incoming connections for cells on this RANK - C = np.random.rand(n_pre, gids.size) < connprob - if pre == post: - # avoid self connections. - gids_pre, gids_post = np.where(C) - gids_pre += self.populations[pre].first_gid - gids_post *= SIZE # asssume round-robin distribution of gids - gids_post += self.populations[post].gids[0] - inds = gids_pre == gids_post - gids_pre = gids_pre[inds == False] - gids_pre -= self.populations[pre].first_gid - gids_post = gids_post[inds == False] - gids_post -= self.populations[post].gids[0] - gids_post //= SIZE - c = np.c_[gids_pre, gids_post] - # create boolean matrix - C = ss.csr_matrix((np.ones(gids_pre.shape[0], dtype=bool), - (c[:, 0], c[:, 1])), - shape=(n_pre, gids.size), dtype=bool) - return C.toarray() - else: - return C - else: - return np.zeros((n_pre, 0), dtype=bool) - - - def connect(self, pre, post, connectivity, - syntype=neuron.h.ExpSyn, - synparams=dict(tau=2., e=0.), - weightfun=np.random.normal, - weightargs=dict(loc=0.1, scale=0.01), - minweight=0, - delayfun=np.random.normal, - delayargs=dict(loc=2, scale=0.2), - mindelay=0.3, - multapsefun=np.random.normal, - multapseargs=dict(loc=4, scale=1), - syn_pos_args=dict(section=['soma', 'dend', 'apic'], - fun=[stats.norm]*2, - funargs=[dict(loc=0, scale=100)]*2, - funweights=[0.5]*2, - z_min=-1E6, z_max=1E6, - ), - save_connections=False, - ): - """ - Connect presynaptic cells to postsynaptic cells. Connections are - drawn from presynaptic cells to postsynaptic cells, hence connectivity - array must only be specified for postsynaptic units existing on this - RANK. - - Parameters - ---------- - pre : str - presynaptic population name - post : str - postsynaptic population name - connectivity : ndarray / (scipy.sparse array) - boolean connectivity matrix between pre and post. - syntype : hoc.HocObject - reference to NEURON synapse mechanism, e.g., neuron.h.ExpSyn - synparams : dict - dictionary of parameters for synapse mechanism, keys 'e', 'tau' etc. - weightfun : function - function used to draw weights from a numpy.random distribution - weightargs : dict - parameters passed to weightfun - minweight : float, - minimum weight in units of nS - delayfun : function - function used to draw delays from a numpy.random distribution - delayargs : dict - parameters passed to delayfun - mindelay : float, - minimum delay in multiples of dt - multapsefun : function or None - function reference, e.g., numpy.random.normal used to draw a number - of synapses for a cell-to-cell connection. If None, draw only one - connection - multapseargs : dict - arguments passed to multapsefun - syn_pos_args : dict - arguments passed to inherited LFPy.Cell method - NetworkCell.get_rand_idx_area_and_distribution_norm to find - synapse locations. - save_connections : bool - if True (default False), save instantiated connections to HDF5 file - "Network.OUTPUTPATH/synapse_positions.h5" as dataset "
:"
-            using a structured ndarray with dtype
-            [('gid', 'i8'), ('x', float), ('y', float), ('z', float)]
-            where gid is postsynaptic cell id, and x,y,z the corresponding
-            midpoint coordinates of the target compartment.
-        """
-        # set up connections from all cells in presynaptic to post across RANKs
-        n0 = self.populations[pre].first_gid
-        # gids of presynaptic neurons:
-        pre_gids = np.arange(n0, n0 + self.populations[pre].POP_SIZE)
-
-        # count connections and synapses made on this RANK
-        conncount = connectivity.astype(int).sum()
-        syncount = 0
-
-        # keep track of synapse positions for this connect
-        # call on this rank such that these can be communicated and stored
-        syn_idx_pos = []
-
-        # iterate over gids on this RANK and create connections
-        for i, (post_gid, cell) in enumerate(zip(self.populations[post].gids, self.populations[post].cells)):
-            # do NOT iterate over all possible presynaptic neurons
-            for pre_gid in pre_gids[connectivity[:, i]]:
-                # throw a warning if sender neuron is identical to receiving neuron
-                if post_gid == pre_gid:
-                    print('connecting cell w. gid {} to itself (RANK {})'.format(post_gid, RANK))
-
-                # assess number of synapses
-                if multapsefun is None:
-                    nidx = 1
-                else:
-                    nidx = 0
-                    j = 0
-                    while nidx <= 0 and j < 1000:
-                        nidx = int(multapsefun(**multapseargs))
-                        j += 1
-                    if j == 1000:
-                        raise Exception('change multapseargs as no positive synapse count was found in 1000 trials')
-
-                # find synapse locations and corresponding section names
-                idxs = cell.get_rand_idx_area_and_distribution_norm(nidx=nidx, **syn_pos_args)
-                secs = cell.get_idx_name(idxs)
-
-                # draw weights
-                weights = weightfun(size=nidx, **weightargs)
-                # redraw weights less that minweight
-                while np.any(weights < minweight):
-                    j = weights < minweight
-                    weights[j] = weightfun(size=j.sum(), **weightargs)
-
-                # draw delays
-                delays = delayfun(size=nidx, **delayargs)
-                # redraw delays shorter than mindelay
-                while np.any(delays < mindelay):
-                    j = delays < mindelay
-                    delays[j] = delayfun(size=j.sum(), **delayargs)
-
-                for i, ((idx, secname, x), weight, delay) in enumerate(zip(secs, weights, delays)):
-                    cell.create_synapse(cell,
-                                        # TODO: Find neater way of accessing Section reference, this seems slow
-                                        sec=list(cell.allseclist)[np.where(np.array(cell.allsecnames)==secname)[0][0]],
-                                        x=x, syntype=syntype,
-                                        synparams=synparams)
-                    # connect up NetCon object
-                    nc = self.pc.gid_connect(pre_gid, cell.netconsynapses[-1])
-                    nc.weight[0] = weight
-                    nc.delay = delays[i]
-                    self.netconlist.append(nc)
-
-                    # store also synapse indices allowing for computing LFPs from syn.i
-                    cell.synidx.append(idx)
-
-                    # store gid and xyz-coordinate of synapse positions
-                    syn_idx_pos.append((cell.gid, cell.xmid[idx], cell.ymid[idx], cell.zmid[idx]))
-
-                syncount += nidx
-
-        conncount = COMM.reduce(conncount, op=MPI.SUM, root=0)
-        syncount = COMM.reduce(syncount, op=MPI.SUM, root=0)
-
-        if RANK == 0:
-            print('Connected population {} to {} by {} connections and {} synapses'.format(pre, post, conncount, syncount))
-
-        else:
-            conncount = None
-            syncount = None
-
-
-        # gather and write syn_idx_pos data
-        if save_connections:
-            if RANK == 0:
-                synData = flattenlist(COMM.gather(syn_idx_pos))
-
-                # convert to structured array
-                dtype = [('gid', 'i8'), ('x', float), ('y', float), ('z', float)]
-                synDataArray = np.empty((len(synData), ), dtype=dtype)
-                for i, (gid, x, y, z) in enumerate(synData):
-                    synDataArray[i]['gid'] = gid
-                    synDataArray[i]['x'] = x
-                    synDataArray[i]['y'] = y
-                    synDataArray[i]['z'] = z
-                # Dump to hdf5 file, append to file if entry exists
-                f = h5py.File(os.path.join(self.OUTPUTPATH,
-                                           'synapse_positions.h5'), 'a')
-                key = '{}:{}'.format(pre, post)
-                if key in f.keys():
-                    del f[key]
-                    try:
-                        assert key not in f.keys()
-                    except AssertionError:
-                        raise AssertionError
-                f[key] = synDataArray
-                f.close()
-            else:
-                COMM.gather(syn_idx_pos)
-
-        return COMM.bcast([conncount, syncount])
-
-
-    def simulate(self, electrode=None, rec_imem=False, rec_vmem=False,
-                 rec_ipas=False, rec_icap=False,
-                 rec_isyn=False, rec_vmemsyn=False, rec_istim=False,
-                 rec_current_dipole_moment=False,
-                 rec_pop_contributions=False,
-                 rec_variables=[], variable_dt=False, atol=0.001,
-                 to_memory=True, to_file=False,
-                 file_name='OUTPUT.h5',
-                 dotprodcoeffs=None, **kwargs):
-        """
-        This is the main function running the simulation of the network model.
-
-        Parameters
-        ----------
-        electrode:
-            Either an LFPy.RecExtElectrode object or a list of such.
-                    If supplied, LFPs will be calculated at every time step
-                    and accessible as electrode.LFP. If a list of objects
-                    is given, accessible as electrode[0].LFP etc.
-        rec_imem:   If true, segment membrane currents will be recorded
-                    If no electrode argument is given, it is necessary to
-                    set rec_imem=True in order to calculate LFP later on.
-                    Units of (nA).
-        rec_vmem:   record segment membrane voltages (mV)
-        rec_ipas:   record passive segment membrane currents (nA)
-        rec_icap:   record capacitive segment membrane currents (nA)
-        rec_isyn:   record synaptic currents of from Synapse class (nA)
-        rec_vmemsyn:    record membrane voltage of segments with Synapse(mV)
-        rec_istim:  record currents of StimIntraElectrode (nA)
-        rec_current_dipole_moment : bool
-            If True, compute and record current-dipole moment from
-            transmembrane currents as in Linden et al. (2010) J Comput Neurosci,
-            DOI: 10.1007/s10827-010-0245-4. Will set the `LFPy.Cell` attribute
-            `current_dipole_moment` as n_timesteps x 3 `ndarray` where the
-            last dimension contains the x,y,z components of the dipole moment.
-        rec_pop_contributions : bool
-            If True, compute and return single-population contributions to
-            the extracellular potential during simulation time
-        rec_variables: list of variables to record, i.e arg=['cai', ]
-        variable_dt: boolean, using variable timestep in NEURON
-        atol:       absolute tolerance used with NEURON variable timestep
-        to_memory:  only valid with electrode, store lfp in -> electrode.LFP
-        to_file:    only valid with electrode, save LFPs in hdf5 file format
-        file_name : str
-            If to_file is True, file which extracellular potentials will be
-            written to. The file format is HDF5, default is "OUTPUT.h5", put
-            in folder Network.OUTPUTPATH
-        dotprodcoeffs :  list of N x Nseg ndarray. These arrays will at
-                    every timestep be multiplied by the membrane currents.
-                    Presumably useful for memory efficient csd or lfp calcs
-        **kwargs :  keyword argument dict values passed along to function
-                    _run_simulation_with_electrode(), containing some or all of
-                    the boolean flags: use_ipas, use_icap, use_isyn
-                    (defaulting to 'False').
-
-        Returns
-        -------
-        SPIKES : dict
-            the first returned argument is a dictionary with keys 'gids' and
-            'times'. Each item is a nested list of len(Npop) times N_X where N_X
-            is the corresponding population size. Each entry is a np.ndarray
-            containing the spike times of each cell in the nested list in item
-            'gids'
-        OUTPUT : list of ndarray
-            if parameters electrode is not None and/or dotprodcoeffs is not
-            None, contains the
-            [electrode.LFP, ...., (dotprodcoeffs[0] dot I)(t), ...]
-            The first output is a structured array, so OUTPUT[0]['imem']
-            corresponds to the total LFP and the other the per-population
-            contributions.
-        P : ndarray
-            if rec_current_dipole_moment==True, contains the x,y,z-components of
-            current-dipole moment from transmembrane currents summed up over
-            all populations
-
-        """
-        # set up integrator, use the CVode().fast_imem method by default
-        # as it doesn't hurt sim speeds much if at all.
-        cvode = neuron.h.CVode()
-        try:
-            cvode.use_fast_imem(1)
-        except AttributeError as ae:
-            raise Exception('neuron.h.CVode().use_fast_imem() not found. Please update NEURON to v.7.4 or newer')
-
-        # test some of the inputs
-        try:
-            if electrode is None:
-                assert(rec_pop_contributions is False)
-        except AssertionError:
-            raise AssertionError('rec_pop_contributions can not be True when electrode is None')
-
-        for name in self.population_names:
-            for cell in self.populations[name].cells:
-                cell._set_soma_volt_recorder()
-                if rec_imem:
-                    cell._set_imem_recorders()
-                if rec_vmem:
-                    cell._set_voltage_recorders()
-                if rec_ipas:
-                    cell._set_ipas_recorders()
-                if rec_icap:
-                    cell._set_icap_recorders()
-                # if rec_current_dipole_moment:
-                #     self._set_current_dipole_moment_array()
-                if len(rec_variables) > 0:
-                    cell._set_variable_recorders(rec_variables)
-
-        #run fadvance until t >= tstop, and calculate LFP if asked for
-        if electrode is None and dotprodcoeffs is None and not rec_current_dipole_moment and not rec_pop_contributions and not to_file:
-            if not rec_imem:
-                if self.verbose:
-                    print("rec_imem = {}, not recording membrane currents!".format(rec_imem))
-            _run_simulation(self, cvode, variable_dt, atol)
-        else:
-            if dotprodcoeffs is not None:
-                raise NotImplementedError
-            LFP, P = _run_simulation_with_electrode(self, cvode=cvode,
-                            electrode=electrode,
-                            variable_dt=variable_dt,
-                            atol=atol,
-                            to_memory=to_memory,
-                            to_file=to_file,
-                            file_name='tmp_output_RANK_{:03d}.h5',
-                            dotprodcoeffs=dotprodcoeffs,
-                            rec_current_dipole_moment=rec_current_dipole_moment,
-                            rec_pop_contributions=rec_pop_contributions,
-                            **kwargs)
-
-        for name in self.population_names:
-            for cell in self.populations[name].cells:
-                #somatic trace
-                cell.somav = np.array(cell.somav)
-                if rec_imem:
-                    cell._calc_imem()
-                if rec_ipas:
-                    cell._calc_ipas()
-                if rec_icap:
-                    cell._calc_icap()
-                if rec_vmem:
-                    cell._collect_vmem()
-                if rec_isyn:
-                    cell._collect_isyn()
-                if rec_vmemsyn:
-                    cell._collect_vsyn()
-                if rec_istim:
-                    cell._collect_istim()
-                if len(rec_variables) > 0:
-                    cell._collect_rec_variables(rec_variables)
-                if hasattr(cell, 'netstimlist'):
-                    del cell.netstimlist
-
-        # Collect spike trains across all RANKs to RANK 0
-        for name in self.population_names:
-            population = self.populations[name]
-            for i in range(len(population.spike_vectors)):
-                population.spike_vectors[i] = np.array(population.spike_vectors[i])
-        if RANK == 0:
-            times = []
-            gids = []
-            for i, name in enumerate(self.population_names):
-                times.append([])
-                gids.append([])
-                times[i] += [x for x in self.populations[name].spike_vectors]
-                gids[i] += [x for x in self.populations[name].gids]
-                for j in range(1, SIZE):
-                    times[i] += COMM.recv(source=j, tag=13)
-                    gids[i] += COMM.recv(source=j, tag=14)
-        else:
-            times = None
-            gids = None
-            for name in self.population_names:
-                COMM.send([x for x in self.populations[name].spike_vectors],
-                    dest=0, tag=13)
-                COMM.send([x for x in self.populations[name].gids],
-                    dest=0, tag=14)
-
-        # create final output file, summing up single RANK output from temp files
-        if to_file and electrode is not None:
-            op=MPI.SUM
-            fname = os.path.join(self.OUTPUTPATH, 'tmp_output_RANK_{:03d}.h5'.format(RANK))
-            f0 = h5py.File(fname, 'r')
-            if RANK == 0:
-                f1 = h5py.File(os.path.join(self.OUTPUTPATH, file_name), 'w')
-            dtype = []
-            for key, value in f0[list(f0.keys())[0]].items():
-                dtype.append((str(key), np.float))
-            shape = value.shape
-            for grp in f0.keys():
-                if RANK == 0:
-                    f1[grp] = np.zeros(shape, dtype=dtype)
-                for key, value in f0[grp].items():
-                    if RANK == 0:
-                        recvbuf = np.zeros(shape, dtype=np.float)
-                    else:
-                        recvbuf = None
-                    COMM.Reduce(value[()].astype(np.float), recvbuf, op=op, root=0)
-                    if RANK == 0:
-                        f1[grp][key] = recvbuf
-            f0.close()
-            if RANK == 0:
-                f1.close()
-            os.remove(fname)
-
-
-        if electrode is None and dotprodcoeffs is None and not rec_current_dipole_moment and not rec_pop_contributions:
-            return dict(times=times, gids=gids)
-        else:
-            # communicate and sum up LFPs and dipole moments:
-            if LFP is not None:
-                for i in range(len(LFP)):
-                    LFP[i] = ReduceStructArray(LFP[i])
-            if P is not None:
-                P = ReduceStructArray(P)
-            return dict(times=times, gids=gids), LFP, P
-
-
-    def _create_network_dummycell(self):
-        """
-        set up parameters for a DummyCell object, allowing for computing
-        the sum of all single-cell LFPs at each timestep, essentially
-        creating one supercell with all segments of all cell objects
-        present on this RANK.
-        """
-        # compute the total number of segments per population on this RANK
-        nsegs = [[cell.totnsegs for cell in self.populations[name].cells]
-            for name in self.population_names]
-        for i, nseg in enumerate(nsegs):
-            if nseg == []:
-                nsegs[i] = [0]
-        for i, y in enumerate(nsegs): nsegs[i] = np.sum(y)
-        nsegs = np.array(nsegs, dtype=int)
-
-        totnsegs = nsegs.sum()
-        imem = np.eye(totnsegs)
-        xstart = np.array([])
-        xmid = np.array([])
-        xend = np.array([])
-        ystart = np.array([])
-        ymid = np.array([])
-        yend = np.array([])
-        zstart = np.array([])
-        zmid = np.array([])
-        zend = np.array([])
-        diam = np.array([])
-        area = np.array([])
-
-        somainds = np.array([], dtype=int)
-        nseg = 0
-
-        for name in self.population_names:
-            for cell in self.populations[name].cells:
-                xstart = np.r_[xstart, cell.xstart]
-                ystart = np.r_[ystart, cell.ystart]
-                zstart = np.r_[zstart, cell.zstart]
-                xmid = np.r_[xmid, cell.xmid]
-                ymid = np.r_[ymid, cell.ymid]
-                zmid = np.r_[zmid, cell.zmid]
-                xend = np.r_[xend, cell.xend]
-                yend = np.r_[yend, cell.yend]
-                zend = np.r_[zend, cell.zend]
-                diam = np.r_[diam, cell.diam]
-                area = np.r_[area, cell.area]
-
-                somainds = np.r_[somainds, cell.get_idx("soma")+nseg]
-                nseg += cell.totnsegs
-
-
-        # return number of segments per population and DummyCell object
-        return nsegs, DummyCell(totnsegs,
-                         imem,
-                         xstart, xmid, xend,
-                         ystart, ymid, yend,
-                         zstart, zmid, zend,
-                         diam, area, somainds)
-
-
-def _run_simulation(network, cvode, variable_dt=False, atol=0.001):
-    """
-    Running the actual simulation in NEURON, simulations in NEURON
-    are now interruptable.
-
-    Parameters
-    ----------
-    network : LFPy.Network object
-        instantiation of class LFPy.Network
-    cvode : neuron.h.CVode() object
-    variable_dt : bool
-        switch for variable-timestep method
-    atol : float
-        absolute tolerance with CVode for variable time-step method
-    """
-    # set maximum integration step, it is necessary for communication of
-    # spikes across RANKs to occur.
-    network.pc.set_maxstep(10)
-
-    # time resolution
-    neuron.h.dt = network.dt
-
-    #don't know if this is the way to do, but needed for variable dt method
-    if variable_dt:
-        cvode.active(1)
-        cvode.atol(atol)
-    else:
-        cvode.active(0)
-
-    # initialize state
-    neuron.h.finitialize(network.v_init)
-
-    # initialize current- and record
-    if cvode.active():
-        cvode.re_init()
-    else:
-        neuron.h.fcurrent()
-    neuron.h.frecord_init()
-
-    # Starting simulation at tstart
-    neuron.h.t = network.tstart
-
-    # only needed if LFPy.Synapse classes are used.
-    for name in network.population_names:
-        for cell in network.populations[name].cells:
-            cell._loadspikes()
-
-    while neuron.h.t < network.tstop:
-        neuron.h.fadvance()
-        if neuron.h.t % 100 == 0:
-            if RANK == 0:
-                print('t = {} ms'.format(neuron.h.t))
-
-    return
-
-
-def _run_simulation_with_electrode(network, cvode,
-                                   electrode=None,
-                                   variable_dt=False,
-                                   atol=0.001,
-                                   to_memory=True,
-                                   to_file=False,
-                                   file_name=None,
-                                   dotprodcoeffs=None,
-                                   rec_current_dipole_moment=False,
-                                   use_ipas=False, use_icap=False,
-                                   use_isyn=False,
-                                   rec_pop_contributions=False
-                                   ):
-    """
-    Running the actual simulation in NEURON.
-    electrode argument used to determine coefficient
-    matrix, and calculate the LFP on every time step.
-
-    Parameters
-    ----------
-    network : LFPy.Network object
-        instantiation of class LFPy.Network
-    cvode : neuron.h.CVode() object
-    electrode : LFPy.RecExtElectrode object or None
-        instantiation of class LFPy.RecExtElectrode for which extracellular
-        potentials will be computed.
-    variable_dt : bool
-        switch for variable-timestep method
-    atol : float
-        absolute tolerance with CVode for variable time-step method
-    to_memory : bool
-        Boolean flag for computing extracellular potentials, default is True
-    to_file : bool or None
-        Boolean flag for computing extracellular potentials to file
-        , default is False
-    file_name : formattable str
-        If to_file is True, file which extracellular potentials will be
-        written to. The file format is HDF5, default is
-        "output_RANK_{:03d}.h5". The output is written per RANK, and the
-        RANK # will be inserted into the corresponding file name.
-    dotprodcoeffs : None or list of ndarrays
-        Each element in list is a mapping of transmembrane currents to a measure
-        on the form :math:`V = \\mathbf{C} \\cdot \\mathbf{I}`
-    rec_current_dipole_moment : bool
-        if True, compute and store the total current-dipole moment per time
-        step as the sum over each individual population
-    use_ipas : bool
-        if True, compute the contribution to extracellular potentials across
-        the passive leak channels embedded in the cells membranes summed over
-        populations
-    use_icap : bool
-        if True, compute the contribution to extracellular potentials across
-        the membrane capacitance embedded in the cells membranes summed over
-        populations
-    use_isyn : bool
-        if True, compute the contribution to extracellular potentials across
-        the excitatory and inhibitory synapses embedded in the cells membranes
-        summed over populations
-    rec_pop_contributions : bool
-        if True, compute and return single-population contributions to the
-        extracellular potential during each time step of the simulation
-
-    Returns
-    -------
-    RESULTS : list
-        ordered according to [dotprodcoeffs, ..., electrode, ...], each element
-        being the superimposed contribution to i.e., the extracellular potential
-        at each timestep from all cell objects on this particular RANK.
-        Thus, no single-cell contributions to the LFP
-        are returned.
-    DIPOLE_MOMENT : ndarray
-        Shape (n_timesteps, 3) array containing the x,y,z-components of the
-        current-dipole moment summed up over contributions from cells across
-        all populations on this MPI RANK.
-    """
-    # create a dummycell object lumping together needed attributes
-    # for calculation of extracellular potentials etc. The population_nsegs
-    # array is used to slice indices such that single-population
-    # contributions to the potential can be calculated.
-    population_nsegs, network_dummycell = network._create_network_dummycell()
-
-    # Use electrode object(s) to calculate coefficient matrices for LFP
-    # calculations. If electrode is a list, then
-    # put electrodecoeff in a list, if it isn't already
-    if dotprodcoeffs is not None:
-        if type(dotprodcoeffs) != list:
-            dotprodcoeffs = [dotprodcoeffs]
-    else:
-        #create empty list if no dotprodcoeffs are supplied
-        dotprodcoeffs = []
-
-    #access electrode object and append dotprodcoeffs
-    if electrode is not None:
-        #put electrode argument in list if needed
-        if type(electrode) == list:
-            electrodes = electrode
-        else:
-            electrodes = [electrode]
-
-        # At each timestep we will later construct a single vector I of all
-        # transmembrane currents. With that, and a corresponding matrix G
-        # mapping a current contribution to an electrode contact, we can here
-        # compute the extracellular potentials V_r in all contacts r at
-        # timestep t_i as
-        # V_r(r, t_i) = G x I(r, t_i)
-
-
-        # # create a dummycell object lumping together needed attributes
-        # # for calculation of extracellular potentials. The population_nsegs
-        # # array is used to slice indices such that single-population
-        # # contributions to the potential can be calculated.
-        # population_nsegs, network_dummycell = network._create_network_dummycell()
-
-        # We can have a number of separate electrode objects in a list, create
-        # mappings for each
-        for el in electrodes:
-            # el.calc_lfp(cell=network_dummycell)
-            el.calc_mapping(cell=network_dummycell)
-            dotprodcoeffs += [el.mapping]
-            # del el.LFP
-            del el.mapping
-
-    elif electrode is None:
-        electrodes = None
-        # if rec_current_dipole_moment:
-        #     population_nsegs, network_dummycell = network._create_network_dummycell()
-
-
-
-
-    # set maximum integration step, it is necessary for communication of
-    # spikes across RANKs to occur.
-    # NOTE: Should this depend on the minimum delay in the network?
-    network.pc.set_maxstep(10)
-
-    # Initialize NEURON simulations of cell object
-    neuron.h.dt = network.dt
-
-    #needed for variable dt method
-    if network.dt <= 1E-8:
-        cvode.active(1)
-        cvode.atol(atol)
-    else:
-        cvode.active(0)
-
-    #initialize state
-    neuron.h.finitialize(network.v_init)
-
-    # use fast calculation of transmembrane currents
-    cvode.use_fast_imem(1)
-
-    #initialize current- and record
-    if cvode.active():
-        cvode.re_init()
-    else:
-        neuron.h.fcurrent()
-    neuron.h.frecord_init()
-
-    #Starting simulation at tstart
-    neuron.h.t = network.tstart
-
-    # create list of cells across all populations to simplify loops
-    cells = []
-    for name in network.population_names:
-        cells += network.populations[name].cells
-
-    #load spike times from NetCon, only needed if LFPy.Synapse class is used
-    for cell in cells:
-        cell._loadspikes()
-
-
-    # define data type for structured arrays dependent on the boolean arguments
-    dtype = [('imem', np.float)]
-    if use_ipas: dtype += [('ipas', np.float)]
-    if use_icap: dtype += [('icap', np.float)]
-    if use_isyn: dtype += [('isyn_e', np.float), ('isyn_i', np.float)]
-    if rec_pop_contributions: dtype += list(zip(network.population_names,
-                                                [np.float]*len(network.population_names)))
-
-    # setup list of structured arrays for all extracellular potentials
-    # at each contact from different source terms and subpopulations
-    if to_memory:
-        RESULTS = []
-        for coeffs in dotprodcoeffs:
-            RESULTS.append(np.zeros((coeffs.shape[0],
-                                     int(network.tstop / network.dt) + 1),
-                                    dtype=dtype)
-                           )
-    else:
-        RESULTS = None
-
-    # container for electric current dipole moment for the individual
-    # populations captured inside the DummyCell instance
-    if rec_current_dipole_moment:
-        DIPOLE_MOMENT = np.zeros((int(network.tstop / network.dt) + 1, 3),
-            dtype=list(zip(network.population_names,
-                           [np.float]*len(network.population_names))))
-    else:
-        DIPOLE_MOMENT = None
-
-    #LFPs for each electrode will be put here during simulations
-    if to_file:
-        #ensure right ending:
-        if file_name.split('.')[-1] != 'h5':
-            file_name += '.h5'
-        outputfile = h5py.File(os.path.join(network.OUTPUTPATH,
-                                            file_name.format(RANK)), 'w')
-        for i, coeffs in enumerate(dotprodcoeffs):
-            # can't do it this way until h5py issue #770
-            # (https://github.com/h5py/h5py/issues/770) is fixed:
-            # outputfile['OUTPUT[{}]'.format(i)] = np.zeros((coeffs.shape[0],
-            #                     int(network.tstop / network.dt) + 1), dtype=dtype)
-            grp = outputfile.create_group('OUTPUT[{}]'.format(i))
-            for key, val in dtype:
-                grp[key] = np.zeros((coeffs.shape[0], int(network.tstop / network.dt) + 1), dtype=val)
-
-    # temp vector to store membrane currents at each timestep:
-    imem = np.zeros(network_dummycell.totnsegs, dtype=dtype)
-
-    # create a 2D array representation of segment midpoints for dot product
-    # with transmembrane currents when computing dipole moment
-    if rec_current_dipole_moment:
-        midpoints = np.c_[network_dummycell.xmid,
-                          network_dummycell.ymid,
-                          network_dummycell.zmid]
-
-    #run fadvance until time limit, and calculate LFPs for each timestep
-    tstep = 0
-    while neuron.h.t < network.tstop:
-        if neuron.h.t >= 0:
-            i = 0
-            totnsegs = 0
-            if use_isyn:
-                imem['isyn_e'] = 0. # need to reset these for every iteration
-                imem['isyn_i'] = 0. # because we sum over synapses
-            for cell in cells:
-                for sec in cell.allseclist:
-                    for seg in sec:
-                        imem['imem'][i] = seg.i_membrane_
-                        if use_ipas:
-                            imem['ipas'][i] = seg.i_pas
-                        if use_icap:
-                            imem['icap'][i] = seg.i_cap
-                        i += 1
-
-                if use_isyn:
-                    for idx, syn in zip(cell.synidx, cell.netconsynapses):
-                        if hasattr(syn, 'e') and syn.e > -50:
-                            imem['isyn_e'][idx+totnsegs] += syn.i
-                        else:
-                            imem['isyn_i'][idx+totnsegs] += syn.i
-
-                totnsegs += cell.totnsegs
-
-            if rec_current_dipole_moment:
-                k = 0 # counter
-                for nsegs, name in zip(population_nsegs, network.population_names):
-                    cellinds = np.arange(k, k+nsegs)
-                    DIPOLE_MOMENT[name][tstep, ] = np.dot(imem['imem'][cellinds, ],
-                                                          midpoints[cellinds, ])
-                    k += nsegs
-
-            if to_memory:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    RESULTS[j]['imem'][:, tstep] = np.dot(coeffs, imem['imem'])
-                    if use_ipas:
-                        RESULTS[j]['ipas'][:, tstep] = np.dot(coeffs, imem['ipas'] * network_dummycell.area * 1E-2)
-                    if use_icap:
-                        RESULTS[j]['icap'][:, tstep] = np.dot(coeffs, imem['icap'] * network_dummycell.area * 1E-2)
-                    if use_isyn:
-                        RESULTS[j]['isyn_e'][:, tstep] = np.dot(coeffs, imem['isyn_e'])
-                        RESULTS[j]['isyn_i'][:, tstep] = np.dot(coeffs, imem['isyn_i'])
-
-                if rec_pop_contributions:
-                    for j, coeffs in enumerate(dotprodcoeffs):
-                        k = 0 # counter
-                        for nsegs, name in zip(population_nsegs, network.population_names):
-                            cellinds = np.arange(k, k+nsegs)
-                            RESULTS[j][name][:, tstep] = np.dot(coeffs[:, cellinds],
-                                                                imem['imem'][cellinds, ])
-                            k += nsegs
-
-            if to_file:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    outputfile['OUTPUT[{}]'.format(j)
-                               ]['imem'][:, tstep] = np.dot(coeffs, imem['imem'])
-                    if use_ipas:
-                        outputfile['OUTPUT[{}]'.format(j)
-                                   ]['ipas'][:, tstep] = np.dot(coeffs, imem['ipas'] * network_dummycell.area * 1E-2)
-                    if use_icap:
-                        outputfile['OUTPUT[{}]'.format(j)
-                                   ]['icap'][:, tstep] = np.dot(coeffs, imem['icap'] * network_dummycell.area * 1E-2)
-                    if use_isyn:
-                        outputfile['OUTPUT[{}]'.format(j)
-                                   ]['isyn_e'][:, tstep] = np.dot(coeffs, imem['isyn_e'])
-                        outputfile['OUTPUT[{}]'.format(j)
-                                   ]['isyn_i'][:, tstep] = np.dot(coeffs, imem['isyn_i'])
-
-                if rec_pop_contributions:
-                    for j, coeffs in enumerate(dotprodcoeffs):
-                        k = 0 # counter
-                        for nsegs, name in zip(population_nsegs, network.population_names):
-                            cellinds = np.arange(k, k+nsegs)
-                            outputfile['OUTPUT[{}]'.format(j)
-                                       ][name][:, tstep] = np.dot(coeffs[:, cellinds], imem['imem'][cellinds, ])
-                            k += nsegs
-
-            tstep += 1
-        neuron.h.fadvance()
-        if neuron.h.t % 100. == 0.:
-            if RANK == 0:
-                print('t = {} ms'.format(neuron.h.t))
-
-
-    try:
-        #calculate LFP after final fadvance()
-        i = 0
-        totnsegs = 0
-        if use_isyn:
-            imem['isyn_e'] = 0. # need to reset these for every iteration because we sum over synapses
-            imem['isyn_i'] = 0.
-        for cell in cells:
-            for sec in cell.allseclist:
-                for seg in sec:
-                    imem['imem'][i] = seg.i_membrane_
-                    if use_ipas:
-                        imem['ipas'][i] = seg.i_pas
-                    if use_icap:
-                        imem['icap'][i] = seg.i_cap
-                    i += 1
-
-            if use_isyn:
-                for idx, syn in zip(cell.synidx, cell.netconsynapses):
-                    if hasattr(syn, 'e') and syn.e > -50:
-                        imem['isyn_e'][idx+totnsegs] += syn.i
-                    else:
-                        imem['isyn_i'][idx+totnsegs] += syn.i
-
-            totnsegs += cell.totnsegs
-
-        if rec_current_dipole_moment:
-            k = 0 # counter
-            for nsegs, name in zip(population_nsegs, network.population_names):
-                cellinds = np.arange(k, k+nsegs)
-                DIPOLE_MOMENT[name][tstep, ] = np.dot(imem['imem'][cellinds, ], midpoints[cellinds, ])
-                k += nsegs
-
-        if to_memory:
-            for j, coeffs in enumerate(dotprodcoeffs):
-                RESULTS[j]['imem'][:, tstep] = np.dot(coeffs, imem['imem'])
-                if use_ipas:
-                    RESULTS[j]['ipas'][:, tstep] = np.dot(coeffs, imem['ipas'] * network_dummycell.area * 1E-2)
-                if use_icap:
-                    RESULTS[j]['icap'][:, tstep] = np.dot(coeffs, imem['icap'] * network_dummycell.area * 1E-2)
-                if use_isyn:
-                    RESULTS[j]['isyn_e'][:, tstep] = np.dot(coeffs, imem['isyn_e'])
-                    RESULTS[j]['isyn_i'][:, tstep] = np.dot(coeffs, imem['isyn_i'])
-
-            if rec_pop_contributions:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    k = 0 # counter
-                    for nsegs, name in zip(population_nsegs, network.population_names):
-                        cellinds = np.arange(k, k+nsegs)
-                        RESULTS[j][name][:, tstep] = np.dot(coeffs[:, cellinds], imem['imem'][cellinds, ])
-                        k += nsegs
-
-
-        if to_file:
-            for j, coeffs in enumerate(dotprodcoeffs):
-                outputfile['OUTPUT[{}]'.format(j)
-                           ]['imem'][:, tstep] = np.dot(coeffs, imem['imem'])
-                if use_ipas:
-                    outputfile['OUTPUT[{}]'.format(j)
-                               ]['ipas'][:, tstep] = np.dot(coeffs, imem['ipas'] * network_dummycell.area * 1E-2)
-                if use_icap:
-                    outputfile['OUTPUT[{}]'.format(j)
-                               ]['icap'][:, tstep] = np.dot(coeffs, imem['icap'] * network_dummycell.area * 1E-2)
-                if use_isyn:
-                    outputfile['OUTPUT[{}]'.format(j)
-                               ]['isyn_e'][:, tstep] = np.dot(coeffs, imem['isyn_e'])
-                    outputfile['OUTPUT[{}]'.format(j)
-                               ]['isyn_i'][:, tstep] = np.dot(coeffs, imem['isyn_i'])
-
-            if rec_pop_contributions:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    k = 0 # counter
-                    for nsegs, name in zip(population_nsegs, network.population_names):
-                        cellinds = np.arange(k, k+nsegs)
-                        outputfile['OUTPUT[{}]'.format(j)
-                                   ][name][:, tstep] = np.dot(coeffs[:, cellinds],
-                                                              imem['imem'][cellinds, ])
-                        k += nsegs
-
-    except IndexError:
-        pass
-
-    if to_memory:
-        return RESULTS, DIPOLE_MOMENT
-
-    if to_file:
-        outputfile.close()
-        return RESULTS, DIPOLE_MOMENT
-
-
-def ReduceStructArray(sendbuf, op=MPI.SUM):
-    """
-    simplify MPI Reduce for structured ndarrays with floating point numbers
-
-    Parameters
-    ----------
-    sendbuf : structured ndarray
-        Array data to be reduced (default: summed)
-    op : mpi4py.MPI.Op object
-        MPI_Reduce function. Default is mpi4py.MPI.SUM
-    """
-    if RANK == 0:
-        shape = sendbuf.shape
-        dtype_names = sendbuf.dtype.names
-    else:
-        shape = None
-        dtype_names = None
-    shape = COMM.bcast(shape)
-    dtype_names = COMM.bcast(dtype_names)
-
-    if RANK == 0:
-        reduced = np.zeros(shape,
-                           dtype=list(zip(dtype_names,
-                                     ['f8' for i in range(len(dtype_names))])))
-    else:
-        reduced = None
-    for name in dtype_names:
-        if RANK == 0:
-            recvbuf = np.zeros(shape)
-        else:
-            recvbuf = None
-        COMM.Reduce(np.array(sendbuf[name]), recvbuf, op=op, root=0)
-        if RANK == 0:
-            reduced[name] = recvbuf
-    return reduced
diff --git a/LFPy-2.0.7/LFPy/pointprocess.py b/LFPy-2.0.7/LFPy/pointprocess.py
deleted file mode 100644
index 31c7726..0000000
--- a/LFPy-2.0.7/LFPy/pointprocess.py
+++ /dev/null
@@ -1,295 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import numpy as np
-import neuron
-
-class PointProcess(object):
-    """
-    Superclass on top of Synapse, StimIntElectrode, just to import and set
-    some shared variables and extracts Cartesian coordinates of a segment
-    
-    Parameters
-    ----------
-    cell : obj
-        LFPy.Cell object
-    idx : int
-        index of segment
-    record_current : bool
-        Must be set to True for recording of pointprocess currents
-    record_potential : bool
-        Must be set to True for recording potential of pointprocess target idx
-    kwargs : pointprocess specific variables passed on to cell/neuron
-
-    """
-    def __init__(self, cell, idx, record_current=False, record_potential=False, **kwargs):
-        """
-        Initializes the PointProcess class
-        """
-        for key in ['color', 'marker']:
-            if key in kwargs.keys():
-                raise DeprecationWarning('Parameter {} has been deprecated'.format(key))
-        self.idx = idx
-        self.record_current = record_current
-        self.record_potential = record_potential
-        self.kwargs = kwargs
-        self.update_pos(cell)
-
-    def update_pos(self, cell):
-        """
-        Extract coordinates of point-process 
-        """
-        self.x = cell.xmid[self.idx]
-        self.y = cell.ymid[self.idx]
-        self.z = cell.zmid[self.idx]
-
-
-class Synapse(PointProcess):
-    """
-    The synapse class, pointprocesses that spawn membrane currents.
-    See http://www.neuron.yale.edu/neuron/static/docs/help/neuron/neuron/mech.html#pointprocesses
-    for details, or corresponding mod-files.
-    
-    This class is meant to be used with synaptic mechanisms, giving rise to
-    currents that will be part of the membrane currents. 
-
-    Parameters
-    ----------
-    cell : obj
-        `LFPy.Cell` or `LFPy.TemplateCell` instance to receive synapptic
-        input
-    idx : int
-        Cell index where the synaptic input arrives
-    syntype : str
-        Type of synapse. Built-in examples: ExpSyn, Exp2Syn
-    record_current : bool
-        Decides if current is recorded
-    **kwargs
-        Additional arguments to be passed on to
-        NEURON in `cell.set_synapse`
-
-    Examples
-    --------
-    >>> import pylab as pl
-    >>> pl.interactive(1)
-    >>> import LFPy
-    >>> import os
-    >>> cellParameters = {
-    >>>     'morphology' :  os.path.join('examples', 'morphologies', 'L5_Mainen96_LFPy.hoc'),
-    >>>     'passive' : True,
-    >>>     'tstop' :     50,
-    >>> }
-    >>> cell = LFPy.Cell(**cellParameters)
-
-    >>> synapseParameters = {
-    >>>     'idx' : cell.get_closest_idx(x=0, y=0, z=800),
-    >>>     'e' : 0,                                # reversal potential
-    >>>     'syntype' : 'ExpSyn',                   # synapse type
-    >>>     'tau' : 2,                              # syn. time constant
-    >>>     'weight' : 0.01,                        # syn. weight
-    >>>     'record_current' : True                 # syn. current record
-    >>> }
-    >>> synapse = LFPy.Synapse(cell, **synapseParameters)
-    >>> synapse.set_spike_times(pl.array([10, 15, 20, 25]))
-    >>> cell.simulate()
-
-    >>> pl.subplot(211)
-    >>> pl.plot(cell.tvec, synapse.i)
-    >>> pl.title('Synapse current (nA)')
-    >>> pl.subplot(212)
-    >>> pl.plot(cell.tvec, cell.somav)
-    >>> pl.title('Somatic potential (mV)')
-
-    """
-    def __init__(self, cell, idx, syntype, record_current=False, record_potential=False, **kwargs):
-        """
-        Initialization of class Synapse
-        """
-        PointProcess.__init__(self, cell, idx, record_current, record_potential, **kwargs)
-            
-        self.syntype = syntype
-        self.cell = cell
-        self.hocidx = int(cell.set_synapse(idx=idx, syntype=syntype,
-                                           record_current=record_current,
-                                           record_potential=record_potential,
-                                           **kwargs))
-        self._ns_index = int(cell.netstimlist.count()) - 1
-        cell.synapses.append(self)
-        cell.synidx.append(idx)
-        self.cell.sptimeslist.append(np.array([]))
-
-    def set_spike_times(self, sptimes=np.zeros(0)):
-        """Set the spike times explicitly using numpy arrays"""
-        try:
-            assert type(sptimes) is np.ndarray
-        except AssertionError:
-            raise AssertionError('synapse activation times must be a np.ndarray, not type({})'.format(type(sptimes)))
-        self.cell.sptimeslist.insrt(self._ns_index, sptimes)
-        self.cell.sptimeslist.remove(self._ns_index + 1)
-    
-    def set_spike_times_w_netstim(self, noise=1., start=0., number=1E3,
-                                  interval=10., seed=1234.):
-        """
-        Generate a train of pre-synaptic stimulus times by setting up the
-        neuron NetStim object associated with this synapse
-        
-        Parameters
-        ----------
-        noise : float in range [0, 1]
-            Fractional randomness, from deterministic to intervals that drawn
-            from negexp distribution (Poisson spiketimes).
-        start : float
-            ms, (most likely) start time of first spike
-        number : int
-            (average) number of spikes
-        interval : float
-            ms, (mean) time between spikes
-        seed : float
-            Random seed value
-        """
-        self.cell.netstimlist[self._ns_index].noise = noise
-        self.cell.netstimlist[self._ns_index].start = start
-        self.cell.netstimlist[self._ns_index].number = number
-        self.cell.netstimlist[self._ns_index].interval = interval        
-        self.cell.netstimlist[self._ns_index].seed(seed)
-
-    def collect_current(self, cell):
-        """Collect synapse current"""
-        try:
-            self.i = np.array(cell.synireclist.o(self.hocidx))
-        except:
-            raise Exception('cell.synireclist deleted from consequtive runs')
-    
-    def collect_potential(self, cell):
-        """Collect membrane potential of segment with synapse"""
-        try:
-            self.v = np.array(cell.synvreclist.o(self.hocidx))
-        except:
-            raise Exception('cell.synvreclist deleted from consequtive runs')
-
-
-class StimIntElectrode(PointProcess):
-    """Class for NEURON point processes representing electrode currents,
-    such as VClamp, SEClamp and ICLamp.
-    
-    Membrane currents will no longer sum to zero if these mechanisms are used,
-    as the equivalent circuit is akin to a current input to the compartment
-    from a far away extracellular location ("ground"), not immediately from
-    the surface to the inside of the compartment as with transmembrane currents.
-    
-    Refer to NEURON documentation @ neuron.yale.edu for keyword arguments or 
-    class documentation in Python issuing e.g.
-        
-        help(neuron.h.VClamp)
-    
-    Will insert pptype on cell-instance, pass the corresponding kwargs onto
-    cell.set_point_process.
-
-    Parameters
-    ----------
-    cell : obj
-        `LFPy.Cell` or `LFPy.TemplateCell` instance to receive Stimulation
-         electrode input
-    idx : int
-        Cell segment index where the stimulation electrode is placed
-    pptype : str
-        Type of point process. Built-in examples: VClamp, SEClamp and ICLamp.
-        Defaults to 'SEClamp'.
-    record_current : bool
-        Decides if current is recorded
-    record_potential : bool
-        switch for recording the potential on postsynaptic segment index
-    **kwargs
-        Additional arguments to be passed on to
-        NEURON in `cell.set_point_process`
-
-    Examples
-    --------
-    >>> import pylab as pl
-    >>> pl.ion()
-    >>> import os
-    >>> import LFPy
-    >>> #define a list of different electrode implementations from NEURON
-    >>> pointprocesses = [
-    >>>     {
-    >>>         'idx' : 0,
-    >>>         'record_current' : True,
-    >>>         'pptype' : 'IClamp',
-    >>>         'amp' : 1,
-    >>>         'dur' : 20,
-    >>>         'delay' : 10,
-    >>>     },
-    >>>     {
-    >>>         'idx' : 0,
-    >>>         'record_current' : True,
-    >>>         'pptype' : 'VClamp',
-    >>>         'amp[0]' : -70,
-    >>>         'dur[0]' : 10,
-    >>>         'amp[1]' : 0,
-    >>>         'dur[1]' : 20,
-    >>>         'amp[2]' : -70,
-    >>>         'dur[2]' : 10,
-    >>>    },
-    >>>    {
-    >>>        'idx' : 0,
-    >>>        'record_current' : True,
-    >>>        'pptype' : 'SEClamp',
-    >>>        'dur1' : 10,
-    >>>        'amp1' : -70,
-    >>>        'dur2' : 20,
-    >>>        'amp2' : 0,
-    >>>        'dur3' : 10,
-    >>>        'amp3' : -70,
-    >>>     },
-    >>>  ]
-    >>>  #create a cell instance for each electrode
-    >>> for pointprocess in pointprocesses:
-    >>>      cell = LFPy.Cell(morphology=os.path.join('examples', 'morphologies', 'L5_Mainen96_LFPy.hoc'),
-    >>>                      passive=True)
-    >>>      stimulus = LFPy.StimIntElectrode(cell, **pointprocess)
-    >>>      cell.simulate()
-    >>>      pl.subplot(211)
-    >>>      pl.plot(cell.tvec, stimulus.i, label=pointprocess['pptype'])
-    >>>      pl.legend(loc='best')
-    >>>      pl.title('Stimulus currents (nA)')
-    >>>      pl.subplot(212)
-    >>>      pl.plot(cell.tvec, cell.somav, label=pointprocess['pptype'])
-    >>>      pl.legend(loc='best')
-    >>>      pl.title('Somatic potential (mV)')
-
-    """    
-    def __init__(self, cell, idx, pptype='SEClamp',
-                 record_current=False,
-                 record_potential=False, **kwargs):
-        """Initialize StimIntElectrode class"""
-        PointProcess.__init__(self, cell=cell, idx=idx,
-                              record_current=record_current,
-                              record_potential=record_potential)
-        self.pptype = pptype
-        self.hocidx = int(cell.set_point_process(idx, pptype,
-                                                 record_current=record_current,
-                                                 record_potential=record_potential,
-                                                 **kwargs))
-        cell.pointprocesses.append(self)
-        cell.pointprocess_idx.append(idx)
-
-    def collect_current(self, cell):
-        """Fetch electrode current from recorder list"""
-        self.i = np.array(cell.stimireclist.o(self.hocidx))
-    
-    def collect_potential(self, cell):
-        """Collect membrane potential of segment with PointProcess"""
-        self.v = np.array(cell.stimvreclist.o(self.hocidx))
diff --git a/LFPy-2.0.7/LFPy/recextelectrode.py b/LFPy-2.0.7/LFPy/recextelectrode.py
deleted file mode 100644
index 35ef6c1..0000000
--- a/LFPy-2.0.7/LFPy/recextelectrode.py
+++ /dev/null
@@ -1,900 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import sys
-import warnings
-import numpy as np
-from . import lfpcalc, tools
-
-class RecExtElectrode(object):
-    """class RecExtElectrode
-
-    Main class that represents an extracellular electric recording devices such
-    as a laminar probe.
-
-    Parameters
-    ----------
-    cell : None or object
-        If not None, instantiation of LFPy.Cell, LFPy.TemplateCell or similar.
-    sigma : float or list/ndarray of floats
-        extracellular conductivity in units of (S/m). A scalar value implies an
-        isotropic extracellular conductivity. If a length 3 list or array of
-        floats is provided, these values corresponds to an anisotropic
-        conductor with conductivities [sigma_x, sigma_y, sigma_z] accordingly.
-    x, y, z : np.ndarray
-        coordinates or arrays of coordinates in units of (um). Must be same length
-    N : None or list of lists
-        Normal vectors [x, y, z] of each circular electrode contact surface,
-        default None
-    r : float
-        radius of each contact surface, default None
-    n : int
-        if N is not None and r > 0, the number of discrete points used to
-        compute the n-point average potential on each circular contact point.
-    contact_shape : str
-        'circle'/'square' (default 'circle') defines the contact point shape
-        If 'circle' r is the radius, if 'square' r is the side length
-    method : str
-        switch between the assumption of 'linesource', 'pointsource',
-        'soma_as_point' to represent each compartment when computing
-        extracellular potentials
-    from_file : bool
-        if True, load cell object from file
-    cellfile : str
-        path to cell pickle
-    verbose : bool
-        Flag for verbose output, i.e., print more information
-    seedvalue : int
-        random seed when finding random position on contact with r > 0
-
-    Examples
-    --------
-    Compute extracellular potentials after simulating and storage of
-    transmembrane currents with the LFPy.Cell class:
-
-    >>> import numpy as np
-    >>> import matplotlib.pyplot as plt
-    >>> import LFPy
-    >>>
-    >>> cellParameters = {
-    >>>     'morphology' : 'examples/morphologies/L5_Mainen96_LFPy.hoc',  # morphology file
-    >>>     'v_init' : -65,                          # initial voltage
-    >>>     'cm' : 1.0,                             # membrane capacitance
-    >>>     'Ra' : 150,                             # axial resistivity
-    >>>     'passive' : True,                        # insert passive channels
-    >>>     'passive_parameters' : {"g_pas":1./3E4, "e_pas":-65}, # passive params
-    >>>     'dt' : 2**-4,                           # simulation time res
-    >>>     'tstart' : 0.,                        # start t of simulation
-    >>>     'tstop' : 50.,                        # end t of simulation
-    >>> }
-    >>> cell = LFPy.Cell(**cellParameters)
-    >>>
-    >>> synapseParameters = {
-    >>>     'idx' : cell.get_closest_idx(x=0, y=0, z=800), # compartment
-    >>>     'e' : 0,                                # reversal potential
-    >>>     'syntype' : 'ExpSyn',                   # synapse type
-    >>>     'tau' : 2,                              # syn. time constant
-    >>>     'weight' : 0.01,                       # syn. weight
-    >>>     'record_current' : True                 # syn. current record
-    >>> }
-    >>> synapse = LFPy.Synapse(cell, **synapseParameters)
-    >>> synapse.set_spike_times(np.array([10., 15., 20., 25.]))
-    >>>
-    >>> cell.simulate(rec_imem=True)
-    >>>
-    >>> N = np.empty((16, 3))
-    >>> for i in xrange(N.shape[0]): N[i,] = [1, 0, 0] #normal vec. of contacts
-    >>> electrodeParameters = {         #parameters for RecExtElectrode class
-    >>>     'sigma' : 0.3,              #Extracellular potential
-    >>>     'x' : np.zeros(16)+25,      #Coordinates of electrode contacts
-    >>>     'y' : np.zeros(16),
-    >>>     'z' : np.linspace(-500,1000,16),
-    >>>     'n' : 20,
-    >>>     'r' : 10,
-    >>>     'N' : N,
-    >>> }
-    >>> electrode = LFPy.RecExtElectrode(cell, **electrodeParameters)
-    >>> electrode.calc_lfp()
-    >>> plt.matshow(electrode.LFP)
-    >>> plt.colorbar()
-    >>> plt.axis('tight')
-    >>> plt.show()
-
-
-    Compute extracellular potentials during simulation (recommended):
-
-    >>> import numpy as np
-    >>> import matplotlib.pyplot as plt
-    >>> import LFPy
-    >>>
-    >>> cellParameters = {
-    >>>     'morphology' : 'examples/morphologies/L5_Mainen96_LFPy.hoc',  # morphology file
-    >>>     'v_init' : -65,                          # initial voltage
-    >>>     'cm' : 1.0,                             # membrane capacitance
-    >>>     'Ra' : 150,                             # axial resistivity
-    >>>     'passive' : True,                        # insert passive channels
-    >>>     'passive_parameters' : {"g_pas":1./3E4, "e_pas":-65}, # passive params
-    >>>     'dt' : 2**-4,                           # simulation time res
-    >>>     'tstart' : 0.,                        # start t of simulation
-    >>>     'tstop' : 50.,                        # end t of simulation
-    >>> }
-    >>> cell = LFPy.Cell(**cellParameters)
-    >>>
-    >>> synapseParameters = {
-    >>>     'idx' : cell.get_closest_idx(x=0, y=0, z=800), # compartment
-    >>>     'e' : 0,                                # reversal potential
-    >>>     'syntype' : 'ExpSyn',                   # synapse type
-    >>>     'tau' : 2,                              # syn. time constant
-    >>>     'weight' : 0.01,                       # syn. weight
-    >>>     'record_current' : True                 # syn. current record
-    >>> }
-    >>> synapse = LFPy.Synapse(cell, **synapseParameters)
-    >>> synapse.set_spike_times(np.array([10., 15., 20., 25.]))
-    >>>
-    >>> N = np.empty((16, 3))
-    >>> for i in xrange(N.shape[0]): N[i,] = [1, 0, 0] #normal vec. of contacts
-    >>> electrodeParameters = {         #parameters for RecExtElectrode class
-    >>>     'sigma' : 0.3,              #Extracellular potential
-    >>>     'x' : np.zeros(16)+25,      #Coordinates of electrode contacts
-    >>>     'y' : np.zeros(16),
-    >>>     'z' : np.linspace(-500,1000,16),
-    >>>     'n' : 20,
-    >>>     'r' : 10,
-    >>>     'N' : N,
-    >>> }
-    >>> electrode = LFPy.RecExtElectrode(**electrodeParameters)
-    >>>
-    >>> cell.simulate(electrode=electrode)
-    >>>
-    >>> plt.matshow(electrode.LFP)
-    >>> plt.colorbar()
-    >>> plt.axis('tight')
-    >>> plt.show()
-
-    """
-
-    def __init__(self, cell=None, sigma=0.3,
-                 x=np.array([0]), y=np.array([0]), z=np.array([0]),
-                 N=None, r=None, n=None, contact_shape='circle',
-                 perCellLFP=False, method='linesource',
-                 from_file=False, cellfile=None, verbose=False,
-                 seedvalue=None, **kwargs):
-        """Initialize RecExtElectrode class"""
-
-        self.sigma = sigma
-        if type(sigma) in [list, np.ndarray]:
-            self.sigma = np.array(sigma)
-            if not self.sigma.shape == (3,):
-                raise ValueError("Conductivity, sigma, should be float "
-                                 "or array of length 3: "
-                                 "[sigma_x, sigma_y, sigma_z]")
-
-            self.anisotropic = True
-        else:
-            self.sigma = sigma
-            self.anisotropic = False
-
-        if type(x) in [float, int]:
-            self.x = np.array([x])
-        else:
-            self.x = np.array(x).flatten()
-        if type(y) in [float, int]:
-            self.y = np.array([y])
-        else:
-            self.y = np.array(y).flatten()
-        if type(z) in [float, int]:
-            self.z = np.array([z])
-        else:
-            self.z = np.array(z).flatten()
-        try:
-            assert((self.x.size==self.y.size) and (self.x.size==self.z.size))
-        except AssertionError:
-            raise AssertionError("The number of elements in [x, y, z] must be identical")
-
-        if N is not None:
-            if type(N) != np.array:
-                try:
-                    N = np.array(N)
-                except:
-                    print('Keyword argument N could not be converted to a '
-                          'numpy.ndarray of shape (n_contacts, 3)')
-                    print(sys.exc_info()[0])
-                    raise
-            if N.shape[-1] == 3:
-                self.N = N
-            else:
-                self.N = N.T
-                if N.shape[-1] != 3:
-                    raise Exception('N.shape must be (n_contacts, 1, 3)!')
-        else:
-            self.N = N
-
-        self.r = r
-        self.n = n
-
-        if contact_shape is None:
-            self.contact_shape = 'circle'
-        elif contact_shape in ['circle', 'square']:
-            self.contact_shape = contact_shape
-        else:
-            raise ValueError('The contact_shape argument must be either: '
-                             'None, \'circle\', \'square\'')
-
-        self.perCellLFP = perCellLFP
-
-        self.method = method
-        self.verbose = verbose
-        self.seedvalue = seedvalue
-
-        self.kwargs = kwargs
-
-        #None-type some attributes created by the Cell class
-        self.electrodecoeff = None
-        self.circle = None
-        self.offsets = None
-
-        if from_file:
-            if type(cellfile) == type(str()):
-                cell = tools.load(cellfile)
-            elif type(cellfile) == type([]):
-                cell = []
-                for fil in cellfile:
-                    cell.append(tools.load(fil))
-            else:
-                raise ValueError('cell either string or list of strings')
-
-        if cell is not None:
-            self.set_cell(cell)
-
-        if method == 'soma_as_point':
-            if self.anisotropic:
-                self.lfp_method = lfpcalc.calc_lfp_soma_as_point_anisotropic
-            else:
-                self.lfp_method = lfpcalc.calc_lfp_soma_as_point
-        elif method == 'som_as_point':
-            raise RuntimeError('The method "som_as_point" is deprecated.'
-                                     'Use "soma_as_point" instead')
-        elif method == 'linesource':
-            if self.anisotropic:
-                self.lfp_method = lfpcalc.calc_lfp_linesource_anisotropic
-            else:
-                self.lfp_method = lfpcalc.calc_lfp_linesource
-        elif method == 'pointsource':
-            if self.anisotropic:
-                self.lfp_method = lfpcalc.calc_lfp_pointsource_anisotropic
-            else:
-                self.lfp_method = lfpcalc.calc_lfp_pointsource
-        else:
-            raise ValueError("LFP method not recognized. "
-                             "Should be 'soma_as_point', 'linesource' "
-                             "or 'pointsource'")
-
-    def set_cell(self, cell):
-        """Set the supplied cell object as attribute "cell" of the
-        RecExtElectrode object
-
-        Parameters
-        ----------
-        cell : obj
-            `LFPy.Cell` or `LFPy.TemplateCell` instance.
-
-        Returns
-        -------
-        None
-        """
-        self.cell = cell
-        if self.cell is not None:
-            self.r_limit = self.cell.diam/2
-            self.mapping = np.zeros((self.x.size, len(cell.xmid)))
-
-
-    def _test_imem_sum(self, tolerance=1E-8):
-        """Test that the membrane currents sum to zero"""
-        if type(self.cell) == dict or type(self.cell) == list:
-            raise DeprecationWarning('no support for more than one cell-object')
-
-        sum_imem = self.cell.imem.sum(axis=0)
-        #check if eye matrix is supplied:
-        if ((self.cell.imem.shape == (self.cell.totnsegs, self.cell.totnsegs))
-            and (np.all(self.cell.imem == np.eye(self.cell.totnsegs)))):
-            pass
-        else:
-            if abs(sum_imem).max() >= tolerance:
-                warnings.warn('Membrane currents do not sum to zero')
-                [inds] = np.where((abs(sum_imem) >= tolerance))
-                if self.cell.verbose:
-                    for i in inds:
-                        print('membrane current sum of celltimestep %i: %.3e'
-                            % (i, sum_imem[i]))
-            else:
-                pass
-
-
-    def calc_mapping(self, cell):
-        """Creates a linear mapping of transmembrane currents of each segment
-        of the supplied cell object to contribution to extracellular potential
-        at each electrode contact point of the RexExtElectrode object. Sets
-        the class attribute "mapping", which is a shape (n_contact, n_segs)
-        ndarray, such that the extracellular potential at the contacts
-        phi = np.dot(mapping, I_mem)
-        where I_mem is a shape (n_segs, n_tsteps) ndarray with transmembrane
-        currents for each time step of the simulation.
-
-        Parameters
-        ----------
-        cell : obj
-            `LFPy.Cell` or `LFPy.TemplateCell` instance.
-
-        Returns
-        -------
-        mapping : ndarray
-            The attribute RecExtElectrode.mapping is returned (optional)
-        """
-        if cell is not None:
-            self.set_cell(cell)
-
-        if self.n is not None and self.N is not None and self.r is not None:
-            if self.n <= 1:
-                raise ValueError("n = %i must be larger that 1" % self.n)
-            else:
-                pass
-
-            self._lfp_el_pos_calc_dist()
-
-            if self.verbose:
-                print('calculations finished, %s, %s' % (str(self),
-                                                         str(self.cell)))
-        else:
-            self._loop_over_contacts()
-            if self.verbose:
-                print('calculations finished, %s, %s' % (str(self),
-                                                         str(self.cell)))
-        # return mapping
-        return self.mapping
-
-
-    def calc_lfp(self, t_indices=None, cell=None):
-        """Calculate LFP on electrode geometry from all cell instances.
-        Will chose distributed calculated if electrode contain 'n', 'N', and 'r'
-
-        Parameters
-        ----------
-        cell : obj, optional
-            `LFPy.Cell` or `LFPy.TemplateCell` instance. Must be specified here
-            if it was not specified at the initiation of the `RecExtElectrode`
-            class
-        t_indices : np.ndarray
-            Array of timestep indexes where extracellular potential should
-            be calculated.
-        """
-
-        self.calc_mapping(cell)
-
-        if t_indices is not None:
-            currmem = self.cell.imem[:, t_indices]
-        else:
-            currmem = self.cell.imem
-
-        self._test_imem_sum()
-        self.LFP = np.dot(self.mapping, currmem)
-        # del self.mapping
-
-
-    def _loop_over_contacts(self, **kwargs):
-        """Loop over electrode contacts, and return LFPs across channels"""
-
-        for i in range(self.x.size):
-            self.mapping[i, :] = self.lfp_method(self.cell,
-                                             x = self.x[i],
-                                             y = self.y[i],
-                                             z = self.z[i],
-                                             sigma = self.sigma,
-                                             r_limit = self.r_limit,
-                                             **kwargs)
-
-
-    def _lfp_el_pos_calc_dist(self, **kwargs):
-
-        """
-        Calc. of LFP over an n-point integral approximation over flat
-        electrode surface: circle of radius r or square of side r. The
-        locations of these n points on the electrode surface are random,
-        within the given surface. """
-        # lfp_el_pos = np.zeros(self.LFP.shape)
-        self.offsets = {}
-        self.circle_circ = {}
-
-        def create_crcl(i):
-            """make circumsize of contact point"""
-            crcl = np.zeros((self.n, 3))
-            for j in range(self.n):
-                B = [(np.random.rand()-0.5),
-                    (np.random.rand()-0.5),
-                    (np.random.rand()-0.5)]
-                crcl[j, ] = np.cross(self.N[i, ], B)
-                crcl[j, ] = crcl[j, ]/np.sqrt(crcl[j, 0]**2 +
-                                           crcl[j, 1]**2 +
-                                           crcl[j, 2]**2)*self.r
-
-            crclx = crcl[:, 0] + self.x[i]
-            crcly = crcl[:, 1] + self.y[i]
-            crclz = crcl[:, 2] + self.z[i]
-
-            return crclx, crcly, crclz
-
-        def create_sqr(i):
-            """make circle in which square contact is circumscribed"""
-            sqr = np.zeros((self.n, 3))
-            for j in range(self.n):
-                B = [(np.random.rand() - 0.5),
-                     (np.random.rand() - 0.5),
-                     (np.random.rand() - 0.5)]
-                sqr[j,] = np.cross(self.N[i,], B)/np.linalg.norm(np.cross(self.N[i,], B)) * self.r * np.sqrt(2)/2
-
-            sqrx = sqr[:, 0] + self.x[i]
-            sqry = sqr[:, 1] + self.y[i]
-            sqrz = sqr[:, 2] + self.z[i]
-
-            return sqrx, sqry, sqrz
-
-        def calc_xyz_n(i):
-            """calculate some offsets"""
-            #offsets and radii init
-            offs = np.zeros((self.n, 3))
-            r2 = np.zeros(self.n)
-
-            #assert the same random numbers are drawn every time
-            if self.seedvalue is not None:
-                np.random.seed(self.seedvalue)
-
-            if self.contact_shape is 'circle':
-                for j in range(self.n):
-                    A = [(np.random.rand()-0.5)*self.r*2,
-                        (np.random.rand()-0.5)*self.r*2,
-                        (np.random.rand()-0.5)*self.r*2]
-                    offs[j, ] = np.cross(self.N[i, ], A)
-                    r2[j] = offs[j, 0]**2 + offs[j, 1]**2 + offs[j, 2]**2
-                    while r2[j] > self.r**2:
-                        A = [(np.random.rand()-0.5)*self.r*2,
-                            (np.random.rand()-0.5)*self.r*2,
-                            (np.random.rand()-0.5)*self.r*2]
-                        offs[j, ] = np.cross(self.N[i, ], A)
-                        r2[j] = offs[j, 0]**2 + offs[j, 1]**2 + offs[j, 2]**2
-            elif self.contact_shape is 'square':
-                for j in range(self.n):
-                    A = [(np.random.rand()-0.5),
-                        (np.random.rand()-0.5),
-                        (np.random.rand()-0.5)]
-                    offs[j, ] = np.cross(self.N[i, ], A)*self.r
-                    r2[j] = offs[j, 0]**2 + offs[j, 1]**2 + offs[j, 2]**2
-
-            x_n = offs[:, 0] + self.x[i]
-            y_n = offs[:, 1] + self.y[i]
-            z_n = offs[:, 2] + self.z[i]
-
-            return x_n, y_n, z_n
-
-        def loop_over_points(x_n, y_n, z_n):
-
-            #loop over points on contact
-            for j in range(self.n):
-                tmp = self.lfp_method(self.cell,
-                                              x = x_n[j],
-                                              y = y_n[j],
-                                              z = z_n[j],
-                                              r_limit = self.r_limit,
-                                              sigma = self.sigma,
-                                              **kwargs
-                                              )
-
-                if j == 0:
-                    lfp_e = tmp
-                else:
-                    lfp_e += tmp
-
-                #no longer needed
-                del tmp
-
-            return lfp_e / self.n
-
-        #loop over contacts
-        for i in range(len(self.x)):
-            if self.n > 1:
-
-                #fetch offsets:
-                x_n, y_n, z_n = calc_xyz_n(i)
-
-                #fill in with contact average
-                self.mapping[i] = loop_over_points(x_n, y_n, z_n) #lfp_e.mean(axis=0)
-
-            else:
-                self.mapping[i] = self.lfp_method(self.cell,
-                                              x=self.x[i],
-                                              y=self.y[i],
-                                              z=self.z[i],
-                                              r_limit = self.r_limit,
-                                              sigma=self.sigma,
-                                              **kwargs)
-
-            self.offsets[i] = {'x_n' : x_n,
-                               'y_n' : y_n,
-                               'z_n' : z_n}
-
-            #fetch circumscribed circle around contact
-            if self.contact_shape is 'circle':
-                crcl = create_crcl(i)
-                self.circle_circ[i] = {
-                    'x' : crcl[0],
-                    'y' : crcl[1],
-                    'z' : crcl[2],
-                }
-            elif self.contact_shape is 'square':
-                sqr = create_sqr(i)
-                self.circle_circ[i] = {
-                    'x': sqr[0],
-                    'y': sqr[1],
-                    'z': sqr[2],
-                }
-
-
-class RecMEAElectrode(RecExtElectrode):
-    """class RecMEAElectrode
-
-    Electrode class that represents an extracellular in vitro slice recording
-    as a Microelectrode Array (MEA). Inherits RecExtElectrode class
-
-    Set-up:
-
-              Above neural tissue (Saline) -> sigma_S
-    <----------------------------------------------------> z = z_shift + h
-
-              Neural Tissue -> sigma_T
-
-                   o -> source_pos = [x',y',z']
-
-    <-----------*----------------------------------------> z = z_shift + 0
-                 \-> elec_pos = [x,y,z]
-
-              Below neural tissue (MEA Glass plate) -> sigma_G
-
-    Parameters
-    ----------
-    cell : None or object
-        If not None, instantiation of LFPy.Cell, LFPy.TemplateCell or similar.
-    sigma_T : float
-        extracellular conductivity of neural tissue in unit (S/m)
-    sigma_S : float
-        conductivity of saline bath that the neural slice is
-        immersed in [1.5] (S/m)
-    sigma_G : float
-        conductivity of MEA glass electrode plate. Most commonly
-        assumed non-conducting [0.0] (S/m)
-    h : float, int
-        Thickness in um of neural tissue layer containing current
-        the current sources (i.e., in vitro slice or cortex)
-    z_shift : float, int
-        Height in um of neural tissue layer bottom. If e.g., top of neural tissue
-        layer should be z=0, use z_shift=-h. Defaults to z_shift = 0, so
-        that the neural tissue layer extends from z=0 to z=h.
-    squeeze_cell_factor : float or None
-        Factor to squeeze the cell in the z-direction. This is
-        needed for large cells that are thicker than the slice, since no part
-        of the cell is allowed to be outside the slice. The squeeze is done
-        after the neural simulation, and therefore does not affect neuronal
-        simulation, only calculation of extracellular potentials.
-    x, y, z : np.ndarray
-        coordinates or arrays of coordinates in units of (um).
-        Must be same length
-    N : None or list of lists
-        Normal vectors [x, y, z] of each circular electrode contact surface,
-        default None
-    r : float
-        radius of each contact surface, default None
-    n : int
-        if N is not None and r > 0, the number of discrete points used to
-        compute the n-point average potential on each circular contact point.
-    contact_shape : str
-        'circle'/'square' (default 'circle') defines the contact point shape
-        If 'circle' r is the radius, if 'square' r is the side length
-    method : str
-        switch between the assumption of 'linesource', 'pointsource',
-        'soma_as_point' to represent each compartment when computing
-        extracellular potentials
-    from_file : bool
-        if True, load cell object from file
-    cellfile : str
-        path to cell pickle
-    verbose : bool
-        Flag for verbose output, i.e., print more information
-    seedvalue : int
-        random seed when finding random position on contact with r > 0
-
-    Examples
-    See also examples/example_MEA.py
-
-    >>> import numpy as np
-    >>> import matplotlib.pyplot as plt
-    >>> import LFPy
-    >>>
-    >>> cellParameters = {
-    >>>     'morphology' : 'examples/morphologies/L5_Mainen96_LFPy.hoc',  # morphology file
-    >>>     'v_init' : -65,                          # initial voltage
-    >>>     'cm' : 1.0,                             # membrane capacitance
-    >>>     'Ra' : 150,                             # axial resistivity
-    >>>     'passive' : True,                        # insert passive channels
-    >>>     'passive_parameters' : {"g_pas":1./3E4, "e_pas":-65}, # passive params
-    >>>     'dt' : 2**-4,                           # simulation time res
-    >>>     'tstart' : 0.,                        # start t of simulation
-    >>>     'tstop' : 50.,                        # end t of simulation
-    >>> }
-    >>> cell = LFPy.Cell(**cellParameters)
-    >>> cell.set_rotation(x=np.pi/2, z=np.pi/2)
-    >>> cell.set_pos(z=100)
-    >>> synapseParameters = {
-    >>>     'idx' : cell.get_closest_idx(x=800, y=0, z=100), # compartment
-    >>>     'e' : 0,                                # reversal potential
-    >>>     'syntype' : 'ExpSyn',                   # synapse type
-    >>>     'tau' : 2,                              # syn. time constant
-    >>>     'weight' : 0.01,                       # syn. weight
-    >>>     'record_current' : True                 # syn. current record
-    >>> }
-    >>> synapse = LFPy.Synapse(cell, **synapseParameters)
-    >>> synapse.set_spike_times(np.array([10., 15., 20., 25.]))
-    >>>
-    >>> MEA_electrode_parameters = {
-    >>>     'sigma_T' : 0.3,      # extracellular conductivity
-    >>>     'sigma_G' : 0.0,      # MEA glass electrode plate conductivity
-    >>>     'sigma_S' : 1.5,      # Saline bath conductivity
-    >>>     'x' : np.linspace(0, 1200, 16),  # electrode requires 1d vector of positions
-    >>>     'y' : np.zeros(16),
-    >>>     'z' : np.zeros(16),
-    >>>     "method": "pointsource",
-    >>>     "h": 300,
-    >>>     "squeeze_cell_factor": 0.3,
-    >>> }
-    >>> MEA = LFPy.RecMEAElectrode(cell, **MEA_electrode_parameters)
-    >>>
-    >>> cell.simulate(electrode=MEA)
-    >>>
-    >>> plt.matshow(MEA.LFP)
-    >>> plt.colorbar()
-    >>> plt.axis('tight')
-    >>> plt.show()
-    """
-    def __init__(self, cell=None, sigma_T=0.3, sigma_S=1.5, sigma_G=0.0,
-                 h=300., z_shift=0., steps=20,
-                 x=np.array([0]), y=np.array([0]), z=np.array([0]),
-                 N=None, r=None, n=None,
-                 perCellLFP=False, method='linesource',
-                 from_file=False, cellfile=None, verbose=False,
-                 seedvalue=None, squeeze_cell_factor=None, **kwargs):
-
-        RecExtElectrode.__init__(self, cell=cell,
-                     x=x, y=y, z=z,
-                     N=N, r=r, n=n,
-                     perCellLFP=perCellLFP, method=method,
-                     from_file=from_file, cellfile=cellfile, verbose=verbose,
-                     seedvalue=seedvalue, **kwargs)
-
-        self.sigma_G = sigma_G
-        self.sigma_T = sigma_T
-        self.sigma_S = sigma_S
-        self.sigma = None
-        self.h = h
-        self.z_shift = z_shift
-        self.steps = steps
-        self.squeeze_cell_factor = squeeze_cell_factor
-        self.moi_param_kwargs = {"h": self.h,
-                                 "steps": self.steps,
-                                 "sigma_G": self.sigma_G,
-                                 "sigma_T": self.sigma_T,
-                                 "sigma_S": self.sigma_S,
-                                 }
-
-        if cell is not None:
-            self.set_cell(cell)
-
-        if method == 'pointsource':
-            self.lfp_method = lfpcalc.calc_lfp_pointsource_moi
-        elif method == "linesource":
-            if (np.abs(z - self.z_shift) > 1e-9).any():
-                raise NotImplementedError("The method 'linesource' is only "
-                                          "supported for electrodes at the "
-                                          "z=0 plane. Use z=0 or method "
-                                          "'pointsource'.")
-            if np.abs(self.sigma_G) > 1e-9:
-                raise NotImplementedError("The method 'linesource' is only "
-                                          "supported for sigma_G=0. Use "
-                                          "sigma_G=0 or method "
-                                          "'pointsource'.")
-            self.lfp_method = lfpcalc.calc_lfp_linesource_moi
-        elif method == "soma_as_point":
-            if (np.abs(z - self.z_shift) > 1e-9).any():
-                raise NotImplementedError("The method 'soma_as_point' is only "
-                                          "supported for electrodes at the "
-                                          "z=0 plane. Use z=0 or method "
-                                          "'pointsource'.")
-            if np.abs(self.sigma_G) > 1e-9:
-                raise NotImplementedError("The method 'soma_as_point' is only "
-                                          "supported for sigma_G=0. Use "
-                                          "sigma_G=0 or method "
-                                          "'pointsource'.")
-            self.lfp_method = lfpcalc.calc_lfp_soma_as_point_moi
-        else:
-            raise ValueError("LFP method not recognized. "
-                             "Should be 'soma_as_point', 'linesource' "
-                             "or 'pointsource'")
-
-    def _squeeze_cell_in_depth_direction(self):
-        """Will squeeze self.cell centered around the soma by a scaling factor,
-        so that it fits inside the slice. If scaling factor is not big enough,
-        a RuntimeError is raised. """
-
-        self.cell.distort_geometry(factor=self.squeeze_cell_factor)
-
-        if (np.max([self.cell.zstart, self.cell.zend]) > self.h + self.z_shift or
-            np.min([self.cell.zstart, self.cell.zend]) < self.z_shift):
-            bad_comps, reason = self._return_comp_outside_slice()
-            msg = ("Compartments {} of cell ({}) has cell.{} slice. "
-                   "Increase squeeze_cell_factor, move or rotate cell."
-                   ).format(bad_comps, self.cell.morphology, reason)
-
-            raise RuntimeError(msg)
-
-    def _return_comp_outside_slice(self):
-        """
-        Assuming part of the cell is outside the valid region,
-        i.e, not in the slice (self.z_shift < z < self.z_shift + self.h)
-        this function check what array (cell.zstart or cell.zend) that is
-        outside, and if it is above or below the valid region.
-
-        Raises: RuntimeError
-            If no compartment is outside valid region.
-
-        Returns: array, str
-            Numpy array with the compartments that are outside the slice,
-            and a string with additional information on the problem.
-        """
-        zstart_above = np.where(self.cell.zstart > self.z_shift + self.h)[0]
-        zend_above = np.where(self.cell.zend > self.z_shift + self.h)[0]
-        zend_below = np.where(self.cell.zend < self.z_shift)[0]
-        zstart_below = np.where(self.cell.zstart < self.z_shift)[0]
-
-        if len(zstart_above) > 0:
-            return zstart_above, "zstart above"
-        if len(zstart_below) > 0:
-            return zstart_below, "zstart below"
-        if len(zend_above) > 0:
-            return zend_above, "zend above"
-        if len(zend_below) > 0:
-            return zend_below, "zend below"
-        raise RuntimeError("This function should only be called if cell"
-                           "extends outside slice")
-
-    def test_cell_extent(self):
-        """
-        Test if the cell is confined within the slice.
-        If class argument "squeeze_cell" is True, cell is squeezed to to
-        fit inside slice.
-
-        """
-        if self.cell is None:
-            raise RuntimeError("Does not have cell instance.")
-
-        if (np.max([self.cell.zstart, self.cell.zend]) > self.z_shift + self.h or
-                np.min([self.cell.zstart, self.cell.zend]) < self.z_shift):
-
-            if self.verbose:
-                print("Cell extends outside slice.")
-
-            if self.squeeze_cell_factor is not None:
-                if not self.z_shift < self.cell.zmid[0] < self.z_shift + self.h:
-                    raise RuntimeError("Soma position is not in slice.")
-                self._squeeze_cell_in_depth_direction()
-            else:
-                bad_comps, reason = self._return_comp_outside_slice()
-                msg = ("Compartments {} of cell ({}) has cell.{} slice "
-                       "and argument squeeze_cell_factor is None."
-                       ).format(bad_comps, self.cell.morphology, reason)
-                raise RuntimeError(msg)
-        else:
-            if self.verbose:
-                print("Cell position is good.")
-            if self.squeeze_cell_factor is not None:
-                if self.verbose:
-                    print("Squeezing cell anyway.")
-                self._squeeze_cell_in_depth_direction()
-
-    def calc_mapping(self, cell):
-        """Creates a linear mapping of transmembrane currents of each segment
-        of the supplied cell object to contribution to extracellular potential
-        at each electrode contact point of the RexExtElectrode object. Sets
-        the class attribute "mapping", which is a shape (n_contact, n_segs)
-        ndarray, such that the extracellular potential at the contacts
-        phi = np.dot(mapping, I_mem)
-        where I_mem is a shape (n_segs, n_tsteps) ndarray with transmembrane
-        currents for each time step of the simulation.
-
-        Parameters
-        ----------
-        cell : obj
-            `LFPy.Cell` or `LFPy.TemplateCell` instance.
-
-        Returns
-        -------
-        None
-        """
-        if cell is not None:
-            self.set_cell(cell)
-        self.test_cell_extent()
-
-        # Temporarily shift coordinate system so middle layer extends
-        # from z=0 to z=h
-        self.z = self.z - self.z_shift
-        self.cell.zstart = self.cell.zstart - self.z_shift
-        self.cell.zmid = self.cell.zmid - self.z_shift
-        self.cell.zend = self.cell.zend - self.z_shift
-
-        if self.n is not None and self.N is not None and self.r is not None:
-            if self.n <= 1:
-                raise ValueError("n = %i must be larger that 1" % self.n)
-            else:
-                pass
-
-            self._lfp_el_pos_calc_dist(**self.moi_param_kwargs)
-
-            if self.verbose:
-                print('calculations finished, %s, %s' % (str(self),
-                                                         str(self.cell)))
-        else:
-            self._loop_over_contacts(**self.moi_param_kwargs)
-            if self.verbose:
-                print('calculations finished, %s, %s' % (str(self),
-                                                         str(self.cell)))
-
-        # Shift coordinate system back so middle layer extends
-        # from z=z_shift to z=z_shift + h
-        self.z = self.z + self.z_shift
-        self.cell.zstart = self.cell.zstart + self.z_shift
-        self.cell.zmid = self.cell.zmid + self.z_shift
-        self.cell.zend = self.cell.zend + self.z_shift
-
-
-    def calc_lfp(self, t_indices=None, cell=None):
-        """Calculate LFP on electrode geometry from all cell instances.
-        Will chose distributed calculated if electrode contain 'n', 'N', and 'r'
-
-        Parameters
-        ----------
-        cell : obj, optional
-            `LFPy.Cell` or `LFPy.TemplateCell` instance. Must be specified here
-            if it was not specified at the initiation of the `RecExtElectrode`
-            class
-        t_indices : np.ndarray
-            Array of timestep indexes where extracellular potential should
-            be calculated.
-        """
-
-        self.calc_mapping(cell)
-
-        if t_indices is not None:
-            currmem = self.cell.imem[:, t_indices]
-        else:
-            currmem = self.cell.imem
-
-        self._test_imem_sum()
-        self.LFP = np.dot(self.mapping, currmem)
-        # del self.mapping
diff --git a/LFPy-2.0.7/LFPy/run_simulation.c b/LFPy-2.0.7/LFPy/run_simulation.c
deleted file mode 100644
index d6946c1..0000000
--- a/LFPy-2.0.7/LFPy/run_simulation.c
+++ /dev/null
@@ -1,16102 +0,0 @@
-/* Generated by Cython 0.29.14 */
-
-#define PY_SSIZE_T_CLEAN
-#include "Python.h"
-#ifndef Py_PYTHON_H
-    #error Python headers needed to compile C extensions, please install development version of Python.
-#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
-    #error Cython requires Python 2.6+ or Python 3.3+.
-#else
-#define CYTHON_ABI "0_29_14"
-#define CYTHON_HEX_VERSION 0x001D0EF0
-#define CYTHON_FUTURE_DIVISION 1
-#include 
-#ifndef offsetof
-  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
-#endif
-#if !defined(WIN32) && !defined(MS_WINDOWS)
-  #ifndef __stdcall
-    #define __stdcall
-  #endif
-  #ifndef __cdecl
-    #define __cdecl
-  #endif
-  #ifndef __fastcall
-    #define __fastcall
-  #endif
-#endif
-#ifndef DL_IMPORT
-  #define DL_IMPORT(t) t
-#endif
-#ifndef DL_EXPORT
-  #define DL_EXPORT(t) t
-#endif
-#define __PYX_COMMA ,
-#ifndef HAVE_LONG_LONG
-  #if PY_VERSION_HEX >= 0x02070000
-    #define HAVE_LONG_LONG
-  #endif
-#endif
-#ifndef PY_LONG_LONG
-  #define PY_LONG_LONG LONG_LONG
-#endif
-#ifndef Py_HUGE_VAL
-  #define Py_HUGE_VAL HUGE_VAL
-#endif
-#ifdef PYPY_VERSION
-  #define CYTHON_COMPILING_IN_PYPY 1
-  #define CYTHON_COMPILING_IN_PYSTON 0
-  #define CYTHON_COMPILING_IN_CPYTHON 0
-  #undef CYTHON_USE_TYPE_SLOTS
-  #define CYTHON_USE_TYPE_SLOTS 0
-  #undef CYTHON_USE_PYTYPE_LOOKUP
-  #define CYTHON_USE_PYTYPE_LOOKUP 0
-  #if PY_VERSION_HEX < 0x03050000
-    #undef CYTHON_USE_ASYNC_SLOTS
-    #define CYTHON_USE_ASYNC_SLOTS 0
-  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
-    #define CYTHON_USE_ASYNC_SLOTS 1
-  #endif
-  #undef CYTHON_USE_PYLIST_INTERNALS
-  #define CYTHON_USE_PYLIST_INTERNALS 0
-  #undef CYTHON_USE_UNICODE_INTERNALS
-  #define CYTHON_USE_UNICODE_INTERNALS 0
-  #undef CYTHON_USE_UNICODE_WRITER
-  #define CYTHON_USE_UNICODE_WRITER 0
-  #undef CYTHON_USE_PYLONG_INTERNALS
-  #define CYTHON_USE_PYLONG_INTERNALS 0
-  #undef CYTHON_AVOID_BORROWED_REFS
-  #define CYTHON_AVOID_BORROWED_REFS 1
-  #undef CYTHON_ASSUME_SAFE_MACROS
-  #define CYTHON_ASSUME_SAFE_MACROS 0
-  #undef CYTHON_UNPACK_METHODS
-  #define CYTHON_UNPACK_METHODS 0
-  #undef CYTHON_FAST_THREAD_STATE
-  #define CYTHON_FAST_THREAD_STATE 0
-  #undef CYTHON_FAST_PYCALL
-  #define CYTHON_FAST_PYCALL 0
-  #undef CYTHON_PEP489_MULTI_PHASE_INIT
-  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
-  #undef CYTHON_USE_TP_FINALIZE
-  #define CYTHON_USE_TP_FINALIZE 0
-  #undef CYTHON_USE_DICT_VERSIONS
-  #define CYTHON_USE_DICT_VERSIONS 0
-  #undef CYTHON_USE_EXC_INFO_STACK
-  #define CYTHON_USE_EXC_INFO_STACK 0
-#elif defined(PYSTON_VERSION)
-  #define CYTHON_COMPILING_IN_PYPY 0
-  #define CYTHON_COMPILING_IN_PYSTON 1
-  #define CYTHON_COMPILING_IN_CPYTHON 0
-  #ifndef CYTHON_USE_TYPE_SLOTS
-    #define CYTHON_USE_TYPE_SLOTS 1
-  #endif
-  #undef CYTHON_USE_PYTYPE_LOOKUP
-  #define CYTHON_USE_PYTYPE_LOOKUP 0
-  #undef CYTHON_USE_ASYNC_SLOTS
-  #define CYTHON_USE_ASYNC_SLOTS 0
-  #undef CYTHON_USE_PYLIST_INTERNALS
-  #define CYTHON_USE_PYLIST_INTERNALS 0
-  #ifndef CYTHON_USE_UNICODE_INTERNALS
-    #define CYTHON_USE_UNICODE_INTERNALS 1
-  #endif
-  #undef CYTHON_USE_UNICODE_WRITER
-  #define CYTHON_USE_UNICODE_WRITER 0
-  #undef CYTHON_USE_PYLONG_INTERNALS
-  #define CYTHON_USE_PYLONG_INTERNALS 0
-  #ifndef CYTHON_AVOID_BORROWED_REFS
-    #define CYTHON_AVOID_BORROWED_REFS 0
-  #endif
-  #ifndef CYTHON_ASSUME_SAFE_MACROS
-    #define CYTHON_ASSUME_SAFE_MACROS 1
-  #endif
-  #ifndef CYTHON_UNPACK_METHODS
-    #define CYTHON_UNPACK_METHODS 1
-  #endif
-  #undef CYTHON_FAST_THREAD_STATE
-  #define CYTHON_FAST_THREAD_STATE 0
-  #undef CYTHON_FAST_PYCALL
-  #define CYTHON_FAST_PYCALL 0
-  #undef CYTHON_PEP489_MULTI_PHASE_INIT
-  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
-  #undef CYTHON_USE_TP_FINALIZE
-  #define CYTHON_USE_TP_FINALIZE 0
-  #undef CYTHON_USE_DICT_VERSIONS
-  #define CYTHON_USE_DICT_VERSIONS 0
-  #undef CYTHON_USE_EXC_INFO_STACK
-  #define CYTHON_USE_EXC_INFO_STACK 0
-#else
-  #define CYTHON_COMPILING_IN_PYPY 0
-  #define CYTHON_COMPILING_IN_PYSTON 0
-  #define CYTHON_COMPILING_IN_CPYTHON 1
-  #ifndef CYTHON_USE_TYPE_SLOTS
-    #define CYTHON_USE_TYPE_SLOTS 1
-  #endif
-  #if PY_VERSION_HEX < 0x02070000
-    #undef CYTHON_USE_PYTYPE_LOOKUP
-    #define CYTHON_USE_PYTYPE_LOOKUP 0
-  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
-    #define CYTHON_USE_PYTYPE_LOOKUP 1
-  #endif
-  #if PY_MAJOR_VERSION < 3
-    #undef CYTHON_USE_ASYNC_SLOTS
-    #define CYTHON_USE_ASYNC_SLOTS 0
-  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
-    #define CYTHON_USE_ASYNC_SLOTS 1
-  #endif
-  #if PY_VERSION_HEX < 0x02070000
-    #undef CYTHON_USE_PYLONG_INTERNALS
-    #define CYTHON_USE_PYLONG_INTERNALS 0
-  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
-    #define CYTHON_USE_PYLONG_INTERNALS 1
-  #endif
-  #ifndef CYTHON_USE_PYLIST_INTERNALS
-    #define CYTHON_USE_PYLIST_INTERNALS 1
-  #endif
-  #ifndef CYTHON_USE_UNICODE_INTERNALS
-    #define CYTHON_USE_UNICODE_INTERNALS 1
-  #endif
-  #if PY_VERSION_HEX < 0x030300F0
-    #undef CYTHON_USE_UNICODE_WRITER
-    #define CYTHON_USE_UNICODE_WRITER 0
-  #elif !defined(CYTHON_USE_UNICODE_WRITER)
-    #define CYTHON_USE_UNICODE_WRITER 1
-  #endif
-  #ifndef CYTHON_AVOID_BORROWED_REFS
-    #define CYTHON_AVOID_BORROWED_REFS 0
-  #endif
-  #ifndef CYTHON_ASSUME_SAFE_MACROS
-    #define CYTHON_ASSUME_SAFE_MACROS 1
-  #endif
-  #ifndef CYTHON_UNPACK_METHODS
-    #define CYTHON_UNPACK_METHODS 1
-  #endif
-  #ifndef CYTHON_FAST_THREAD_STATE
-    #define CYTHON_FAST_THREAD_STATE 1
-  #endif
-  #ifndef CYTHON_FAST_PYCALL
-    #define CYTHON_FAST_PYCALL 1
-  #endif
-  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
-    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
-  #endif
-  #ifndef CYTHON_USE_TP_FINALIZE
-    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
-  #endif
-  #ifndef CYTHON_USE_DICT_VERSIONS
-    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
-  #endif
-  #ifndef CYTHON_USE_EXC_INFO_STACK
-    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
-  #endif
-#endif
-#if !defined(CYTHON_FAST_PYCCALL)
-#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
-#endif
-#if CYTHON_USE_PYLONG_INTERNALS
-  #include "longintrepr.h"
-  #undef SHIFT
-  #undef BASE
-  #undef MASK
-  #ifdef SIZEOF_VOID_P
-    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
-  #endif
-#endif
-#ifndef __has_attribute
-  #define __has_attribute(x) 0
-#endif
-#ifndef __has_cpp_attribute
-  #define __has_cpp_attribute(x) 0
-#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
-#ifndef CYTHON_UNUSED
-# if defined(__GNUC__)
-#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define CYTHON_UNUSED __attribute__ ((__unused__))
-#   else
-#     define CYTHON_UNUSED
-#   endif
-# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
-#   define CYTHON_UNUSED __attribute__ ((__unused__))
-# else
-#   define CYTHON_UNUSED
-# endif
-#endif
-#ifndef CYTHON_MAYBE_UNUSED_VAR
-#  if defined(__cplusplus)
-     template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
-#  else
-#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
-#  endif
-#endif
-#ifndef CYTHON_NCP_UNUSED
-# if CYTHON_COMPILING_IN_CPYTHON
-#  define CYTHON_NCP_UNUSED
-# else
-#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
-# endif
-#endif
-#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
-#ifdef _MSC_VER
-    #ifndef _MSC_STDINT_H_
-        #if _MSC_VER < 1300
-           typedef unsigned char     uint8_t;
-           typedef unsigned int      uint32_t;
-        #else
-           typedef unsigned __int8   uint8_t;
-           typedef unsigned __int32  uint32_t;
-        #endif
-    #endif
-#else
-   #include 
-#endif
-#ifndef CYTHON_FALLTHROUGH
-  #if defined(__cplusplus) && __cplusplus >= 201103L
-    #if __has_cpp_attribute(fallthrough)
-      #define CYTHON_FALLTHROUGH [[fallthrough]]
-    #elif __has_cpp_attribute(clang::fallthrough)
-      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
-    #elif __has_cpp_attribute(gnu::fallthrough)
-      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
-    #endif
-  #endif
-  #ifndef CYTHON_FALLTHROUGH
-    #if __has_attribute(fallthrough)
-      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
-    #else
-      #define CYTHON_FALLTHROUGH
-    #endif
-  #endif
-  #if defined(__clang__ ) && defined(__apple_build_version__)
-    #if __apple_build_version__ < 7000000
-      #undef  CYTHON_FALLTHROUGH
-      #define CYTHON_FALLTHROUGH
-    #endif
-  #endif
-#endif
-
-#ifndef CYTHON_INLINE
-  #if defined(__clang__)
-    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
-  #elif 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
-
-#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
-  #define Py_OptimizeFlag 0
-#endif
-#define __PYX_BUILD_PY_SSIZE_T "n"
-#define CYTHON_FORMAT_SSIZE_T "z"
-#if PY_MAJOR_VERSION < 3
-  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
-  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
-          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
-  #define __Pyx_DefaultClassType PyClass_Type
-#else
-  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
-#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
-  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
-          PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
-#else
-  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
-          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
-#endif
-  #define __Pyx_DefaultClassType PyType_Type
-#endif
-#ifndef Py_TPFLAGS_CHECKTYPES
-  #define Py_TPFLAGS_CHECKTYPES 0
-#endif
-#ifndef Py_TPFLAGS_HAVE_INDEX
-  #define Py_TPFLAGS_HAVE_INDEX 0
-#endif
-#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
-  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
-#endif
-#ifndef Py_TPFLAGS_HAVE_FINALIZE
-  #define Py_TPFLAGS_HAVE_FINALIZE 0
-#endif
-#ifndef METH_STACKLESS
-  #define METH_STACKLESS 0
-#endif
-#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
-  #ifndef METH_FASTCALL
-     #define METH_FASTCALL 0x80
-  #endif
-  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
-  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
-                                                          Py_ssize_t nargs, PyObject *kwnames);
-#else
-  #define __Pyx_PyCFunctionFast _PyCFunctionFast
-  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
-#endif
-#if CYTHON_FAST_PYCCALL
-#define __Pyx_PyFastCFunction_Check(func)\
-    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
-#else
-#define __Pyx_PyFastCFunction_Check(func) 0
-#endif
-#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
-  #define PyObject_Malloc(s)   PyMem_Malloc(s)
-  #define PyObject_Free(p)     PyMem_Free(p)
-  #define PyObject_Realloc(p)  PyMem_Realloc(p)
-#endif
-#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
-  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
-  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
-  #define PyMem_RawFree(p)             PyMem_Free(p)
-#endif
-#if CYTHON_COMPILING_IN_PYSTON
-  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
-  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
-#else
-  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
-  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
-#endif
-#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
-  #define __Pyx_PyThreadState_Current PyThreadState_GET()
-#elif PY_VERSION_HEX >= 0x03060000
-  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
-#elif PY_VERSION_HEX >= 0x03000000
-  #define __Pyx_PyThreadState_Current PyThreadState_GET()
-#else
-  #define __Pyx_PyThreadState_Current _PyThreadState_Current
-#endif
-#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
-#include "pythread.h"
-#define Py_tss_NEEDS_INIT 0
-typedef int Py_tss_t;
-static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
-  *key = PyThread_create_key();
-  return 0;
-}
-static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
-  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
-  *key = Py_tss_NEEDS_INIT;
-  return key;
-}
-static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
-  PyObject_Free(key);
-}
-static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
-  return *key != Py_tss_NEEDS_INIT;
-}
-static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
-  PyThread_delete_key(*key);
-  *key = Py_tss_NEEDS_INIT;
-}
-static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
-  return PyThread_set_key_value(*key, value);
-}
-static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
-  return PyThread_get_key_value(*key);
-}
-#endif
-#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
-#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
-#else
-#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
-#endif
-#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
-  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
-  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
-#else
-  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
-  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
-#endif
-#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
-#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
-#else
-#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
-#endif
-#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
-  #define CYTHON_PEP393_ENABLED 1
-  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
-                                              0 : _PyUnicode_Ready((PyObject *)(op)))
-  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
-  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
-  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
-  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
-  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
-  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
-  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
-  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
-#else
-  #define CYTHON_PEP393_ENABLED 0
-  #define PyUnicode_1BYTE_KIND  1
-  #define PyUnicode_2BYTE_KIND  2
-  #define PyUnicode_4BYTE_KIND  4
-  #define __Pyx_PyUnicode_READY(op)       (0)
-  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
-  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
-  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
-  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
-  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
-  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
-  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
-  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
-#endif
-#if CYTHON_COMPILING_IN_PYPY
-  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
-  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
-#else
-  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
-  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
-      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
-#endif
-#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
-  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
-#endif
-#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
-  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
-#endif
-#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
-  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
-#endif
-#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
-#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
-#if PY_MAJOR_VERSION >= 3
-  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
-#else
-  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
-#endif
-#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
-  #define PyObject_ASCII(o)            PyObject_Repr(o)
-#endif
-#if PY_MAJOR_VERSION >= 3
-  #define PyBaseString_Type            PyUnicode_Type
-  #define PyStringObject               PyUnicodeObject
-  #define PyString_Type                PyUnicode_Type
-  #define PyString_Check               PyUnicode_Check
-  #define PyString_CheckExact          PyUnicode_CheckExact
-  #define PyObject_Unicode             PyObject_Str
-#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_Check(obj) || PyUnicode_Check(obj))
-  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
-#endif
-#ifndef PySet_CheckExact
-  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
-#endif
-#if CYTHON_ASSUME_SAFE_MACROS
-  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
-#else
-  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
-#endif
-#if PY_MAJOR_VERSION >= 3
-  #define PyIntObject                  PyLongObject
-  #define PyInt_Type                   PyLong_Type
-  #define PyInt_Check(op)              PyLong_Check(op)
-  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
-  #define PyInt_FromString             PyLong_FromString
-  #define PyInt_FromUnicode            PyLong_FromUnicode
-  #define PyInt_FromLong               PyLong_FromLong
-  #define PyInt_FromSize_t             PyLong_FromSize_t
-  #define PyInt_FromSsize_t            PyLong_FromSsize_t
-  #define PyInt_AsLong                 PyLong_AsLong
-  #define PyInt_AS_LONG                PyLong_AS_LONG
-  #define PyInt_AsSsize_t              PyLong_AsSsize_t
-  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
-  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
-  #define PyNumber_Int                 PyNumber_Long
-#endif
-#if PY_MAJOR_VERSION >= 3
-  #define PyBoolObject                 PyLongObject
-#endif
-#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
-  #ifndef PyUnicode_InternFromString
-    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
-  #endif
-#endif
-#if PY_VERSION_HEX < 0x030200A4
-  typedef long Py_hash_t;
-  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
-  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
-#else
-  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
-  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
-#endif
-#if PY_MAJOR_VERSION >= 3
-  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
-#else
-  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
-#endif
-#if CYTHON_USE_ASYNC_SLOTS
-  #if PY_VERSION_HEX >= 0x030500B1
-    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
-    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
-  #else
-    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
-  #endif
-#else
-  #define __Pyx_PyType_AsAsync(obj) NULL
-#endif
-#ifndef __Pyx_PyAsyncMethodsStruct
-    typedef struct {
-        unaryfunc am_await;
-        unaryfunc am_aiter;
-        unaryfunc am_anext;
-    } __Pyx_PyAsyncMethodsStruct;
-#endif
-
-#if defined(WIN32) || defined(MS_WINDOWS)
-  #define _USE_MATH_DEFINES
-#endif
-#include 
-#ifdef NAN
-#define __PYX_NAN() ((float) NAN)
-#else
-static CYTHON_INLINE float __PYX_NAN() {
-  float value;
-  memset(&value, 0xFF, sizeof(value));
-  return value;
-}
-#endif
-#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
-#define __Pyx_truncl trunc
-#else
-#define __Pyx_truncl truncl
-#endif
-
-
-#define __PYX_ERR(f_index, lineno, Ln_error) \
-{ \
-  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
-}
-
-#ifndef __PYX_EXTERN_C
-  #ifdef __cplusplus
-    #define __PYX_EXTERN_C extern "C"
-  #else
-    #define __PYX_EXTERN_C extern
-  #endif
-#endif
-
-#define __PYX_HAVE__LFPy__run_simulation
-#define __PYX_HAVE_API__LFPy__run_simulation
-/* Early includes */
-#include 
-#include 
-#include "numpy/arrayobject.h"
-#include "numpy/ufuncobject.h"
-#ifdef _OPENMP
-#include 
-#endif /* _OPENMP */
-
-#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
-#define CYTHON_WITHOUT_ASSERTIONS
-#endif
-
-typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
-                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
-
-#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
-#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
-#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
-#define __PYX_DEFAULT_STRING_ENCODING ""
-#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
-#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
-#define __Pyx_uchar_cast(c) ((unsigned char)c)
-#define __Pyx_long_cast(x) ((long)x)
-#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
-    (sizeof(type) < sizeof(Py_ssize_t))  ||\
-    (sizeof(type) > sizeof(Py_ssize_t) &&\
-          likely(v < (type)PY_SSIZE_T_MAX ||\
-                 v == (type)PY_SSIZE_T_MAX)  &&\
-          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
-                                v == (type)PY_SSIZE_T_MIN)))  ||\
-    (sizeof(type) == sizeof(Py_ssize_t) &&\
-          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
-                               v == (type)PY_SSIZE_T_MAX)))  )
-static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
-    return (size_t) i < (size_t) limit;
-}
-#if defined (__cplusplus) && __cplusplus >= 201103L
-    #include 
-    #define __Pyx_sst_abs(value) std::abs(value)
-#elif SIZEOF_INT >= SIZEOF_SIZE_T
-    #define __Pyx_sst_abs(value) abs(value)
-#elif SIZEOF_LONG >= SIZEOF_SIZE_T
-    #define __Pyx_sst_abs(value) labs(value)
-#elif defined (_MSC_VER)
-    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
-#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-    #define __Pyx_sst_abs(value) llabs(value)
-#elif defined (__GNUC__)
-    #define __Pyx_sst_abs(value) __builtin_llabs(value)
-#else
-    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
-#endif
-static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
-static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
-#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
-#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
-#define __Pyx_PyBytes_FromString        PyBytes_FromString
-#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
-static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const 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_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
-#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
-#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
-#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
-#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
-#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
-#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
-#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
-#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
-#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
-#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
-#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
-#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
-#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
-#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
-#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
-static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
-    const Py_UNICODE *u_end = u;
-    while (*u_end++) ;
-    return (size_t)(u_end - u - 1);
-}
-#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_NewRef(obj) (Py_INCREF(obj), obj)
-#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
-static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
-static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
-static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
-static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
-#define __Pyx_PySequence_Tuple(obj)\
-    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
-static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
-static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
-#if CYTHON_ASSUME_SAFE_MACROS
-#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
-#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
-#else
-#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
-#endif
-#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(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(void) {
-    PyObject* sys;
-    PyObject* default_encoding = NULL;
-    PyObject* ascii_chars_u = NULL;
-    PyObject* ascii_chars_b = NULL;
-    const char* default_encoding_c;
-    sys = PyImport_ImportModule("sys");
-    if (!sys) goto bad;
-    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
-    Py_DECREF(sys);
-    if (!default_encoding) goto bad;
-    default_encoding_c = PyBytes_AsString(default_encoding);
-    if (!default_encoding_c) goto bad;
-    if (strcmp(default_encoding_c, "ascii") == 0) {
-        __Pyx_sys_getdefaultencoding_not_ascii = 0;
-    } else {
-        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) goto bad;
-        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
-        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(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 '%.200s' is not a superset of ascii.",
-                default_encoding_c);
-            goto bad;
-        }
-        Py_DECREF(ascii_chars_u);
-        Py_DECREF(ascii_chars_b);
-    }
-    Py_DECREF(default_encoding);
-    return 0;
-bad:
-    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(void) {
-    PyObject* sys;
-    PyObject* default_encoding = NULL;
-    char* default_encoding_c;
-    sys = PyImport_ImportModule("sys");
-    if (!sys) goto bad;
-    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
-    Py_DECREF(sys);
-    if (!default_encoding) goto bad;
-    default_encoding_c = PyBytes_AsString(default_encoding);
-    if (!default_encoding_c) goto bad;
-    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
-    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
-    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
-    Py_DECREF(default_encoding);
-    return 0;
-bad:
-    Py_XDECREF(default_encoding);
-    return -1;
-}
-#endif
-#endif
-
-
-/* Test for GCC > 2.95 */
-#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
-  #define likely(x)   __builtin_expect(!!(x), 1)
-  #define unlikely(x) __builtin_expect(!!(x), 0)
-#else /* !__GNUC__ or GCC < 2.95 */
-  #define likely(x)   (x)
-  #define unlikely(x) (x)
-#endif /* __GNUC__ */
-static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
-
-static PyObject *__pyx_m = NULL;
-static PyObject *__pyx_d;
-static PyObject *__pyx_b;
-static PyObject *__pyx_cython_runtime = NULL;
-static PyObject *__pyx_empty_tuple;
-static PyObject *__pyx_empty_bytes;
-static PyObject *__pyx_empty_unicode;
-static int __pyx_lineno;
-static int __pyx_clineno = 0;
-static const char * __pyx_cfilenm= __FILE__;
-static const char *__pyx_filename;
-
-/* Header.proto */
-#if !defined(CYTHON_CCOMPLEX)
-  #if defined(__cplusplus)
-    #define CYTHON_CCOMPLEX 1
-  #elif defined(_Complex_I)
-    #define CYTHON_CCOMPLEX 1
-  #else
-    #define CYTHON_CCOMPLEX 0
-  #endif
-#endif
-#if CYTHON_CCOMPLEX
-  #ifdef __cplusplus
-    #include 
-  #else
-    #include 
-  #endif
-#endif
-#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
-  #undef _Complex_I
-  #define _Complex_I 1.0fj
-#endif
-
-
-static const char *__pyx_f[] = {
-  "LFPy/run_simulation.pyx",
-  "__init__.pxd",
-  "type.pxd",
-};
-/* BufferFormatStructs.proto */
-#define IS_UNSIGNED(type) (((type) -1) > 0)
-struct __Pyx_StructField_;
-#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
-typedef struct {
-  const char* name;
-  struct __Pyx_StructField_* fields;
-  size_t size;
-  size_t arraysize[8];
-  int ndim;
-  char typegroup;
-  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;
-
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":776
- * # in Cython to enable them only on the right systems.
- * 
- * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
- * ctypedef npy_int16      int16_t
- * ctypedef npy_int32      int32_t
- */
-typedef npy_int8 __pyx_t_5numpy_int8_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":777
- * 
- * ctypedef npy_int8       int8_t
- * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
- * ctypedef npy_int32      int32_t
- * ctypedef npy_int64      int64_t
- */
-typedef npy_int16 __pyx_t_5numpy_int16_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":778
- * ctypedef npy_int8       int8_t
- * ctypedef npy_int16      int16_t
- * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
- * ctypedef npy_int64      int64_t
- * #ctypedef npy_int96      int96_t
- */
-typedef npy_int32 __pyx_t_5numpy_int32_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":779
- * ctypedef npy_int16      int16_t
- * ctypedef npy_int32      int32_t
- * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
- * #ctypedef npy_int96      int96_t
- * #ctypedef npy_int128     int128_t
- */
-typedef npy_int64 __pyx_t_5numpy_int64_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":783
- * #ctypedef npy_int128     int128_t
- * 
- * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
- * ctypedef npy_uint16     uint16_t
- * ctypedef npy_uint32     uint32_t
- */
-typedef npy_uint8 __pyx_t_5numpy_uint8_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":784
- * 
- * ctypedef npy_uint8      uint8_t
- * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
- * ctypedef npy_uint32     uint32_t
- * ctypedef npy_uint64     uint64_t
- */
-typedef npy_uint16 __pyx_t_5numpy_uint16_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":785
- * ctypedef npy_uint8      uint8_t
- * ctypedef npy_uint16     uint16_t
- * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
- * ctypedef npy_uint64     uint64_t
- * #ctypedef npy_uint96     uint96_t
- */
-typedef npy_uint32 __pyx_t_5numpy_uint32_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":786
- * ctypedef npy_uint16     uint16_t
- * ctypedef npy_uint32     uint32_t
- * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
- * #ctypedef npy_uint96     uint96_t
- * #ctypedef npy_uint128    uint128_t
- */
-typedef npy_uint64 __pyx_t_5numpy_uint64_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":790
- * #ctypedef npy_uint128    uint128_t
- * 
- * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
- * ctypedef npy_float64    float64_t
- * #ctypedef npy_float80    float80_t
- */
-typedef npy_float32 __pyx_t_5numpy_float32_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":791
- * 
- * ctypedef npy_float32    float32_t
- * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
- * #ctypedef npy_float80    float80_t
- * #ctypedef npy_float128   float128_t
- */
-typedef npy_float64 __pyx_t_5numpy_float64_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":800
- * # The int types are mapped a bit surprising --
- * # numpy.int corresponds to 'l' and numpy.long to 'q'
- * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
- * ctypedef npy_longlong   long_t
- * ctypedef npy_longlong   longlong_t
- */
-typedef npy_long __pyx_t_5numpy_int_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":801
- * # numpy.int corresponds to 'l' and numpy.long to 'q'
- * ctypedef npy_long       int_t
- * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
- * ctypedef npy_longlong   longlong_t
- * 
- */
-typedef npy_longlong __pyx_t_5numpy_long_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":802
- * ctypedef npy_long       int_t
- * ctypedef npy_longlong   long_t
- * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
- * 
- * ctypedef npy_ulong      uint_t
- */
-typedef npy_longlong __pyx_t_5numpy_longlong_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":804
- * ctypedef npy_longlong   longlong_t
- * 
- * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
- * ctypedef npy_ulonglong  ulong_t
- * ctypedef npy_ulonglong  ulonglong_t
- */
-typedef npy_ulong __pyx_t_5numpy_uint_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":805
- * 
- * ctypedef npy_ulong      uint_t
- * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
- * ctypedef npy_ulonglong  ulonglong_t
- * 
- */
-typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":806
- * ctypedef npy_ulong      uint_t
- * ctypedef npy_ulonglong  ulong_t
- * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
- * 
- * ctypedef npy_intp       intp_t
- */
-typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":808
- * ctypedef npy_ulonglong  ulonglong_t
- * 
- * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
- * ctypedef npy_uintp      uintp_t
- * 
- */
-typedef npy_intp __pyx_t_5numpy_intp_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":809
- * 
- * ctypedef npy_intp       intp_t
- * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
- * 
- * ctypedef npy_double     float_t
- */
-typedef npy_uintp __pyx_t_5numpy_uintp_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":811
- * ctypedef npy_uintp      uintp_t
- * 
- * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
- * ctypedef npy_double     double_t
- * ctypedef npy_longdouble longdouble_t
- */
-typedef npy_double __pyx_t_5numpy_float_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":812
- * 
- * ctypedef npy_double     float_t
- * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
- * ctypedef npy_longdouble longdouble_t
- * 
- */
-typedef npy_double __pyx_t_5numpy_double_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":813
- * ctypedef npy_double     float_t
- * ctypedef npy_double     double_t
- * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
- * 
- * ctypedef npy_cfloat      cfloat_t
- */
-typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
-
-/* "LFPy/run_simulation.pyx":25
- * 
- * DTYPE = np.float64
- * ctypedef np.float64_t DTYPE_t             # <<<<<<<<<<<<<<
- * ctypedef Py_ssize_t   LTYPE_t
- * 
- */
-typedef __pyx_t_5numpy_float64_t __pyx_t_4LFPy_14run_simulation_DTYPE_t;
-
-/* "LFPy/run_simulation.pyx":26
- * DTYPE = np.float64
- * ctypedef np.float64_t DTYPE_t
- * ctypedef Py_ssize_t   LTYPE_t             # <<<<<<<<<<<<<<
- * 
- * 
- */
-typedef Py_ssize_t __pyx_t_4LFPy_14run_simulation_LTYPE_t;
-/* Declarations.proto */
-#if CYTHON_CCOMPLEX
-  #ifdef __cplusplus
-    typedef ::std::complex< float > __pyx_t_float_complex;
-  #else
-    typedef float _Complex __pyx_t_float_complex;
-  #endif
-#else
-    typedef struct { float real, imag; } __pyx_t_float_complex;
-#endif
-static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
-
-/* Declarations.proto */
-#if CYTHON_CCOMPLEX
-  #ifdef __cplusplus
-    typedef ::std::complex< double > __pyx_t_double_complex;
-  #else
-    typedef double _Complex __pyx_t_double_complex;
-  #endif
-#else
-    typedef struct { double real, imag; } __pyx_t_double_complex;
-#endif
-static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
-
-
-/*--- Type declarations ---*/
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":815
- * ctypedef npy_longdouble longdouble_t
- * 
- * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
- * ctypedef npy_cdouble     cdouble_t
- * ctypedef npy_clongdouble clongdouble_t
- */
-typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":816
- * 
- * ctypedef npy_cfloat      cfloat_t
- * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
- * ctypedef npy_clongdouble clongdouble_t
- * 
- */
-typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":817
- * ctypedef npy_cfloat      cfloat_t
- * ctypedef npy_cdouble     cdouble_t
- * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
- * 
- * ctypedef npy_cdouble     complex_t
- */
-typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":819
- * ctypedef npy_clongdouble clongdouble_t
- * 
- * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
- * 
- * cdef inline object PyArray_MultiIterNew1(a):
- */
-typedef npy_cdouble __pyx_t_5numpy_complex_t;
-
-/* --- Runtime support code (head) --- */
-/* Refnanny.proto */
-#ifndef CYTHON_REFNANNY
-  #define CYTHON_REFNANNY 0
-#endif
-#if CYTHON_REFNANNY
-  typedef struct {
-    void (*INCREF)(void*, PyObject*, int);
-    void (*DECREF)(void*, PyObject*, int);
-    void (*GOTREF)(void*, PyObject*, int);
-    void (*GIVEREF)(void*, PyObject*, int);
-    void* (*SetupContext)(const char*, int, const char*);
-    void (*FinishContext)(void**);
-  } __Pyx_RefNannyAPIStruct;
-  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
-  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
-  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
-#ifdef WITH_THREAD
-  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
-          if (acquire_gil) {\
-              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
-              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
-              PyGILState_Release(__pyx_gilstate_save);\
-          } else {\
-              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
-          }
-#else
-  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
-          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
-#endif
-  #define __Pyx_RefNannyFinishContext()\
-          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
-  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
-  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
-  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
-  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
-  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
-  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
-  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
-  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
-#else
-  #define __Pyx_RefNannyDeclarations
-  #define __Pyx_RefNannySetupContext(name, acquire_gil)
-  #define __Pyx_RefNannyFinishContext()
-  #define __Pyx_INCREF(r) Py_INCREF(r)
-  #define __Pyx_DECREF(r) Py_DECREF(r)
-  #define __Pyx_GOTREF(r)
-  #define __Pyx_GIVEREF(r)
-  #define __Pyx_XINCREF(r) Py_XINCREF(r)
-  #define __Pyx_XDECREF(r) Py_XDECREF(r)
-  #define __Pyx_XGOTREF(r)
-  #define __Pyx_XGIVEREF(r)
-#endif
-#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)
-
-/* PyObjectGetAttrStr.proto */
-#if CYTHON_USE_TYPE_SLOTS
-static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
-#else
-#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
-#endif
-
-/* GetBuiltinName.proto */
-static PyObject *__Pyx_GetBuiltinName(PyObject *name);
-
-/* RaiseArgTupleInvalid.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);
-
-/* RaiseDoubleKeywords.proto */
-static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
-
-/* ParseKeywords.proto */
-static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
-    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
-    const char* function_name);
-
-/* PyDictVersioning.proto */
-#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
-#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
-#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
-#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
-    (version_var) = __PYX_GET_DICT_VERSION(dict);\
-    (cache_var) = (value);
-#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
-    static PY_UINT64_T __pyx_dict_version = 0;\
-    static PyObject *__pyx_dict_cached_value = NULL;\
-    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
-        (VAR) = __pyx_dict_cached_value;\
-    } else {\
-        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
-        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
-    }\
-}
-static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
-static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
-static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
-#else
-#define __PYX_GET_DICT_VERSION(dict)  (0)
-#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
-#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
-#endif
-
-/* GetModuleGlobalName.proto */
-#if CYTHON_USE_DICT_VERSIONS
-#define __Pyx_GetModuleGlobalName(var, name)  {\
-    static PY_UINT64_T __pyx_dict_version = 0;\
-    static PyObject *__pyx_dict_cached_value = NULL;\
-    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
-        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
-        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
-}
-#define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
-    PY_UINT64_T __pyx_dict_version;\
-    PyObject *__pyx_dict_cached_value;\
-    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
-}
-static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
-#else
-#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
-#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
-static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
-#endif
-
-/* PyObjectSetAttrStr.proto */
-#if CYTHON_USE_TYPE_SLOTS
-#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);
-#else
-#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
-#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
-#endif
-
-/* PyCFunctionFastCall.proto */
-#if CYTHON_FAST_PYCCALL
-static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
-#else
-#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
-#endif
-
-/* PyFunctionFastCall.proto */
-#if CYTHON_FAST_PYCALL
-#define __Pyx_PyFunction_FastCall(func, args, nargs)\
-    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
-#if 1 || PY_VERSION_HEX < 0x030600B1
-static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
-#else
-#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
-#endif
-#define __Pyx_BUILD_ASSERT_EXPR(cond)\
-    (sizeof(char [1 - 2*!(cond)]) - 1)
-#ifndef Py_MEMBER_SIZE
-#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
-#endif
-  static size_t __pyx_pyframe_localsplus_offset = 0;
-  #include "frameobject.h"
-  #define __Pxy_PyFrame_Initialize_Offsets()\
-    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
-     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
-  #define __Pyx_PyFrame_GetLocalsplus(frame)\
-    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
-#endif
-
-/* PyObjectCall.proto */
-#if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
-#else
-#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
-#endif
-
-/* PyObjectCall2Args.proto */
-static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
-
-/* PyObjectCallMethO.proto */
-#if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
-#endif
-
-/* PyObjectCallOneArg.proto */
-static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
-
-/* PyObjectCallNoArg.proto */
-#if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
-#else
-#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
-#endif
-
-/* PyFloatBinop.proto */
-#if !CYTHON_COMPILING_IN_PYPY
-static PyObject* __Pyx_PyFloat_TrueDivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
-#else
-#define __Pyx_PyFloat_TrueDivideCObj(op1, op2, floatval, inplace, zerodivision_check)\
-    (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
-#endif
-
-/* None.proto */
-static CYTHON_INLINE double __Pyx_mod_double(double, double);
-
-/* PyFloatBinop.proto */
-#if !CYTHON_COMPILING_IN_PYPY
-static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
-#else
-#define __Pyx_PyFloat_AddObjC(op1, op2, floatval, inplace, zerodivision_check)\
-    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
-#endif
-
-/* Import.proto */
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
-
-/* GetTopmostException.proto */
-#if CYTHON_USE_EXC_INFO_STACK
-static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
-#endif
-
-/* PyThreadStateGet.proto */
-#if CYTHON_FAST_THREAD_STATE
-#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
-#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
-#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
-#else
-#define __Pyx_PyThreadState_declare
-#define __Pyx_PyThreadState_assign
-#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
-#endif
-
-/* SaveResetException.proto */
-#if CYTHON_FAST_THREAD_STATE
-#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
-static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
-#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
-static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
-#else
-#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
-#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
-#endif
-
-/* GetException.proto */
-#if CYTHON_FAST_THREAD_STATE
-#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
-static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
-#else
-static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
-#endif
-
-/* ListAppend.proto */
-#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
-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
-
-/* PyObjectGetMethod.proto */
-static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
-
-/* PyObjectCallMethod1.proto */
-static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
-
-/* append.proto */
-static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
-
-/* ExtTypeTest.proto */
-static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
-
-/* IsLittleEndian.proto */
-static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
-
-/* BufferFormatCheck.proto */
-static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
-static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
-                              __Pyx_BufFmt_StackElem* stack,
-                              __Pyx_TypeInfo* type);
-
-/* BufferGetAndValidate.proto */
-#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
-    ((obj == Py_None || obj == NULL) ?\
-    (__Pyx_ZeroBuffer(buf), 0) :\
-    __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
-static int  __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
-    __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
-static void __Pyx_ZeroBuffer(Py_buffer* buf);
-static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
-static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
-static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
-
-/* BufferFallbackError.proto */
-static void __Pyx_RaiseBufferFallbackError(void);
-
-/* PyIntFromDouble.proto */
-#if PY_MAJOR_VERSION < 3
-static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value);
-#else
-#define __Pyx_PyInt_FromDouble(value) PyLong_FromDouble(value)
-#endif
-
-/* GetItemInt.proto */
-#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
-    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
-    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
-    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
-               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
-#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
-    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
-    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
-    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
-                                                              int wraparound, int boundscheck);
-#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
-    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
-    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
-    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
-                                                              int wraparound, int boundscheck);
-static 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);
-
-/* IncludeStringH.proto */
-#include 
-
-/* BytesEquals.proto */
-static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
-
-/* UnicodeEquals.proto */
-static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
-
-/* StrEquals.proto */
-#if PY_MAJOR_VERSION >= 3
-#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
-#else
-#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
-#endif
-
-/* None.proto */
-static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
-
-/* ObjectGetItem.proto */
-#if CYTHON_USE_TYPE_SLOTS
-static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
-#else
-#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
-#endif
-
-/* SetItemInt.proto */
-#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
-    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
-    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
-    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
-               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
-static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
-static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
-                                               int is_list, int wraparound, int boundscheck);
-
-/* PyErrFetchRestore.proto */
-#if CYTHON_FAST_THREAD_STATE
-#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
-#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
-#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
-#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
-#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
-static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
-static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
-#if CYTHON_COMPILING_IN_CPYTHON
-#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
-#else
-#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
-#endif
-#else
-#define __Pyx_PyErr_Clear() PyErr_Clear()
-#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
-#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
-#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
-#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
-#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
-#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
-#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
-#endif
-
-/* SliceTupleAndList.proto */
-#if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
-static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
-#else
-#define __Pyx_PyList_GetSlice(seq, start, stop)   PySequence_GetSlice(seq, start, stop)
-#define __Pyx_PyTuple_GetSlice(seq, start, stop)  PySequence_GetSlice(seq, start, stop)
-#endif
-
-/* GetAttr.proto */
-static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
-
-/* HasAttr.proto */
-static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
-
-/* BufferIndexError.proto */
-static void __Pyx_RaiseBufferIndexError(int axis);
-
-#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
-/* RaiseException.proto */
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
-
-/* DictGetItem.proto */
-#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
-static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
-#define __Pyx_PyObject_Dict_GetItem(obj, name)\
-    (likely(PyDict_CheckExact(obj)) ?\
-     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
-#else
-#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
-#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
-#endif
-
-/* RaiseTooManyValuesToUnpack.proto */
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
-
-/* RaiseNeedMoreValuesToUnpack.proto */
-static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
-
-/* RaiseNoneIterError.proto */
-static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
-
-/* PyErrExceptionMatches.proto */
-#if CYTHON_FAST_THREAD_STATE
-#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
-static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
-#else
-#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
-#endif
-
-/* TypeImport.proto */
-#ifndef __PYX_HAVE_RT_ImportType_proto
-#define __PYX_HAVE_RT_ImportType_proto
-enum __Pyx_ImportType_CheckSize {
-   __Pyx_ImportType_CheckSize_Error = 0,
-   __Pyx_ImportType_CheckSize_Warn = 1,
-   __Pyx_ImportType_CheckSize_Ignore = 2
-};
-static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
-#endif
-
-/* ImportFrom.proto */
-static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
-
-/* CLineInTraceback.proto */
-#ifdef CYTHON_CLINE_IN_TRACEBACK
-#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
-#else
-static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
-#endif
-
-/* CodeObjectCache.proto */
-typedef struct {
-    PyCodeObject* code_object;
-    int code_line;
-} __Pyx_CodeObjectCacheEntry;
-struct __Pyx_CodeObjectCache {
-    int count;
-    int max_count;
-    __Pyx_CodeObjectCacheEntry* entries;
-};
-static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
-static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
-static PyCodeObject *__pyx_find_code_object(int code_line);
-static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
-
-/* AddTraceback.proto */
-static void __Pyx_AddTraceback(const char *funcname, int c_line,
-                               int py_line, const char *filename);
-
-/* BufferStructDeclare.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
-
-
-/* Print.proto */
-static int __Pyx_Print(PyObject*, PyObject *, int);
-#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
-static PyObject* __pyx_print = 0;
-static PyObject* __pyx_print_kwargs = 0;
-#endif
-
-/* CIntToPy.proto */
-static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
-
-/* CIntToPy.proto */
-static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
-
-/* CIntToPy.proto */
-static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
-
-/* RealImag.proto */
-#if CYTHON_CCOMPLEX
-  #ifdef __cplusplus
-    #define __Pyx_CREAL(z) ((z).real())
-    #define __Pyx_CIMAG(z) ((z).imag())
-  #else
-    #define __Pyx_CREAL(z) (__real__(z))
-    #define __Pyx_CIMAG(z) (__imag__(z))
-  #endif
-#else
-    #define __Pyx_CREAL(z) ((z).real)
-    #define __Pyx_CIMAG(z) ((z).imag)
-#endif
-#if defined(__cplusplus) && CYTHON_CCOMPLEX\
-        && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
-    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
-    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
-#else
-    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
-    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
-#endif
-
-/* Arithmetic.proto */
-#if CYTHON_CCOMPLEX
-    #define __Pyx_c_eq_float(a, b)   ((a)==(b))
-    #define __Pyx_c_sum_float(a, b)  ((a)+(b))
-    #define __Pyx_c_diff_float(a, b) ((a)-(b))
-    #define __Pyx_c_prod_float(a, b) ((a)*(b))
-    #define __Pyx_c_quot_float(a, b) ((a)/(b))
-    #define __Pyx_c_neg_float(a)     (-(a))
-  #ifdef __cplusplus
-    #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
-    #define __Pyx_c_conj_float(z)    (::std::conj(z))
-    #if 1
-        #define __Pyx_c_abs_float(z)     (::std::abs(z))
-        #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
-    #endif
-  #else
-    #define __Pyx_c_is_zero_float(z) ((z)==0)
-    #define __Pyx_c_conj_float(z)    (conjf(z))
-    #if 1
-        #define __Pyx_c_abs_float(z)     (cabsf(z))
-        #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
-    #endif
- #endif
-#else
-    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
-    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
-    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
-    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
-    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
-    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
-    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
-    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
-    #if 1
-        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
-        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
-    #endif
-#endif
-
-/* Arithmetic.proto */
-#if CYTHON_CCOMPLEX
-    #define __Pyx_c_eq_double(a, b)   ((a)==(b))
-    #define __Pyx_c_sum_double(a, b)  ((a)+(b))
-    #define __Pyx_c_diff_double(a, b) ((a)-(b))
-    #define __Pyx_c_prod_double(a, b) ((a)*(b))
-    #define __Pyx_c_quot_double(a, b) ((a)/(b))
-    #define __Pyx_c_neg_double(a)     (-(a))
-  #ifdef __cplusplus
-    #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
-    #define __Pyx_c_conj_double(z)    (::std::conj(z))
-    #if 1
-        #define __Pyx_c_abs_double(z)     (::std::abs(z))
-        #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
-    #endif
-  #else
-    #define __Pyx_c_is_zero_double(z) ((z)==0)
-    #define __Pyx_c_conj_double(z)    (conj(z))
-    #if 1
-        #define __Pyx_c_abs_double(z)     (cabs(z))
-        #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
-    #endif
- #endif
-#else
-    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
-    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
-    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
-    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
-    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
-    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
-    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
-    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
-    #if 1
-        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
-        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
-    #endif
-#endif
-
-/* CIntToPy.proto */
-static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
-
-/* PrintOne.proto */
-static int __Pyx_PrintOne(PyObject* stream, PyObject *o);
-
-/* CIntFromPy.proto */
-static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
-
-/* CIntFromPy.proto */
-static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
-
-/* FastTypeChecks.proto */
-#if CYTHON_COMPILING_IN_CPYTHON
-#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
-static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
-static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
-static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
-#else
-#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
-#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
-#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
-#endif
-#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
-
-/* CheckBinaryVersion.proto */
-static int __Pyx_check_binary_version(void);
-
-/* InitStrings.proto */
-static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
-
-
-/* Module declarations from 'cpython.buffer' */
-
-/* Module declarations from 'libc.string' */
-
-/* Module declarations from 'libc.stdio' */
-
-/* Module declarations from '__builtin__' */
-
-/* Module declarations from 'cpython.type' */
-static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
-
-/* Module declarations from 'cpython' */
-
-/* Module declarations from 'cpython.object' */
-
-/* Module declarations from 'cpython.ref' */
-
-/* Module declarations from 'cpython.mem' */
-
-/* Module declarations from 'numpy' */
-
-/* Module declarations from 'numpy' */
-static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
-static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
-static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
-static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
-static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
-static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
-
-/* Module declarations from 'LFPy.run_simulation' */
-static PyObject *__pyx_f_4LFPy_14run_simulation__collect_geometry_neuron(PyObject *, int __pyx_skip_dispatch); /*proto*/
-static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_4LFPy_14run_simulation_DTYPE_t), { 0 }, 0, 'R', 0, 0 };
-#define __Pyx_MODULE_NAME "LFPy.run_simulation"
-extern int __pyx_module_is_main_LFPy__run_simulation;
-int __pyx_module_is_main_LFPy__run_simulation = 0;
-
-/* Implementation of 'LFPy.run_simulation' */
-static PyObject *__pyx_builtin_enumerate;
-static PyObject *__pyx_builtin_range;
-static PyObject *__pyx_builtin_ValueError;
-static PyObject *__pyx_builtin_RuntimeError;
-static PyObject *__pyx_builtin_ImportError;
-static const char __pyx_k_[] = ".";
-static const char __pyx_k_L[] = "L";
-static const char __pyx_k_c[] = "c_";
-static const char __pyx_k_h[] = "h";
-static const char __pyx_k_i[] = "i";
-static const char __pyx_k_j[] = "j";
-static const char __pyx_k_t[] = "t";
-static const char __pyx_k_w[] = "w";
-static const char __pyx_k_x[] = "x";
-static const char __pyx_k_dt[] = "dt";
-static const char __pyx_k_el[] = "el";
-static const char __pyx_k_h5[] = "h5";
-static const char __pyx_k_np[] = "np";
-static const char __pyx_k_t0[] = "t0";
-static const char __pyx_k_ti[] = "ti";
-static const char __pyx_k_LFP[] = "LFP";
-static const char __pyx_k_dot[] = "dot";
-static const char __pyx_k_end[] = "end";
-static const char __pyx_k_n3d[] = "n3d";
-static const char __pyx_k_sec[] = "sec";
-static const char __pyx_k_seg[] = "seg";
-static const char __pyx_k_x3d[] = "x3d";
-static const char __pyx_k_y3d[] = "y3d";
-static const char __pyx_k_z3d[] = "z3d";
-static const char __pyx_k_File[] = "File";
-static const char __pyx_k_area[] = "area";
-static const char __pyx_k_atol[] = "atol";
-static const char __pyx_k_cell[] = "cell";
-static const char __pyx_k_copy[] = "copy";
-static const char __pyx_k_diam[] = "diam";
-static const char __pyx_k_file[] = "file";
-static const char __pyx_k_h5_2[] = ".h5";
-static const char __pyx_k_h5py[] = "h5py";
-static const char __pyx_k_imem[] = "imem";
-static const char __pyx_k_main[] = "__main__";
-static const char __pyx_k_name[] = "__name__";
-static const char __pyx_k_nseg[] = "nseg";
-static const char __pyx_k_test[] = "__test__";
-static const char __pyx_k_time[] = "time";
-static const char __pyx_k_xend[] = "xend";
-static const char __pyx_k_xmid[] = "xmid";
-static const char __pyx_k_yend[] = "yend";
-static const char __pyx_k_ymid[] = "ymid";
-static const char __pyx_k_zend[] = "zend";
-static const char __pyx_k_zmid[] = "zmid";
-static const char __pyx_k_DTYPE[] = "DTYPE";
-static const char __pyx_k_arc3d[] = "arc3d";
-static const char __pyx_k_array[] = "array";
-static const char __pyx_k_close[] = "close";
-static const char __pyx_k_cvode[] = "cvode";
-static const char __pyx_k_numpy[] = "numpy";
-static const char __pyx_k_print[] = "print";
-static const char __pyx_k_range[] = "range";
-static const char __pyx_k_split[] = "split";
-static const char __pyx_k_tstep[] = "tstep";
-static const char __pyx_k_tstop[] = "tstop";
-static const char __pyx_k_zeros[] = "zeros";
-static const char __pyx_k_active[] = "active";
-static const char __pyx_k_append[] = "append";
-static const char __pyx_k_coeffs[] = "coeffs";
-static const char __pyx_k_format[] = "format";
-static const char __pyx_k_import[] = "__import__";
-static const char __pyx_k_interp[] = "interp";
-static const char __pyx_k_length[] = "length";
-static const char __pyx_k_neuron[] = "neuron";
-static const char __pyx_k_tstart[] = "tstart";
-static const char __pyx_k_v_init[] = "v_init";
-static const char __pyx_k_xstart[] = "xstart";
-static const char __pyx_k_ystart[] = "ystart";
-static const char __pyx_k_zstart[] = "zstart";
-static const char __pyx_k_CellLFP[] = "CellLFP";
-static const char __pyx_k_counter[] = "counter";
-static const char __pyx_k_float64[] = "float64";
-static const char __pyx_k_mapping[] = "mapping";
-static const char __pyx_k_re_init[] = "re_init";
-static const char __pyx_k_to_file[] = "to_file";
-static const char __pyx_k_verbose[] = "verbose";
-static const char __pyx_k_fadvance[] = "fadvance";
-static const char __pyx_k_fcurrent[] = "fcurrent";
-static const char __pyx_k_interval[] = "interval";
-static const char __pyx_k_rtfactor[] = "rtfactor";
-static const char __pyx_k_totnsegs[] = "totnsegs";
-static const char __pyx_k_electrode[] = "electrode";
-static const char __pyx_k_enumerate[] = "enumerate";
-static const char __pyx_k_file_name[] = "file_name";
-static const char __pyx_k_midpoints[] = "midpoints";
-static const char __pyx_k_to_memory[] = "to_memory";
-static const char __pyx_k_ValueError[] = "ValueError";
-static const char __pyx_k_allseclist[] = "allseclist";
-static const char __pyx_k_electrodes[] = "electrodes";
-static const char __pyx_k_i_membrane[] = "i_membrane_";
-static const char __pyx_k_loadspikes[] = "_loadspikes";
-static const char __pyx_k_perCellLFP[] = "perCellLFP";
-static const char __pyx_k_ImportError[] = "ImportError";
-static const char __pyx_k_el_LFP_file[] = "el_LFP_file";
-static const char __pyx_k_finitialize[] = "finitialize";
-static const char __pyx_k_variable_dt[] = "variable_dt";
-static const char __pyx_k_RuntimeError[] = "RuntimeError";
-static const char __pyx_k_calc_mapping[] = "calc_mapping";
-static const char __pyx_k_frecord_init[] = "frecord_init";
-static const char __pyx_k_dotprodcoeffs[] = "dotprodcoeffs";
-static const char __pyx_k_electrode_03d[] = "electrode{:03d}";
-static const char __pyx_k_electrodesLFP[] = "electrodesLFP";
-static const char __pyx_k_dotprodresults[] = "dotprodresults";
-static const char __pyx_k_electrodecoeff[] = "electrodecoeff";
-static const char __pyx_k_run_simulation[] = "_run_simulation";
-static const char __pyx_k_lendotprodcoeffs0[] = "lendotprodcoeffs0";
-static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
-static const char __pyx_k_LFPy_run_simulation[] = "LFPy.run_simulation";
-static const char __pyx_k_current_dipole_moment[] = "current_dipole_moment";
-static const char __pyx_k_LFPy_run_simulation_pyx[] = "LFPy/run_simulation.pyx";
-static const char __pyx_k_t_0f_realtime_factor_3f[] = "t = {:.0f}, realtime factor: {:.3f}";
-static const char __pyx_k_rec_current_dipole_moment[] = "rec_current_dipole_moment";
-static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
-static const char __pyx_k_run_simulation_with_electrode[] = "_run_simulation_with_electrode";
-static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
-static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
-static const char __pyx_k_Copyright_C_2012_Computational_N[] = "Copyright (C) 2012 Computational Neuroscience Group, NMBU.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\n";
-static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
-static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
-static const char __pyx_k_h5py_not_found_LFP_to_file_not_p[] = "h5py not found, LFP to file not possible";
-static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
-static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
-static const char __pyx_k_precalculating_geometry_LFP_mapp[] = "precalculating geometry - LFP mapping";
-static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
-static PyObject *__pyx_kp_s_;
-static PyObject *__pyx_n_s_CellLFP;
-static PyObject *__pyx_n_s_DTYPE;
-static PyObject *__pyx_n_s_File;
-static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
-static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
-static PyObject *__pyx_n_s_ImportError;
-static PyObject *__pyx_n_s_L;
-static PyObject *__pyx_n_s_LFP;
-static PyObject *__pyx_n_s_LFPy_run_simulation;
-static PyObject *__pyx_kp_s_LFPy_run_simulation_pyx;
-static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
-static PyObject *__pyx_n_s_RuntimeError;
-static PyObject *__pyx_n_s_ValueError;
-static PyObject *__pyx_n_s_active;
-static PyObject *__pyx_n_s_allseclist;
-static PyObject *__pyx_n_s_append;
-static PyObject *__pyx_n_s_arc3d;
-static PyObject *__pyx_n_s_area;
-static PyObject *__pyx_n_s_array;
-static PyObject *__pyx_n_s_atol;
-static PyObject *__pyx_n_s_c;
-static PyObject *__pyx_n_s_calc_mapping;
-static PyObject *__pyx_n_s_cell;
-static PyObject *__pyx_n_s_cline_in_traceback;
-static PyObject *__pyx_n_s_close;
-static PyObject *__pyx_n_s_coeffs;
-static PyObject *__pyx_n_s_copy;
-static PyObject *__pyx_n_s_counter;
-static PyObject *__pyx_n_s_current_dipole_moment;
-static PyObject *__pyx_n_s_cvode;
-static PyObject *__pyx_n_s_diam;
-static PyObject *__pyx_n_s_dot;
-static PyObject *__pyx_n_s_dotprodcoeffs;
-static PyObject *__pyx_n_s_dotprodresults;
-static PyObject *__pyx_n_s_dt;
-static PyObject *__pyx_n_s_el;
-static PyObject *__pyx_n_s_el_LFP_file;
-static PyObject *__pyx_n_s_electrode;
-static PyObject *__pyx_kp_s_electrode_03d;
-static PyObject *__pyx_n_s_electrodecoeff;
-static PyObject *__pyx_n_s_electrodes;
-static PyObject *__pyx_n_s_electrodesLFP;
-static PyObject *__pyx_n_s_end;
-static PyObject *__pyx_n_s_enumerate;
-static PyObject *__pyx_n_s_fadvance;
-static PyObject *__pyx_n_s_fcurrent;
-static PyObject *__pyx_n_s_file;
-static PyObject *__pyx_n_s_file_name;
-static PyObject *__pyx_n_s_finitialize;
-static PyObject *__pyx_n_s_float64;
-static PyObject *__pyx_n_s_format;
-static PyObject *__pyx_n_s_frecord_init;
-static PyObject *__pyx_n_s_h;
-static PyObject *__pyx_n_s_h5;
-static PyObject *__pyx_kp_s_h5_2;
-static PyObject *__pyx_n_s_h5py;
-static PyObject *__pyx_kp_s_h5py_not_found_LFP_to_file_not_p;
-static PyObject *__pyx_n_s_i;
-static PyObject *__pyx_n_s_i_membrane;
-static PyObject *__pyx_n_s_imem;
-static PyObject *__pyx_n_s_import;
-static PyObject *__pyx_n_s_interp;
-static PyObject *__pyx_n_s_interval;
-static PyObject *__pyx_n_s_j;
-static PyObject *__pyx_n_s_lendotprodcoeffs0;
-static PyObject *__pyx_n_s_length;
-static PyObject *__pyx_n_s_loadspikes;
-static PyObject *__pyx_n_s_main;
-static PyObject *__pyx_n_s_mapping;
-static PyObject *__pyx_n_s_midpoints;
-static PyObject *__pyx_n_s_n3d;
-static PyObject *__pyx_n_s_name;
-static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
-static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
-static PyObject *__pyx_n_s_neuron;
-static PyObject *__pyx_n_s_np;
-static PyObject *__pyx_n_s_nseg;
-static PyObject *__pyx_n_s_numpy;
-static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
-static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
-static PyObject *__pyx_n_s_perCellLFP;
-static PyObject *__pyx_kp_s_precalculating_geometry_LFP_mapp;
-static PyObject *__pyx_n_s_print;
-static PyObject *__pyx_n_s_range;
-static PyObject *__pyx_n_s_re_init;
-static PyObject *__pyx_n_s_rec_current_dipole_moment;
-static PyObject *__pyx_n_s_rtfactor;
-static PyObject *__pyx_n_s_run_simulation;
-static PyObject *__pyx_n_s_run_simulation_with_electrode;
-static PyObject *__pyx_n_s_sec;
-static PyObject *__pyx_n_s_seg;
-static PyObject *__pyx_n_s_split;
-static PyObject *__pyx_n_s_t;
-static PyObject *__pyx_n_s_t0;
-static PyObject *__pyx_kp_s_t_0f_realtime_factor_3f;
-static PyObject *__pyx_n_s_test;
-static PyObject *__pyx_n_s_ti;
-static PyObject *__pyx_n_s_time;
-static PyObject *__pyx_n_s_to_file;
-static PyObject *__pyx_n_s_to_memory;
-static PyObject *__pyx_n_s_totnsegs;
-static PyObject *__pyx_n_s_tstart;
-static PyObject *__pyx_n_s_tstep;
-static PyObject *__pyx_n_s_tstop;
-static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
-static PyObject *__pyx_n_s_v_init;
-static PyObject *__pyx_n_s_variable_dt;
-static PyObject *__pyx_n_s_verbose;
-static PyObject *__pyx_n_s_w;
-static PyObject *__pyx_n_s_x;
-static PyObject *__pyx_n_s_x3d;
-static PyObject *__pyx_n_s_xend;
-static PyObject *__pyx_n_s_xmid;
-static PyObject *__pyx_n_s_xstart;
-static PyObject *__pyx_n_s_y3d;
-static PyObject *__pyx_n_s_yend;
-static PyObject *__pyx_n_s_ymid;
-static PyObject *__pyx_n_s_ystart;
-static PyObject *__pyx_n_s_z3d;
-static PyObject *__pyx_n_s_zend;
-static PyObject *__pyx_n_s_zeros;
-static PyObject *__pyx_n_s_zmid;
-static PyObject *__pyx_n_s_zstart;
-static PyObject *__pyx_pf_4LFPy_14run_simulation__run_simulation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cell, PyObject *__pyx_v_cvode, PyObject *__pyx_v_variable_dt, PyObject *__pyx_v_atol); /* proto */
-static PyObject *__pyx_pf_4LFPy_14run_simulation_2_run_simulation_with_electrode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cell, PyObject *__pyx_v_cvode, PyObject *__pyx_v_electrode, CYTHON_UNUSED PyObject *__pyx_v_variable_dt, PyObject *__pyx_v_atol, PyObject *__pyx_v_to_memory, PyObject *__pyx_v_to_file, PyObject *__pyx_v_file_name, PyObject *__pyx_v_dotprodcoeffs, PyObject *__pyx_v_rec_current_dipole_moment); /* proto */
-static PyObject *__pyx_pf_4LFPy_14run_simulation_4_collect_geometry_neuron(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cell); /* 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 PyObject *__pyx_float_100_;
-static PyObject *__pyx_float_1Eneg_3;
-static PyObject *__pyx_float_1Eneg_8;
-static PyObject *__pyx_float_1Eneg_9;
-static PyObject *__pyx_float_0_001;
-static PyObject *__pyx_float_1000_;
-static PyObject *__pyx_int_0;
-static PyObject *__pyx_int_1;
-static PyObject *__pyx_slice__2;
-static PyObject *__pyx_tuple__3;
-static PyObject *__pyx_tuple__4;
-static PyObject *__pyx_tuple__5;
-static PyObject *__pyx_tuple__6;
-static PyObject *__pyx_tuple__7;
-static PyObject *__pyx_tuple__8;
-static PyObject *__pyx_tuple__9;
-static PyObject *__pyx_tuple__10;
-static PyObject *__pyx_tuple__12;
-static PyObject *__pyx_codeobj__11;
-static PyObject *__pyx_codeobj__13;
-/* Late includes */
-
-/* "LFPy/run_simulation.pyx":29
- * 
- * 
- * def _run_simulation(cell, cvode, variable_dt=False, atol=0.001):             # <<<<<<<<<<<<<<
- *     """
- *     Running the actual simulation in NEURON, simulations in NEURON
- */
-
-/* Python wrapper */
-static PyObject *__pyx_pw_4LFPy_14run_simulation_1_run_simulation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4LFPy_14run_simulation__run_simulation[] = "\n    Running the actual simulation in NEURON, simulations in NEURON\n    is now interruptable.\n    ";
-static PyMethodDef __pyx_mdef_4LFPy_14run_simulation_1_run_simulation = {"_run_simulation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4LFPy_14run_simulation_1_run_simulation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4LFPy_14run_simulation__run_simulation};
-static PyObject *__pyx_pw_4LFPy_14run_simulation_1_run_simulation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyObject *__pyx_v_cell = 0;
-  PyObject *__pyx_v_cvode = 0;
-  PyObject *__pyx_v_variable_dt = 0;
-  PyObject *__pyx_v_atol = 0;
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("_run_simulation (wrapper)", 0);
-  {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cell,&__pyx_n_s_cvode,&__pyx_n_s_variable_dt,&__pyx_n_s_atol,0};
-    PyObject* values[4] = {0,0,0,0};
-    values[2] = ((PyObject *)Py_False);
-    values[3] = ((PyObject *)__pyx_float_0_001);
-    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);
-        CYTHON_FALLTHROUGH;
-        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-        CYTHON_FALLTHROUGH;
-        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-        CYTHON_FALLTHROUGH;
-        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-        CYTHON_FALLTHROUGH;
-        case  0: break;
-        default: goto __pyx_L5_argtuple_error;
-      }
-      kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
-        case  0:
-        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cell)) != 0)) kw_args--;
-        else goto __pyx_L5_argtuple_error;
-        CYTHON_FALLTHROUGH;
-        case  1:
-        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cvode)) != 0)) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("_run_simulation", 0, 2, 4, 1); __PYX_ERR(0, 29, __pyx_L3_error)
-        }
-        CYTHON_FALLTHROUGH;
-        case  2:
-        if (kw_args > 0) {
-          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variable_dt);
-          if (value) { values[2] = value; kw_args--; }
-        }
-        CYTHON_FALLTHROUGH;
-        case  3:
-        if (kw_args > 0) {
-          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_atol);
-          if (value) { values[3] = value; kw_args--; }
-        }
-      }
-      if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_run_simulation") < 0)) __PYX_ERR(0, 29, __pyx_L3_error)
-      }
-    } else {
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
-        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
-        CYTHON_FALLTHROUGH;
-        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-        CYTHON_FALLTHROUGH;
-        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_cell = values[0];
-    __pyx_v_cvode = values[1];
-    __pyx_v_variable_dt = values[2];
-    __pyx_v_atol = values[3];
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("_run_simulation", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 29, __pyx_L3_error)
-  __pyx_L3_error:;
-  __Pyx_AddTraceback("LFPy.run_simulation._run_simulation", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __Pyx_RefNannyFinishContext();
-  return NULL;
-  __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4LFPy_14run_simulation__run_simulation(__pyx_self, __pyx_v_cell, __pyx_v_cvode, __pyx_v_variable_dt, __pyx_v_atol);
-
-  /* function exit code */
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-static PyObject *__pyx_pf_4LFPy_14run_simulation__run_simulation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cell, PyObject *__pyx_v_cvode, PyObject *__pyx_v_variable_dt, PyObject *__pyx_v_atol) {
-  int __pyx_v_counter;
-  double __pyx_v_interval;
-  double __pyx_v_tstop;
-  double __pyx_v_t0;
-  double __pyx_v_ti;
-  double __pyx_v_rtfactor;
-  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;
-  double __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
-  int __pyx_t_8;
-  PyObject *__pyx_t_9 = NULL;
-  __Pyx_RefNannySetupContext("_run_simulation", 0);
-
-  /* "LFPy/run_simulation.pyx":34
- *     is now interruptable.
- *     """
- *     neuron.h.dt = cell.dt             # <<<<<<<<<<<<<<
- * 
- *     # variable dt method
- */
-  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_dt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_neuron); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (__Pyx_PyObject_SetAttrStr(__pyx_t_3, __pyx_n_s_dt, __pyx_t_1) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
-  /* "LFPy/run_simulation.pyx":37
- * 
- *     # variable dt method
- *     if variable_dt:             # <<<<<<<<<<<<<<
- *         cvode.active(1)
- *         cvode.atol(atol)
- */
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_variable_dt); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 37, __pyx_L1_error)
-  if (__pyx_t_4) {
-
-    /* "LFPy/run_simulation.pyx":38
- *     # variable dt method
- *     if variable_dt:
- *         cvode.active(1)             # <<<<<<<<<<<<<<
- *         cvode.atol(atol)
- *     else:
- */
-    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cvode, __pyx_n_s_active); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = NULL;
-    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
-      if (likely(__pyx_t_2)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-        __Pyx_INCREF(__pyx_t_2);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_1, function);
-      }
-    }
-    __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_int_1);
-    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
-    /* "LFPy/run_simulation.pyx":39
- *     if variable_dt:
- *         cvode.active(1)
- *         cvode.atol(atol)             # <<<<<<<<<<<<<<
- *     else:
- *         cvode.active(0)
- */
-    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cvode, __pyx_n_s_atol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = NULL;
-    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
-      if (likely(__pyx_t_2)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-        __Pyx_INCREF(__pyx_t_2);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_1, function);
-      }
-    }
-    __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_atol) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_atol);
-    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
-    /* "LFPy/run_simulation.pyx":37
- * 
- *     # variable dt method
- *     if variable_dt:             # <<<<<<<<<<<<<<
- *         cvode.active(1)
- *         cvode.atol(atol)
- */
-    goto __pyx_L3;
-  }
-
-  /* "LFPy/run_simulation.pyx":41
- *         cvode.atol(atol)
- *     else:
- *         cvode.active(0)             # <<<<<<<<<<<<<<
- * 
- *     #re-initialize state
- */
-  /*else*/ {
-    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cvode, __pyx_n_s_active); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = NULL;
-    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
-      if (likely(__pyx_t_2)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-        __Pyx_INCREF(__pyx_t_2);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_1, function);
-      }
-    }
-    __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_int_0);
-    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  }
-  __pyx_L3:;
-
-  /* "LFPy/run_simulation.pyx":44
- * 
- *     #re-initialize state
- *     neuron.h.finitialize(cell.v_init)             # <<<<<<<<<<<<<<
- * 
- *     #initialize current- and record
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_neuron); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_finitialize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __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_cell, __pyx_n_s_v_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_5 = NULL;
-  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
-    if (likely(__pyx_t_5)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-      __Pyx_INCREF(__pyx_t_5);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_1, function);
-    }
-  }
-  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
-  /* "LFPy/run_simulation.pyx":47
- * 
- *     #initialize current- and record
- *     if cvode.active():             # <<<<<<<<<<<<<<
- *         cvode.re_init()
- *     else:
- */
-  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cvode, __pyx_n_s_active); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = NULL;
-  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
-    if (likely(__pyx_t_2)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-      __Pyx_INCREF(__pyx_t_2);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_1, function);
-    }
-  }
-  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 47, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (__pyx_t_4) {
-
-    /* "LFPy/run_simulation.pyx":48
- *     #initialize current- and record
- *     if cvode.active():
- *         cvode.re_init()             # <<<<<<<<<<<<<<
- *     else:
- *         neuron.h.fcurrent()
- */
-    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cvode, __pyx_n_s_re_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = NULL;
-    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
-      if (likely(__pyx_t_2)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-        __Pyx_INCREF(__pyx_t_2);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_1, function);
-      }
-    }
-    __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
-    /* "LFPy/run_simulation.pyx":47
- * 
- *     #initialize current- and record
- *     if cvode.active():             # <<<<<<<<<<<<<<
- *         cvode.re_init()
- *     else:
- */
-    goto __pyx_L4;
-  }
-
-  /* "LFPy/run_simulation.pyx":50
- *         cvode.re_init()
- *     else:
- *         neuron.h.fcurrent()             # <<<<<<<<<<<<<<
- *     neuron.h.frecord_init()
- * 
- */
-  /*else*/ {
-    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_neuron); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_fcurrent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = NULL;
-    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
-      if (likely(__pyx_t_2)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-        __Pyx_INCREF(__pyx_t_2);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_1, function);
-      }
-    }
-    __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  }
-  __pyx_L4:;
-
-  /* "LFPy/run_simulation.pyx":51
- *     else:
- *         neuron.h.fcurrent()
- *     neuron.h.frecord_init()             # <<<<<<<<<<<<<<
- * 
- *     #Starting simulation at t != 0
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_neuron); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_frecord_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = NULL;
-  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
-    if (likely(__pyx_t_2)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-      __Pyx_INCREF(__pyx_t_2);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_1, function);
-    }
-  }
-  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
-  /* "LFPy/run_simulation.pyx":54
- * 
- *     #Starting simulation at t != 0
- *     neuron.h.t = cell.tstart             # <<<<<<<<<<<<<<
- * 
- *     cell._loadspikes()
- */
-  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_tstart); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_neuron); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__Pyx_PyObject_SetAttrStr(__pyx_t_2, __pyx_n_s_t, __pyx_t_3) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-
-  /* "LFPy/run_simulation.pyx":56
- *     neuron.h.t = cell.tstart
- * 
- *     cell._loadspikes()             # <<<<<<<<<<<<<<
- * 
- *     #print sim.time at intervals
- */
-  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_loadspikes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = NULL;
-  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
-    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
-    if (likely(__pyx_t_1)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
-      __Pyx_INCREF(__pyx_t_1);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_3, function);
-    }
-  }
-  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-
-  /* "LFPy/run_simulation.pyx":59
- * 
- *     #print sim.time at intervals
- *     cdef int counter = 0             # <<<<<<<<<<<<<<
- *     cdef double interval
- *     cdef double tstop = cell.tstop
- */
-  __pyx_v_counter = 0;
-
-  /* "LFPy/run_simulation.pyx":61
- *     cdef int counter = 0
- *     cdef double interval
- *     cdef double tstop = cell.tstop             # <<<<<<<<<<<<<<
- *     cdef double t0 = time()
- *     cdef double ti = neuron.h.t
- */
-  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_tstop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 61, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_v_tstop = __pyx_t_6;
-
-  /* "LFPy/run_simulation.pyx":62
- *     cdef double interval
- *     cdef double tstop = cell.tstop
- *     cdef double t0 = time()             # <<<<<<<<<<<<<<
- *     cdef double ti = neuron.h.t
- *     cdef double rtfactor
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
-    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
-    if (likely(__pyx_t_1)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
-      __Pyx_INCREF(__pyx_t_1);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_3, function);
-    }
-  }
-  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 62, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_v_t0 = __pyx_t_6;
-
-  /* "LFPy/run_simulation.pyx":63
- *     cdef double tstop = cell.tstop
- *     cdef double t0 = time()
- *     cdef double ti = neuron.h.t             # <<<<<<<<<<<<<<
- *     cdef double rtfactor
- *     if tstop >= 10000:
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_neuron); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 63, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_v_ti = __pyx_t_6;
-
-  /* "LFPy/run_simulation.pyx":65
- *     cdef double ti = neuron.h.t
- *     cdef double rtfactor
- *     if tstop >= 10000:             # <<<<<<<<<<<<<<
- *         interval = 1000. / cell.dt
- *     else:
- */
-  __pyx_t_4 = ((__pyx_v_tstop >= 10000.0) != 0);
-  if (__pyx_t_4) {
-
-    /* "LFPy/run_simulation.pyx":66
- *     cdef double rtfactor
- *     if tstop >= 10000:
- *         interval = 1000. / cell.dt             # <<<<<<<<<<<<<<
- *     else:
- *         interval = 100. / cell.dt
- */
-    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_dt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = __Pyx_PyFloat_TrueDivideCObj(__pyx_float_1000_, __pyx_t_2, 1000., 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 66, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_v_interval = __pyx_t_6;
-
-    /* "LFPy/run_simulation.pyx":65
- *     cdef double ti = neuron.h.t
- *     cdef double rtfactor
- *     if tstop >= 10000:             # <<<<<<<<<<<<<<
- *         interval = 1000. / cell.dt
- *     else:
- */
-    goto __pyx_L5;
-  }
-
-  /* "LFPy/run_simulation.pyx":68
- *         interval = 1000. / cell.dt
- *     else:
- *         interval = 100. / cell.dt             # <<<<<<<<<<<<<<
- * 
- *     while neuron.h.t < tstop:
- */
-  /*else*/ {
-    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_dt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = __Pyx_PyFloat_TrueDivideCObj(__pyx_float_100_, __pyx_t_3, 100., 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 68, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_v_interval = __pyx_t_6;
-  }
-  __pyx_L5:;
-
-  /* "LFPy/run_simulation.pyx":70
- *         interval = 100. / cell.dt
- * 
- *     while neuron.h.t < tstop:             # <<<<<<<<<<<<<<
- *         neuron.h.fadvance()
- *         counter += 1
- */
-  while (1) {
-    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_neuron); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tstop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 70, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (!__pyx_t_4) break;
-
-    /* "LFPy/run_simulation.pyx":71
- * 
- *     while neuron.h.t < tstop:
- *         neuron.h.fadvance()             # <<<<<<<<<<<<<<
- *         counter += 1
- *         if counter % interval == 0:
- */
-    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_neuron); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_fadvance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = NULL;
-    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
-      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
-      if (likely(__pyx_t_2)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
-        __Pyx_INCREF(__pyx_t_2);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_3, function);
-      }
-    }
-    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
-    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-    /* "LFPy/run_simulation.pyx":72
- *     while neuron.h.t < tstop:
- *         neuron.h.fadvance()
- *         counter += 1             # <<<<<<<<<<<<<<
- *         if counter % interval == 0:
- *             rtfactor = (neuron.h.t - ti)  * 1E-3 / (time() - t0 + 1E-9)
- */
-    __pyx_v_counter = (__pyx_v_counter + 1);
-
-    /* "LFPy/run_simulation.pyx":73
- *         neuron.h.fadvance()
- *         counter += 1
- *         if counter % interval == 0:             # <<<<<<<<<<<<<<
- *             rtfactor = (neuron.h.t - ti)  * 1E-3 / (time() - t0 + 1E-9)
- *             if cell.verbose:
- */
-    if (unlikely(__pyx_v_interval == 0)) {
-      PyErr_SetString(PyExc_ZeroDivisionError, "float divmod()");
-      __PYX_ERR(0, 73, __pyx_L1_error)
-    }
-    __pyx_t_4 = ((__Pyx_mod_double(__pyx_v_counter, __pyx_v_interval) == 0.0) != 0);
-    if (__pyx_t_4) {
-
-      /* "LFPy/run_simulation.pyx":74
- *         counter += 1
- *         if counter % interval == 0:
- *             rtfactor = (neuron.h.t - ti)  * 1E-3 / (time() - t0 + 1E-9)             # <<<<<<<<<<<<<<
- *             if cell.verbose:
- *                 print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_neuron); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_ti); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_float_1Eneg_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = NULL;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
-        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
-        if (likely(__pyx_t_5)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-          __Pyx_INCREF(__pyx_t_5);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_1, function);
-        }
-      }
-      __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
-      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
-      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_t0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __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_ERR(0, 74, __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;
-      __pyx_t_1 = __Pyx_PyFloat_AddObjC(__pyx_t_5, __pyx_float_1Eneg_9, 1E-9, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_v_rtfactor = __pyx_t_6;
-
-      /* "LFPy/run_simulation.pyx":75
- *         if counter % interval == 0:
- *             rtfactor = (neuron.h.t - ti)  * 1E-3 / (time() - t0 + 1E-9)
- *             if cell.verbose:             # <<<<<<<<<<<<<<
- *                 print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
- *                                                                    rtfactor))
- */
-      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_verbose); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 75, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 75, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      if (__pyx_t_4) {
-
-        /* "LFPy/run_simulation.pyx":76
- *             rtfactor = (neuron.h.t - ti)  * 1E-3 / (time() - t0 + 1E-9)
- *             if cell.verbose:
- *                 print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,             # <<<<<<<<<<<<<<
- *                                                                    rtfactor))
- *             t0 = time()
- */
-        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_t_0f_realtime_factor_3f, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_neuron); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_3);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-
-        /* "LFPy/run_simulation.pyx":77
- *             if cell.verbose:
- *                 print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
- *                                                                    rtfactor))             # <<<<<<<<<<<<<<
- *             t0 = time()
- *             ti = neuron.h.t
- */
-        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_rtfactor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_7 = NULL;
-        __pyx_t_8 = 0;
-        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
-          if (likely(__pyx_t_7)) {
-            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-            __Pyx_INCREF(__pyx_t_7);
-            __Pyx_INCREF(function);
-            __Pyx_DECREF_SET(__pyx_t_1, function);
-            __pyx_t_8 = 1;
-          }
-        }
-        #if CYTHON_FAST_PYCALL
-        if (PyFunction_Check(__pyx_t_1)) {
-          PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_3, __pyx_t_2};
-          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error)
-          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
-          __Pyx_GOTREF(__pyx_t_5);
-          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        } else
-        #endif
-        #if CYTHON_FAST_PYCCALL
-        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
-          PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_3, __pyx_t_2};
-          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error)
-          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
-          __Pyx_GOTREF(__pyx_t_5);
-          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        } else
-        #endif
-        {
-          __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 76, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_9);
-          if (__pyx_t_7) {
-            __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
-          }
-          __Pyx_GIVEREF(__pyx_t_3);
-          PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);
-          __Pyx_GIVEREF(__pyx_t_2);
-          PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_2);
-          __pyx_t_3 = 0;
-          __pyx_t_2 = 0;
-          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_5);
-          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-        }
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        if (__Pyx_PrintOne(0, __pyx_t_5) < 0) __PYX_ERR(0, 76, __pyx_L1_error)
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-
-        /* "LFPy/run_simulation.pyx":75
- *         if counter % interval == 0:
- *             rtfactor = (neuron.h.t - ti)  * 1E-3 / (time() - t0 + 1E-9)
- *             if cell.verbose:             # <<<<<<<<<<<<<<
- *                 print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
- *                                                                    rtfactor))
- */
-      }
-
-      /* "LFPy/run_simulation.pyx":78
- *                 print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
- *                                                                    rtfactor))
- *             t0 = time()             # <<<<<<<<<<<<<<
- *             ti = neuron.h.t
- * 
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_9 = NULL;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
-        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
-        if (likely(__pyx_t_9)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-          __Pyx_INCREF(__pyx_t_9);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_1, function);
-        }
-      }
-      __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
-      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
-      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_v_t0 = __pyx_t_6;
-
-      /* "LFPy/run_simulation.pyx":79
- *                                                                    rtfactor))
- *             t0 = time()
- *             ti = neuron.h.t             # <<<<<<<<<<<<<<
- * 
- * 
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_neuron); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_t); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_v_ti = __pyx_t_6;
-
-      /* "LFPy/run_simulation.pyx":73
- *         neuron.h.fadvance()
- *         counter += 1
- *         if counter % interval == 0:             # <<<<<<<<<<<<<<
- *             rtfactor = (neuron.h.t - ti)  * 1E-3 / (time() - t0 + 1E-9)
- *             if cell.verbose:
- */
-    }
-  }
-
-  /* "LFPy/run_simulation.pyx":29
- * 
- * 
- * def _run_simulation(cell, cvode, variable_dt=False, atol=0.001):             # <<<<<<<<<<<<<<
- *     """
- *     Running the actual simulation in NEURON, simulations in NEURON
- */
-
-  /* function exit code */
-  __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_5);
-  __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_XDECREF(__pyx_t_9);
-  __Pyx_AddTraceback("LFPy.run_simulation._run_simulation", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "LFPy/run_simulation.pyx":82
- * 
- * 
- * def _run_simulation_with_electrode(cell, cvode, electrode=None,             # <<<<<<<<<<<<<<
- *                                    variable_dt=False, atol=0.001,
- *                                    to_memory=True, to_file=False,
- */
-
-/* Python wrapper */
-static PyObject *__pyx_pw_4LFPy_14run_simulation_3_run_simulation_with_electrode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4LFPy_14run_simulation_2_run_simulation_with_electrode[] = "\n    Running the actual simulation in NEURON.\n    electrode argument used to determine coefficient\n    matrix, and calculate the LFP on every time step.\n    ";
-static PyMethodDef __pyx_mdef_4LFPy_14run_simulation_3_run_simulation_with_electrode = {"_run_simulation_with_electrode", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4LFPy_14run_simulation_3_run_simulation_with_electrode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4LFPy_14run_simulation_2_run_simulation_with_electrode};
-static PyObject *__pyx_pw_4LFPy_14run_simulation_3_run_simulation_with_electrode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyObject *__pyx_v_cell = 0;
-  PyObject *__pyx_v_cvode = 0;
-  PyObject *__pyx_v_electrode = 0;
-  CYTHON_UNUSED PyObject *__pyx_v_variable_dt = 0;
-  PyObject *__pyx_v_atol = 0;
-  PyObject *__pyx_v_to_memory = 0;
-  PyObject *__pyx_v_to_file = 0;
-  PyObject *__pyx_v_file_name = 0;
-  PyObject *__pyx_v_dotprodcoeffs = 0;
-  PyObject *__pyx_v_rec_current_dipole_moment = 0;
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("_run_simulation_with_electrode (wrapper)", 0);
-  {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cell,&__pyx_n_s_cvode,&__pyx_n_s_electrode,&__pyx_n_s_variable_dt,&__pyx_n_s_atol,&__pyx_n_s_to_memory,&__pyx_n_s_to_file,&__pyx_n_s_file_name,&__pyx_n_s_dotprodcoeffs,&__pyx_n_s_rec_current_dipole_moment,0};
-    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
-    values[2] = ((PyObject *)Py_None);
-
-    /* "LFPy/run_simulation.pyx":83
- * 
- * def _run_simulation_with_electrode(cell, cvode, electrode=None,
- *                                    variable_dt=False, atol=0.001,             # <<<<<<<<<<<<<<
- *                                    to_memory=True, to_file=False,
- *                                    file_name=None, dotprodcoeffs=None,
- */
-    values[3] = ((PyObject *)Py_False);
-    values[4] = ((PyObject *)__pyx_float_0_001);
-
-    /* "LFPy/run_simulation.pyx":84
- * def _run_simulation_with_electrode(cell, cvode, electrode=None,
- *                                    variable_dt=False, atol=0.001,
- *                                    to_memory=True, to_file=False,             # <<<<<<<<<<<<<<
- *                                    file_name=None, dotprodcoeffs=None,
- *                                    rec_current_dipole_moment=False):
- */
-    values[5] = ((PyObject *)Py_True);
-    values[6] = ((PyObject *)Py_False);
-
-    /* "LFPy/run_simulation.pyx":85
- *                                    variable_dt=False, atol=0.001,
- *                                    to_memory=True, to_file=False,
- *                                    file_name=None, dotprodcoeffs=None,             # <<<<<<<<<<<<<<
- *                                    rec_current_dipole_moment=False):
- *     """
- */
-    values[7] = ((PyObject *)Py_None);
-    values[8] = ((PyObject *)Py_None);
-
-    /* "LFPy/run_simulation.pyx":86
- *                                    to_memory=True, to_file=False,
- *                                    file_name=None, dotprodcoeffs=None,
- *                                    rec_current_dipole_moment=False):             # <<<<<<<<<<<<<<
- *     """
- *     Running the actual simulation in NEURON.
- */
-    values[9] = ((PyObject *)Py_False);
-    if (unlikely(__pyx_kwds)) {
-      Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
-        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
-        CYTHON_FALLTHROUGH;
-        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
-        CYTHON_FALLTHROUGH;
-        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
-        CYTHON_FALLTHROUGH;
-        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
-        CYTHON_FALLTHROUGH;
-        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
-        CYTHON_FALLTHROUGH;
-        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
-        CYTHON_FALLTHROUGH;
-        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
-        CYTHON_FALLTHROUGH;
-        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-        CYTHON_FALLTHROUGH;
-        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-        CYTHON_FALLTHROUGH;
-        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-        CYTHON_FALLTHROUGH;
-        case  0: break;
-        default: goto __pyx_L5_argtuple_error;
-      }
-      kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
-        case  0:
-        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cell)) != 0)) kw_args--;
-        else goto __pyx_L5_argtuple_error;
-        CYTHON_FALLTHROUGH;
-        case  1:
-        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cvode)) != 0)) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("_run_simulation_with_electrode", 0, 2, 10, 1); __PYX_ERR(0, 82, __pyx_L3_error)
-        }
-        CYTHON_FALLTHROUGH;
-        case  2:
-        if (kw_args > 0) {
-          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_electrode);
-          if (value) { values[2] = value; kw_args--; }
-        }
-        CYTHON_FALLTHROUGH;
-        case  3:
-        if (kw_args > 0) {
-          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variable_dt);
-          if (value) { values[3] = value; kw_args--; }
-        }
-        CYTHON_FALLTHROUGH;
-        case  4:
-        if (kw_args > 0) {
-          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_atol);
-          if (value) { values[4] = value; kw_args--; }
-        }
-        CYTHON_FALLTHROUGH;
-        case  5:
-        if (kw_args > 0) {
-          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_to_memory);
-          if (value) { values[5] = value; kw_args--; }
-        }
-        CYTHON_FALLTHROUGH;
-        case  6:
-        if (kw_args > 0) {
-          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_to_file);
-          if (value) { values[6] = value; kw_args--; }
-        }
-        CYTHON_FALLTHROUGH;
-        case  7:
-        if (kw_args > 0) {
-          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_file_name);
-          if (value) { values[7] = value; kw_args--; }
-        }
-        CYTHON_FALLTHROUGH;
-        case  8:
-        if (kw_args > 0) {
-          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dotprodcoeffs);
-          if (value) { values[8] = value; kw_args--; }
-        }
-        CYTHON_FALLTHROUGH;
-        case  9:
-        if (kw_args > 0) {
-          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rec_current_dipole_moment);
-          if (value) { values[9] = value; kw_args--; }
-        }
-      }
-      if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_run_simulation_with_electrode") < 0)) __PYX_ERR(0, 82, __pyx_L3_error)
-      }
-    } else {
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
-        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
-        CYTHON_FALLTHROUGH;
-        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
-        CYTHON_FALLTHROUGH;
-        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
-        CYTHON_FALLTHROUGH;
-        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
-        CYTHON_FALLTHROUGH;
-        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
-        CYTHON_FALLTHROUGH;
-        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
-        CYTHON_FALLTHROUGH;
-        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
-        CYTHON_FALLTHROUGH;
-        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-        CYTHON_FALLTHROUGH;
-        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_cell = values[0];
-    __pyx_v_cvode = values[1];
-    __pyx_v_electrode = values[2];
-    __pyx_v_variable_dt = values[3];
-    __pyx_v_atol = values[4];
-    __pyx_v_to_memory = values[5];
-    __pyx_v_to_file = values[6];
-    __pyx_v_file_name = values[7];
-    __pyx_v_dotprodcoeffs = values[8];
-    __pyx_v_rec_current_dipole_moment = values[9];
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("_run_simulation_with_electrode", 0, 2, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 82, __pyx_L3_error)
-  __pyx_L3_error:;
-  __Pyx_AddTraceback("LFPy.run_simulation._run_simulation_with_electrode", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __Pyx_RefNannyFinishContext();
-  return NULL;
-  __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_4LFPy_14run_simulation_2_run_simulation_with_electrode(__pyx_self, __pyx_v_cell, __pyx_v_cvode, __pyx_v_electrode, __pyx_v_variable_dt, __pyx_v_atol, __pyx_v_to_memory, __pyx_v_to_file, __pyx_v_file_name, __pyx_v_dotprodcoeffs, __pyx_v_rec_current_dipole_moment);
-
-  /* "LFPy/run_simulation.pyx":82
- * 
- * 
- * def _run_simulation_with_electrode(cell, cvode, electrode=None,             # <<<<<<<<<<<<<<
- *                                    variable_dt=False, atol=0.001,
- *                                    to_memory=True, to_file=False,
- */
-
-  /* function exit code */
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-static PyObject *__pyx_pf_4LFPy_14run_simulation_2_run_simulation_with_electrode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cell, PyObject *__pyx_v_cvode, PyObject *__pyx_v_electrode, CYTHON_UNUSED PyObject *__pyx_v_variable_dt, PyObject *__pyx_v_atol, PyObject *__pyx_v_to_memory, PyObject *__pyx_v_to_file, PyObject *__pyx_v_file_name, PyObject *__pyx_v_dotprodcoeffs, PyObject *__pyx_v_rec_current_dipole_moment) {
-  int __pyx_v_i;
-  int __pyx_v_j;
-  int __pyx_v_tstep;
-  double __pyx_v_tstop;
-  int __pyx_v_counter;
-  int __pyx_v_lendotprodcoeffs0;
-  double __pyx_v_interval;
-  double __pyx_v_t0;
-  double __pyx_v_ti;
-  double __pyx_v_rtfactor;
-  double __pyx_v_dt;
-  PyArrayObject *__pyx_v_coeffs = 0;
-  PyArrayObject *__pyx_v_current_dipole_moment = 0;
-  PyArrayObject *__pyx_v_midpoints = 0;
-  PyObject *__pyx_v_h5py = NULL;
-  PyObject *__pyx_v_electrodes = NULL;
-  PyObject *__pyx_v_el = NULL;
-  PyObject *__pyx_v_imem = NULL;
-  PyObject *__pyx_v_electrodesLFP = NULL;
-  PyObject *__pyx_v_el_LFP_file = NULL;
-  PyObject *__pyx_v_sec = NULL;
-  PyObject *__pyx_v_seg = NULL;
-  PyObject *__pyx_v_LFP = NULL;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_coeffs;
-  __Pyx_Buffer __pyx_pybuffer_coeffs;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_current_dipole_moment;
-  __Pyx_Buffer __pyx_pybuffer_current_dipole_moment;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_midpoints;
-  __Pyx_Buffer __pyx_pybuffer_midpoints;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  double __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  PyObject *__pyx_t_6 = NULL;
-  PyObject *__pyx_t_7 = NULL;
-  int __pyx_t_8;
-  int __pyx_t_9;
-  Py_ssize_t __pyx_t_10;
-  PyObject *(*__pyx_t_11)(PyObject *);
-  PyObject *__pyx_t_12 = NULL;
-  int __pyx_t_13;
-  PyArrayObject *__pyx_t_14 = NULL;
-  int __pyx_t_15;
-  PyObject *__pyx_t_16 = NULL;
-  PyObject *__pyx_t_17 = NULL;
-  PyArrayObject *__pyx_t_18 = NULL;
-  PyArrayObject *__pyx_t_19 = NULL;
-  Py_ssize_t __pyx_t_20;
-  PyObject *(*__pyx_t_21)(PyObject *);
-  int __pyx_t_22;
-  PyObject *__pyx_t_23 = NULL;
-  PyObject *__pyx_t_24 = NULL;
-  PyObject *__pyx_t_25 = NULL;
-  __Pyx_RefNannySetupContext("_run_simulation_with_electrode", 0);
-  __Pyx_INCREF(__pyx_v_to_file);
-  __Pyx_INCREF(__pyx_v_file_name);
-  __Pyx_INCREF(__pyx_v_dotprodcoeffs);
-  __pyx_pybuffer_coeffs.pybuffer.buf = NULL;
-  __pyx_pybuffer_coeffs.refcount = 0;
-  __pyx_pybuffernd_coeffs.data = NULL;
-  __pyx_pybuffernd_coeffs.rcbuffer = &__pyx_pybuffer_coeffs;
-  __pyx_pybuffer_current_dipole_moment.pybuffer.buf = NULL;
-  __pyx_pybuffer_current_dipole_moment.refcount = 0;
-  __pyx_pybuffernd_current_dipole_moment.data = NULL;
-  __pyx_pybuffernd_current_dipole_moment.rcbuffer = &__pyx_pybuffer_current_dipole_moment;
-  __pyx_pybuffer_midpoints.pybuffer.buf = NULL;
-  __pyx_pybuffer_midpoints.refcount = 0;
-  __pyx_pybuffernd_midpoints.data = NULL;
-  __pyx_pybuffernd_midpoints.rcbuffer = &__pyx_pybuffer_midpoints;
-
-  /* "LFPy/run_simulation.pyx":96
- *     cdef int i, j, tstep#, ncoeffs
- *     #cdef int totnsegs = cell.totnsegs
- *     cdef double tstop = cell.tstop             # <<<<<<<<<<<<<<
- *     cdef int counter
- *     cdef int lendotprodcoeffs0
- */
-  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_tstop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_tstop = __pyx_t_2;
-
-  /* "LFPy/run_simulation.pyx":103
- *     cdef double ti
- *     cdef double rtfactor
- *     cdef double dt = cell.dt             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[DTYPE_t, ndim=2, negative_indices=False] coeffs
- *     cdef np.ndarray[DTYPE_t, ndim=2, negative_indices=False] current_dipole_moment
- */
-  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_dt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_dt = __pyx_t_2;
-
-  /* "LFPy/run_simulation.pyx":109
- * 
- *     #check if h5py exist and saving is possible
- *     try:             # <<<<<<<<<<<<<<
- *         import h5py
- *     except:
- */
-  {
-    __Pyx_PyThreadState_declare
-    __Pyx_PyThreadState_assign
-    __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);
-    /*try:*/ {
-
-      /* "LFPy/run_simulation.pyx":110
- *     #check if h5py exist and saving is possible
- *     try:
- *         import h5py             # <<<<<<<<<<<<<<
- *     except:
- *         print('h5py not found, LFP to file not possible')
- */
-      __pyx_t_1 = __Pyx_Import(__pyx_n_s_h5py, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L3_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_v_h5py = __pyx_t_1;
-      __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":109
- * 
- *     #check if h5py exist and saving is possible
- *     try:             # <<<<<<<<<<<<<<
- *         import h5py
- *     except:
- */
-    }
-    __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;
-    goto __pyx_L8_try_end;
-    __pyx_L3_error:;
-    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-    /* "LFPy/run_simulation.pyx":111
- *     try:
- *         import h5py
- *     except:             # <<<<<<<<<<<<<<
- *         print('h5py not found, LFP to file not possible')
- *         to_file = False
- */
-    /*except:*/ {
-      __Pyx_AddTraceback("LFPy.run_simulation._run_simulation_with_electrode", __pyx_clineno, __pyx_lineno, __pyx_filename);
-      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 111, __pyx_L5_except_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_GOTREF(__pyx_t_7);
-
-      /* "LFPy/run_simulation.pyx":112
- *         import h5py
- *     except:
- *         print('h5py not found, LFP to file not possible')             # <<<<<<<<<<<<<<
- *         to_file = False
- *         file_name = None
- */
-      if (__Pyx_PrintOne(0, __pyx_kp_s_h5py_not_found_LFP_to_file_not_p) < 0) __PYX_ERR(0, 112, __pyx_L5_except_error)
-
-      /* "LFPy/run_simulation.pyx":113
- *     except:
- *         print('h5py not found, LFP to file not possible')
- *         to_file = False             # <<<<<<<<<<<<<<
- *         file_name = None
- * 
- */
-      __Pyx_INCREF(Py_False);
-      __Pyx_DECREF_SET(__pyx_v_to_file, Py_False);
-
-      /* "LFPy/run_simulation.pyx":114
- *         print('h5py not found, LFP to file not possible')
- *         to_file = False
- *         file_name = None             # <<<<<<<<<<<<<<
- * 
- * 
- */
-      __Pyx_INCREF(Py_None);
-      __Pyx_DECREF_SET(__pyx_v_file_name, Py_None);
-      __Pyx_XDECREF(__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;
-      goto __pyx_L4_exception_handled;
-    }
-    __pyx_L5_except_error:;
-
-    /* "LFPy/run_simulation.pyx":109
- * 
- *     #check if h5py exist and saving is possible
- *     try:             # <<<<<<<<<<<<<<
- *         import h5py
- *     except:
- */
-    __Pyx_XGIVEREF(__pyx_t_3);
-    __Pyx_XGIVEREF(__pyx_t_4);
-    __Pyx_XGIVEREF(__pyx_t_5);
-    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
-    goto __pyx_L1_error;
-    __pyx_L4_exception_handled:;
-    __Pyx_XGIVEREF(__pyx_t_3);
-    __Pyx_XGIVEREF(__pyx_t_4);
-    __Pyx_XGIVEREF(__pyx_t_5);
-    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
-    __pyx_L8_try_end:;
-  }
-
-  /* "LFPy/run_simulation.pyx":119
- *     # Use electrode object(s) to calculate coefficient matrices for LFP
- *     # calculations. If electrode is a list, then
- *     if cell.verbose:             # <<<<<<<<<<<<<<
- *         print('precalculating geometry - LFP mapping')
- * 
- */
-  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_verbose); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 119, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 119, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  if (__pyx_t_8) {
-
-    /* "LFPy/run_simulation.pyx":120
- *     # calculations. If electrode is a list, then
- *     if cell.verbose:
- *         print('precalculating geometry - LFP mapping')             # <<<<<<<<<<<<<<
- * 
- *     #put electrodecoeff in a list, if it isn't already
- */
-    if (__Pyx_PrintOne(0, __pyx_kp_s_precalculating_geometry_LFP_mapp) < 0) __PYX_ERR(0, 120, __pyx_L1_error)
-
-    /* "LFPy/run_simulation.pyx":119
- *     # Use electrode object(s) to calculate coefficient matrices for LFP
- *     # calculations. If electrode is a list, then
- *     if cell.verbose:             # <<<<<<<<<<<<<<
- *         print('precalculating geometry - LFP mapping')
- * 
- */
-  }
-
-  /* "LFPy/run_simulation.pyx":123
- * 
- *     #put electrodecoeff in a list, if it isn't already
- *     if dotprodcoeffs is not None:             # <<<<<<<<<<<<<<
- *         if type(dotprodcoeffs) != list:
- *             dotprodcoeffs = [dotprodcoeffs]
- */
-  __pyx_t_8 = (__pyx_v_dotprodcoeffs != Py_None);
-  __pyx_t_9 = (__pyx_t_8 != 0);
-  if (__pyx_t_9) {
-
-    /* "LFPy/run_simulation.pyx":124
- *     #put electrodecoeff in a list, if it isn't already
- *     if dotprodcoeffs is not None:
- *         if type(dotprodcoeffs) != list:             # <<<<<<<<<<<<<<
- *             dotprodcoeffs = [dotprodcoeffs]
- *         electrodes = []
- */
-    __pyx_t_7 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_dotprodcoeffs)), ((PyObject *)(&PyList_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 124, __pyx_L1_error)
-    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (__pyx_t_9) {
-
-      /* "LFPy/run_simulation.pyx":125
- *     if dotprodcoeffs is not None:
- *         if type(dotprodcoeffs) != list:
- *             dotprodcoeffs = [dotprodcoeffs]             # <<<<<<<<<<<<<<
- *         electrodes = []
- *     else:
- */
-      __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 125, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_INCREF(__pyx_v_dotprodcoeffs);
-      __Pyx_GIVEREF(__pyx_v_dotprodcoeffs);
-      PyList_SET_ITEM(__pyx_t_7, 0, __pyx_v_dotprodcoeffs);
-      __Pyx_DECREF_SET(__pyx_v_dotprodcoeffs, __pyx_t_7);
-      __pyx_t_7 = 0;
-
-      /* "LFPy/run_simulation.pyx":124
- *     #put electrodecoeff in a list, if it isn't already
- *     if dotprodcoeffs is not None:
- *         if type(dotprodcoeffs) != list:             # <<<<<<<<<<<<<<
- *             dotprodcoeffs = [dotprodcoeffs]
- *         electrodes = []
- */
-    }
-
-    /* "LFPy/run_simulation.pyx":126
- *         if type(dotprodcoeffs) != list:
- *             dotprodcoeffs = [dotprodcoeffs]
- *         electrodes = []             # <<<<<<<<<<<<<<
- *     else:
- *         #create empty list if no dotprodcoeffs are supplied
- */
-    __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 126, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_7);
-    __pyx_v_electrodes = __pyx_t_7;
-    __pyx_t_7 = 0;
-
-    /* "LFPy/run_simulation.pyx":123
- * 
- *     #put electrodecoeff in a list, if it isn't already
- *     if dotprodcoeffs is not None:             # <<<<<<<<<<<<<<
- *         if type(dotprodcoeffs) != list:
- *             dotprodcoeffs = [dotprodcoeffs]
- */
-    goto __pyx_L12;
-  }
-
-  /* "LFPy/run_simulation.pyx":129
- *     else:
- *         #create empty list if no dotprodcoeffs are supplied
- *         dotprodcoeffs = []             # <<<<<<<<<<<<<<
- * 
- *     #just for safekeeping
- */
-  /*else*/ {
-    __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 129, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF_SET(__pyx_v_dotprodcoeffs, __pyx_t_7);
-    __pyx_t_7 = 0;
-  }
-  __pyx_L12:;
-
-  /* "LFPy/run_simulation.pyx":132
- * 
- *     #just for safekeeping
- *     lendotprodcoeffs0 = len(dotprodcoeffs)             # <<<<<<<<<<<<<<
- * 
- *     #access electrode object and append mapping
- */
-  __pyx_t_10 = PyObject_Length(__pyx_v_dotprodcoeffs); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 132, __pyx_L1_error)
-  __pyx_v_lendotprodcoeffs0 = __pyx_t_10;
-
-  /* "LFPy/run_simulation.pyx":135
- * 
- *     #access electrode object and append mapping
- *     if electrode is not None:             # <<<<<<<<<<<<<<
- *         #put electrode argument in list if needed
- *         if type(electrode) == list:
- */
-  __pyx_t_9 = (__pyx_v_electrode != Py_None);
-  __pyx_t_8 = (__pyx_t_9 != 0);
-  if (__pyx_t_8) {
-
-    /* "LFPy/run_simulation.pyx":137
- *     if electrode is not None:
- *         #put electrode argument in list if needed
- *         if type(electrode) == list:             # <<<<<<<<<<<<<<
- *             electrodes = electrode
- *         else:
- */
-    __pyx_t_7 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_electrode)), ((PyObject *)(&PyList_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 137, __pyx_L1_error)
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 137, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (__pyx_t_8) {
-
-      /* "LFPy/run_simulation.pyx":138
- *         #put electrode argument in list if needed
- *         if type(electrode) == list:
- *             electrodes = electrode             # <<<<<<<<<<<<<<
- *         else:
- *             electrodes = [electrode]
- */
-      __Pyx_INCREF(__pyx_v_electrode);
-      __Pyx_XDECREF_SET(__pyx_v_electrodes, __pyx_v_electrode);
-
-      /* "LFPy/run_simulation.pyx":137
- *     if electrode is not None:
- *         #put electrode argument in list if needed
- *         if type(electrode) == list:             # <<<<<<<<<<<<<<
- *             electrodes = electrode
- *         else:
- */
-      goto __pyx_L15;
-    }
-
-    /* "LFPy/run_simulation.pyx":140
- *             electrodes = electrode
- *         else:
- *             electrodes = [electrode]             # <<<<<<<<<<<<<<
- * 
- *         for el in electrodes:
- */
-    /*else*/ {
-      __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 140, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_INCREF(__pyx_v_electrode);
-      __Pyx_GIVEREF(__pyx_v_electrode);
-      PyList_SET_ITEM(__pyx_t_7, 0, __pyx_v_electrode);
-      __Pyx_XDECREF_SET(__pyx_v_electrodes, __pyx_t_7);
-      __pyx_t_7 = 0;
-    }
-    __pyx_L15:;
-
-    /* "LFPy/run_simulation.pyx":142
- *             electrodes = [electrode]
- * 
- *         for el in electrodes:             # <<<<<<<<<<<<<<
- *             el.calc_mapping(cell)
- *             dotprodcoeffs.append(el.mapping)
- */
-    if (likely(PyList_CheckExact(__pyx_v_electrodes)) || PyTuple_CheckExact(__pyx_v_electrodes)) {
-      __pyx_t_7 = __pyx_v_electrodes; __Pyx_INCREF(__pyx_t_7); __pyx_t_10 = 0;
-      __pyx_t_11 = NULL;
-    } else {
-      __pyx_t_10 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_electrodes); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 142, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_11 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 142, __pyx_L1_error)
-    }
-    for (;;) {
-      if (likely(!__pyx_t_11)) {
-        if (likely(PyList_CheckExact(__pyx_t_7))) {
-          if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_7)) break;
-          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 142, __pyx_L1_error)
-          #else
-          __pyx_t_6 = PySequence_ITEM(__pyx_t_7, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 142, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_6);
-          #endif
-        } else {
-          if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
-          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 142, __pyx_L1_error)
-          #else
-          __pyx_t_6 = PySequence_ITEM(__pyx_t_7, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 142, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_6);
-          #endif
-        }
-      } else {
-        __pyx_t_6 = __pyx_t_11(__pyx_t_7);
-        if (unlikely(!__pyx_t_6)) {
-          PyObject* exc_type = PyErr_Occurred();
-          if (exc_type) {
-            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
-            else __PYX_ERR(0, 142, __pyx_L1_error)
-          }
-          break;
-        }
-        __Pyx_GOTREF(__pyx_t_6);
-      }
-      __Pyx_XDECREF_SET(__pyx_v_el, __pyx_t_6);
-      __pyx_t_6 = 0;
-
-      /* "LFPy/run_simulation.pyx":143
- * 
- *         for el in electrodes:
- *             el.calc_mapping(cell)             # <<<<<<<<<<<<<<
- *             dotprodcoeffs.append(el.mapping)
- *     elif electrode is None:
- */
-      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_calc_mapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_12 = NULL;
-      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1);
-        if (likely(__pyx_t_12)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-          __Pyx_INCREF(__pyx_t_12);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_1, function);
-        }
-      }
-      __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_12, __pyx_v_cell) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_cell);
-      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
-      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 143, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-      /* "LFPy/run_simulation.pyx":144
- *         for el in electrodes:
- *             el.calc_mapping(cell)
- *             dotprodcoeffs.append(el.mapping)             # <<<<<<<<<<<<<<
- *     elif electrode is None:
- *         electrodes = None
- */
-      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_el, __pyx_n_s_mapping); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 144, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_13 = __Pyx_PyObject_Append(__pyx_v_dotprodcoeffs, __pyx_t_6); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 144, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-      /* "LFPy/run_simulation.pyx":142
- *             electrodes = [electrode]
- * 
- *         for el in electrodes:             # <<<<<<<<<<<<<<
- *             el.calc_mapping(cell)
- *             dotprodcoeffs.append(el.mapping)
- */
-    }
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-
-    /* "LFPy/run_simulation.pyx":135
- * 
- *     #access electrode object and append mapping
- *     if electrode is not None:             # <<<<<<<<<<<<<<
- *         #put electrode argument in list if needed
- *         if type(electrode) == list:
- */
-    goto __pyx_L14;
-  }
-
-  /* "LFPy/run_simulation.pyx":145
- *             el.calc_mapping(cell)
- *             dotprodcoeffs.append(el.mapping)
- *     elif electrode is None:             # <<<<<<<<<<<<<<
- *         electrodes = None
- * 
- */
-  __pyx_t_8 = (__pyx_v_electrode == Py_None);
-  __pyx_t_9 = (__pyx_t_8 != 0);
-  if (__pyx_t_9) {
-
-    /* "LFPy/run_simulation.pyx":146
- *             dotprodcoeffs.append(el.mapping)
- *     elif electrode is None:
- *         electrodes = None             # <<<<<<<<<<<<<<
- * 
- * 
- */
-    __Pyx_INCREF(Py_None);
-    __Pyx_XDECREF_SET(__pyx_v_electrodes, Py_None);
-
-    /* "LFPy/run_simulation.pyx":145
- *             el.calc_mapping(cell)
- *             dotprodcoeffs.append(el.mapping)
- *     elif electrode is None:             # <<<<<<<<<<<<<<
- *         electrodes = None
- * 
- */
-  }
-  __pyx_L14:;
-
-  /* "LFPy/run_simulation.pyx":150
- * 
- *     # Initialize NEURON simulations of cell object
- *     neuron.h.dt = dt             # <<<<<<<<<<<<<<
- * 
- *     #don't know if this is the way to do, but needed for variable dt method
- */
-  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_dt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_7);
-  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_neuron); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 150, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  if (__Pyx_PyObject_SetAttrStr(__pyx_t_1, __pyx_n_s_dt, __pyx_t_7) < 0) __PYX_ERR(0, 150, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-  /* "LFPy/run_simulation.pyx":153
- * 
- *     #don't know if this is the way to do, but needed for variable dt method
- *     if cell.dt <= 1E-8:             # <<<<<<<<<<<<<<
- *         cvode.active(1)
- *         cvode.atol(atol)
- */
-  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_dt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_float_1Eneg_8, Py_LE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 153, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 153, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  if (__pyx_t_9) {
-
-    /* "LFPy/run_simulation.pyx":154
- *     #don't know if this is the way to do, but needed for variable dt method
- *     if cell.dt <= 1E-8:
- *         cvode.active(1)             # <<<<<<<<<<<<<<
- *         cvode.atol(atol)
- * 
- */
-    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cvode, __pyx_n_s_active); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = NULL;
-    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
-      if (likely(__pyx_t_6)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-        __Pyx_INCREF(__pyx_t_6);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_1, function);
-      }
-    }
-    __pyx_t_7 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_int_1);
-    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 154, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-
-    /* "LFPy/run_simulation.pyx":155
- *     if cell.dt <= 1E-8:
- *         cvode.active(1)
- *         cvode.atol(atol)             # <<<<<<<<<<<<<<
- * 
- *     #re-initialize state
- */
-    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cvode, __pyx_n_s_atol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = NULL;
-    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
-      if (likely(__pyx_t_6)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-        __Pyx_INCREF(__pyx_t_6);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_1, function);
-      }
-    }
-    __pyx_t_7 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_atol) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_atol);
-    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-
-    /* "LFPy/run_simulation.pyx":153
- * 
- *     #don't know if this is the way to do, but needed for variable dt method
- *     if cell.dt <= 1E-8:             # <<<<<<<<<<<<<<
- *         cvode.active(1)
- *         cvode.atol(atol)
- */
-  }
-
-  /* "LFPy/run_simulation.pyx":158
- * 
- *     #re-initialize state
- *     neuron.h.finitialize(cell.v_init)             # <<<<<<<<<<<<<<
- *     neuron.h.frecord_init() # wrong voltages t=0 for tstart < 0 otherwise
- *     neuron.h.fcurrent()
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_neuron); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 158, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_finitialize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __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_cell, __pyx_n_s_v_init); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 158, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_12 = NULL;
-  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1);
-    if (likely(__pyx_t_12)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-      __Pyx_INCREF(__pyx_t_12);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_1, function);
-    }
-  }
-  __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6);
-  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 158, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_7);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-
-  /* "LFPy/run_simulation.pyx":159
- *     #re-initialize state
- *     neuron.h.finitialize(cell.v_init)
- *     neuron.h.frecord_init() # wrong voltages t=0 for tstart < 0 otherwise             # <<<<<<<<<<<<<<
- *     neuron.h.fcurrent()
- * 
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_neuron); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 159, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_frecord_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = NULL;
-  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
-    if (likely(__pyx_t_6)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-      __Pyx_INCREF(__pyx_t_6);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_1, function);
-    }
-  }
-  __pyx_t_7 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
-  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 159, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_7);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-
-  /* "LFPy/run_simulation.pyx":160
- *     neuron.h.finitialize(cell.v_init)
- *     neuron.h.frecord_init() # wrong voltages t=0 for tstart < 0 otherwise
- *     neuron.h.fcurrent()             # <<<<<<<<<<<<<<
- * 
- *     #Starting simulation at t != 0
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_neuron); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 160, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_fcurrent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = NULL;
-  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
-    if (likely(__pyx_t_6)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-      __Pyx_INCREF(__pyx_t_6);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_1, function);
-    }
-  }
-  __pyx_t_7 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
-  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 160, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_7);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-
-  /* "LFPy/run_simulation.pyx":163
- * 
- *     #Starting simulation at t != 0
- *     neuron.h.t = cell.tstart             # <<<<<<<<<<<<<<
- * 
- *     #load spike times from NetCon
- */
-  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_tstart); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 163, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_7);
-  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_neuron); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 163, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__Pyx_PyObject_SetAttrStr(__pyx_t_6, __pyx_n_s_t, __pyx_t_7) < 0) __PYX_ERR(0, 163, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-  /* "LFPy/run_simulation.pyx":166
- * 
- *     #load spike times from NetCon
- *     cell._loadspikes()             # <<<<<<<<<<<<<<
- * 
- *     #print sim.time at intervals
- */
-  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_loadspikes); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 166, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_1 = NULL;
-  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
-    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
-    if (likely(__pyx_t_1)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
-      __Pyx_INCREF(__pyx_t_1);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_7, function);
-    }
-  }
-  __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
-  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 166, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-  /* "LFPy/run_simulation.pyx":169
- * 
- *     #print sim.time at intervals
- *     counter = 0             # <<<<<<<<<<<<<<
- *     tstep = 0
- *     t0 = time()
- */
-  __pyx_v_counter = 0;
-
-  /* "LFPy/run_simulation.pyx":170
- *     #print sim.time at intervals
- *     counter = 0
- *     tstep = 0             # <<<<<<<<<<<<<<
- *     t0 = time()
- *     ti = neuron.h.t
- */
-  __pyx_v_tstep = 0;
-
-  /* "LFPy/run_simulation.pyx":171
- *     counter = 0
- *     tstep = 0
- *     t0 = time()             # <<<<<<<<<<<<<<
- *     ti = neuron.h.t
- *     if tstop >= 10000:
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_time); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 171, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_1 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
-    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
-    if (likely(__pyx_t_1)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
-      __Pyx_INCREF(__pyx_t_1);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_7, function);
-    }
-  }
-  __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
-  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 171, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_v_t0 = __pyx_t_2;
-
-  /* "LFPy/run_simulation.pyx":172
- *     tstep = 0
- *     t0 = time()
- *     ti = neuron.h.t             # <<<<<<<<<<<<<<
- *     if tstop >= 10000:
- *         interval = 1000. / dt
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_neuron); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_h); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 172, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_7);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_v_ti = __pyx_t_2;
-
-  /* "LFPy/run_simulation.pyx":173
- *     t0 = time()
- *     ti = neuron.h.t
- *     if tstop >= 10000:             # <<<<<<<<<<<<<<
- *         interval = 1000. / dt
- *     else:
- */
-  __pyx_t_9 = ((__pyx_v_tstop >= 10000.0) != 0);
-  if (__pyx_t_9) {
-
-    /* "LFPy/run_simulation.pyx":174
- *     ti = neuron.h.t
- *     if tstop >= 10000:
- *         interval = 1000. / dt             # <<<<<<<<<<<<<<
- *     else:
- *         interval = 100. / dt
- */
-    if (unlikely(__pyx_v_dt == 0)) {
-      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
-      __PYX_ERR(0, 174, __pyx_L1_error)
-    }
-    __pyx_v_interval = (1000. / __pyx_v_dt);
-
-    /* "LFPy/run_simulation.pyx":173
- *     t0 = time()
- *     ti = neuron.h.t
- *     if tstop >= 10000:             # <<<<<<<<<<<<<<
- *         interval = 1000. / dt
- *     else:
- */
-    goto __pyx_L19;
-  }
-
-  /* "LFPy/run_simulation.pyx":176
- *         interval = 1000. / dt
- *     else:
- *         interval = 100. / dt             # <<<<<<<<<<<<<<
- * 
- *     #temp vector to store membrane currents at each timestep
- */
-  /*else*/ {
-    if (unlikely(__pyx_v_dt == 0)) {
-      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
-      __PYX_ERR(0, 176, __pyx_L1_error)
-    }
-    __pyx_v_interval = (100. / __pyx_v_dt);
-  }
-  __pyx_L19:;
-
-  /* "LFPy/run_simulation.pyx":179
- * 
- *     #temp vector to store membrane currents at each timestep
- *     imem = np.zeros(cell.totnsegs)             # <<<<<<<<<<<<<<
- *     #LFPs for each electrode will be put here during simulation
- *     if to_memory:
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 179, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_totnsegs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 179, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_12 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
-    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1);
-    if (likely(__pyx_t_12)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-      __Pyx_INCREF(__pyx_t_12);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_1, function);
-    }
-  }
-  __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_12, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7);
-  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 179, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_imem = __pyx_t_6;
-  __pyx_t_6 = 0;
-
-  /* "LFPy/run_simulation.pyx":181
- *     imem = np.zeros(cell.totnsegs)
- *     #LFPs for each electrode will be put here during simulation
- *     if to_memory:             # <<<<<<<<<<<<<<
- *         electrodesLFP = []
- *         for coeffs in dotprodcoeffs:
- */
-  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_to_memory); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 181, __pyx_L1_error)
-  if (__pyx_t_9) {
-
-    /* "LFPy/run_simulation.pyx":182
- *     #LFPs for each electrode will be put here during simulation
- *     if to_memory:
- *         electrodesLFP = []             # <<<<<<<<<<<<<<
- *         for coeffs in dotprodcoeffs:
- *             electrodesLFP.append(np.zeros((coeffs.shape[0],
- */
-    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 182, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_v_electrodesLFP = ((PyObject*)__pyx_t_6);
-    __pyx_t_6 = 0;
-
-    /* "LFPy/run_simulation.pyx":183
- *     if to_memory:
- *         electrodesLFP = []
- *         for coeffs in dotprodcoeffs:             # <<<<<<<<<<<<<<
- *             electrodesLFP.append(np.zeros((coeffs.shape[0],
- *                                     int(tstop / dt + 1))))
- */
-    if (likely(PyList_CheckExact(__pyx_v_dotprodcoeffs)) || PyTuple_CheckExact(__pyx_v_dotprodcoeffs)) {
-      __pyx_t_6 = __pyx_v_dotprodcoeffs; __Pyx_INCREF(__pyx_t_6); __pyx_t_10 = 0;
-      __pyx_t_11 = NULL;
-    } else {
-      __pyx_t_10 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_dotprodcoeffs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 183, __pyx_L1_error)
-    }
-    for (;;) {
-      if (likely(!__pyx_t_11)) {
-        if (likely(PyList_CheckExact(__pyx_t_6))) {
-          if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_6)) break;
-          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 183, __pyx_L1_error)
-          #else
-          __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_1);
-          #endif
-        } else {
-          if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
-          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 183, __pyx_L1_error)
-          #else
-          __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_1);
-          #endif
-        }
-      } else {
-        __pyx_t_1 = __pyx_t_11(__pyx_t_6);
-        if (unlikely(!__pyx_t_1)) {
-          PyObject* exc_type = PyErr_Occurred();
-          if (exc_type) {
-            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
-            else __PYX_ERR(0, 183, __pyx_L1_error)
-          }
-          break;
-        }
-        __Pyx_GOTREF(__pyx_t_1);
-      }
-      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 183, __pyx_L1_error)
-      __pyx_t_14 = ((PyArrayObject *)__pyx_t_1);
-      {
-        __Pyx_BufFmt_StackElem __pyx_stack[1];
-        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer);
-        __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
-        if (unlikely(__pyx_t_15 < 0)) {
-          PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
-          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer, (PyObject*)__pyx_v_coeffs, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
-            Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3);
-            __Pyx_RaiseBufferFallbackError();
-          } else {
-            PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
-          }
-          __pyx_t_5 = __pyx_t_4 = __pyx_t_3 = 0;
-        }
-        __pyx_pybuffernd_coeffs.diminfo[0].strides = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coeffs.diminfo[0].shape = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coeffs.diminfo[1].strides = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coeffs.diminfo[1].shape = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.shape[1];
-        if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 183, __pyx_L1_error)
-      }
-      __pyx_t_14 = 0;
-      __Pyx_XDECREF_SET(__pyx_v_coeffs, ((PyArrayObject *)__pyx_t_1));
-      __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":184
- *         electrodesLFP = []
- *         for coeffs in dotprodcoeffs:
- *             electrodesLFP.append(np.zeros((coeffs.shape[0],             # <<<<<<<<<<<<<<
- *                                     int(tstop / dt + 1))))
- *     #LFPs for each electrode will be put here during simulations
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 184, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 184, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_12);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_7 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coeffs->dimensions[0])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 184, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_7);
-
-      /* "LFPy/run_simulation.pyx":185
- *         for coeffs in dotprodcoeffs:
- *             electrodesLFP.append(np.zeros((coeffs.shape[0],
- *                                     int(tstop / dt + 1))))             # <<<<<<<<<<<<<<
- *     #LFPs for each electrode will be put here during simulations
- *     if to_file:
- */
-      if (unlikely(__pyx_v_dt == 0)) {
-        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
-        __PYX_ERR(0, 185, __pyx_L1_error)
-      }
-      __pyx_t_16 = __Pyx_PyInt_FromDouble(((__pyx_v_tstop / __pyx_v_dt) + 1.0)); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 185, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_16);
-
-      /* "LFPy/run_simulation.pyx":184
- *         electrodesLFP = []
- *         for coeffs in dotprodcoeffs:
- *             electrodesLFP.append(np.zeros((coeffs.shape[0],             # <<<<<<<<<<<<<<
- *                                     int(tstop / dt + 1))))
- *     #LFPs for each electrode will be put here during simulations
- */
-      __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 184, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_17);
-      __Pyx_GIVEREF(__pyx_t_7);
-      PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_7);
-      __Pyx_GIVEREF(__pyx_t_16);
-      PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_16);
-      __pyx_t_7 = 0;
-      __pyx_t_16 = 0;
-      __pyx_t_16 = NULL;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
-        __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_12);
-        if (likely(__pyx_t_16)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
-          __Pyx_INCREF(__pyx_t_16);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_12, function);
-        }
-      }
-      __pyx_t_1 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_16, __pyx_t_17) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_17);
-      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
-      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
-      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-      __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_electrodesLFP, __pyx_t_1); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 184, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":183
- *     if to_memory:
- *         electrodesLFP = []
- *         for coeffs in dotprodcoeffs:             # <<<<<<<<<<<<<<
- *             electrodesLFP.append(np.zeros((coeffs.shape[0],
- *                                     int(tstop / dt + 1))))
- */
-    }
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-    /* "LFPy/run_simulation.pyx":181
- *     imem = np.zeros(cell.totnsegs)
- *     #LFPs for each electrode will be put here during simulation
- *     if to_memory:             # <<<<<<<<<<<<<<
- *         electrodesLFP = []
- *         for coeffs in dotprodcoeffs:
- */
-  }
-
-  /* "LFPy/run_simulation.pyx":187
- *                                     int(tstop / dt + 1))))
- *     #LFPs for each electrode will be put here during simulations
- *     if to_file:             # <<<<<<<<<<<<<<
- *         #ensure right ending:
- *         if file_name.split('.')[-1] != 'h5':
- */
-  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_to_file); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 187, __pyx_L1_error)
-  if (__pyx_t_9) {
-
-    /* "LFPy/run_simulation.pyx":189
- *     if to_file:
- *         #ensure right ending:
- *         if file_name.split('.')[-1] != 'h5':             # <<<<<<<<<<<<<<
- *             file_name += '.h5'
- *         el_LFP_file = h5py.File(file_name, 'w')
- */
-    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_file_name, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_12 = NULL;
-    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1);
-      if (likely(__pyx_t_12)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-        __Pyx_INCREF(__pyx_t_12);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_1, function);
-      }
-    }
-    __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_12, __pyx_kp_s_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_);
-    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
-    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 189, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_6, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_9 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_h5, Py_NE)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 189, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (__pyx_t_9) {
-
-      /* "LFPy/run_simulation.pyx":190
- *         #ensure right ending:
- *         if file_name.split('.')[-1] != 'h5':
- *             file_name += '.h5'             # <<<<<<<<<<<<<<
- *         el_LFP_file = h5py.File(file_name, 'w')
- *         i = 0
- */
-      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_file_name, __pyx_kp_s_h5_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF_SET(__pyx_v_file_name, __pyx_t_1);
-      __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":189
- *     if to_file:
- *         #ensure right ending:
- *         if file_name.split('.')[-1] != 'h5':             # <<<<<<<<<<<<<<
- *             file_name += '.h5'
- *         el_LFP_file = h5py.File(file_name, 'w')
- */
-    }
-
-    /* "LFPy/run_simulation.pyx":191
- *         if file_name.split('.')[-1] != 'h5':
- *             file_name += '.h5'
- *         el_LFP_file = h5py.File(file_name, 'w')             # <<<<<<<<<<<<<<
- *         i = 0
- *         for coeffs in dotprodcoeffs:
- */
-    if (unlikely(!__pyx_v_h5py)) { __Pyx_RaiseUnboundLocalError("h5py"); __PYX_ERR(0, 191, __pyx_L1_error) }
-    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_h5py, __pyx_n_s_File); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 191, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_12 = NULL;
-    __pyx_t_15 = 0;
-    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
-      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6);
-      if (likely(__pyx_t_12)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
-        __Pyx_INCREF(__pyx_t_12);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_6, function);
-        __pyx_t_15 = 1;
-      }
-    }
-    #if CYTHON_FAST_PYCALL
-    if (PyFunction_Check(__pyx_t_6)) {
-      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_file_name, __pyx_n_s_w};
-      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
-      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
-      __Pyx_GOTREF(__pyx_t_1);
-    } else
-    #endif
-    #if CYTHON_FAST_PYCCALL
-    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
-      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_file_name, __pyx_n_s_w};
-      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
-      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
-      __Pyx_GOTREF(__pyx_t_1);
-    } else
-    #endif
-    {
-      __pyx_t_17 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 191, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_17);
-      if (__pyx_t_12) {
-        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_12); __pyx_t_12 = NULL;
-      }
-      __Pyx_INCREF(__pyx_v_file_name);
-      __Pyx_GIVEREF(__pyx_v_file_name);
-      PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_15, __pyx_v_file_name);
-      __Pyx_INCREF(__pyx_n_s_w);
-      __Pyx_GIVEREF(__pyx_n_s_w);
-      PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_15, __pyx_n_s_w);
-      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
-    }
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_v_el_LFP_file = __pyx_t_1;
-    __pyx_t_1 = 0;
-
-    /* "LFPy/run_simulation.pyx":192
- *             file_name += '.h5'
- *         el_LFP_file = h5py.File(file_name, 'w')
- *         i = 0             # <<<<<<<<<<<<<<
- *         for coeffs in dotprodcoeffs:
- *             el_LFP_file['electrode{:03d}'.format(i)] = np.zeros((coeffs.shape[0],
- */
-    __pyx_v_i = 0;
-
-    /* "LFPy/run_simulation.pyx":193
- *         el_LFP_file = h5py.File(file_name, 'w')
- *         i = 0
- *         for coeffs in dotprodcoeffs:             # <<<<<<<<<<<<<<
- *             el_LFP_file['electrode{:03d}'.format(i)] = np.zeros((coeffs.shape[0],
- *                                             int(tstop / dt + 1)))
- */
-    if (likely(PyList_CheckExact(__pyx_v_dotprodcoeffs)) || PyTuple_CheckExact(__pyx_v_dotprodcoeffs)) {
-      __pyx_t_1 = __pyx_v_dotprodcoeffs; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0;
-      __pyx_t_11 = NULL;
-    } else {
-      __pyx_t_10 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_dotprodcoeffs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 193, __pyx_L1_error)
-    }
-    for (;;) {
-      if (likely(!__pyx_t_11)) {
-        if (likely(PyList_CheckExact(__pyx_t_1))) {
-          if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_1)) break;
-          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 193, __pyx_L1_error)
-          #else
-          __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 193, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_6);
-          #endif
-        } else {
-          if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 193, __pyx_L1_error)
-          #else
-          __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 193, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_6);
-          #endif
-        }
-      } else {
-        __pyx_t_6 = __pyx_t_11(__pyx_t_1);
-        if (unlikely(!__pyx_t_6)) {
-          PyObject* exc_type = PyErr_Occurred();
-          if (exc_type) {
-            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
-            else __PYX_ERR(0, 193, __pyx_L1_error)
-          }
-          break;
-        }
-        __Pyx_GOTREF(__pyx_t_6);
-      }
-      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 193, __pyx_L1_error)
-      __pyx_t_14 = ((PyArrayObject *)__pyx_t_6);
-      {
-        __Pyx_BufFmt_StackElem __pyx_stack[1];
-        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer);
-        __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
-        if (unlikely(__pyx_t_15 < 0)) {
-          PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
-          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer, (PyObject*)__pyx_v_coeffs, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
-            Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
-            __Pyx_RaiseBufferFallbackError();
-          } else {
-            PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
-          }
-          __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
-        }
-        __pyx_pybuffernd_coeffs.diminfo[0].strides = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coeffs.diminfo[0].shape = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coeffs.diminfo[1].strides = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coeffs.diminfo[1].shape = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.shape[1];
-        if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 193, __pyx_L1_error)
-      }
-      __pyx_t_14 = 0;
-      __Pyx_XDECREF_SET(__pyx_v_coeffs, ((PyArrayObject *)__pyx_t_6));
-      __pyx_t_6 = 0;
-
-      /* "LFPy/run_simulation.pyx":194
- *         i = 0
- *         for coeffs in dotprodcoeffs:
- *             el_LFP_file['electrode{:03d}'.format(i)] = np.zeros((coeffs.shape[0],             # <<<<<<<<<<<<<<
- *                                             int(tstop / dt + 1)))
- *             i += 1
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 194, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_17);
-      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_zeros); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 194, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_12);
-      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
-      __pyx_t_17 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coeffs->dimensions[0])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 194, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_17);
-
-      /* "LFPy/run_simulation.pyx":195
- *         for coeffs in dotprodcoeffs:
- *             el_LFP_file['electrode{:03d}'.format(i)] = np.zeros((coeffs.shape[0],
- *                                             int(tstop / dt + 1)))             # <<<<<<<<<<<<<<
- *             i += 1
- * 
- */
-      if (unlikely(__pyx_v_dt == 0)) {
-        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
-        __PYX_ERR(0, 195, __pyx_L1_error)
-      }
-      __pyx_t_16 = __Pyx_PyInt_FromDouble(((__pyx_v_tstop / __pyx_v_dt) + 1.0)); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 195, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_16);
-
-      /* "LFPy/run_simulation.pyx":194
- *         i = 0
- *         for coeffs in dotprodcoeffs:
- *             el_LFP_file['electrode{:03d}'.format(i)] = np.zeros((coeffs.shape[0],             # <<<<<<<<<<<<<<
- *                                             int(tstop / dt + 1)))
- *             i += 1
- */
-      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_GIVEREF(__pyx_t_17);
-      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_17);
-      __Pyx_GIVEREF(__pyx_t_16);
-      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_16);
-      __pyx_t_17 = 0;
-      __pyx_t_16 = 0;
-      __pyx_t_16 = NULL;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
-        __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_12);
-        if (likely(__pyx_t_16)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
-          __Pyx_INCREF(__pyx_t_16);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_12, function);
-        }
-      }
-      __pyx_t_6 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_16, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_7);
-      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 194, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_electrode_03d, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 194, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_16);
-      __pyx_t_17 = NULL;
-      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
-        __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_7);
-        if (likely(__pyx_t_17)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
-          __Pyx_INCREF(__pyx_t_17);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_7, function);
-        }
-      }
-      __pyx_t_12 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_17, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_16);
-      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
-      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 194, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_12);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      if (unlikely(PyObject_SetItem(__pyx_v_el_LFP_file, __pyx_t_12, __pyx_t_6) < 0)) __PYX_ERR(0, 194, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-      /* "LFPy/run_simulation.pyx":196
- *             el_LFP_file['electrode{:03d}'.format(i)] = np.zeros((coeffs.shape[0],
- *                                             int(tstop / dt + 1)))
- *             i += 1             # <<<<<<<<<<<<<<
- * 
- *     # create a 2D array representation of segment midpoints for dot product
- */
-      __pyx_v_i = (__pyx_v_i + 1);
-
-      /* "LFPy/run_simulation.pyx":193
- *         el_LFP_file = h5py.File(file_name, 'w')
- *         i = 0
- *         for coeffs in dotprodcoeffs:             # <<<<<<<<<<<<<<
- *             el_LFP_file['electrode{:03d}'.format(i)] = np.zeros((coeffs.shape[0],
- *                                             int(tstop / dt + 1)))
- */
-    }
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-    /* "LFPy/run_simulation.pyx":187
- *                                     int(tstop / dt + 1))))
- *     #LFPs for each electrode will be put here during simulations
- *     if to_file:             # <<<<<<<<<<<<<<
- *         #ensure right ending:
- *         if file_name.split('.')[-1] != 'h5':
- */
-  }
-
-  /* "LFPy/run_simulation.pyx":200
- *     # create a 2D array representation of segment midpoints for dot product
- *     # with transmembrane currents when computing dipole moment
- *     if rec_current_dipole_moment:             # <<<<<<<<<<<<<<
- *         current_dipole_moment = cell.current_dipole_moment.copy()
- *         cell.current_dipole_moment = np.array([[]])
- */
-  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_rec_current_dipole_moment); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 200, __pyx_L1_error)
-  if (__pyx_t_9) {
-
-    /* "LFPy/run_simulation.pyx":201
- *     # with transmembrane currents when computing dipole moment
- *     if rec_current_dipole_moment:
- *         current_dipole_moment = cell.current_dipole_moment.copy()             # <<<<<<<<<<<<<<
- *         cell.current_dipole_moment = np.array([[]])
- *         midpoints = np.c_[cell.xmid, cell.ymid, cell.zmid]
- */
-    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_current_dipole_moment); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 201, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_copy); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 201, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_12);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = NULL;
-    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
-      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_12);
-      if (likely(__pyx_t_6)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
-        __Pyx_INCREF(__pyx_t_6);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_12, function);
-      }
-    }
-    __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
-    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 201, __pyx_L1_error)
-    __pyx_t_18 = ((PyArrayObject *)__pyx_t_1);
-    {
-      __Pyx_BufFmt_StackElem __pyx_stack[1];
-      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_current_dipole_moment.rcbuffer->pybuffer);
-      __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_current_dipole_moment.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
-      if (unlikely(__pyx_t_15 < 0)) {
-        PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
-        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_current_dipole_moment.rcbuffer->pybuffer, (PyObject*)__pyx_v_current_dipole_moment, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
-          Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3);
-          __Pyx_RaiseBufferFallbackError();
-        } else {
-          PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
-        }
-        __pyx_t_5 = __pyx_t_4 = __pyx_t_3 = 0;
-      }
-      __pyx_pybuffernd_current_dipole_moment.diminfo[0].strides = __pyx_pybuffernd_current_dipole_moment.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_current_dipole_moment.diminfo[0].shape = __pyx_pybuffernd_current_dipole_moment.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_current_dipole_moment.diminfo[1].strides = __pyx_pybuffernd_current_dipole_moment.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_current_dipole_moment.diminfo[1].shape = __pyx_pybuffernd_current_dipole_moment.rcbuffer->pybuffer.shape[1];
-      if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 201, __pyx_L1_error)
-    }
-    __pyx_t_18 = 0;
-    __pyx_v_current_dipole_moment = ((PyArrayObject *)__pyx_t_1);
-    __pyx_t_1 = 0;
-
-    /* "LFPy/run_simulation.pyx":202
- *     if rec_current_dipole_moment:
- *         current_dipole_moment = cell.current_dipole_moment.copy()
- *         cell.current_dipole_moment = np.array([[]])             # <<<<<<<<<<<<<<
- *         midpoints = np.c_[cell.xmid, cell.ymid, cell.zmid]
- * 
- */
-    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 202, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_12);
-    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 202, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_12);
-    __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 202, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_GIVEREF(__pyx_t_12);
-    PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_12);
-    __pyx_t_12 = 0;
-    __pyx_t_12 = NULL;
-    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
-      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6);
-      if (likely(__pyx_t_12)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
-        __Pyx_INCREF(__pyx_t_12);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_6, function);
-      }
-    }
-    __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_12, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
-    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (__Pyx_PyObject_SetAttrStr(__pyx_v_cell, __pyx_n_s_current_dipole_moment, __pyx_t_1) < 0) __PYX_ERR(0, 202, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-    /* "LFPy/run_simulation.pyx":203
- *         current_dipole_moment = cell.current_dipole_moment.copy()
- *         cell.current_dipole_moment = np.array([[]])
- *         midpoints = np.c_[cell.xmid, cell.ymid, cell.zmid]             # <<<<<<<<<<<<<<
- * 
- *     #run fadvance until time limit, and calculate LFPs for each timestep
- */
-    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_c); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 203, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_xmid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_ymid); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 203, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_zmid); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 203, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_12);
-    __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 203, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_16);
-    __Pyx_GIVEREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_7);
-    PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_7);
-    __Pyx_GIVEREF(__pyx_t_12);
-    PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_12);
-    __pyx_t_1 = 0;
-    __pyx_t_7 = 0;
-    __pyx_t_12 = 0;
-    __pyx_t_12 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_16); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 203, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_12);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-    if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 203, __pyx_L1_error)
-    __pyx_t_19 = ((PyArrayObject *)__pyx_t_12);
-    {
-      __Pyx_BufFmt_StackElem __pyx_stack[1];
-      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_midpoints.rcbuffer->pybuffer);
-      __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_midpoints.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
-      if (unlikely(__pyx_t_15 < 0)) {
-        PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
-        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_midpoints.rcbuffer->pybuffer, (PyObject*)__pyx_v_midpoints, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
-          Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
-          __Pyx_RaiseBufferFallbackError();
-        } else {
-          PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
-        }
-        __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
-      }
-      __pyx_pybuffernd_midpoints.diminfo[0].strides = __pyx_pybuffernd_midpoints.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_midpoints.diminfo[0].shape = __pyx_pybuffernd_midpoints.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_midpoints.diminfo[1].strides = __pyx_pybuffernd_midpoints.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_midpoints.diminfo[1].shape = __pyx_pybuffernd_midpoints.rcbuffer->pybuffer.shape[1];
-      if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 203, __pyx_L1_error)
-    }
-    __pyx_t_19 = 0;
-    __pyx_v_midpoints = ((PyArrayObject *)__pyx_t_12);
-    __pyx_t_12 = 0;
-
-    /* "LFPy/run_simulation.pyx":200
- *     # create a 2D array representation of segment midpoints for dot product
- *     # with transmembrane currents when computing dipole moment
- *     if rec_current_dipole_moment:             # <<<<<<<<<<<<<<
- *         current_dipole_moment = cell.current_dipole_moment.copy()
- *         cell.current_dipole_moment = np.array([[]])
- */
-  }
-
-  /* "LFPy/run_simulation.pyx":206
- * 
- *     #run fadvance until time limit, and calculate LFPs for each timestep
- *     while neuron.h.t < tstop:             # <<<<<<<<<<<<<<
- *         if neuron.h.t >= 0:
- *             i = 0
- */
-  while (1) {
-    __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_neuron); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 206, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_12);
-    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_h); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 206, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_16);
-    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 206, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_12);
-    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-    __pyx_t_16 = PyFloat_FromDouble(__pyx_v_tstop); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 206, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_16);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_12, __pyx_t_16, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 206, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (!__pyx_t_9) break;
-
-    /* "LFPy/run_simulation.pyx":207
- *     #run fadvance until time limit, and calculate LFPs for each timestep
- *     while neuron.h.t < tstop:
- *         if neuron.h.t >= 0:             # <<<<<<<<<<<<<<
- *             i = 0
- *             for sec in cell.allseclist:
- */
-    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_neuron); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_h); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 207, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_16);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-    __pyx_t_16 = PyObject_RichCompare(__pyx_t_6, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_16); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 207, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_16); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 207, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-    if (__pyx_t_9) {
-
-      /* "LFPy/run_simulation.pyx":208
- *     while neuron.h.t < tstop:
- *         if neuron.h.t >= 0:
- *             i = 0             # <<<<<<<<<<<<<<
- *             for sec in cell.allseclist:
- *                 for seg in sec:
- */
-      __pyx_v_i = 0;
-
-      /* "LFPy/run_simulation.pyx":209
- *         if neuron.h.t >= 0:
- *             i = 0
- *             for sec in cell.allseclist:             # <<<<<<<<<<<<<<
- *                 for seg in sec:
- *                     imem[i] = seg.i_membrane_
- */
-      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_allseclist); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 209, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_16);
-      if (likely(PyList_CheckExact(__pyx_t_16)) || PyTuple_CheckExact(__pyx_t_16)) {
-        __pyx_t_6 = __pyx_t_16; __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_16); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 209, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_6);
-        __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 209, __pyx_L1_error)
-      }
-      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-      for (;;) {
-        if (likely(!__pyx_t_11)) {
-          if (likely(PyList_CheckExact(__pyx_t_6))) {
-            if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_6)) break;
-            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-            __pyx_t_16 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_16); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 209, __pyx_L1_error)
-            #else
-            __pyx_t_16 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 209, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_16);
-            #endif
-          } else {
-            if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
-            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-            __pyx_t_16 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_16); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 209, __pyx_L1_error)
-            #else
-            __pyx_t_16 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 209, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_16);
-            #endif
-          }
-        } else {
-          __pyx_t_16 = __pyx_t_11(__pyx_t_6);
-          if (unlikely(!__pyx_t_16)) {
-            PyObject* exc_type = PyErr_Occurred();
-            if (exc_type) {
-              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
-              else __PYX_ERR(0, 209, __pyx_L1_error)
-            }
-            break;
-          }
-          __Pyx_GOTREF(__pyx_t_16);
-        }
-        __Pyx_XDECREF_SET(__pyx_v_sec, __pyx_t_16);
-        __pyx_t_16 = 0;
-
-        /* "LFPy/run_simulation.pyx":210
- *             i = 0
- *             for sec in cell.allseclist:
- *                 for seg in sec:             # <<<<<<<<<<<<<<
- *                     imem[i] = seg.i_membrane_
- *                     i += 1
- */
-        if (likely(PyList_CheckExact(__pyx_v_sec)) || PyTuple_CheckExact(__pyx_v_sec)) {
-          __pyx_t_16 = __pyx_v_sec; __Pyx_INCREF(__pyx_t_16); __pyx_t_20 = 0;
-          __pyx_t_21 = NULL;
-        } else {
-          __pyx_t_20 = -1; __pyx_t_16 = PyObject_GetIter(__pyx_v_sec); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 210, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_16);
-          __pyx_t_21 = Py_TYPE(__pyx_t_16)->tp_iternext; if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 210, __pyx_L1_error)
-        }
-        for (;;) {
-          if (likely(!__pyx_t_21)) {
-            if (likely(PyList_CheckExact(__pyx_t_16))) {
-              if (__pyx_t_20 >= PyList_GET_SIZE(__pyx_t_16)) break;
-              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-              __pyx_t_12 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_20); __Pyx_INCREF(__pyx_t_12); __pyx_t_20++; if (unlikely(0 < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
-              #else
-              __pyx_t_12 = PySequence_ITEM(__pyx_t_16, __pyx_t_20); __pyx_t_20++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 210, __pyx_L1_error)
-              __Pyx_GOTREF(__pyx_t_12);
-              #endif
-            } else {
-              if (__pyx_t_20 >= PyTuple_GET_SIZE(__pyx_t_16)) break;
-              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-              __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_16, __pyx_t_20); __Pyx_INCREF(__pyx_t_12); __pyx_t_20++; if (unlikely(0 < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
-              #else
-              __pyx_t_12 = PySequence_ITEM(__pyx_t_16, __pyx_t_20); __pyx_t_20++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 210, __pyx_L1_error)
-              __Pyx_GOTREF(__pyx_t_12);
-              #endif
-            }
-          } else {
-            __pyx_t_12 = __pyx_t_21(__pyx_t_16);
-            if (unlikely(!__pyx_t_12)) {
-              PyObject* exc_type = PyErr_Occurred();
-              if (exc_type) {
-                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
-                else __PYX_ERR(0, 210, __pyx_L1_error)
-              }
-              break;
-            }
-            __Pyx_GOTREF(__pyx_t_12);
-          }
-          __Pyx_XDECREF_SET(__pyx_v_seg, __pyx_t_12);
-          __pyx_t_12 = 0;
-
-          /* "LFPy/run_simulation.pyx":211
- *             for sec in cell.allseclist:
- *                 for seg in sec:
- *                     imem[i] = seg.i_membrane_             # <<<<<<<<<<<<<<
- *                     i += 1
- * 
- */
-          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_seg, __pyx_n_s_i_membrane); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 211, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_12);
-          if (unlikely(__Pyx_SetItemInt(__pyx_v_imem, __pyx_v_i, __pyx_t_12, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) __PYX_ERR(0, 211, __pyx_L1_error)
-          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-
-          /* "LFPy/run_simulation.pyx":212
- *                 for seg in sec:
- *                     imem[i] = seg.i_membrane_
- *                     i += 1             # <<<<<<<<<<<<<<
- * 
- *             if rec_current_dipole_moment:
- */
-          __pyx_v_i = (__pyx_v_i + 1);
-
-          /* "LFPy/run_simulation.pyx":210
- *             i = 0
- *             for sec in cell.allseclist:
- *                 for seg in sec:             # <<<<<<<<<<<<<<
- *                     imem[i] = seg.i_membrane_
- *                     i += 1
- */
-        }
-        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-
-        /* "LFPy/run_simulation.pyx":209
- *         if neuron.h.t >= 0:
- *             i = 0
- *             for sec in cell.allseclist:             # <<<<<<<<<<<<<<
- *                 for seg in sec:
- *                     imem[i] = seg.i_membrane_
- */
-      }
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-      /* "LFPy/run_simulation.pyx":214
- *                     i += 1
- * 
- *             if rec_current_dipole_moment:             # <<<<<<<<<<<<<<
- *                 current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
- * 
- */
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_rec_current_dipole_moment); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 214, __pyx_L1_error)
-      if (__pyx_t_9) {
-
-        /* "LFPy/run_simulation.pyx":215
- * 
- *             if rec_current_dipole_moment:
- *                 current_dipole_moment[tstep, ] = np.dot(imem, midpoints)             # <<<<<<<<<<<<<<
- * 
- *             if to_memory:
- */
-        __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 215, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_16);
-        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_dot); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 215, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_12);
-        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-        __pyx_t_16 = NULL;
-        __pyx_t_15 = 0;
-        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
-          __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_12);
-          if (likely(__pyx_t_16)) {
-            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
-            __Pyx_INCREF(__pyx_t_16);
-            __Pyx_INCREF(function);
-            __Pyx_DECREF_SET(__pyx_t_12, function);
-            __pyx_t_15 = 1;
-          }
-        }
-        #if CYTHON_FAST_PYCALL
-        if (PyFunction_Check(__pyx_t_12)) {
-          PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_v_imem, ((PyObject *)__pyx_v_midpoints)};
-          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 215, __pyx_L1_error)
-          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
-          __Pyx_GOTREF(__pyx_t_6);
-        } else
-        #endif
-        #if CYTHON_FAST_PYCCALL
-        if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
-          PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_v_imem, ((PyObject *)__pyx_v_midpoints)};
-          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 215, __pyx_L1_error)
-          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
-          __Pyx_GOTREF(__pyx_t_6);
-        } else
-        #endif
-        {
-          __pyx_t_7 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 215, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_7);
-          if (__pyx_t_16) {
-            __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_16); __pyx_t_16 = NULL;
-          }
-          __Pyx_INCREF(__pyx_v_imem);
-          __Pyx_GIVEREF(__pyx_v_imem);
-          PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_15, __pyx_v_imem);
-          __Pyx_INCREF(((PyObject *)__pyx_v_midpoints));
-          __Pyx_GIVEREF(((PyObject *)__pyx_v_midpoints));
-          PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_15, ((PyObject *)__pyx_v_midpoints));
-          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 215, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_6);
-          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        }
-        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-        __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_tstep); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 215, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_12);
-        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 215, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_GIVEREF(__pyx_t_12);
-        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_12);
-        __pyx_t_12 = 0;
-        if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_current_dipole_moment), __pyx_t_7, __pyx_t_6) < 0)) __PYX_ERR(0, 215, __pyx_L1_error)
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-        /* "LFPy/run_simulation.pyx":214
- *                     i += 1
- * 
- *             if rec_current_dipole_moment:             # <<<<<<<<<<<<<<
- *                 current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
- * 
- */
-      }
-
-      /* "LFPy/run_simulation.pyx":217
- *                 current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
- * 
- *             if to_memory:             # <<<<<<<<<<<<<<
- *                 for j, coeffs in enumerate(dotprodcoeffs):
- *                     electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
- */
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_to_memory); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 217, __pyx_L1_error)
-      if (__pyx_t_9) {
-
-        /* "LFPy/run_simulation.pyx":218
- * 
- *             if to_memory:
- *                 for j, coeffs in enumerate(dotprodcoeffs):             # <<<<<<<<<<<<<<
- *                     electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
- * 
- */
-        __pyx_t_15 = 0;
-        if (likely(PyList_CheckExact(__pyx_v_dotprodcoeffs)) || PyTuple_CheckExact(__pyx_v_dotprodcoeffs)) {
-          __pyx_t_6 = __pyx_v_dotprodcoeffs; __Pyx_INCREF(__pyx_t_6); __pyx_t_10 = 0;
-          __pyx_t_11 = NULL;
-        } else {
-          __pyx_t_10 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_dotprodcoeffs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 218, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_6);
-          __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 218, __pyx_L1_error)
-        }
-        for (;;) {
-          if (likely(!__pyx_t_11)) {
-            if (likely(PyList_CheckExact(__pyx_t_6))) {
-              if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_6)) break;
-              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-              __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 218, __pyx_L1_error)
-              #else
-              __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 218, __pyx_L1_error)
-              __Pyx_GOTREF(__pyx_t_7);
-              #endif
-            } else {
-              if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
-              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-              __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 218, __pyx_L1_error)
-              #else
-              __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 218, __pyx_L1_error)
-              __Pyx_GOTREF(__pyx_t_7);
-              #endif
-            }
-          } else {
-            __pyx_t_7 = __pyx_t_11(__pyx_t_6);
-            if (unlikely(!__pyx_t_7)) {
-              PyObject* exc_type = PyErr_Occurred();
-              if (exc_type) {
-                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
-                else __PYX_ERR(0, 218, __pyx_L1_error)
-              }
-              break;
-            }
-            __Pyx_GOTREF(__pyx_t_7);
-          }
-          if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 218, __pyx_L1_error)
-          __pyx_t_14 = ((PyArrayObject *)__pyx_t_7);
-          {
-            __Pyx_BufFmt_StackElem __pyx_stack[1];
-            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer);
-            __pyx_t_22 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
-            if (unlikely(__pyx_t_22 < 0)) {
-              PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
-              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer, (PyObject*)__pyx_v_coeffs, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
-                Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3);
-                __Pyx_RaiseBufferFallbackError();
-              } else {
-                PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3);
-              }
-              __pyx_t_5 = __pyx_t_4 = __pyx_t_3 = 0;
-            }
-            __pyx_pybuffernd_coeffs.diminfo[0].strides = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coeffs.diminfo[0].shape = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coeffs.diminfo[1].strides = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coeffs.diminfo[1].shape = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.shape[1];
-            if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 218, __pyx_L1_error)
-          }
-          __pyx_t_14 = 0;
-          __Pyx_XDECREF_SET(__pyx_v_coeffs, ((PyArrayObject *)__pyx_t_7));
-          __pyx_t_7 = 0;
-          __pyx_v_j = __pyx_t_15;
-          __pyx_t_15 = (__pyx_t_15 + 1);
-
-          /* "LFPy/run_simulation.pyx":219
- *             if to_memory:
- *                 for j, coeffs in enumerate(dotprodcoeffs):
- *                     electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)             # <<<<<<<<<<<<<<
- * 
- *             if to_file:
- */
-          __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 219, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_12);
-          __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_dot); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 219, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_16);
-          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-          __pyx_t_12 = NULL;
-          __pyx_t_22 = 0;
-          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
-            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_16);
-            if (likely(__pyx_t_12)) {
-              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
-              __Pyx_INCREF(__pyx_t_12);
-              __Pyx_INCREF(function);
-              __Pyx_DECREF_SET(__pyx_t_16, function);
-              __pyx_t_22 = 1;
-            }
-          }
-          #if CYTHON_FAST_PYCALL
-          if (PyFunction_Check(__pyx_t_16)) {
-            PyObject *__pyx_temp[3] = {__pyx_t_12, ((PyObject *)__pyx_v_coeffs), __pyx_v_imem};
-            __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 219, __pyx_L1_error)
-            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
-            __Pyx_GOTREF(__pyx_t_7);
-          } else
-          #endif
-          #if CYTHON_FAST_PYCCALL
-          if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
-            PyObject *__pyx_temp[3] = {__pyx_t_12, ((PyObject *)__pyx_v_coeffs), __pyx_v_imem};
-            __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 219, __pyx_L1_error)
-            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
-            __Pyx_GOTREF(__pyx_t_7);
-          } else
-          #endif
-          {
-            __pyx_t_1 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_1);
-            if (__pyx_t_12) {
-              __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_12); __pyx_t_12 = NULL;
-            }
-            __Pyx_INCREF(((PyObject *)__pyx_v_coeffs));
-            __Pyx_GIVEREF(((PyObject *)__pyx_v_coeffs));
-            PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_22, ((PyObject *)__pyx_v_coeffs));
-            __Pyx_INCREF(__pyx_v_imem);
-            __Pyx_GIVEREF(__pyx_v_imem);
-            PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_22, __pyx_v_imem);
-            __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 219, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_7);
-            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          }
-          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-          if (unlikely(!__pyx_v_electrodesLFP)) { __Pyx_RaiseUnboundLocalError("electrodesLFP"); __PYX_ERR(0, 219, __pyx_L1_error) }
-          __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_electrodesLFP, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 219, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_16);
-          __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_tstep); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_1);
-          __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 219, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_12);
-          __Pyx_INCREF(__pyx_slice__2);
-          __Pyx_GIVEREF(__pyx_slice__2);
-          PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_slice__2);
-          __Pyx_GIVEREF(__pyx_t_1);
-          PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_1);
-          __pyx_t_1 = 0;
-          if (unlikely(PyObject_SetItem(__pyx_t_16, __pyx_t_12, __pyx_t_7) < 0)) __PYX_ERR(0, 219, __pyx_L1_error)
-          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-
-          /* "LFPy/run_simulation.pyx":218
- * 
- *             if to_memory:
- *                 for j, coeffs in enumerate(dotprodcoeffs):             # <<<<<<<<<<<<<<
- *                     electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
- * 
- */
-        }
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-        /* "LFPy/run_simulation.pyx":217
- *                 current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
- * 
- *             if to_memory:             # <<<<<<<<<<<<<<
- *                 for j, coeffs in enumerate(dotprodcoeffs):
- *                     electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
- */
-      }
-
-      /* "LFPy/run_simulation.pyx":221
- *                     electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
- * 
- *             if to_file:             # <<<<<<<<<<<<<<
- *                 for j, coeffs in enumerate(dotprodcoeffs):
- *                     el_LFP_file['electrode{:03d}'.format(j)
- */
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_to_file); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 221, __pyx_L1_error)
-      if (__pyx_t_9) {
-
-        /* "LFPy/run_simulation.pyx":222
- * 
- *             if to_file:
- *                 for j, coeffs in enumerate(dotprodcoeffs):             # <<<<<<<<<<<<<<
- *                     el_LFP_file['electrode{:03d}'.format(j)
- *                                 ][:, tstep] = np.dot(coeffs, imem)
- */
-        __pyx_t_15 = 0;
-        if (likely(PyList_CheckExact(__pyx_v_dotprodcoeffs)) || PyTuple_CheckExact(__pyx_v_dotprodcoeffs)) {
-          __pyx_t_6 = __pyx_v_dotprodcoeffs; __Pyx_INCREF(__pyx_t_6); __pyx_t_10 = 0;
-          __pyx_t_11 = NULL;
-        } else {
-          __pyx_t_10 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_dotprodcoeffs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 222, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_6);
-          __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 222, __pyx_L1_error)
-        }
-        for (;;) {
-          if (likely(!__pyx_t_11)) {
-            if (likely(PyList_CheckExact(__pyx_t_6))) {
-              if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_6)) break;
-              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-              __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 222, __pyx_L1_error)
-              #else
-              __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 222, __pyx_L1_error)
-              __Pyx_GOTREF(__pyx_t_7);
-              #endif
-            } else {
-              if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
-              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-              __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 222, __pyx_L1_error)
-              #else
-              __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 222, __pyx_L1_error)
-              __Pyx_GOTREF(__pyx_t_7);
-              #endif
-            }
-          } else {
-            __pyx_t_7 = __pyx_t_11(__pyx_t_6);
-            if (unlikely(!__pyx_t_7)) {
-              PyObject* exc_type = PyErr_Occurred();
-              if (exc_type) {
-                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
-                else __PYX_ERR(0, 222, __pyx_L1_error)
-              }
-              break;
-            }
-            __Pyx_GOTREF(__pyx_t_7);
-          }
-          if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 222, __pyx_L1_error)
-          __pyx_t_14 = ((PyArrayObject *)__pyx_t_7);
-          {
-            __Pyx_BufFmt_StackElem __pyx_stack[1];
-            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer);
-            __pyx_t_22 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
-            if (unlikely(__pyx_t_22 < 0)) {
-              PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
-              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer, (PyObject*)__pyx_v_coeffs, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
-                Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5);
-                __Pyx_RaiseBufferFallbackError();
-              } else {
-                PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5);
-              }
-              __pyx_t_3 = __pyx_t_4 = __pyx_t_5 = 0;
-            }
-            __pyx_pybuffernd_coeffs.diminfo[0].strides = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coeffs.diminfo[0].shape = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coeffs.diminfo[1].strides = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coeffs.diminfo[1].shape = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.shape[1];
-            if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 222, __pyx_L1_error)
-          }
-          __pyx_t_14 = 0;
-          __Pyx_XDECREF_SET(__pyx_v_coeffs, ((PyArrayObject *)__pyx_t_7));
-          __pyx_t_7 = 0;
-          __pyx_v_j = __pyx_t_15;
-          __pyx_t_15 = (__pyx_t_15 + 1);
-
-          /* "LFPy/run_simulation.pyx":224
- *                 for j, coeffs in enumerate(dotprodcoeffs):
- *                     el_LFP_file['electrode{:03d}'.format(j)
- *                                 ][:, tstep] = np.dot(coeffs, imem)             # <<<<<<<<<<<<<<
- * 
- *             tstep += 1
- */
-          __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 224, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_12);
-          __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_dot); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 224, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_16);
-          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-          __pyx_t_12 = NULL;
-          __pyx_t_22 = 0;
-          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
-            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_16);
-            if (likely(__pyx_t_12)) {
-              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
-              __Pyx_INCREF(__pyx_t_12);
-              __Pyx_INCREF(function);
-              __Pyx_DECREF_SET(__pyx_t_16, function);
-              __pyx_t_22 = 1;
-            }
-          }
-          #if CYTHON_FAST_PYCALL
-          if (PyFunction_Check(__pyx_t_16)) {
-            PyObject *__pyx_temp[3] = {__pyx_t_12, ((PyObject *)__pyx_v_coeffs), __pyx_v_imem};
-            __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 224, __pyx_L1_error)
-            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
-            __Pyx_GOTREF(__pyx_t_7);
-          } else
-          #endif
-          #if CYTHON_FAST_PYCCALL
-          if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
-            PyObject *__pyx_temp[3] = {__pyx_t_12, ((PyObject *)__pyx_v_coeffs), __pyx_v_imem};
-            __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 224, __pyx_L1_error)
-            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
-            __Pyx_GOTREF(__pyx_t_7);
-          } else
-          #endif
-          {
-            __pyx_t_1 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_1);
-            if (__pyx_t_12) {
-              __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_12); __pyx_t_12 = NULL;
-            }
-            __Pyx_INCREF(((PyObject *)__pyx_v_coeffs));
-            __Pyx_GIVEREF(((PyObject *)__pyx_v_coeffs));
-            PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_22, ((PyObject *)__pyx_v_coeffs));
-            __Pyx_INCREF(__pyx_v_imem);
-            __Pyx_GIVEREF(__pyx_v_imem);
-            PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_22, __pyx_v_imem);
-            __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 224, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_7);
-            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          }
-          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-
-          /* "LFPy/run_simulation.pyx":223
- *             if to_file:
- *                 for j, coeffs in enumerate(dotprodcoeffs):
- *                     el_LFP_file['electrode{:03d}'.format(j)             # <<<<<<<<<<<<<<
- *                                 ][:, tstep] = np.dot(coeffs, imem)
- * 
- */
-          if (unlikely(!__pyx_v_el_LFP_file)) { __Pyx_RaiseUnboundLocalError("el_LFP_file"); __PYX_ERR(0, 223, __pyx_L1_error) }
-          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_electrode_03d, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_1);
-          __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 223, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_12);
-          __pyx_t_17 = NULL;
-          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-            __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_1);
-            if (likely(__pyx_t_17)) {
-              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-              __Pyx_INCREF(__pyx_t_17);
-              __Pyx_INCREF(function);
-              __Pyx_DECREF_SET(__pyx_t_1, function);
-            }
-          }
-          __pyx_t_16 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_17, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_12);
-          __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
-          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-          if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 223, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_16);
-          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_el_LFP_file, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_1);
-          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-
-          /* "LFPy/run_simulation.pyx":224
- *                 for j, coeffs in enumerate(dotprodcoeffs):
- *                     el_LFP_file['electrode{:03d}'.format(j)
- *                                 ][:, tstep] = np.dot(coeffs, imem)             # <<<<<<<<<<<<<<
- * 
- *             tstep += 1
- */
-          __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_tstep); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 224, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_16);
-          __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 224, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_12);
-          __Pyx_INCREF(__pyx_slice__2);
-          __Pyx_GIVEREF(__pyx_slice__2);
-          PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_slice__2);
-          __Pyx_GIVEREF(__pyx_t_16);
-          PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_16);
-          __pyx_t_16 = 0;
-          if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_t_12, __pyx_t_7) < 0)) __PYX_ERR(0, 224, __pyx_L1_error)
-          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-
-          /* "LFPy/run_simulation.pyx":222
- * 
- *             if to_file:
- *                 for j, coeffs in enumerate(dotprodcoeffs):             # <<<<<<<<<<<<<<
- *                     el_LFP_file['electrode{:03d}'.format(j)
- *                                 ][:, tstep] = np.dot(coeffs, imem)
- */
-        }
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-        /* "LFPy/run_simulation.pyx":221
- *                     electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
- * 
- *             if to_file:             # <<<<<<<<<<<<<<
- *                 for j, coeffs in enumerate(dotprodcoeffs):
- *                     el_LFP_file['electrode{:03d}'.format(j)
- */
-      }
-
-      /* "LFPy/run_simulation.pyx":226
- *                                 ][:, tstep] = np.dot(coeffs, imem)
- * 
- *             tstep += 1             # <<<<<<<<<<<<<<
- *         neuron.h.fadvance()
- *         counter += 1
- */
-      __pyx_v_tstep = (__pyx_v_tstep + 1);
-
-      /* "LFPy/run_simulation.pyx":207
- *     #run fadvance until time limit, and calculate LFPs for each timestep
- *     while neuron.h.t < tstop:
- *         if neuron.h.t >= 0:             # <<<<<<<<<<<<<<
- *             i = 0
- *             for sec in cell.allseclist:
- */
-    }
-
-    /* "LFPy/run_simulation.pyx":227
- * 
- *             tstep += 1
- *         neuron.h.fadvance()             # <<<<<<<<<<<<<<
- *         counter += 1
- *         if counter % interval == 0:
- */
-    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_neuron); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 227, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_h); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 227, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_12);
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_fadvance); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 227, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    __pyx_t_12 = NULL;
-    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
-      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7);
-      if (likely(__pyx_t_12)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
-        __Pyx_INCREF(__pyx_t_12);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_7, function);
-      }
-    }
-    __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
-    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
-    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 227, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-    /* "LFPy/run_simulation.pyx":228
- *             tstep += 1
- *         neuron.h.fadvance()
- *         counter += 1             # <<<<<<<<<<<<<<
- *         if counter % interval == 0:
- *             rtfactor = (neuron.h.t - ti) * 1E-3 / (time() - t0)
- */
-    __pyx_v_counter = (__pyx_v_counter + 1);
-
-    /* "LFPy/run_simulation.pyx":229
- *         neuron.h.fadvance()
- *         counter += 1
- *         if counter % interval == 0:             # <<<<<<<<<<<<<<
- *             rtfactor = (neuron.h.t - ti) * 1E-3 / (time() - t0)
- *             if cell.verbose:
- */
-    if (unlikely(__pyx_v_interval == 0)) {
-      PyErr_SetString(PyExc_ZeroDivisionError, "float divmod()");
-      __PYX_ERR(0, 229, __pyx_L1_error)
-    }
-    __pyx_t_9 = ((__Pyx_mod_double(__pyx_v_counter, __pyx_v_interval) == 0.0) != 0);
-    if (__pyx_t_9) {
-
-      /* "LFPy/run_simulation.pyx":230
- *         counter += 1
- *         if counter % interval == 0:
- *             rtfactor = (neuron.h.t - ti) * 1E-3 / (time() - t0)             # <<<<<<<<<<<<<<
- *             if cell.verbose:
- *                 print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_neuron); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 230, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_h); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 230, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 230, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_7 = PyFloat_FromDouble(__pyx_v_ti); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 230, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_12 = PyNumber_Subtract(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 230, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_12);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_7 = PyNumber_Multiply(__pyx_t_12, __pyx_float_1Eneg_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 230, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_7);
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 230, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_1 = NULL;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
-        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
-        if (likely(__pyx_t_1)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
-          __Pyx_INCREF(__pyx_t_1);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_6, function);
-        }
-      }
-      __pyx_t_12 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
-      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 230, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_12);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_t0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 230, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_1 = PyNumber_Subtract(__pyx_t_12, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 230, __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_2 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_v_rtfactor = __pyx_t_2;
-
-      /* "LFPy/run_simulation.pyx":231
- *         if counter % interval == 0:
- *             rtfactor = (neuron.h.t - ti) * 1E-3 / (time() - t0)
- *             if cell.verbose:             # <<<<<<<<<<<<<<
- *                 print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
- *                                                                    rtfactor))
- */
-      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_verbose); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 231, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 231, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      if (__pyx_t_9) {
-
-        /* "LFPy/run_simulation.pyx":232
- *             rtfactor = (neuron.h.t - ti) * 1E-3 / (time() - t0)
- *             if cell.verbose:
- *                 print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,             # <<<<<<<<<<<<<<
- *                                                                    rtfactor))
- *             t0 = time()
- */
-        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_t_0f_realtime_factor_3f, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_neuron); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 232, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_h); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 232, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_12);
-        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_t); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 232, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_7);
-        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-
-        /* "LFPy/run_simulation.pyx":233
- *             if cell.verbose:
- *                 print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
- *                                                                    rtfactor))             # <<<<<<<<<<<<<<
- *             t0 = time()
- *             ti = neuron.h.t
- */
-        __pyx_t_12 = PyFloat_FromDouble(__pyx_v_rtfactor); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 233, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_12);
-        __pyx_t_16 = NULL;
-        __pyx_t_15 = 0;
-        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-          __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_1);
-          if (likely(__pyx_t_16)) {
-            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-            __Pyx_INCREF(__pyx_t_16);
-            __Pyx_INCREF(function);
-            __Pyx_DECREF_SET(__pyx_t_1, function);
-            __pyx_t_15 = 1;
-          }
-        }
-        #if CYTHON_FAST_PYCALL
-        if (PyFunction_Check(__pyx_t_1)) {
-          PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_7, __pyx_t_12};
-          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 232, __pyx_L1_error)
-          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
-          __Pyx_GOTREF(__pyx_t_6);
-          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-        } else
-        #endif
-        #if CYTHON_FAST_PYCCALL
-        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
-          PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_7, __pyx_t_12};
-          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 232, __pyx_L1_error)
-          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
-          __Pyx_GOTREF(__pyx_t_6);
-          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-        } else
-        #endif
-        {
-          __pyx_t_17 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 232, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_17);
-          if (__pyx_t_16) {
-            __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_16); __pyx_t_16 = NULL;
-          }
-          __Pyx_GIVEREF(__pyx_t_7);
-          PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_15, __pyx_t_7);
-          __Pyx_GIVEREF(__pyx_t_12);
-          PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_15, __pyx_t_12);
-          __pyx_t_7 = 0;
-          __pyx_t_12 = 0;
-          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_17, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 232, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_6);
-          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
-        }
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        if (__Pyx_PrintOne(0, __pyx_t_6) < 0) __PYX_ERR(0, 232, __pyx_L1_error)
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-        /* "LFPy/run_simulation.pyx":231
- *         if counter % interval == 0:
- *             rtfactor = (neuron.h.t - ti) * 1E-3 / (time() - t0)
- *             if cell.verbose:             # <<<<<<<<<<<<<<
- *                 print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
- *                                                                    rtfactor))
- */
-      }
-
-      /* "LFPy/run_simulation.pyx":234
- *                 print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
- *                                                                    rtfactor))
- *             t0 = time()             # <<<<<<<<<<<<<<
- *             ti = neuron.h.t
- * 
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_17 = NULL;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
-        __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_1);
-        if (likely(__pyx_t_17)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-          __Pyx_INCREF(__pyx_t_17);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_1, function);
-        }
-      }
-      __pyx_t_6 = (__pyx_t_17) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_17) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
-      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
-      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_v_t0 = __pyx_t_2;
-
-      /* "LFPy/run_simulation.pyx":235
- *                                                                    rtfactor))
- *             t0 = time()
- *             ti = neuron.h.t             # <<<<<<<<<<<<<<
- * 
- *     try:
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_neuron); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 235, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 235, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_v_ti = __pyx_t_2;
-
-      /* "LFPy/run_simulation.pyx":229
- *         neuron.h.fadvance()
- *         counter += 1
- *         if counter % interval == 0:             # <<<<<<<<<<<<<<
- *             rtfactor = (neuron.h.t - ti) * 1E-3 / (time() - t0)
- *             if cell.verbose:
- */
-    }
-  }
-
-  /* "LFPy/run_simulation.pyx":237
- *             ti = neuron.h.t
- * 
- *     try:             # <<<<<<<<<<<<<<
- *         #calculate LFP after final fadvance()
- *         i = 0
- */
-  {
-    __Pyx_PyThreadState_declare
-    __Pyx_PyThreadState_assign
-    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
-    __Pyx_XGOTREF(__pyx_t_5);
-    __Pyx_XGOTREF(__pyx_t_4);
-    __Pyx_XGOTREF(__pyx_t_3);
-    /*try:*/ {
-
-      /* "LFPy/run_simulation.pyx":239
- *     try:
- *         #calculate LFP after final fadvance()
- *         i = 0             # <<<<<<<<<<<<<<
- *         for sec in cell.allseclist:
- *             for seg in sec:
- */
-      __pyx_v_i = 0;
-
-      /* "LFPy/run_simulation.pyx":240
- *         #calculate LFP after final fadvance()
- *         i = 0
- *         for sec in cell.allseclist:             # <<<<<<<<<<<<<<
- *             for seg in sec:
- *                 imem[i] = seg.i_membrane_
- */
-      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_allseclist); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 240, __pyx_L44_error)
-      __Pyx_GOTREF(__pyx_t_6);
-      if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
-        __pyx_t_1 = __pyx_t_6; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0;
-        __pyx_t_11 = NULL;
-      } else {
-        __pyx_t_10 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L44_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 240, __pyx_L44_error)
-      }
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      for (;;) {
-        if (likely(!__pyx_t_11)) {
-          if (likely(PyList_CheckExact(__pyx_t_1))) {
-            if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_1)) break;
-            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-            __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 240, __pyx_L44_error)
-            #else
-            __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 240, __pyx_L44_error)
-            __Pyx_GOTREF(__pyx_t_6);
-            #endif
-          } else {
-            if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-            __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_6); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 240, __pyx_L44_error)
-            #else
-            __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 240, __pyx_L44_error)
-            __Pyx_GOTREF(__pyx_t_6);
-            #endif
-          }
-        } else {
-          __pyx_t_6 = __pyx_t_11(__pyx_t_1);
-          if (unlikely(!__pyx_t_6)) {
-            PyObject* exc_type = PyErr_Occurred();
-            if (exc_type) {
-              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
-              else __PYX_ERR(0, 240, __pyx_L44_error)
-            }
-            break;
-          }
-          __Pyx_GOTREF(__pyx_t_6);
-        }
-        __Pyx_XDECREF_SET(__pyx_v_sec, __pyx_t_6);
-        __pyx_t_6 = 0;
-
-        /* "LFPy/run_simulation.pyx":241
- *         i = 0
- *         for sec in cell.allseclist:
- *             for seg in sec:             # <<<<<<<<<<<<<<
- *                 imem[i] = seg.i_membrane_
- *                 i += 1
- */
-        if (likely(PyList_CheckExact(__pyx_v_sec)) || PyTuple_CheckExact(__pyx_v_sec)) {
-          __pyx_t_6 = __pyx_v_sec; __Pyx_INCREF(__pyx_t_6); __pyx_t_20 = 0;
-          __pyx_t_21 = NULL;
-        } else {
-          __pyx_t_20 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_sec); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 241, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_6);
-          __pyx_t_21 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 241, __pyx_L44_error)
-        }
-        for (;;) {
-          if (likely(!__pyx_t_21)) {
-            if (likely(PyList_CheckExact(__pyx_t_6))) {
-              if (__pyx_t_20 >= PyList_GET_SIZE(__pyx_t_6)) break;
-              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-              __pyx_t_17 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_20); __Pyx_INCREF(__pyx_t_17); __pyx_t_20++; if (unlikely(0 < 0)) __PYX_ERR(0, 241, __pyx_L44_error)
-              #else
-              __pyx_t_17 = PySequence_ITEM(__pyx_t_6, __pyx_t_20); __pyx_t_20++; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 241, __pyx_L44_error)
-              __Pyx_GOTREF(__pyx_t_17);
-              #endif
-            } else {
-              if (__pyx_t_20 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
-              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-              __pyx_t_17 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_20); __Pyx_INCREF(__pyx_t_17); __pyx_t_20++; if (unlikely(0 < 0)) __PYX_ERR(0, 241, __pyx_L44_error)
-              #else
-              __pyx_t_17 = PySequence_ITEM(__pyx_t_6, __pyx_t_20); __pyx_t_20++; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 241, __pyx_L44_error)
-              __Pyx_GOTREF(__pyx_t_17);
-              #endif
-            }
-          } else {
-            __pyx_t_17 = __pyx_t_21(__pyx_t_6);
-            if (unlikely(!__pyx_t_17)) {
-              PyObject* exc_type = PyErr_Occurred();
-              if (exc_type) {
-                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
-                else __PYX_ERR(0, 241, __pyx_L44_error)
-              }
-              break;
-            }
-            __Pyx_GOTREF(__pyx_t_17);
-          }
-          __Pyx_XDECREF_SET(__pyx_v_seg, __pyx_t_17);
-          __pyx_t_17 = 0;
-
-          /* "LFPy/run_simulation.pyx":242
- *         for sec in cell.allseclist:
- *             for seg in sec:
- *                 imem[i] = seg.i_membrane_             # <<<<<<<<<<<<<<
- *                 i += 1
- * 
- */
-          __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_seg, __pyx_n_s_i_membrane); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 242, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_17);
-          if (unlikely(__Pyx_SetItemInt(__pyx_v_imem, __pyx_v_i, __pyx_t_17, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) __PYX_ERR(0, 242, __pyx_L44_error)
-          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
-
-          /* "LFPy/run_simulation.pyx":243
- *             for seg in sec:
- *                 imem[i] = seg.i_membrane_
- *                 i += 1             # <<<<<<<<<<<<<<
- * 
- *         if rec_current_dipole_moment:
- */
-          __pyx_v_i = (__pyx_v_i + 1);
-
-          /* "LFPy/run_simulation.pyx":241
- *         i = 0
- *         for sec in cell.allseclist:
- *             for seg in sec:             # <<<<<<<<<<<<<<
- *                 imem[i] = seg.i_membrane_
- *                 i += 1
- */
-        }
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-        /* "LFPy/run_simulation.pyx":240
- *         #calculate LFP after final fadvance()
- *         i = 0
- *         for sec in cell.allseclist:             # <<<<<<<<<<<<<<
- *             for seg in sec:
- *                 imem[i] = seg.i_membrane_
- */
-      }
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":245
- *                 i += 1
- * 
- *         if rec_current_dipole_moment:             # <<<<<<<<<<<<<<
- *             current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
- * 
- */
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_rec_current_dipole_moment); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 245, __pyx_L44_error)
-      if (__pyx_t_9) {
-
-        /* "LFPy/run_simulation.pyx":246
- * 
- *         if rec_current_dipole_moment:
- *             current_dipole_moment[tstep, ] = np.dot(imem, midpoints)             # <<<<<<<<<<<<<<
- * 
- *         if to_memory:
- */
-        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 246, __pyx_L44_error)
-        __Pyx_GOTREF(__pyx_t_6);
-        __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_dot); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 246, __pyx_L44_error)
-        __Pyx_GOTREF(__pyx_t_17);
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-        __pyx_t_6 = NULL;
-        __pyx_t_15 = 0;
-        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
-          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_17);
-          if (likely(__pyx_t_6)) {
-            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
-            __Pyx_INCREF(__pyx_t_6);
-            __Pyx_INCREF(function);
-            __Pyx_DECREF_SET(__pyx_t_17, function);
-            __pyx_t_15 = 1;
-          }
-        }
-        #if CYTHON_FAST_PYCALL
-        if (PyFunction_Check(__pyx_t_17)) {
-          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_imem, ((PyObject *)__pyx_v_midpoints)};
-          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L44_error)
-          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
-          __Pyx_GOTREF(__pyx_t_1);
-        } else
-        #endif
-        #if CYTHON_FAST_PYCCALL
-        if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
-          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_imem, ((PyObject *)__pyx_v_midpoints)};
-          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L44_error)
-          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
-          __Pyx_GOTREF(__pyx_t_1);
-        } else
-        #endif
-        {
-          __pyx_t_12 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 246, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_12);
-          if (__pyx_t_6) {
-            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_6); __pyx_t_6 = NULL;
-          }
-          __Pyx_INCREF(__pyx_v_imem);
-          __Pyx_GIVEREF(__pyx_v_imem);
-          PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_15, __pyx_v_imem);
-          __Pyx_INCREF(((PyObject *)__pyx_v_midpoints));
-          __Pyx_GIVEREF(((PyObject *)__pyx_v_midpoints));
-          PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_15, ((PyObject *)__pyx_v_midpoints));
-          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_1);
-          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-        }
-        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
-        __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_tstep); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 246, __pyx_L44_error)
-        __Pyx_GOTREF(__pyx_t_17);
-        __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 246, __pyx_L44_error)
-        __Pyx_GOTREF(__pyx_t_12);
-        __Pyx_GIVEREF(__pyx_t_17);
-        PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_17);
-        __pyx_t_17 = 0;
-        if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_current_dipole_moment), __pyx_t_12, __pyx_t_1) < 0)) __PYX_ERR(0, 246, __pyx_L44_error)
-        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-        /* "LFPy/run_simulation.pyx":245
- *                 i += 1
- * 
- *         if rec_current_dipole_moment:             # <<<<<<<<<<<<<<
- *             current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
- * 
- */
-      }
-
-      /* "LFPy/run_simulation.pyx":248
- *             current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
- * 
- *         if to_memory:             # <<<<<<<<<<<<<<
- *             for j, coeffs in enumerate(dotprodcoeffs):
- *                 electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
- */
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_to_memory); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 248, __pyx_L44_error)
-      if (__pyx_t_9) {
-
-        /* "LFPy/run_simulation.pyx":249
- * 
- *         if to_memory:
- *             for j, coeffs in enumerate(dotprodcoeffs):             # <<<<<<<<<<<<<<
- *                 electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
- *         if to_file:
- */
-        __pyx_t_15 = 0;
-        if (likely(PyList_CheckExact(__pyx_v_dotprodcoeffs)) || PyTuple_CheckExact(__pyx_v_dotprodcoeffs)) {
-          __pyx_t_1 = __pyx_v_dotprodcoeffs; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0;
-          __pyx_t_11 = NULL;
-        } else {
-          __pyx_t_10 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_dotprodcoeffs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_1);
-          __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 249, __pyx_L44_error)
-        }
-        for (;;) {
-          if (likely(!__pyx_t_11)) {
-            if (likely(PyList_CheckExact(__pyx_t_1))) {
-              if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_1)) break;
-              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-              __pyx_t_12 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_12); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 249, __pyx_L44_error)
-              #else
-              __pyx_t_12 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 249, __pyx_L44_error)
-              __Pyx_GOTREF(__pyx_t_12);
-              #endif
-            } else {
-              if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-              __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_12); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 249, __pyx_L44_error)
-              #else
-              __pyx_t_12 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 249, __pyx_L44_error)
-              __Pyx_GOTREF(__pyx_t_12);
-              #endif
-            }
-          } else {
-            __pyx_t_12 = __pyx_t_11(__pyx_t_1);
-            if (unlikely(!__pyx_t_12)) {
-              PyObject* exc_type = PyErr_Occurred();
-              if (exc_type) {
-                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
-                else __PYX_ERR(0, 249, __pyx_L44_error)
-              }
-              break;
-            }
-            __Pyx_GOTREF(__pyx_t_12);
-          }
-          if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 249, __pyx_L44_error)
-          __pyx_t_14 = ((PyArrayObject *)__pyx_t_12);
-          {
-            __Pyx_BufFmt_StackElem __pyx_stack[1];
-            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer);
-            __pyx_t_22 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
-            if (unlikely(__pyx_t_22 < 0)) {
-              PyErr_Fetch(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25);
-              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer, (PyObject*)__pyx_v_coeffs, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
-                Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_24); Py_XDECREF(__pyx_t_25);
-                __Pyx_RaiseBufferFallbackError();
-              } else {
-                PyErr_Restore(__pyx_t_23, __pyx_t_24, __pyx_t_25);
-              }
-              __pyx_t_23 = __pyx_t_24 = __pyx_t_25 = 0;
-            }
-            __pyx_pybuffernd_coeffs.diminfo[0].strides = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coeffs.diminfo[0].shape = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coeffs.diminfo[1].strides = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coeffs.diminfo[1].shape = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.shape[1];
-            if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 249, __pyx_L44_error)
-          }
-          __pyx_t_14 = 0;
-          __Pyx_XDECREF_SET(__pyx_v_coeffs, ((PyArrayObject *)__pyx_t_12));
-          __pyx_t_12 = 0;
-          __pyx_v_j = __pyx_t_15;
-          __pyx_t_15 = (__pyx_t_15 + 1);
-
-          /* "LFPy/run_simulation.pyx":250
- *         if to_memory:
- *             for j, coeffs in enumerate(dotprodcoeffs):
- *                 electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)             # <<<<<<<<<<<<<<
- *         if to_file:
- *             for j, coeffs in enumerate(dotprodcoeffs):
- */
-          __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 250, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_17);
-          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_dot); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 250, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_6);
-          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
-          __pyx_t_17 = NULL;
-          __pyx_t_22 = 0;
-          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
-            __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_6);
-            if (likely(__pyx_t_17)) {
-              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
-              __Pyx_INCREF(__pyx_t_17);
-              __Pyx_INCREF(function);
-              __Pyx_DECREF_SET(__pyx_t_6, function);
-              __pyx_t_22 = 1;
-            }
-          }
-          #if CYTHON_FAST_PYCALL
-          if (PyFunction_Check(__pyx_t_6)) {
-            PyObject *__pyx_temp[3] = {__pyx_t_17, ((PyObject *)__pyx_v_coeffs), __pyx_v_imem};
-            __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 250, __pyx_L44_error)
-            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
-            __Pyx_GOTREF(__pyx_t_12);
-          } else
-          #endif
-          #if CYTHON_FAST_PYCCALL
-          if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
-            PyObject *__pyx_temp[3] = {__pyx_t_17, ((PyObject *)__pyx_v_coeffs), __pyx_v_imem};
-            __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 250, __pyx_L44_error)
-            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
-            __Pyx_GOTREF(__pyx_t_12);
-          } else
-          #endif
-          {
-            __pyx_t_7 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 250, __pyx_L44_error)
-            __Pyx_GOTREF(__pyx_t_7);
-            if (__pyx_t_17) {
-              __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_17); __pyx_t_17 = NULL;
-            }
-            __Pyx_INCREF(((PyObject *)__pyx_v_coeffs));
-            __Pyx_GIVEREF(((PyObject *)__pyx_v_coeffs));
-            PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_22, ((PyObject *)__pyx_v_coeffs));
-            __Pyx_INCREF(__pyx_v_imem);
-            __Pyx_GIVEREF(__pyx_v_imem);
-            PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_22, __pyx_v_imem);
-            __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 250, __pyx_L44_error)
-            __Pyx_GOTREF(__pyx_t_12);
-            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-          }
-          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-          if (unlikely(!__pyx_v_electrodesLFP)) { __Pyx_RaiseUnboundLocalError("electrodesLFP"); __PYX_ERR(0, 250, __pyx_L44_error) }
-          __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_electrodesLFP, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 250, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_6);
-          __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_tstep); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 250, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_7);
-          __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 250, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_17);
-          __Pyx_INCREF(__pyx_slice__2);
-          __Pyx_GIVEREF(__pyx_slice__2);
-          PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_slice__2);
-          __Pyx_GIVEREF(__pyx_t_7);
-          PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_7);
-          __pyx_t_7 = 0;
-          if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_t_17, __pyx_t_12) < 0)) __PYX_ERR(0, 250, __pyx_L44_error)
-          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
-          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-
-          /* "LFPy/run_simulation.pyx":249
- * 
- *         if to_memory:
- *             for j, coeffs in enumerate(dotprodcoeffs):             # <<<<<<<<<<<<<<
- *                 electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
- *         if to_file:
- */
-        }
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-        /* "LFPy/run_simulation.pyx":248
- *             current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
- * 
- *         if to_memory:             # <<<<<<<<<<<<<<
- *             for j, coeffs in enumerate(dotprodcoeffs):
- *                 electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
- */
-      }
-
-      /* "LFPy/run_simulation.pyx":251
- *             for j, coeffs in enumerate(dotprodcoeffs):
- *                 electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
- *         if to_file:             # <<<<<<<<<<<<<<
- *             for j, coeffs in enumerate(dotprodcoeffs):
- *                 el_LFP_file['electrode{:03d}'.format(j)
- */
-      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_to_file); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 251, __pyx_L44_error)
-      if (__pyx_t_9) {
-
-        /* "LFPy/run_simulation.pyx":252
- *                 electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
- *         if to_file:
- *             for j, coeffs in enumerate(dotprodcoeffs):             # <<<<<<<<<<<<<<
- *                 el_LFP_file['electrode{:03d}'.format(j)
- *                             ][:, tstep] = np.dot(coeffs, imem)
- */
-        __pyx_t_15 = 0;
-        if (likely(PyList_CheckExact(__pyx_v_dotprodcoeffs)) || PyTuple_CheckExact(__pyx_v_dotprodcoeffs)) {
-          __pyx_t_1 = __pyx_v_dotprodcoeffs; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0;
-          __pyx_t_11 = NULL;
-        } else {
-          __pyx_t_10 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_dotprodcoeffs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_1);
-          __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 252, __pyx_L44_error)
-        }
-        for (;;) {
-          if (likely(!__pyx_t_11)) {
-            if (likely(PyList_CheckExact(__pyx_t_1))) {
-              if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_1)) break;
-              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-              __pyx_t_12 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_12); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 252, __pyx_L44_error)
-              #else
-              __pyx_t_12 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 252, __pyx_L44_error)
-              __Pyx_GOTREF(__pyx_t_12);
-              #endif
-            } else {
-              if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-              __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_12); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 252, __pyx_L44_error)
-              #else
-              __pyx_t_12 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 252, __pyx_L44_error)
-              __Pyx_GOTREF(__pyx_t_12);
-              #endif
-            }
-          } else {
-            __pyx_t_12 = __pyx_t_11(__pyx_t_1);
-            if (unlikely(!__pyx_t_12)) {
-              PyObject* exc_type = PyErr_Occurred();
-              if (exc_type) {
-                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
-                else __PYX_ERR(0, 252, __pyx_L44_error)
-              }
-              break;
-            }
-            __Pyx_GOTREF(__pyx_t_12);
-          }
-          if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 252, __pyx_L44_error)
-          __pyx_t_14 = ((PyArrayObject *)__pyx_t_12);
-          {
-            __Pyx_BufFmt_StackElem __pyx_stack[1];
-            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer);
-            __pyx_t_22 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
-            if (unlikely(__pyx_t_22 < 0)) {
-              PyErr_Fetch(&__pyx_t_25, &__pyx_t_24, &__pyx_t_23);
-              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer, (PyObject*)__pyx_v_coeffs, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
-                Py_XDECREF(__pyx_t_25); Py_XDECREF(__pyx_t_24); Py_XDECREF(__pyx_t_23);
-                __Pyx_RaiseBufferFallbackError();
-              } else {
-                PyErr_Restore(__pyx_t_25, __pyx_t_24, __pyx_t_23);
-              }
-              __pyx_t_25 = __pyx_t_24 = __pyx_t_23 = 0;
-            }
-            __pyx_pybuffernd_coeffs.diminfo[0].strides = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coeffs.diminfo[0].shape = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coeffs.diminfo[1].strides = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coeffs.diminfo[1].shape = __pyx_pybuffernd_coeffs.rcbuffer->pybuffer.shape[1];
-            if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 252, __pyx_L44_error)
-          }
-          __pyx_t_14 = 0;
-          __Pyx_XDECREF_SET(__pyx_v_coeffs, ((PyArrayObject *)__pyx_t_12));
-          __pyx_t_12 = 0;
-          __pyx_v_j = __pyx_t_15;
-          __pyx_t_15 = (__pyx_t_15 + 1);
-
-          /* "LFPy/run_simulation.pyx":254
- *             for j, coeffs in enumerate(dotprodcoeffs):
- *                 el_LFP_file['electrode{:03d}'.format(j)
- *                             ][:, tstep] = np.dot(coeffs, imem)             # <<<<<<<<<<<<<<
- * 
- *     except:
- */
-          __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 254, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_17);
-          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_dot); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 254, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_6);
-          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
-          __pyx_t_17 = NULL;
-          __pyx_t_22 = 0;
-          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
-            __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_6);
-            if (likely(__pyx_t_17)) {
-              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
-              __Pyx_INCREF(__pyx_t_17);
-              __Pyx_INCREF(function);
-              __Pyx_DECREF_SET(__pyx_t_6, function);
-              __pyx_t_22 = 1;
-            }
-          }
-          #if CYTHON_FAST_PYCALL
-          if (PyFunction_Check(__pyx_t_6)) {
-            PyObject *__pyx_temp[3] = {__pyx_t_17, ((PyObject *)__pyx_v_coeffs), __pyx_v_imem};
-            __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 254, __pyx_L44_error)
-            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
-            __Pyx_GOTREF(__pyx_t_12);
-          } else
-          #endif
-          #if CYTHON_FAST_PYCCALL
-          if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
-            PyObject *__pyx_temp[3] = {__pyx_t_17, ((PyObject *)__pyx_v_coeffs), __pyx_v_imem};
-            __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 254, __pyx_L44_error)
-            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
-            __Pyx_GOTREF(__pyx_t_12);
-          } else
-          #endif
-          {
-            __pyx_t_7 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L44_error)
-            __Pyx_GOTREF(__pyx_t_7);
-            if (__pyx_t_17) {
-              __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_17); __pyx_t_17 = NULL;
-            }
-            __Pyx_INCREF(((PyObject *)__pyx_v_coeffs));
-            __Pyx_GIVEREF(((PyObject *)__pyx_v_coeffs));
-            PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_22, ((PyObject *)__pyx_v_coeffs));
-            __Pyx_INCREF(__pyx_v_imem);
-            __Pyx_GIVEREF(__pyx_v_imem);
-            PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_22, __pyx_v_imem);
-            __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 254, __pyx_L44_error)
-            __Pyx_GOTREF(__pyx_t_12);
-            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-          }
-          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-          /* "LFPy/run_simulation.pyx":253
- *         if to_file:
- *             for j, coeffs in enumerate(dotprodcoeffs):
- *                 el_LFP_file['electrode{:03d}'.format(j)             # <<<<<<<<<<<<<<
- *                             ][:, tstep] = np.dot(coeffs, imem)
- * 
- */
-          if (unlikely(!__pyx_v_el_LFP_file)) { __Pyx_RaiseUnboundLocalError("el_LFP_file"); __PYX_ERR(0, 253, __pyx_L44_error) }
-          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_electrode_03d, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 253, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_7);
-          __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 253, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_17);
-          __pyx_t_16 = NULL;
-          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
-            __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_7);
-            if (likely(__pyx_t_16)) {
-              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
-              __Pyx_INCREF(__pyx_t_16);
-              __Pyx_INCREF(function);
-              __Pyx_DECREF_SET(__pyx_t_7, function);
-            }
-          }
-          __pyx_t_6 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_16, __pyx_t_17) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_17);
-          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
-          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
-          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 253, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_6);
-          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-          __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_el_LFP_file, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 253, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_7);
-          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-          /* "LFPy/run_simulation.pyx":254
- *             for j, coeffs in enumerate(dotprodcoeffs):
- *                 el_LFP_file['electrode{:03d}'.format(j)
- *                             ][:, tstep] = np.dot(coeffs, imem)             # <<<<<<<<<<<<<<
- * 
- *     except:
- */
-          __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_tstep); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 254, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_6);
-          __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 254, __pyx_L44_error)
-          __Pyx_GOTREF(__pyx_t_17);
-          __Pyx_INCREF(__pyx_slice__2);
-          __Pyx_GIVEREF(__pyx_slice__2);
-          PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_slice__2);
-          __Pyx_GIVEREF(__pyx_t_6);
-          PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_6);
-          __pyx_t_6 = 0;
-          if (unlikely(PyObject_SetItem(__pyx_t_7, __pyx_t_17, __pyx_t_12) < 0)) __PYX_ERR(0, 254, __pyx_L44_error)
-          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
-          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-
-          /* "LFPy/run_simulation.pyx":252
- *                 electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
- *         if to_file:
- *             for j, coeffs in enumerate(dotprodcoeffs):             # <<<<<<<<<<<<<<
- *                 el_LFP_file['electrode{:03d}'.format(j)
- *                             ][:, tstep] = np.dot(coeffs, imem)
- */
-        }
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-        /* "LFPy/run_simulation.pyx":251
- *             for j, coeffs in enumerate(dotprodcoeffs):
- *                 electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
- *         if to_file:             # <<<<<<<<<<<<<<
- *             for j, coeffs in enumerate(dotprodcoeffs):
- *                 el_LFP_file['electrode{:03d}'.format(j)
- */
-      }
-
-      /* "LFPy/run_simulation.pyx":237
- *             ti = neuron.h.t
- * 
- *     try:             # <<<<<<<<<<<<<<
- *         #calculate LFP after final fadvance()
- *         i = 0
- */
-    }
-    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
-    goto __pyx_L49_try_end;
-    __pyx_L44_error:;
-    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
-    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
-    __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
-    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
-
-    /* "LFPy/run_simulation.pyx":256
- *                             ][:, tstep] = np.dot(coeffs, imem)
- * 
- *     except:             # <<<<<<<<<<<<<<
- *         pass
- * 
- */
-    /*except:*/ {
-      __Pyx_ErrRestore(0,0,0);
-      goto __pyx_L45_exception_handled;
-    }
-    __pyx_L45_exception_handled:;
-    __Pyx_XGIVEREF(__pyx_t_5);
-    __Pyx_XGIVEREF(__pyx_t_4);
-    __Pyx_XGIVEREF(__pyx_t_3);
-    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
-    __pyx_L49_try_end:;
-  }
-
-  /* "LFPy/run_simulation.pyx":260
- * 
- *     # update current dipole moment values
- *     if rec_current_dipole_moment:             # <<<<<<<<<<<<<<
- *         cell.current_dipole_moment = current_dipole_moment
- * 
- */
-  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_rec_current_dipole_moment); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 260, __pyx_L1_error)
-  if (__pyx_t_9) {
-
-    /* "LFPy/run_simulation.pyx":261
- *     # update current dipole moment values
- *     if rec_current_dipole_moment:
- *         cell.current_dipole_moment = current_dipole_moment             # <<<<<<<<<<<<<<
- * 
- *     # Final step, put LFPs in the electrode object, superimpose if necessary
- */
-    if (__Pyx_PyObject_SetAttrStr(__pyx_v_cell, __pyx_n_s_current_dipole_moment, ((PyObject *)__pyx_v_current_dipole_moment)) < 0) __PYX_ERR(0, 261, __pyx_L1_error)
-
-    /* "LFPy/run_simulation.pyx":260
- * 
- *     # update current dipole moment values
- *     if rec_current_dipole_moment:             # <<<<<<<<<<<<<<
- *         cell.current_dipole_moment = current_dipole_moment
- * 
- */
-  }
-
-  /* "LFPy/run_simulation.pyx":265
- *     # Final step, put LFPs in the electrode object, superimpose if necessary
- *     # If electrode.perCellLFP, store individual LFPs
- *     if to_memory:             # <<<<<<<<<<<<<<
- *         #the first few belong to input dotprodcoeffs
- *         cell.dotprodresults = electrodesLFP[:lendotprodcoeffs0]
- */
-  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_to_memory); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 265, __pyx_L1_error)
-  if (__pyx_t_9) {
-
-    /* "LFPy/run_simulation.pyx":267
- *     if to_memory:
- *         #the first few belong to input dotprodcoeffs
- *         cell.dotprodresults = electrodesLFP[:lendotprodcoeffs0]             # <<<<<<<<<<<<<<
- *         #the remaining belong to input electrode arguments
- *         if electrodes is not None:
- */
-    if (unlikely(!__pyx_v_electrodesLFP)) { __Pyx_RaiseUnboundLocalError("electrodesLFP"); __PYX_ERR(0, 267, __pyx_L1_error) }
-    __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_electrodesLFP, 0, __pyx_v_lendotprodcoeffs0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    if (__Pyx_PyObject_SetAttrStr(__pyx_v_cell, __pyx_n_s_dotprodresults, __pyx_t_1) < 0) __PYX_ERR(0, 267, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-    /* "LFPy/run_simulation.pyx":269
- *         cell.dotprodresults = electrodesLFP[:lendotprodcoeffs0]
- *         #the remaining belong to input electrode arguments
- *         if electrodes is not None:             # <<<<<<<<<<<<<<
- *             for j, LFP in enumerate(electrodesLFP):
- *                 if not j < lendotprodcoeffs0:
- */
-    if (unlikely(!__pyx_v_electrodes)) { __Pyx_RaiseUnboundLocalError("electrodes"); __PYX_ERR(0, 269, __pyx_L1_error) }
-    __pyx_t_9 = (__pyx_v_electrodes != Py_None);
-    __pyx_t_8 = (__pyx_t_9 != 0);
-    if (__pyx_t_8) {
-
-      /* "LFPy/run_simulation.pyx":270
- *         #the remaining belong to input electrode arguments
- *         if electrodes is not None:
- *             for j, LFP in enumerate(electrodesLFP):             # <<<<<<<<<<<<<<
- *                 if not j < lendotprodcoeffs0:
- *                     if hasattr(electrodes[j-lendotprodcoeffs0], 'LFP'):
- */
-      __pyx_t_15 = 0;
-      if (unlikely(!__pyx_v_electrodesLFP)) { __Pyx_RaiseUnboundLocalError("electrodesLFP"); __PYX_ERR(0, 270, __pyx_L1_error) }
-      __pyx_t_1 = __pyx_v_electrodesLFP; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0;
-      for (;;) {
-        if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_1)) break;
-        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-        __pyx_t_12 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_12); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 270, __pyx_L1_error)
-        #else
-        __pyx_t_12 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 270, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_12);
-        #endif
-        __Pyx_XDECREF_SET(__pyx_v_LFP, __pyx_t_12);
-        __pyx_t_12 = 0;
-        __pyx_v_j = __pyx_t_15;
-        __pyx_t_15 = (__pyx_t_15 + 1);
-
-        /* "LFPy/run_simulation.pyx":271
- *         if electrodes is not None:
- *             for j, LFP in enumerate(electrodesLFP):
- *                 if not j < lendotprodcoeffs0:             # <<<<<<<<<<<<<<
- *                     if hasattr(electrodes[j-lendotprodcoeffs0], 'LFP'):
- *                         electrodes[j-lendotprodcoeffs0].LFP += LFP
- */
-        __pyx_t_8 = ((!((__pyx_v_j < __pyx_v_lendotprodcoeffs0) != 0)) != 0);
-        if (__pyx_t_8) {
-
-          /* "LFPy/run_simulation.pyx":272
- *             for j, LFP in enumerate(electrodesLFP):
- *                 if not j < lendotprodcoeffs0:
- *                     if hasattr(electrodes[j-lendotprodcoeffs0], 'LFP'):             # <<<<<<<<<<<<<<
- *                         electrodes[j-lendotprodcoeffs0].LFP += LFP
- *                     else:
- */
-          if (unlikely(!__pyx_v_electrodes)) { __Pyx_RaiseUnboundLocalError("electrodes"); __PYX_ERR(0, 272, __pyx_L1_error) }
-          __pyx_t_22 = (__pyx_v_j - __pyx_v_lendotprodcoeffs0);
-          __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_electrodes, __pyx_t_22, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 272, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_12);
-          __pyx_t_8 = __Pyx_HasAttr(__pyx_t_12, __pyx_n_s_LFP); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 272, __pyx_L1_error)
-          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-          __pyx_t_9 = (__pyx_t_8 != 0);
-          if (__pyx_t_9) {
-
-            /* "LFPy/run_simulation.pyx":273
- *                 if not j < lendotprodcoeffs0:
- *                     if hasattr(electrodes[j-lendotprodcoeffs0], 'LFP'):
- *                         electrodes[j-lendotprodcoeffs0].LFP += LFP             # <<<<<<<<<<<<<<
- *                     else:
- *                         electrodes[j-lendotprodcoeffs0].LFP = LFP
- */
-            if (unlikely(!__pyx_v_electrodes)) { __Pyx_RaiseUnboundLocalError("electrodes"); __PYX_ERR(0, 273, __pyx_L1_error) }
-            __pyx_t_22 = (__pyx_v_j - __pyx_v_lendotprodcoeffs0);
-            __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_electrodes, __pyx_t_22, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 273, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_12);
-            __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_LFP); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 273, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_17);
-            __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_17, __pyx_v_LFP); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 273, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_7);
-            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
-            if (__Pyx_PyObject_SetAttrStr(__pyx_t_12, __pyx_n_s_LFP, __pyx_t_7) < 0) __PYX_ERR(0, 273, __pyx_L1_error)
-            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-
-            /* "LFPy/run_simulation.pyx":272
- *             for j, LFP in enumerate(electrodesLFP):
- *                 if not j < lendotprodcoeffs0:
- *                     if hasattr(electrodes[j-lendotprodcoeffs0], 'LFP'):             # <<<<<<<<<<<<<<
- *                         electrodes[j-lendotprodcoeffs0].LFP += LFP
- *                     else:
- */
-            goto __pyx_L67;
-          }
-
-          /* "LFPy/run_simulation.pyx":275
- *                         electrodes[j-lendotprodcoeffs0].LFP += LFP
- *                     else:
- *                         electrodes[j-lendotprodcoeffs0].LFP = LFP             # <<<<<<<<<<<<<<
- *                     #will save each cell contribution separately
- *                     if electrodes[j-lendotprodcoeffs0].perCellLFP:
- */
-          /*else*/ {
-            if (unlikely(!__pyx_v_electrodes)) { __Pyx_RaiseUnboundLocalError("electrodes"); __PYX_ERR(0, 275, __pyx_L1_error) }
-            __pyx_t_22 = (__pyx_v_j - __pyx_v_lendotprodcoeffs0);
-            __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_electrodes, __pyx_t_22, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 275, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_12);
-            if (__Pyx_PyObject_SetAttrStr(__pyx_t_12, __pyx_n_s_LFP, __pyx_v_LFP) < 0) __PYX_ERR(0, 275, __pyx_L1_error)
-            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-          }
-          __pyx_L67:;
-
-          /* "LFPy/run_simulation.pyx":277
- *                         electrodes[j-lendotprodcoeffs0].LFP = LFP
- *                     #will save each cell contribution separately
- *                     if electrodes[j-lendotprodcoeffs0].perCellLFP:             # <<<<<<<<<<<<<<
- *                         if not hasattr(electrodes[j], 'CellLFP'):
- *                             electrodes[j-lendotprodcoeffs0].CellLFP = []
- */
-          if (unlikely(!__pyx_v_electrodes)) { __Pyx_RaiseUnboundLocalError("electrodes"); __PYX_ERR(0, 277, __pyx_L1_error) }
-          __pyx_t_22 = (__pyx_v_j - __pyx_v_lendotprodcoeffs0);
-          __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_electrodes, __pyx_t_22, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 277, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_12);
-          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_perCellLFP); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 277, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_7);
-          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 277, __pyx_L1_error)
-          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-          if (__pyx_t_9) {
-
-            /* "LFPy/run_simulation.pyx":278
- *                     #will save each cell contribution separately
- *                     if electrodes[j-lendotprodcoeffs0].perCellLFP:
- *                         if not hasattr(electrodes[j], 'CellLFP'):             # <<<<<<<<<<<<<<
- *                             electrodes[j-lendotprodcoeffs0].CellLFP = []
- *                         electrodes[j-lendotprodcoeffs0].CellLFP.append(LFP)
- */
-            if (unlikely(!__pyx_v_electrodes)) { __Pyx_RaiseUnboundLocalError("electrodes"); __PYX_ERR(0, 278, __pyx_L1_error) }
-            __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_electrodes, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 278, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_7);
-            __pyx_t_9 = __Pyx_HasAttr(__pyx_t_7, __pyx_n_s_CellLFP); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 278, __pyx_L1_error)
-            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-            __pyx_t_8 = ((!(__pyx_t_9 != 0)) != 0);
-            if (__pyx_t_8) {
-
-              /* "LFPy/run_simulation.pyx":279
- *                     if electrodes[j-lendotprodcoeffs0].perCellLFP:
- *                         if not hasattr(electrodes[j], 'CellLFP'):
- *                             electrodes[j-lendotprodcoeffs0].CellLFP = []             # <<<<<<<<<<<<<<
- *                         electrodes[j-lendotprodcoeffs0].CellLFP.append(LFP)
- *                     electrodes[j-lendotprodcoeffs0].electrodecoeff = dotprodcoeffs[j]
- */
-              __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 279, __pyx_L1_error)
-              __Pyx_GOTREF(__pyx_t_7);
-              if (unlikely(!__pyx_v_electrodes)) { __Pyx_RaiseUnboundLocalError("electrodes"); __PYX_ERR(0, 279, __pyx_L1_error) }
-              __pyx_t_22 = (__pyx_v_j - __pyx_v_lendotprodcoeffs0);
-              __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_electrodes, __pyx_t_22, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 279, __pyx_L1_error)
-              __Pyx_GOTREF(__pyx_t_12);
-              if (__Pyx_PyObject_SetAttrStr(__pyx_t_12, __pyx_n_s_CellLFP, __pyx_t_7) < 0) __PYX_ERR(0, 279, __pyx_L1_error)
-              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-
-              /* "LFPy/run_simulation.pyx":278
- *                     #will save each cell contribution separately
- *                     if electrodes[j-lendotprodcoeffs0].perCellLFP:
- *                         if not hasattr(electrodes[j], 'CellLFP'):             # <<<<<<<<<<<<<<
- *                             electrodes[j-lendotprodcoeffs0].CellLFP = []
- *                         electrodes[j-lendotprodcoeffs0].CellLFP.append(LFP)
- */
-            }
-
-            /* "LFPy/run_simulation.pyx":280
- *                         if not hasattr(electrodes[j], 'CellLFP'):
- *                             electrodes[j-lendotprodcoeffs0].CellLFP = []
- *                         electrodes[j-lendotprodcoeffs0].CellLFP.append(LFP)             # <<<<<<<<<<<<<<
- *                     electrodes[j-lendotprodcoeffs0].electrodecoeff = dotprodcoeffs[j]
- * 
- */
-            if (unlikely(!__pyx_v_electrodes)) { __Pyx_RaiseUnboundLocalError("electrodes"); __PYX_ERR(0, 280, __pyx_L1_error) }
-            __pyx_t_22 = (__pyx_v_j - __pyx_v_lendotprodcoeffs0);
-            __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_electrodes, __pyx_t_22, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 280, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_12);
-            __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_CellLFP); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 280, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_7);
-            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-            __pyx_t_13 = __Pyx_PyObject_Append(__pyx_t_7, __pyx_v_LFP); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 280, __pyx_L1_error)
-            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-
-            /* "LFPy/run_simulation.pyx":277
- *                         electrodes[j-lendotprodcoeffs0].LFP = LFP
- *                     #will save each cell contribution separately
- *                     if electrodes[j-lendotprodcoeffs0].perCellLFP:             # <<<<<<<<<<<<<<
- *                         if not hasattr(electrodes[j], 'CellLFP'):
- *                             electrodes[j-lendotprodcoeffs0].CellLFP = []
- */
-          }
-
-          /* "LFPy/run_simulation.pyx":281
- *                             electrodes[j-lendotprodcoeffs0].CellLFP = []
- *                         electrodes[j-lendotprodcoeffs0].CellLFP.append(LFP)
- *                     electrodes[j-lendotprodcoeffs0].electrodecoeff = dotprodcoeffs[j]             # <<<<<<<<<<<<<<
- * 
- *     if to_file:
- */
-          __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_dotprodcoeffs, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 281, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_7);
-          if (unlikely(!__pyx_v_electrodes)) { __Pyx_RaiseUnboundLocalError("electrodes"); __PYX_ERR(0, 281, __pyx_L1_error) }
-          __pyx_t_22 = (__pyx_v_j - __pyx_v_lendotprodcoeffs0);
-          __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_electrodes, __pyx_t_22, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 281, __pyx_L1_error)
-          __Pyx_GOTREF(__pyx_t_12);
-          if (__Pyx_PyObject_SetAttrStr(__pyx_t_12, __pyx_n_s_electrodecoeff, __pyx_t_7) < 0) __PYX_ERR(0, 281, __pyx_L1_error)
-          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-
-          /* "LFPy/run_simulation.pyx":271
- *         if electrodes is not None:
- *             for j, LFP in enumerate(electrodesLFP):
- *                 if not j < lendotprodcoeffs0:             # <<<<<<<<<<<<<<
- *                     if hasattr(electrodes[j-lendotprodcoeffs0], 'LFP'):
- *                         electrodes[j-lendotprodcoeffs0].LFP += LFP
- */
-        }
-
-        /* "LFPy/run_simulation.pyx":270
- *         #the remaining belong to input electrode arguments
- *         if electrodes is not None:
- *             for j, LFP in enumerate(electrodesLFP):             # <<<<<<<<<<<<<<
- *                 if not j < lendotprodcoeffs0:
- *                     if hasattr(electrodes[j-lendotprodcoeffs0], 'LFP'):
- */
-      }
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":269
- *         cell.dotprodresults = electrodesLFP[:lendotprodcoeffs0]
- *         #the remaining belong to input electrode arguments
- *         if electrodes is not None:             # <<<<<<<<<<<<<<
- *             for j, LFP in enumerate(electrodesLFP):
- *                 if not j < lendotprodcoeffs0:
- */
-    }
-
-    /* "LFPy/run_simulation.pyx":265
- *     # Final step, put LFPs in the electrode object, superimpose if necessary
- *     # If electrode.perCellLFP, store individual LFPs
- *     if to_memory:             # <<<<<<<<<<<<<<
- *         #the first few belong to input dotprodcoeffs
- *         cell.dotprodresults = electrodesLFP[:lendotprodcoeffs0]
- */
-  }
-
-  /* "LFPy/run_simulation.pyx":283
- *                     electrodes[j-lendotprodcoeffs0].electrodecoeff = dotprodcoeffs[j]
- * 
- *     if to_file:             # <<<<<<<<<<<<<<
- *         el_LFP_file.close()
- * 
- */
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_to_file); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 283, __pyx_L1_error)
-  if (__pyx_t_8) {
-
-    /* "LFPy/run_simulation.pyx":284
- * 
- *     if to_file:
- *         el_LFP_file.close()             # <<<<<<<<<<<<<<
- * 
- * 
- */
-    if (unlikely(!__pyx_v_el_LFP_file)) { __Pyx_RaiseUnboundLocalError("el_LFP_file"); __PYX_ERR(0, 284, __pyx_L1_error) }
-    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_el_LFP_file, __pyx_n_s_close); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 284, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_12);
-    __pyx_t_7 = NULL;
-    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
-      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_12);
-      if (likely(__pyx_t_7)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
-        __Pyx_INCREF(__pyx_t_7);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_12, function);
-      }
-    }
-    __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
-    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-    /* "LFPy/run_simulation.pyx":283
- *                     electrodes[j-lendotprodcoeffs0].electrodecoeff = dotprodcoeffs[j]
- * 
- *     if to_file:             # <<<<<<<<<<<<<<
- *         el_LFP_file.close()
- * 
- */
-  }
-
-  /* "LFPy/run_simulation.pyx":82
- * 
- * 
- * def _run_simulation_with_electrode(cell, cvode, electrode=None,             # <<<<<<<<<<<<<<
- *                                    variable_dt=False, atol=0.001,
- *                                    to_memory=True, to_file=False,
- */
-
-  /* function exit code */
-  __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_12);
-  __Pyx_XDECREF(__pyx_t_16);
-  __Pyx_XDECREF(__pyx_t_17);
-  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
-    __Pyx_PyThreadState_declare
-    __Pyx_PyThreadState_assign
-    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_current_dipole_moment.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_midpoints.rcbuffer->pybuffer);
-  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
-  __Pyx_AddTraceback("LFPy.run_simulation._run_simulation_with_electrode", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = NULL;
-  goto __pyx_L2;
-  __pyx_L0:;
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coeffs.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_current_dipole_moment.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_midpoints.rcbuffer->pybuffer);
-  __pyx_L2:;
-  __Pyx_XDECREF((PyObject *)__pyx_v_coeffs);
-  __Pyx_XDECREF((PyObject *)__pyx_v_current_dipole_moment);
-  __Pyx_XDECREF((PyObject *)__pyx_v_midpoints);
-  __Pyx_XDECREF(__pyx_v_h5py);
-  __Pyx_XDECREF(__pyx_v_electrodes);
-  __Pyx_XDECREF(__pyx_v_el);
-  __Pyx_XDECREF(__pyx_v_imem);
-  __Pyx_XDECREF(__pyx_v_electrodesLFP);
-  __Pyx_XDECREF(__pyx_v_el_LFP_file);
-  __Pyx_XDECREF(__pyx_v_sec);
-  __Pyx_XDECREF(__pyx_v_seg);
-  __Pyx_XDECREF(__pyx_v_LFP);
-  __Pyx_XDECREF(__pyx_v_to_file);
-  __Pyx_XDECREF(__pyx_v_file_name);
-  __Pyx_XDECREF(__pyx_v_dotprodcoeffs);
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "LFPy/run_simulation.pyx":287
- * 
- * 
- * cpdef _collect_geometry_neuron(cell):             # <<<<<<<<<<<<<<
- *     """Loop over allseclist to determine area, diam, xyz-start- and
- *     endpoints, embed geometry to cell object"""
- */
-
-static PyObject *__pyx_pw_4LFPy_14run_simulation_5_collect_geometry_neuron(PyObject *__pyx_self, PyObject *__pyx_v_cell); /*proto*/
-static PyObject *__pyx_f_4LFPy_14run_simulation__collect_geometry_neuron(PyObject *__pyx_v_cell, CYTHON_UNUSED int __pyx_skip_dispatch) {
-  PyArrayObject *__pyx_v_areavec = 0;
-  PyArrayObject *__pyx_v_diamvec = 0;
-  PyArrayObject *__pyx_v_lengthvec = 0;
-  PyArrayObject *__pyx_v_xstartvec = 0;
-  PyArrayObject *__pyx_v_xendvec = 0;
-  PyArrayObject *__pyx_v_ystartvec = 0;
-  PyArrayObject *__pyx_v_yendvec = 0;
-  PyArrayObject *__pyx_v_zstartvec = 0;
-  PyArrayObject *__pyx_v_zendvec = 0;
-  __pyx_t_4LFPy_14run_simulation_DTYPE_t __pyx_v_gsen2;
-  __pyx_t_4LFPy_14run_simulation_DTYPE_t __pyx_v_secL;
-  __pyx_t_4LFPy_14run_simulation_LTYPE_t __pyx_v_counter;
-  __pyx_t_4LFPy_14run_simulation_LTYPE_t __pyx_v_nseg;
-  __pyx_t_4LFPy_14run_simulation_LTYPE_t __pyx_v_n3d;
-  __pyx_t_4LFPy_14run_simulation_LTYPE_t __pyx_v_i;
-  PyArrayObject *__pyx_v_L = 0;
-  PyArrayObject *__pyx_v_x = 0;
-  PyArrayObject *__pyx_v_y = 0;
-  PyArrayObject *__pyx_v_z = 0;
-  PyArrayObject *__pyx_v_segx = 0;
-  PyArrayObject *__pyx_v_segx0 = 0;
-  PyArrayObject *__pyx_v_segx1 = 0;
-  PyObject *__pyx_v_sec = NULL;
-  PyObject *__pyx_v_seg = NULL;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_L;
-  __Pyx_Buffer __pyx_pybuffer_L;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_areavec;
-  __Pyx_Buffer __pyx_pybuffer_areavec;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_diamvec;
-  __Pyx_Buffer __pyx_pybuffer_diamvec;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_lengthvec;
-  __Pyx_Buffer __pyx_pybuffer_lengthvec;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_segx;
-  __Pyx_Buffer __pyx_pybuffer_segx;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_segx0;
-  __Pyx_Buffer __pyx_pybuffer_segx0;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_segx1;
-  __Pyx_Buffer __pyx_pybuffer_segx1;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
-  __Pyx_Buffer __pyx_pybuffer_x;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_xendvec;
-  __Pyx_Buffer __pyx_pybuffer_xendvec;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_xstartvec;
-  __Pyx_Buffer __pyx_pybuffer_xstartvec;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_y;
-  __Pyx_Buffer __pyx_pybuffer_y;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_yendvec;
-  __Pyx_Buffer __pyx_pybuffer_yendvec;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_ystartvec;
-  __Pyx_Buffer __pyx_pybuffer_ystartvec;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_z;
-  __Pyx_Buffer __pyx_pybuffer_z;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_zendvec;
-  __Pyx_Buffer __pyx_pybuffer_zendvec;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_zstartvec;
-  __Pyx_Buffer __pyx_pybuffer_zstartvec;
-  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;
-  PyArrayObject *__pyx_t_5 = NULL;
-  PyArrayObject *__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;
-  PyArrayObject *__pyx_t_13 = NULL;
-  Py_ssize_t __pyx_t_14;
-  PyObject *(*__pyx_t_15)(PyObject *);
-  __pyx_t_4LFPy_14run_simulation_LTYPE_t __pyx_t_16;
-  double __pyx_t_17;
-  __pyx_t_4LFPy_14run_simulation_DTYPE_t __pyx_t_18;
-  int __pyx_t_19;
-  PyObject *__pyx_t_20 = NULL;
-  PyArrayObject *__pyx_t_21 = NULL;
-  int __pyx_t_22;
-  PyObject *__pyx_t_23 = NULL;
-  PyObject *__pyx_t_24 = NULL;
-  PyObject *__pyx_t_25 = NULL;
-  __pyx_t_4LFPy_14run_simulation_LTYPE_t __pyx_t_26;
-  __pyx_t_4LFPy_14run_simulation_LTYPE_t __pyx_t_27;
-  __pyx_t_4LFPy_14run_simulation_LTYPE_t __pyx_t_28;
-  __pyx_t_4LFPy_14run_simulation_LTYPE_t __pyx_t_29;
-  __pyx_t_4LFPy_14run_simulation_LTYPE_t __pyx_t_30;
-  __pyx_t_4LFPy_14run_simulation_LTYPE_t __pyx_t_31;
-  Py_ssize_t __pyx_t_32;
-  PyObject *(*__pyx_t_33)(PyObject *);
-  PyObject *__pyx_t_34 = NULL;
-  __pyx_t_4LFPy_14run_simulation_LTYPE_t __pyx_t_35;
-  __Pyx_RefNannySetupContext("_collect_geometry_neuron", 0);
-  __pyx_pybuffer_areavec.pybuffer.buf = NULL;
-  __pyx_pybuffer_areavec.refcount = 0;
-  __pyx_pybuffernd_areavec.data = NULL;
-  __pyx_pybuffernd_areavec.rcbuffer = &__pyx_pybuffer_areavec;
-  __pyx_pybuffer_diamvec.pybuffer.buf = NULL;
-  __pyx_pybuffer_diamvec.refcount = 0;
-  __pyx_pybuffernd_diamvec.data = NULL;
-  __pyx_pybuffernd_diamvec.rcbuffer = &__pyx_pybuffer_diamvec;
-  __pyx_pybuffer_lengthvec.pybuffer.buf = NULL;
-  __pyx_pybuffer_lengthvec.refcount = 0;
-  __pyx_pybuffernd_lengthvec.data = NULL;
-  __pyx_pybuffernd_lengthvec.rcbuffer = &__pyx_pybuffer_lengthvec;
-  __pyx_pybuffer_xstartvec.pybuffer.buf = NULL;
-  __pyx_pybuffer_xstartvec.refcount = 0;
-  __pyx_pybuffernd_xstartvec.data = NULL;
-  __pyx_pybuffernd_xstartvec.rcbuffer = &__pyx_pybuffer_xstartvec;
-  __pyx_pybuffer_xendvec.pybuffer.buf = NULL;
-  __pyx_pybuffer_xendvec.refcount = 0;
-  __pyx_pybuffernd_xendvec.data = NULL;
-  __pyx_pybuffernd_xendvec.rcbuffer = &__pyx_pybuffer_xendvec;
-  __pyx_pybuffer_ystartvec.pybuffer.buf = NULL;
-  __pyx_pybuffer_ystartvec.refcount = 0;
-  __pyx_pybuffernd_ystartvec.data = NULL;
-  __pyx_pybuffernd_ystartvec.rcbuffer = &__pyx_pybuffer_ystartvec;
-  __pyx_pybuffer_yendvec.pybuffer.buf = NULL;
-  __pyx_pybuffer_yendvec.refcount = 0;
-  __pyx_pybuffernd_yendvec.data = NULL;
-  __pyx_pybuffernd_yendvec.rcbuffer = &__pyx_pybuffer_yendvec;
-  __pyx_pybuffer_zstartvec.pybuffer.buf = NULL;
-  __pyx_pybuffer_zstartvec.refcount = 0;
-  __pyx_pybuffernd_zstartvec.data = NULL;
-  __pyx_pybuffernd_zstartvec.rcbuffer = &__pyx_pybuffer_zstartvec;
-  __pyx_pybuffer_zendvec.pybuffer.buf = NULL;
-  __pyx_pybuffer_zendvec.refcount = 0;
-  __pyx_pybuffernd_zendvec.data = NULL;
-  __pyx_pybuffernd_zendvec.rcbuffer = &__pyx_pybuffer_zendvec;
-  __pyx_pybuffer_L.pybuffer.buf = NULL;
-  __pyx_pybuffer_L.refcount = 0;
-  __pyx_pybuffernd_L.data = NULL;
-  __pyx_pybuffernd_L.rcbuffer = &__pyx_pybuffer_L;
-  __pyx_pybuffer_x.pybuffer.buf = NULL;
-  __pyx_pybuffer_x.refcount = 0;
-  __pyx_pybuffernd_x.data = NULL;
-  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
-  __pyx_pybuffer_y.pybuffer.buf = NULL;
-  __pyx_pybuffer_y.refcount = 0;
-  __pyx_pybuffernd_y.data = NULL;
-  __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y;
-  __pyx_pybuffer_z.pybuffer.buf = NULL;
-  __pyx_pybuffer_z.refcount = 0;
-  __pyx_pybuffernd_z.data = NULL;
-  __pyx_pybuffernd_z.rcbuffer = &__pyx_pybuffer_z;
-  __pyx_pybuffer_segx.pybuffer.buf = NULL;
-  __pyx_pybuffer_segx.refcount = 0;
-  __pyx_pybuffernd_segx.data = NULL;
-  __pyx_pybuffernd_segx.rcbuffer = &__pyx_pybuffer_segx;
-  __pyx_pybuffer_segx0.pybuffer.buf = NULL;
-  __pyx_pybuffer_segx0.refcount = 0;
-  __pyx_pybuffernd_segx0.data = NULL;
-  __pyx_pybuffernd_segx0.rcbuffer = &__pyx_pybuffer_segx0;
-  __pyx_pybuffer_segx1.pybuffer.buf = NULL;
-  __pyx_pybuffer_segx1.refcount = 0;
-  __pyx_pybuffernd_segx1.data = NULL;
-  __pyx_pybuffernd_segx1.rcbuffer = &__pyx_pybuffer_segx1;
-
-  /* "LFPy/run_simulation.pyx":292
- * 
- * 
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] areavec = np.zeros(cell.totnsegs)             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] diamvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] lengthvec = np.zeros(cell.totnsegs)
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __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_cell, __pyx_n_s_totnsegs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
-    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
-    if (likely(__pyx_t_4)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
-      __Pyx_INCREF(__pyx_t_4);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_3, function);
-    }
-  }
-  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 292, __pyx_L1_error)
-  __pyx_t_5 = ((PyArrayObject *)__pyx_t_1);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_areavec.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_areavec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_areavec.rcbuffer->pybuffer.buf = NULL;
-      __PYX_ERR(0, 292, __pyx_L1_error)
-    } else {__pyx_pybuffernd_areavec.diminfo[0].strides = __pyx_pybuffernd_areavec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_areavec.diminfo[0].shape = __pyx_pybuffernd_areavec.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_5 = 0;
-  __pyx_v_areavec = ((PyArrayObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
-
-  /* "LFPy/run_simulation.pyx":293
- * 
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] areavec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] diamvec = np.zeros(cell.totnsegs)             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] lengthvec = np.zeros(cell.totnsegs)
- * 
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_totnsegs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
-    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
-    if (likely(__pyx_t_4)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
-      __Pyx_INCREF(__pyx_t_4);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_2, function);
-    }
-  }
-  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 293, __pyx_L1_error)
-  __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_diamvec.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_diamvec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_diamvec.rcbuffer->pybuffer.buf = NULL;
-      __PYX_ERR(0, 293, __pyx_L1_error)
-    } else {__pyx_pybuffernd_diamvec.diminfo[0].strides = __pyx_pybuffernd_diamvec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_diamvec.diminfo[0].shape = __pyx_pybuffernd_diamvec.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_6 = 0;
-  __pyx_v_diamvec = ((PyArrayObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
-
-  /* "LFPy/run_simulation.pyx":294
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] areavec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] diamvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] lengthvec = np.zeros(cell.totnsegs)             # <<<<<<<<<<<<<<
- * 
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] xstartvec = np.zeros(cell.totnsegs)
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 294, __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_cell, __pyx_n_s_totnsegs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
-    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
-    if (likely(__pyx_t_4)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
-      __Pyx_INCREF(__pyx_t_4);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_3, function);
-    }
-  }
-  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 294, __pyx_L1_error)
-  __pyx_t_7 = ((PyArrayObject *)__pyx_t_1);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lengthvec.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_lengthvec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_lengthvec.rcbuffer->pybuffer.buf = NULL;
-      __PYX_ERR(0, 294, __pyx_L1_error)
-    } else {__pyx_pybuffernd_lengthvec.diminfo[0].strides = __pyx_pybuffernd_lengthvec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lengthvec.diminfo[0].shape = __pyx_pybuffernd_lengthvec.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_7 = 0;
-  __pyx_v_lengthvec = ((PyArrayObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
-
-  /* "LFPy/run_simulation.pyx":296
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] lengthvec = np.zeros(cell.totnsegs)
- * 
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] xstartvec = np.zeros(cell.totnsegs)             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] xendvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] ystartvec = np.zeros(cell.totnsegs)
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_totnsegs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
-    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
-    if (likely(__pyx_t_4)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
-      __Pyx_INCREF(__pyx_t_4);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_2, function);
-    }
-  }
-  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 296, __pyx_L1_error)
-  __pyx_t_8 = ((PyArrayObject *)__pyx_t_1);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xstartvec.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_xstartvec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_xstartvec.rcbuffer->pybuffer.buf = NULL;
-      __PYX_ERR(0, 296, __pyx_L1_error)
-    } else {__pyx_pybuffernd_xstartvec.diminfo[0].strides = __pyx_pybuffernd_xstartvec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xstartvec.diminfo[0].shape = __pyx_pybuffernd_xstartvec.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_8 = 0;
-  __pyx_v_xstartvec = ((PyArrayObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
-
-  /* "LFPy/run_simulation.pyx":297
- * 
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] xstartvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] xendvec = np.zeros(cell.totnsegs)             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] ystartvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] yendvec = np.zeros(cell.totnsegs)
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __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_cell, __pyx_n_s_totnsegs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
-    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
-    if (likely(__pyx_t_4)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
-      __Pyx_INCREF(__pyx_t_4);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_3, function);
-    }
-  }
-  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 297, __pyx_L1_error)
-  __pyx_t_9 = ((PyArrayObject *)__pyx_t_1);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xendvec.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_xendvec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_xendvec.rcbuffer->pybuffer.buf = NULL;
-      __PYX_ERR(0, 297, __pyx_L1_error)
-    } else {__pyx_pybuffernd_xendvec.diminfo[0].strides = __pyx_pybuffernd_xendvec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xendvec.diminfo[0].shape = __pyx_pybuffernd_xendvec.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_9 = 0;
-  __pyx_v_xendvec = ((PyArrayObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
-
-  /* "LFPy/run_simulation.pyx":298
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] xstartvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] xendvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] ystartvec = np.zeros(cell.totnsegs)             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] yendvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] zstartvec = np.zeros(cell.totnsegs)
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_totnsegs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
-    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
-    if (likely(__pyx_t_4)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
-      __Pyx_INCREF(__pyx_t_4);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_2, function);
-    }
-  }
-  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 298, __pyx_L1_error)
-  __pyx_t_10 = ((PyArrayObject *)__pyx_t_1);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ystartvec.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_ystartvec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ystartvec.rcbuffer->pybuffer.buf = NULL;
-      __PYX_ERR(0, 298, __pyx_L1_error)
-    } else {__pyx_pybuffernd_ystartvec.diminfo[0].strides = __pyx_pybuffernd_ystartvec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ystartvec.diminfo[0].shape = __pyx_pybuffernd_ystartvec.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_10 = 0;
-  __pyx_v_ystartvec = ((PyArrayObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
-
-  /* "LFPy/run_simulation.pyx":299
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] xendvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] ystartvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] yendvec = np.zeros(cell.totnsegs)             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] zstartvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] zendvec = np.zeros(cell.totnsegs)
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 299, __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_cell, __pyx_n_s_totnsegs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
-    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
-    if (likely(__pyx_t_4)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
-      __Pyx_INCREF(__pyx_t_4);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_3, function);
-    }
-  }
-  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 299, __pyx_L1_error)
-  __pyx_t_11 = ((PyArrayObject *)__pyx_t_1);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_yendvec.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_yendvec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_yendvec.rcbuffer->pybuffer.buf = NULL;
-      __PYX_ERR(0, 299, __pyx_L1_error)
-    } else {__pyx_pybuffernd_yendvec.diminfo[0].strides = __pyx_pybuffernd_yendvec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_yendvec.diminfo[0].shape = __pyx_pybuffernd_yendvec.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_11 = 0;
-  __pyx_v_yendvec = ((PyArrayObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
-
-  /* "LFPy/run_simulation.pyx":300
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] ystartvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] yendvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] zstartvec = np.zeros(cell.totnsegs)             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] zendvec = np.zeros(cell.totnsegs)
- * 
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_totnsegs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
-    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
-    if (likely(__pyx_t_4)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
-      __Pyx_INCREF(__pyx_t_4);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_2, function);
-    }
-  }
-  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 300, __pyx_L1_error)
-  __pyx_t_12 = ((PyArrayObject *)__pyx_t_1);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_zstartvec.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_zstartvec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_zstartvec.rcbuffer->pybuffer.buf = NULL;
-      __PYX_ERR(0, 300, __pyx_L1_error)
-    } else {__pyx_pybuffernd_zstartvec.diminfo[0].strides = __pyx_pybuffernd_zstartvec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_zstartvec.diminfo[0].shape = __pyx_pybuffernd_zstartvec.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_12 = 0;
-  __pyx_v_zstartvec = ((PyArrayObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
-
-  /* "LFPy/run_simulation.pyx":301
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] yendvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] zstartvec = np.zeros(cell.totnsegs)
- *     cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] zendvec = np.zeros(cell.totnsegs)             # <<<<<<<<<<<<<<
- * 
- *     cdef DTYPE_t gsen2, secL
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __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_cell, __pyx_n_s_totnsegs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = NULL;
-  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
-    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
-    if (likely(__pyx_t_4)) {
-      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
-      __Pyx_INCREF(__pyx_t_4);
-      __Pyx_INCREF(function);
-      __Pyx_DECREF_SET(__pyx_t_3, function);
-    }
-  }
-  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 301, __pyx_L1_error)
-  __pyx_t_13 = ((PyArrayObject *)__pyx_t_1);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_zendvec.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_zendvec = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_zendvec.rcbuffer->pybuffer.buf = NULL;
-      __PYX_ERR(0, 301, __pyx_L1_error)
-    } else {__pyx_pybuffernd_zendvec.diminfo[0].strides = __pyx_pybuffernd_zendvec.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_zendvec.diminfo[0].shape = __pyx_pybuffernd_zendvec.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_13 = 0;
-  __pyx_v_zendvec = ((PyArrayObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
-
-  /* "LFPy/run_simulation.pyx":310
- * 
- * 
- *     counter = 0             # <<<<<<<<<<<<<<
- * 
- *     #loop over all segments
- */
-  __pyx_v_counter = 0;
-
-  /* "LFPy/run_simulation.pyx":313
- * 
- *     #loop over all segments
- *     for sec in cell.allseclist:             # <<<<<<<<<<<<<<
- *         n3d = int(neuron.h.n3d())
- *         nseg = sec.nseg
- */
-  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_allseclist); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
-    __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_14 = 0;
-    __pyx_t_15 = NULL;
-  } else {
-    __pyx_t_14 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_15 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 313, __pyx_L1_error)
-  }
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  for (;;) {
-    if (likely(!__pyx_t_15)) {
-      if (likely(PyList_CheckExact(__pyx_t_3))) {
-        if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_3)) break;
-        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 313, __pyx_L1_error)
-        #else
-        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        #endif
-      } else {
-        if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
-        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 313, __pyx_L1_error)
-        #else
-        __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        #endif
-      }
-    } else {
-      __pyx_t_1 = __pyx_t_15(__pyx_t_3);
-      if (unlikely(!__pyx_t_1)) {
-        PyObject* exc_type = PyErr_Occurred();
-        if (exc_type) {
-          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
-          else __PYX_ERR(0, 313, __pyx_L1_error)
-        }
-        break;
-      }
-      __Pyx_GOTREF(__pyx_t_1);
-    }
-    __Pyx_XDECREF_SET(__pyx_v_sec, __pyx_t_1);
-    __pyx_t_1 = 0;
-
-    /* "LFPy/run_simulation.pyx":314
- *     #loop over all segments
- *     for sec in cell.allseclist:
- *         n3d = int(neuron.h.n3d())             # <<<<<<<<<<<<<<
- *         nseg = sec.nseg
- *         gsen2 = 1./2/nseg
- */
-    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_neuron); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 314, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_n3d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = NULL;
-    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
-      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
-      if (likely(__pyx_t_4)) {
-        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
-        __Pyx_INCREF(__pyx_t_4);
-        __Pyx_INCREF(function);
-        __Pyx_DECREF_SET(__pyx_t_2, function);
-      }
-    }
-    __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
-    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_16 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_16 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 314, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_v_n3d = __pyx_t_16;
-
-    /* "LFPy/run_simulation.pyx":315
- *     for sec in cell.allseclist:
- *         n3d = int(neuron.h.n3d())
- *         nseg = sec.nseg             # <<<<<<<<<<<<<<
- *         gsen2 = 1./2/nseg
- *         secL = sec.L
- */
-    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sec, __pyx_n_s_nseg); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_16 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_16 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 315, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_v_nseg = __pyx_t_16;
-
-    /* "LFPy/run_simulation.pyx":316
- *         n3d = int(neuron.h.n3d())
- *         nseg = sec.nseg
- *         gsen2 = 1./2/nseg             # <<<<<<<<<<<<<<
- *         secL = sec.L
- *         if n3d > 0:
- */
-    __pyx_t_17 = (1. / 2.0);
-    if (unlikely(__pyx_v_nseg == 0)) {
-      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
-      __PYX_ERR(0, 316, __pyx_L1_error)
-    }
-    __pyx_v_gsen2 = (__pyx_t_17 / ((double)__pyx_v_nseg));
-
-    /* "LFPy/run_simulation.pyx":317
- *         nseg = sec.nseg
- *         gsen2 = 1./2/nseg
- *         secL = sec.L             # <<<<<<<<<<<<<<
- *         if n3d > 0:
- *             #create interpolation objects for the xyz pt3d info:
- */
-    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sec, __pyx_n_s_L); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_18 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 317, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_v_secL = __pyx_t_18;
-
-    /* "LFPy/run_simulation.pyx":318
- *         gsen2 = 1./2/nseg
- *         secL = sec.L
- *         if n3d > 0:             # <<<<<<<<<<<<<<
- *             #create interpolation objects for the xyz pt3d info:
- *             L = np.zeros(n3d)
- */
-    __pyx_t_19 = ((__pyx_v_n3d > 0) != 0);
-    if (__pyx_t_19) {
-
-      /* "LFPy/run_simulation.pyx":320
- *         if n3d > 0:
- *             #create interpolation objects for the xyz pt3d info:
- *             L = np.zeros(n3d)             # <<<<<<<<<<<<<<
- *             x = np.zeros(n3d)
- *             y = np.zeros(n3d)
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __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_ERR(0, 320, __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_n3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_20 = NULL;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
-        __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_4);
-        if (likely(__pyx_t_20)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
-          __Pyx_INCREF(__pyx_t_20);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_4, function);
-        }
-      }
-      __pyx_t_2 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_20, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1);
-      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 320, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 320, __pyx_L1_error)
-      __pyx_t_21 = ((PyArrayObject *)__pyx_t_2);
-      {
-        __Pyx_BufFmt_StackElem __pyx_stack[1];
-        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_L.rcbuffer->pybuffer);
-        __pyx_t_22 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_L.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
-        if (unlikely(__pyx_t_22 < 0)) {
-          PyErr_Fetch(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25);
-          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_L.rcbuffer->pybuffer, (PyObject*)__pyx_v_L, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-            Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_24); Py_XDECREF(__pyx_t_25);
-            __Pyx_RaiseBufferFallbackError();
-          } else {
-            PyErr_Restore(__pyx_t_23, __pyx_t_24, __pyx_t_25);
-          }
-          __pyx_t_23 = __pyx_t_24 = __pyx_t_25 = 0;
-        }
-        __pyx_pybuffernd_L.diminfo[0].strides = __pyx_pybuffernd_L.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_L.diminfo[0].shape = __pyx_pybuffernd_L.rcbuffer->pybuffer.shape[0];
-        if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 320, __pyx_L1_error)
-      }
-      __pyx_t_21 = 0;
-      __Pyx_XDECREF_SET(__pyx_v_L, ((PyArrayObject *)__pyx_t_2));
-      __pyx_t_2 = 0;
-
-      /* "LFPy/run_simulation.pyx":321
- *             #create interpolation objects for the xyz pt3d info:
- *             L = np.zeros(n3d)
- *             x = np.zeros(n3d)             # <<<<<<<<<<<<<<
- *             y = np.zeros(n3d)
- *             z = np.zeros(n3d)
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __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_n3d); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_20 = NULL;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
-        __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_1);
-        if (likely(__pyx_t_20)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-          __Pyx_INCREF(__pyx_t_20);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_1, function);
-        }
-      }
-      __pyx_t_2 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_20, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
-      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 321, __pyx_L1_error)
-      __pyx_t_21 = ((PyArrayObject *)__pyx_t_2);
-      {
-        __Pyx_BufFmt_StackElem __pyx_stack[1];
-        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
-        __pyx_t_22 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
-        if (unlikely(__pyx_t_22 < 0)) {
-          PyErr_Fetch(&__pyx_t_25, &__pyx_t_24, &__pyx_t_23);
-          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-            Py_XDECREF(__pyx_t_25); Py_XDECREF(__pyx_t_24); Py_XDECREF(__pyx_t_23);
-            __Pyx_RaiseBufferFallbackError();
-          } else {
-            PyErr_Restore(__pyx_t_25, __pyx_t_24, __pyx_t_23);
-          }
-          __pyx_t_25 = __pyx_t_24 = __pyx_t_23 = 0;
-        }
-        __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0];
-        if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 321, __pyx_L1_error)
-      }
-      __pyx_t_21 = 0;
-      __Pyx_XDECREF_SET(__pyx_v_x, ((PyArrayObject *)__pyx_t_2));
-      __pyx_t_2 = 0;
-
-      /* "LFPy/run_simulation.pyx":322
- *             L = np.zeros(n3d)
- *             x = np.zeros(n3d)
- *             y = np.zeros(n3d)             # <<<<<<<<<<<<<<
- *             z = np.zeros(n3d)
- *             for i in range(n3d):
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __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_ERR(0, 322, __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_n3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_20 = NULL;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
-        __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_4);
-        if (likely(__pyx_t_20)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
-          __Pyx_INCREF(__pyx_t_20);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_4, function);
-        }
-      }
-      __pyx_t_2 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_20, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1);
-      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 322, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 322, __pyx_L1_error)
-      __pyx_t_21 = ((PyArrayObject *)__pyx_t_2);
-      {
-        __Pyx_BufFmt_StackElem __pyx_stack[1];
-        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
-        __pyx_t_22 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
-        if (unlikely(__pyx_t_22 < 0)) {
-          PyErr_Fetch(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25);
-          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-            Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_24); Py_XDECREF(__pyx_t_25);
-            __Pyx_RaiseBufferFallbackError();
-          } else {
-            PyErr_Restore(__pyx_t_23, __pyx_t_24, __pyx_t_25);
-          }
-          __pyx_t_23 = __pyx_t_24 = __pyx_t_25 = 0;
-        }
-        __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0];
-        if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 322, __pyx_L1_error)
-      }
-      __pyx_t_21 = 0;
-      __Pyx_XDECREF_SET(__pyx_v_y, ((PyArrayObject *)__pyx_t_2));
-      __pyx_t_2 = 0;
-
-      /* "LFPy/run_simulation.pyx":323
- *             x = np.zeros(n3d)
- *             y = np.zeros(n3d)
- *             z = np.zeros(n3d)             # <<<<<<<<<<<<<<
- *             for i in range(n3d):
- *                 L[i] = neuron.h.arc3d(i)
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 323, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __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_n3d); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 323, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_20 = NULL;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
-        __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_1);
-        if (likely(__pyx_t_20)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-          __Pyx_INCREF(__pyx_t_20);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_1, function);
-        }
-      }
-      __pyx_t_2 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_20, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
-      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 323, __pyx_L1_error)
-      __pyx_t_21 = ((PyArrayObject *)__pyx_t_2);
-      {
-        __Pyx_BufFmt_StackElem __pyx_stack[1];
-        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_z.rcbuffer->pybuffer);
-        __pyx_t_22 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_z.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
-        if (unlikely(__pyx_t_22 < 0)) {
-          PyErr_Fetch(&__pyx_t_25, &__pyx_t_24, &__pyx_t_23);
-          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_z.rcbuffer->pybuffer, (PyObject*)__pyx_v_z, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-            Py_XDECREF(__pyx_t_25); Py_XDECREF(__pyx_t_24); Py_XDECREF(__pyx_t_23);
-            __Pyx_RaiseBufferFallbackError();
-          } else {
-            PyErr_Restore(__pyx_t_25, __pyx_t_24, __pyx_t_23);
-          }
-          __pyx_t_25 = __pyx_t_24 = __pyx_t_23 = 0;
-        }
-        __pyx_pybuffernd_z.diminfo[0].strides = __pyx_pybuffernd_z.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_z.diminfo[0].shape = __pyx_pybuffernd_z.rcbuffer->pybuffer.shape[0];
-        if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 323, __pyx_L1_error)
-      }
-      __pyx_t_21 = 0;
-      __Pyx_XDECREF_SET(__pyx_v_z, ((PyArrayObject *)__pyx_t_2));
-      __pyx_t_2 = 0;
-
-      /* "LFPy/run_simulation.pyx":324
- *             y = np.zeros(n3d)
- *             z = np.zeros(n3d)
- *             for i in range(n3d):             # <<<<<<<<<<<<<<
- *                 L[i] = neuron.h.arc3d(i)
- *                 x[i] = neuron.h.x3d(i)
- */
-      __pyx_t_16 = __pyx_v_n3d;
-      __pyx_t_26 = __pyx_t_16;
-      for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
-        __pyx_v_i = __pyx_t_27;
-
-        /* "LFPy/run_simulation.pyx":325
- *             z = np.zeros(n3d)
- *             for i in range(n3d):
- *                 L[i] = neuron.h.arc3d(i)             # <<<<<<<<<<<<<<
- *                 x[i] = neuron.h.x3d(i)
- *                 y[i] = neuron.h.y3d(i)
- */
-        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_neuron); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 325, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_arc3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __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_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 325, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_20 = NULL;
-        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-          __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_1);
-          if (likely(__pyx_t_20)) {
-            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-            __Pyx_INCREF(__pyx_t_20);
-            __Pyx_INCREF(function);
-            __Pyx_DECREF_SET(__pyx_t_1, function);
-          }
-        }
-        __pyx_t_2 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_20, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
-        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_18 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 325, __pyx_L1_error)
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_28 = __pyx_v_i;
-        __pyx_t_22 = -1;
-        if (__pyx_t_28 < 0) {
-          __pyx_t_22 = 0;
-        } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_L.diminfo[0].shape)) __pyx_t_22 = 0;
-        if (unlikely(__pyx_t_22 != -1)) {
-          __Pyx_RaiseBufferIndexError(__pyx_t_22);
-          __PYX_ERR(0, 325, __pyx_L1_error)
-        }
-        *__Pyx_BufPtrStrided1d(__pyx_t_4LFPy_14run_simulation_DTYPE_t *, __pyx_pybuffernd_L.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_L.diminfo[0].strides) = __pyx_t_18;
-
-        /* "LFPy/run_simulation.pyx":326
- *             for i in range(n3d):
- *                 L[i] = neuron.h.arc3d(i)
- *                 x[i] = neuron.h.x3d(i)             # <<<<<<<<<<<<<<
- *                 y[i] = neuron.h.y3d(i)
- *                 z[i] = neuron.h.z3d(i)
- */
-        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_neuron); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_x3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __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_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_20 = NULL;
-        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-          __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_1);
-          if (likely(__pyx_t_20)) {
-            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-            __Pyx_INCREF(__pyx_t_20);
-            __Pyx_INCREF(function);
-            __Pyx_DECREF_SET(__pyx_t_1, function);
-          }
-        }
-        __pyx_t_2 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_20, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
-        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 326, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_18 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L1_error)
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_29 = __pyx_v_i;
-        __pyx_t_22 = -1;
-        if (__pyx_t_29 < 0) {
-          __pyx_t_22 = 0;
-        } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_22 = 0;
-        if (unlikely(__pyx_t_22 != -1)) {
-          __Pyx_RaiseBufferIndexError(__pyx_t_22);
-          __PYX_ERR(0, 326, __pyx_L1_error)
-        }
-        *__Pyx_BufPtrStrided1d(__pyx_t_4LFPy_14run_simulation_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_x.diminfo[0].strides) = __pyx_t_18;
-
-        /* "LFPy/run_simulation.pyx":327
- *                 L[i] = neuron.h.arc3d(i)
- *                 x[i] = neuron.h.x3d(i)
- *                 y[i] = neuron.h.y3d(i)             # <<<<<<<<<<<<<<
- *                 z[i] = neuron.h.z3d(i)
- * 
- */
-        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_neuron); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 327, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_y3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __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_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 327, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_20 = NULL;
-        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-          __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_1);
-          if (likely(__pyx_t_20)) {
-            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-            __Pyx_INCREF(__pyx_t_20);
-            __Pyx_INCREF(function);
-            __Pyx_DECREF_SET(__pyx_t_1, function);
-          }
-        }
-        __pyx_t_2 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_20, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
-        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_18 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 327, __pyx_L1_error)
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_30 = __pyx_v_i;
-        __pyx_t_22 = -1;
-        if (__pyx_t_30 < 0) {
-          __pyx_t_22 = 0;
-        } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_y.diminfo[0].shape)) __pyx_t_22 = 0;
-        if (unlikely(__pyx_t_22 != -1)) {
-          __Pyx_RaiseBufferIndexError(__pyx_t_22);
-          __PYX_ERR(0, 327, __pyx_L1_error)
-        }
-        *__Pyx_BufPtrStrided1d(__pyx_t_4LFPy_14run_simulation_DTYPE_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_y.diminfo[0].strides) = __pyx_t_18;
-
-        /* "LFPy/run_simulation.pyx":328
- *                 x[i] = neuron.h.x3d(i)
- *                 y[i] = neuron.h.y3d(i)
- *                 z[i] = neuron.h.z3d(i)             # <<<<<<<<<<<<<<
- * 
- *             #normalize as seg.x [0, 1]
- */
-        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_neuron); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 328, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_z3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __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_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 328, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_20 = NULL;
-        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
-          __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_1);
-          if (likely(__pyx_t_20)) {
-            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
-            __Pyx_INCREF(__pyx_t_20);
-            __Pyx_INCREF(function);
-            __Pyx_DECREF_SET(__pyx_t_1, function);
-          }
-        }
-        __pyx_t_2 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_20, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
-        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 328, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_18 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 328, __pyx_L1_error)
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_31 = __pyx_v_i;
-        __pyx_t_22 = -1;
-        if (__pyx_t_31 < 0) {
-          __pyx_t_22 = 0;
-        } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_z.diminfo[0].shape)) __pyx_t_22 = 0;
-        if (unlikely(__pyx_t_22 != -1)) {
-          __Pyx_RaiseBufferIndexError(__pyx_t_22);
-          __PYX_ERR(0, 328, __pyx_L1_error)
-        }
-        *__Pyx_BufPtrStrided1d(__pyx_t_4LFPy_14run_simulation_DTYPE_t *, __pyx_pybuffernd_z.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_z.diminfo[0].strides) = __pyx_t_18;
-      }
-
-      /* "LFPy/run_simulation.pyx":331
- * 
- *             #normalize as seg.x [0, 1]
- *             L /= secL             # <<<<<<<<<<<<<<
- * 
- *             #temporary store position of segment midpoints
- */
-      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_secL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_1 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_L), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 331, __pyx_L1_error)
-      __pyx_t_21 = ((PyArrayObject *)__pyx_t_1);
-      {
-        __Pyx_BufFmt_StackElem __pyx_stack[1];
-        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_L.rcbuffer->pybuffer);
-        __pyx_t_22 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_L.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
-        if (unlikely(__pyx_t_22 < 0)) {
-          PyErr_Fetch(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25);
-          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_L.rcbuffer->pybuffer, (PyObject*)__pyx_v_L, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-            Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_24); Py_XDECREF(__pyx_t_25);
-            __Pyx_RaiseBufferFallbackError();
-          } else {
-            PyErr_Restore(__pyx_t_23, __pyx_t_24, __pyx_t_25);
-          }
-          __pyx_t_23 = __pyx_t_24 = __pyx_t_25 = 0;
-        }
-        __pyx_pybuffernd_L.diminfo[0].strides = __pyx_pybuffernd_L.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_L.diminfo[0].shape = __pyx_pybuffernd_L.rcbuffer->pybuffer.shape[0];
-        if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 331, __pyx_L1_error)
-      }
-      __pyx_t_21 = 0;
-      __Pyx_DECREF_SET(__pyx_v_L, ((PyArrayObject *)__pyx_t_1));
-      __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":334
- * 
- *             #temporary store position of segment midpoints
- *             segx = np.zeros(nseg)             # <<<<<<<<<<<<<<
- *             i = 0
- *             for seg in sec:
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __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_ERR(0, 334, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nseg); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_20 = NULL;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
-        __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_4);
-        if (likely(__pyx_t_20)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
-          __Pyx_INCREF(__pyx_t_20);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_4, function);
-        }
-      }
-      __pyx_t_1 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_20, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2);
-      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 334, __pyx_L1_error)
-      __pyx_t_21 = ((PyArrayObject *)__pyx_t_1);
-      {
-        __Pyx_BufFmt_StackElem __pyx_stack[1];
-        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_segx.rcbuffer->pybuffer);
-        __pyx_t_22 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_segx.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
-        if (unlikely(__pyx_t_22 < 0)) {
-          PyErr_Fetch(&__pyx_t_25, &__pyx_t_24, &__pyx_t_23);
-          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_segx.rcbuffer->pybuffer, (PyObject*)__pyx_v_segx, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-            Py_XDECREF(__pyx_t_25); Py_XDECREF(__pyx_t_24); Py_XDECREF(__pyx_t_23);
-            __Pyx_RaiseBufferFallbackError();
-          } else {
-            PyErr_Restore(__pyx_t_25, __pyx_t_24, __pyx_t_23);
-          }
-          __pyx_t_25 = __pyx_t_24 = __pyx_t_23 = 0;
-        }
-        __pyx_pybuffernd_segx.diminfo[0].strides = __pyx_pybuffernd_segx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_segx.diminfo[0].shape = __pyx_pybuffernd_segx.rcbuffer->pybuffer.shape[0];
-        if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 334, __pyx_L1_error)
-      }
-      __pyx_t_21 = 0;
-      __Pyx_XDECREF_SET(__pyx_v_segx, ((PyArrayObject *)__pyx_t_1));
-      __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":335
- *             #temporary store position of segment midpoints
- *             segx = np.zeros(nseg)
- *             i = 0             # <<<<<<<<<<<<<<
- *             for seg in sec:
- *                 segx[i] = seg.x
- */
-      __pyx_v_i = 0;
-
-      /* "LFPy/run_simulation.pyx":336
- *             segx = np.zeros(nseg)
- *             i = 0
- *             for seg in sec:             # <<<<<<<<<<<<<<
- *                 segx[i] = seg.x
- *                 i += 1
- */
-      if (likely(PyList_CheckExact(__pyx_v_sec)) || PyTuple_CheckExact(__pyx_v_sec)) {
-        __pyx_t_1 = __pyx_v_sec; __Pyx_INCREF(__pyx_t_1); __pyx_t_32 = 0;
-        __pyx_t_33 = NULL;
-      } else {
-        __pyx_t_32 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_33 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 336, __pyx_L1_error)
-      }
-      for (;;) {
-        if (likely(!__pyx_t_33)) {
-          if (likely(PyList_CheckExact(__pyx_t_1))) {
-            if (__pyx_t_32 >= PyList_GET_SIZE(__pyx_t_1)) break;
-            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-            __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_32); __Pyx_INCREF(__pyx_t_4); __pyx_t_32++; if (unlikely(0 < 0)) __PYX_ERR(0, 336, __pyx_L1_error)
-            #else
-            __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_32); __pyx_t_32++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_4);
-            #endif
-          } else {
-            if (__pyx_t_32 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-            __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_32); __Pyx_INCREF(__pyx_t_4); __pyx_t_32++; if (unlikely(0 < 0)) __PYX_ERR(0, 336, __pyx_L1_error)
-            #else
-            __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_32); __pyx_t_32++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_4);
-            #endif
-          }
-        } else {
-          __pyx_t_4 = __pyx_t_33(__pyx_t_1);
-          if (unlikely(!__pyx_t_4)) {
-            PyObject* exc_type = PyErr_Occurred();
-            if (exc_type) {
-              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
-              else __PYX_ERR(0, 336, __pyx_L1_error)
-            }
-            break;
-          }
-          __Pyx_GOTREF(__pyx_t_4);
-        }
-        __Pyx_XDECREF_SET(__pyx_v_seg, __pyx_t_4);
-        __pyx_t_4 = 0;
-
-        /* "LFPy/run_simulation.pyx":337
- *             i = 0
- *             for seg in sec:
- *                 segx[i] = seg.x             # <<<<<<<<<<<<<<
- *                 i += 1
- * 
- */
-        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_seg, __pyx_n_s_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 337, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_18 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 337, __pyx_L1_error)
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __pyx_t_16 = __pyx_v_i;
-        __pyx_t_22 = -1;
-        if (__pyx_t_16 < 0) {
-          __pyx_t_22 = 0;
-        } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_segx.diminfo[0].shape)) __pyx_t_22 = 0;
-        if (unlikely(__pyx_t_22 != -1)) {
-          __Pyx_RaiseBufferIndexError(__pyx_t_22);
-          __PYX_ERR(0, 337, __pyx_L1_error)
-        }
-        *__Pyx_BufPtrStrided1d(__pyx_t_4LFPy_14run_simulation_DTYPE_t *, __pyx_pybuffernd_segx.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_segx.diminfo[0].strides) = __pyx_t_18;
-
-        /* "LFPy/run_simulation.pyx":338
- *             for seg in sec:
- *                 segx[i] = seg.x
- *                 i += 1             # <<<<<<<<<<<<<<
- * 
- *             #can't be >0 which may happen due to NEURON->Python float transfer:
- */
-        __pyx_v_i = (__pyx_v_i + 1);
-
-        /* "LFPy/run_simulation.pyx":336
- *             segx = np.zeros(nseg)
- *             i = 0
- *             for seg in sec:             # <<<<<<<<<<<<<<
- *                 segx[i] = seg.x
- *                 i += 1
- */
-      }
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":343
- *             #segx0 = (segx - gsen2).round(decimals=6)
- *             #segx1 = (segx + gsen2).round(decimals=6)
- *             segx0 = segx - gsen2             # <<<<<<<<<<<<<<
- *             segx1 = segx + gsen2
- * 
- */
-      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_gsen2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_4 = PyNumber_Subtract(((PyObject *)__pyx_v_segx), __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __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_ERR(0, 343, __pyx_L1_error)
-      __pyx_t_21 = ((PyArrayObject *)__pyx_t_4);
-      {
-        __Pyx_BufFmt_StackElem __pyx_stack[1];
-        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_segx0.rcbuffer->pybuffer);
-        __pyx_t_22 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_segx0.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
-        if (unlikely(__pyx_t_22 < 0)) {
-          PyErr_Fetch(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25);
-          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_segx0.rcbuffer->pybuffer, (PyObject*)__pyx_v_segx0, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
-            Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_24); Py_XDECREF(__pyx_t_25);
-            __Pyx_RaiseBufferFallbackError();
-          } else {
-            PyErr_Restore(__pyx_t_23, __pyx_t_24, __pyx_t_25);
-          }
-          __pyx_t_23 = __pyx_t_24 = __pyx_t_25 = 0;
-        }
-        __pyx_pybuffernd_segx0.diminfo[0].strides = __pyx_pybuffernd_segx0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_segx0.diminfo[0].shape = __pyx_pybuffernd_segx0.rcbuffer->pybuffer.shape[0];
-        if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 343, __pyx_L1_error)
-      }
-      __pyx_t_21 = 0;
-      __Pyx_XDECREF_SET(__pyx_v_segx0, ((PyArrayObject *)__pyx_t_4));
-      __pyx_t_4 = 0;
-
-      /* "LFPy/run_simulation.pyx":344
- *             #segx1 = (segx + gsen2).round(decimals=6)
- *             segx0 = segx - gsen2
- *             segx1 = segx + gsen2             # <<<<<<<<<<<<<<
- * 
- *             #fill vectors with interpolated coordinates of start and end points
- */
-      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_gsen2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 344, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_segx), __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 344, __pyx_L1_error)
-      __pyx_t_21 = ((PyArrayObject *)__pyx_t_1);
-      {
-        __Pyx_BufFmt_StackElem __pyx_stack[1];
-        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_segx1.rcbuffer->pybuffer);
-        __pyx_t_22 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_segx1.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
-        if (unlikely(__pyx_t_22 < 0)) {
-          PyErr_Fetch(&__pyx_t_25, &__pyx_t_24, &__pyx_t_23);
-          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_segx1.rcbuffer->pybuffer, (PyObject*)__pyx_v_segx1, &__Pyx_TypeInfo_nn___pyx_t_4LFPy_14run_simulation_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
-            Py_XDECREF(__pyx_t_25); Py_XDECREF(__pyx_t_24); Py_XDECREF(__pyx_t_23);
-            __Pyx_RaiseBufferFallbackError();
-          } else {
-            PyErr_Restore(__pyx_t_25, __pyx_t_24, __pyx_t_23);
-          }
-          __pyx_t_25 = __pyx_t_24 = __pyx_t_23 = 0;
-        }
-        __pyx_pybuffernd_segx1.diminfo[0].strides = __pyx_pybuffernd_segx1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_segx1.diminfo[0].shape = __pyx_pybuffernd_segx1.rcbuffer->pybuffer.shape[0];
-        if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 344, __pyx_L1_error)
-      }
-      __pyx_t_21 = 0;
-      __Pyx_XDECREF_SET(__pyx_v_segx1, ((PyArrayObject *)__pyx_t_1));
-      __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":347
- * 
- *             #fill vectors with interpolated coordinates of start and end points
- *             xstartvec[counter:counter+nseg] = np.interp(segx0, L, x)             # <<<<<<<<<<<<<<
- *             xendvec[counter:counter+nseg] = np.interp(segx1, L, x)
- * 
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_interp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_4 = NULL;
-      __pyx_t_22 = 0;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
-        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
-        if (likely(__pyx_t_4)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
-          __Pyx_INCREF(__pyx_t_4);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_2, function);
-          __pyx_t_22 = 1;
-        }
-      }
-      #if CYTHON_FAST_PYCALL
-      if (PyFunction_Check(__pyx_t_2)) {
-        PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_segx0), ((PyObject *)__pyx_v_L), ((PyObject *)__pyx_v_x)};
-        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_22, 3+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 347, __pyx_L1_error)
-        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_GOTREF(__pyx_t_1);
-      } else
-      #endif
-      #if CYTHON_FAST_PYCCALL
-      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
-        PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_segx0), ((PyObject *)__pyx_v_L), ((PyObject *)__pyx_v_x)};
-        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_22, 3+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 347, __pyx_L1_error)
-        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_GOTREF(__pyx_t_1);
-      } else
-      #endif
-      {
-        __pyx_t_20 = PyTuple_New(3+__pyx_t_22); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 347, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_20);
-        if (__pyx_t_4) {
-          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_4); __pyx_t_4 = NULL;
-        }
-        __Pyx_INCREF(((PyObject *)__pyx_v_segx0));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_segx0));
-        PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_22, ((PyObject *)__pyx_v_segx0));
-        __Pyx_INCREF(((PyObject *)__pyx_v_L));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_L));
-        PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_22, ((PyObject *)__pyx_v_L));
-        __Pyx_INCREF(((PyObject *)__pyx_v_x));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_x));
-        PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_22, ((PyObject *)__pyx_v_x));
-        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 347, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-      }
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_counter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_20 = PyInt_FromSsize_t((__pyx_v_counter + __pyx_v_nseg)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 347, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_20);
-      __pyx_t_4 = PySlice_New(__pyx_t_2, __pyx_t_20, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-      if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_xstartvec), __pyx_t_4, __pyx_t_1) < 0)) __PYX_ERR(0, 347, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":348
- *             #fill vectors with interpolated coordinates of start and end points
- *             xstartvec[counter:counter+nseg] = np.interp(segx0, L, x)
- *             xendvec[counter:counter+nseg] = np.interp(segx1, L, x)             # <<<<<<<<<<<<<<
- * 
- *             ystartvec[counter:counter+nseg] = np.interp(segx0, L, y)
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 348, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_interp); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 348, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_20);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_4 = NULL;
-      __pyx_t_22 = 0;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
-        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_20);
-        if (likely(__pyx_t_4)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
-          __Pyx_INCREF(__pyx_t_4);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_20, function);
-          __pyx_t_22 = 1;
-        }
-      }
-      #if CYTHON_FAST_PYCALL
-      if (PyFunction_Check(__pyx_t_20)) {
-        PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_segx1), ((PyObject *)__pyx_v_L), ((PyObject *)__pyx_v_x)};
-        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_22, 3+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error)
-        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_GOTREF(__pyx_t_1);
-      } else
-      #endif
-      #if CYTHON_FAST_PYCCALL
-      if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
-        PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_segx1), ((PyObject *)__pyx_v_L), ((PyObject *)__pyx_v_x)};
-        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_22, 3+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error)
-        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_GOTREF(__pyx_t_1);
-      } else
-      #endif
-      {
-        __pyx_t_2 = PyTuple_New(3+__pyx_t_22); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_2);
-        if (__pyx_t_4) {
-          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
-        }
-        __Pyx_INCREF(((PyObject *)__pyx_v_segx1));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_segx1));
-        PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_22, ((PyObject *)__pyx_v_segx1));
-        __Pyx_INCREF(((PyObject *)__pyx_v_L));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_L));
-        PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_22, ((PyObject *)__pyx_v_L));
-        __Pyx_INCREF(((PyObject *)__pyx_v_x));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_x));
-        PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_22, ((PyObject *)__pyx_v_x));
-        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      }
-      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-      __pyx_t_20 = PyInt_FromSsize_t(__pyx_v_counter); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 348, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_20);
-      __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_counter + __pyx_v_nseg)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_4 = PySlice_New(__pyx_t_20, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 348, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_xendvec), __pyx_t_4, __pyx_t_1) < 0)) __PYX_ERR(0, 348, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":350
- *             xendvec[counter:counter+nseg] = np.interp(segx1, L, x)
- * 
- *             ystartvec[counter:counter+nseg] = np.interp(segx0, L, y)             # <<<<<<<<<<<<<<
- *             yendvec[counter:counter+nseg] = np.interp(segx1, L, y)
- * 
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 350, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_interp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_4 = NULL;
-      __pyx_t_22 = 0;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
-        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
-        if (likely(__pyx_t_4)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
-          __Pyx_INCREF(__pyx_t_4);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_2, function);
-          __pyx_t_22 = 1;
-        }
-      }
-      #if CYTHON_FAST_PYCALL
-      if (PyFunction_Check(__pyx_t_2)) {
-        PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_segx0), ((PyObject *)__pyx_v_L), ((PyObject *)__pyx_v_y)};
-        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_22, 3+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error)
-        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_GOTREF(__pyx_t_1);
-      } else
-      #endif
-      #if CYTHON_FAST_PYCCALL
-      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
-        PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_segx0), ((PyObject *)__pyx_v_L), ((PyObject *)__pyx_v_y)};
-        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_22, 3+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error)
-        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_GOTREF(__pyx_t_1);
-      } else
-      #endif
-      {
-        __pyx_t_20 = PyTuple_New(3+__pyx_t_22); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 350, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_20);
-        if (__pyx_t_4) {
-          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_4); __pyx_t_4 = NULL;
-        }
-        __Pyx_INCREF(((PyObject *)__pyx_v_segx0));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_segx0));
-        PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_22, ((PyObject *)__pyx_v_segx0));
-        __Pyx_INCREF(((PyObject *)__pyx_v_L));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_L));
-        PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_22, ((PyObject *)__pyx_v_L));
-        __Pyx_INCREF(((PyObject *)__pyx_v_y));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_y));
-        PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_22, ((PyObject *)__pyx_v_y));
-        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-      }
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_counter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_20 = PyInt_FromSsize_t((__pyx_v_counter + __pyx_v_nseg)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 350, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_20);
-      __pyx_t_4 = PySlice_New(__pyx_t_2, __pyx_t_20, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 350, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-      if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_ystartvec), __pyx_t_4, __pyx_t_1) < 0)) __PYX_ERR(0, 350, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":351
- * 
- *             ystartvec[counter:counter+nseg] = np.interp(segx0, L, y)
- *             yendvec[counter:counter+nseg] = np.interp(segx1, L, y)             # <<<<<<<<<<<<<<
- * 
- *             zstartvec[counter:counter+nseg] = np.interp(segx0, L, z)
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 351, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_interp); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 351, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_20);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_4 = NULL;
-      __pyx_t_22 = 0;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
-        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_20);
-        if (likely(__pyx_t_4)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
-          __Pyx_INCREF(__pyx_t_4);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_20, function);
-          __pyx_t_22 = 1;
-        }
-      }
-      #if CYTHON_FAST_PYCALL
-      if (PyFunction_Check(__pyx_t_20)) {
-        PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_segx1), ((PyObject *)__pyx_v_L), ((PyObject *)__pyx_v_y)};
-        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_22, 3+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error)
-        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_GOTREF(__pyx_t_1);
-      } else
-      #endif
-      #if CYTHON_FAST_PYCCALL
-      if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
-        PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_segx1), ((PyObject *)__pyx_v_L), ((PyObject *)__pyx_v_y)};
-        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_22, 3+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error)
-        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_GOTREF(__pyx_t_1);
-      } else
-      #endif
-      {
-        __pyx_t_2 = PyTuple_New(3+__pyx_t_22); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_2);
-        if (__pyx_t_4) {
-          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
-        }
-        __Pyx_INCREF(((PyObject *)__pyx_v_segx1));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_segx1));
-        PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_22, ((PyObject *)__pyx_v_segx1));
-        __Pyx_INCREF(((PyObject *)__pyx_v_L));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_L));
-        PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_22, ((PyObject *)__pyx_v_L));
-        __Pyx_INCREF(((PyObject *)__pyx_v_y));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_y));
-        PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_22, ((PyObject *)__pyx_v_y));
-        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      }
-      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-      __pyx_t_20 = PyInt_FromSsize_t(__pyx_v_counter); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 351, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_20);
-      __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_counter + __pyx_v_nseg)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_4 = PySlice_New(__pyx_t_20, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 351, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_yendvec), __pyx_t_4, __pyx_t_1) < 0)) __PYX_ERR(0, 351, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":353
- *             yendvec[counter:counter+nseg] = np.interp(segx1, L, y)
- * 
- *             zstartvec[counter:counter+nseg] = np.interp(segx0, L, z)             # <<<<<<<<<<<<<<
- *             zendvec[counter:counter+nseg] = np.interp(segx1, L, z)
- * 
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_interp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_4 = NULL;
-      __pyx_t_22 = 0;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
-        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
-        if (likely(__pyx_t_4)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
-          __Pyx_INCREF(__pyx_t_4);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_2, function);
-          __pyx_t_22 = 1;
-        }
-      }
-      #if CYTHON_FAST_PYCALL
-      if (PyFunction_Check(__pyx_t_2)) {
-        PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_segx0), ((PyObject *)__pyx_v_L), ((PyObject *)__pyx_v_z)};
-        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_22, 3+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error)
-        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_GOTREF(__pyx_t_1);
-      } else
-      #endif
-      #if CYTHON_FAST_PYCCALL
-      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
-        PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_segx0), ((PyObject *)__pyx_v_L), ((PyObject *)__pyx_v_z)};
-        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_22, 3+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error)
-        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_GOTREF(__pyx_t_1);
-      } else
-      #endif
-      {
-        __pyx_t_20 = PyTuple_New(3+__pyx_t_22); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 353, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_20);
-        if (__pyx_t_4) {
-          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_4); __pyx_t_4 = NULL;
-        }
-        __Pyx_INCREF(((PyObject *)__pyx_v_segx0));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_segx0));
-        PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_22, ((PyObject *)__pyx_v_segx0));
-        __Pyx_INCREF(((PyObject *)__pyx_v_L));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_L));
-        PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_22, ((PyObject *)__pyx_v_L));
-        __Pyx_INCREF(((PyObject *)__pyx_v_z));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_z));
-        PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_22, ((PyObject *)__pyx_v_z));
-        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-      }
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_counter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_20 = PyInt_FromSsize_t((__pyx_v_counter + __pyx_v_nseg)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 353, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_20);
-      __pyx_t_4 = PySlice_New(__pyx_t_2, __pyx_t_20, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-      if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_zstartvec), __pyx_t_4, __pyx_t_1) < 0)) __PYX_ERR(0, 353, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":354
- * 
- *             zstartvec[counter:counter+nseg] = np.interp(segx0, L, z)
- *             zendvec[counter:counter+nseg] = np.interp(segx1, L, z)             # <<<<<<<<<<<<<<
- * 
- *             #fill in values area, diam, length
- */
-      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_interp); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 354, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_20);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_4 = NULL;
-      __pyx_t_22 = 0;
-      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
-        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_20);
-        if (likely(__pyx_t_4)) {
-          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
-          __Pyx_INCREF(__pyx_t_4);
-          __Pyx_INCREF(function);
-          __Pyx_DECREF_SET(__pyx_t_20, function);
-          __pyx_t_22 = 1;
-        }
-      }
-      #if CYTHON_FAST_PYCALL
-      if (PyFunction_Check(__pyx_t_20)) {
-        PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_segx1), ((PyObject *)__pyx_v_L), ((PyObject *)__pyx_v_z)};
-        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_22, 3+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error)
-        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_GOTREF(__pyx_t_1);
-      } else
-      #endif
-      #if CYTHON_FAST_PYCCALL
-      if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
-        PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_segx1), ((PyObject *)__pyx_v_L), ((PyObject *)__pyx_v_z)};
-        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_22, 3+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error)
-        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __Pyx_GOTREF(__pyx_t_1);
-      } else
-      #endif
-      {
-        __pyx_t_2 = PyTuple_New(3+__pyx_t_22); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_2);
-        if (__pyx_t_4) {
-          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
-        }
-        __Pyx_INCREF(((PyObject *)__pyx_v_segx1));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_segx1));
-        PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_22, ((PyObject *)__pyx_v_segx1));
-        __Pyx_INCREF(((PyObject *)__pyx_v_L));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_L));
-        PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_22, ((PyObject *)__pyx_v_L));
-        __Pyx_INCREF(((PyObject *)__pyx_v_z));
-        __Pyx_GIVEREF(((PyObject *)__pyx_v_z));
-        PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_22, ((PyObject *)__pyx_v_z));
-        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      }
-      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-      __pyx_t_20 = PyInt_FromSsize_t(__pyx_v_counter); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 354, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_20);
-      __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_counter + __pyx_v_nseg)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_4 = PySlice_New(__pyx_t_20, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_zendvec), __pyx_t_4, __pyx_t_1) < 0)) __PYX_ERR(0, 354, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":357
- * 
- *             #fill in values area, diam, length
- *             for seg in sec:             # <<<<<<<<<<<<<<
- *                 areavec[counter] = neuron.h.area(seg.x)
- *                 diamvec[counter] = seg.diam
- */
-      if (likely(PyList_CheckExact(__pyx_v_sec)) || PyTuple_CheckExact(__pyx_v_sec)) {
-        __pyx_t_1 = __pyx_v_sec; __Pyx_INCREF(__pyx_t_1); __pyx_t_32 = 0;
-        __pyx_t_33 = NULL;
-      } else {
-        __pyx_t_32 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_33 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 357, __pyx_L1_error)
-      }
-      for (;;) {
-        if (likely(!__pyx_t_33)) {
-          if (likely(PyList_CheckExact(__pyx_t_1))) {
-            if (__pyx_t_32 >= PyList_GET_SIZE(__pyx_t_1)) break;
-            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-            __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_32); __Pyx_INCREF(__pyx_t_4); __pyx_t_32++; if (unlikely(0 < 0)) __PYX_ERR(0, 357, __pyx_L1_error)
-            #else
-            __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_32); __pyx_t_32++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_4);
-            #endif
-          } else {
-            if (__pyx_t_32 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-            __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_32); __Pyx_INCREF(__pyx_t_4); __pyx_t_32++; if (unlikely(0 < 0)) __PYX_ERR(0, 357, __pyx_L1_error)
-            #else
-            __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_32); __pyx_t_32++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error)
-            __Pyx_GOTREF(__pyx_t_4);
-            #endif
-          }
-        } else {
-          __pyx_t_4 = __pyx_t_33(__pyx_t_1);
-          if (unlikely(!__pyx_t_4)) {
-            PyObject* exc_type = PyErr_Occurred();
-            if (exc_type) {
-              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
-              else __PYX_ERR(0, 357, __pyx_L1_error)
-            }
-            break;
-          }
-          __Pyx_GOTREF(__pyx_t_4);
-        }
-        __Pyx_XDECREF_SET(__pyx_v_seg, __pyx_t_4);
-        __pyx_t_4 = 0;
-
-        /* "LFPy/run_simulation.pyx":358
- *             #fill in values area, diam, length
- *             for seg in sec:
- *                 areavec[counter] = neuron.h.area(seg.x)             # <<<<<<<<<<<<<<
- *                 diamvec[counter] = seg.diam
- *                 lengthvec[counter] = secL/nseg
- */
-        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_neuron); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 358, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_h); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 358, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_20);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_n_s_area); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 358, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-        __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_v_seg, __pyx_n_s_x); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 358, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_20);
-        __pyx_t_34 = NULL;
-        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
-          __pyx_t_34 = PyMethod_GET_SELF(__pyx_t_2);
-          if (likely(__pyx_t_34)) {
-            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
-            __Pyx_INCREF(__pyx_t_34);
-            __Pyx_INCREF(function);
-            __Pyx_DECREF_SET(__pyx_t_2, function);
-          }
-        }
-        __pyx_t_4 = (__pyx_t_34) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_34, __pyx_t_20) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_20);
-        __Pyx_XDECREF(__pyx_t_34); __pyx_t_34 = 0;
-        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_18 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 358, __pyx_L1_error)
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __pyx_t_26 = __pyx_v_counter;
-        __pyx_t_22 = -1;
-        if (__pyx_t_26 < 0) {
-          __pyx_t_22 = 0;
-        } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_areavec.diminfo[0].shape)) __pyx_t_22 = 0;
-        if (unlikely(__pyx_t_22 != -1)) {
-          __Pyx_RaiseBufferIndexError(__pyx_t_22);
-          __PYX_ERR(0, 358, __pyx_L1_error)
-        }
-        *__Pyx_BufPtrStrided1d(__pyx_t_4LFPy_14run_simulation_DTYPE_t *, __pyx_pybuffernd_areavec.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_areavec.diminfo[0].strides) = __pyx_t_18;
-
-        /* "LFPy/run_simulation.pyx":359
- *             for seg in sec:
- *                 areavec[counter] = neuron.h.area(seg.x)
- *                 diamvec[counter] = seg.diam             # <<<<<<<<<<<<<<
- *                 lengthvec[counter] = secL/nseg
- * 
- */
-        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_seg, __pyx_n_s_diam); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 359, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_18 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L1_error)
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __pyx_t_27 = __pyx_v_counter;
-        __pyx_t_22 = -1;
-        if (__pyx_t_27 < 0) {
-          __pyx_t_22 = 0;
-        } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_diamvec.diminfo[0].shape)) __pyx_t_22 = 0;
-        if (unlikely(__pyx_t_22 != -1)) {
-          __Pyx_RaiseBufferIndexError(__pyx_t_22);
-          __PYX_ERR(0, 359, __pyx_L1_error)
-        }
-        *__Pyx_BufPtrStrided1d(__pyx_t_4LFPy_14run_simulation_DTYPE_t *, __pyx_pybuffernd_diamvec.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_diamvec.diminfo[0].strides) = __pyx_t_18;
-
-        /* "LFPy/run_simulation.pyx":360
- *                 areavec[counter] = neuron.h.area(seg.x)
- *                 diamvec[counter] = seg.diam
- *                 lengthvec[counter] = secL/nseg             # <<<<<<<<<<<<<<
- * 
- *                 counter += 1
- */
-        if (unlikely(__pyx_v_nseg == 0)) {
-          PyErr_SetString(PyExc_ZeroDivisionError, "float division");
-          __PYX_ERR(0, 360, __pyx_L1_error)
-        }
-        __pyx_t_35 = __pyx_v_counter;
-        __pyx_t_22 = -1;
-        if (__pyx_t_35 < 0) {
-          __pyx_t_22 = 0;
-        } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_lengthvec.diminfo[0].shape)) __pyx_t_22 = 0;
-        if (unlikely(__pyx_t_22 != -1)) {
-          __Pyx_RaiseBufferIndexError(__pyx_t_22);
-          __PYX_ERR(0, 360, __pyx_L1_error)
-        }
-        *__Pyx_BufPtrStrided1d(__pyx_t_4LFPy_14run_simulation_DTYPE_t *, __pyx_pybuffernd_lengthvec.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_lengthvec.diminfo[0].strides) = (__pyx_v_secL / ((__pyx_t_4LFPy_14run_simulation_DTYPE_t)__pyx_v_nseg));
-
-        /* "LFPy/run_simulation.pyx":362
- *                 lengthvec[counter] = secL/nseg
- * 
- *                 counter += 1             # <<<<<<<<<<<<<<
- * 
- * 
- */
-        __pyx_v_counter = (__pyx_v_counter + 1);
-
-        /* "LFPy/run_simulation.pyx":357
- * 
- *             #fill in values area, diam, length
- *             for seg in sec:             # <<<<<<<<<<<<<<
- *                 areavec[counter] = neuron.h.area(seg.x)
- *                 diamvec[counter] = seg.diam
- */
-      }
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-      /* "LFPy/run_simulation.pyx":318
- *         gsen2 = 1./2/nseg
- *         secL = sec.L
- *         if n3d > 0:             # <<<<<<<<<<<<<<
- *             #create interpolation objects for the xyz pt3d info:
- *             L = np.zeros(n3d)
- */
-    }
-
-    /* "LFPy/run_simulation.pyx":313
- * 
- *     #loop over all segments
- *     for sec in cell.allseclist:             # <<<<<<<<<<<<<<
- *         n3d = int(neuron.h.n3d())
- *         nseg = sec.nseg
- */
-  }
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
-  /* "LFPy/run_simulation.pyx":366
- * 
- *     #set cell attributes
- *     cell.xstart = xstartvec             # <<<<<<<<<<<<<<
- *     cell.ystart = ystartvec
- *     cell.zstart = zstartvec
- */
-  if (__Pyx_PyObject_SetAttrStr(__pyx_v_cell, __pyx_n_s_xstart, ((PyObject *)__pyx_v_xstartvec)) < 0) __PYX_ERR(0, 366, __pyx_L1_error)
-
-  /* "LFPy/run_simulation.pyx":367
- *     #set cell attributes
- *     cell.xstart = xstartvec
- *     cell.ystart = ystartvec             # <<<<<<<<<<<<<<
- *     cell.zstart = zstartvec
- * 
- */
-  if (__Pyx_PyObject_SetAttrStr(__pyx_v_cell, __pyx_n_s_ystart, ((PyObject *)__pyx_v_ystartvec)) < 0) __PYX_ERR(0, 367, __pyx_L1_error)
-
-  /* "LFPy/run_simulation.pyx":368
- *     cell.xstart = xstartvec
- *     cell.ystart = ystartvec
- *     cell.zstart = zstartvec             # <<<<<<<<<<<<<<
- * 
- *     cell.xend = xendvec
- */
-  if (__Pyx_PyObject_SetAttrStr(__pyx_v_cell, __pyx_n_s_zstart, ((PyObject *)__pyx_v_zstartvec)) < 0) __PYX_ERR(0, 368, __pyx_L1_error)
-
-  /* "LFPy/run_simulation.pyx":370
- *     cell.zstart = zstartvec
- * 
- *     cell.xend = xendvec             # <<<<<<<<<<<<<<
- *     cell.yend = yendvec
- *     cell.zend = zendvec
- */
-  if (__Pyx_PyObject_SetAttrStr(__pyx_v_cell, __pyx_n_s_xend, ((PyObject *)__pyx_v_xendvec)) < 0) __PYX_ERR(0, 370, __pyx_L1_error)
-
-  /* "LFPy/run_simulation.pyx":371
- * 
- *     cell.xend = xendvec
- *     cell.yend = yendvec             # <<<<<<<<<<<<<<
- *     cell.zend = zendvec
- * 
- */
-  if (__Pyx_PyObject_SetAttrStr(__pyx_v_cell, __pyx_n_s_yend, ((PyObject *)__pyx_v_yendvec)) < 0) __PYX_ERR(0, 371, __pyx_L1_error)
-
-  /* "LFPy/run_simulation.pyx":372
- *     cell.xend = xendvec
- *     cell.yend = yendvec
- *     cell.zend = zendvec             # <<<<<<<<<<<<<<
- * 
- *     cell.area = areavec
- */
-  if (__Pyx_PyObject_SetAttrStr(__pyx_v_cell, __pyx_n_s_zend, ((PyObject *)__pyx_v_zendvec)) < 0) __PYX_ERR(0, 372, __pyx_L1_error)
-
-  /* "LFPy/run_simulation.pyx":374
- *     cell.zend = zendvec
- * 
- *     cell.area = areavec             # <<<<<<<<<<<<<<
- *     cell.diam = diamvec
- *     cell.length = lengthvec
- */
-  if (__Pyx_PyObject_SetAttrStr(__pyx_v_cell, __pyx_n_s_area, ((PyObject *)__pyx_v_areavec)) < 0) __PYX_ERR(0, 374, __pyx_L1_error)
-
-  /* "LFPy/run_simulation.pyx":375
- * 
- *     cell.area = areavec
- *     cell.diam = diamvec             # <<<<<<<<<<<<<<
- *     cell.length = lengthvec
- */
-  if (__Pyx_PyObject_SetAttrStr(__pyx_v_cell, __pyx_n_s_diam, ((PyObject *)__pyx_v_diamvec)) < 0) __PYX_ERR(0, 375, __pyx_L1_error)
-
-  /* "LFPy/run_simulation.pyx":376
- *     cell.area = areavec
- *     cell.diam = diamvec
- *     cell.length = lengthvec             # <<<<<<<<<<<<<<
- */
-  if (__Pyx_PyObject_SetAttrStr(__pyx_v_cell, __pyx_n_s_length, ((PyObject *)__pyx_v_lengthvec)) < 0) __PYX_ERR(0, 376, __pyx_L1_error)
-
-  /* "LFPy/run_simulation.pyx":287
- * 
- * 
- * cpdef _collect_geometry_neuron(cell):             # <<<<<<<<<<<<<<
- *     """Loop over allseclist to determine area, diam, xyz-start- and
- *     endpoints, embed geometry to cell object"""
- */
-
-  /* function exit code */
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_20);
-  __Pyx_XDECREF(__pyx_t_34);
-  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
-    __Pyx_PyThreadState_declare
-    __Pyx_PyThreadState_assign
-    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_L.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_areavec.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_diamvec.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lengthvec.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_segx.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_segx0.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_segx1.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xendvec.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xstartvec.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_yendvec.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ystartvec.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_z.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zendvec.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zstartvec.rcbuffer->pybuffer);
-  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
-  __Pyx_AddTraceback("LFPy.run_simulation._collect_geometry_neuron", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = 0;
-  goto __pyx_L2;
-  __pyx_L0:;
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_L.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_areavec.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_diamvec.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lengthvec.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_segx.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_segx0.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_segx1.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xendvec.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xstartvec.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_yendvec.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ystartvec.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_z.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zendvec.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zstartvec.rcbuffer->pybuffer);
-  __pyx_L2:;
-  __Pyx_XDECREF((PyObject *)__pyx_v_areavec);
-  __Pyx_XDECREF((PyObject *)__pyx_v_diamvec);
-  __Pyx_XDECREF((PyObject *)__pyx_v_lengthvec);
-  __Pyx_XDECREF((PyObject *)__pyx_v_xstartvec);
-  __Pyx_XDECREF((PyObject *)__pyx_v_xendvec);
-  __Pyx_XDECREF((PyObject *)__pyx_v_ystartvec);
-  __Pyx_XDECREF((PyObject *)__pyx_v_yendvec);
-  __Pyx_XDECREF((PyObject *)__pyx_v_zstartvec);
-  __Pyx_XDECREF((PyObject *)__pyx_v_zendvec);
-  __Pyx_XDECREF((PyObject *)__pyx_v_L);
-  __Pyx_XDECREF((PyObject *)__pyx_v_x);
-  __Pyx_XDECREF((PyObject *)__pyx_v_y);
-  __Pyx_XDECREF((PyObject *)__pyx_v_z);
-  __Pyx_XDECREF((PyObject *)__pyx_v_segx);
-  __Pyx_XDECREF((PyObject *)__pyx_v_segx0);
-  __Pyx_XDECREF((PyObject *)__pyx_v_segx1);
-  __Pyx_XDECREF(__pyx_v_sec);
-  __Pyx_XDECREF(__pyx_v_seg);
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* Python wrapper */
-static PyObject *__pyx_pw_4LFPy_14run_simulation_5_collect_geometry_neuron(PyObject *__pyx_self, PyObject *__pyx_v_cell); /*proto*/
-static char __pyx_doc_4LFPy_14run_simulation_4_collect_geometry_neuron[] = "Loop over allseclist to determine area, diam, xyz-start- and\n    endpoints, embed geometry to cell object";
-static PyObject *__pyx_pw_4LFPy_14run_simulation_5_collect_geometry_neuron(PyObject *__pyx_self, PyObject *__pyx_v_cell) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("_collect_geometry_neuron (wrapper)", 0);
-  __pyx_r = __pyx_pf_4LFPy_14run_simulation_4_collect_geometry_neuron(__pyx_self, ((PyObject *)__pyx_v_cell));
-
-  /* function exit code */
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-static PyObject *__pyx_pf_4LFPy_14run_simulation_4_collect_geometry_neuron(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cell) {
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_RefNannySetupContext("_collect_geometry_neuron", 0);
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __pyx_f_4LFPy_14run_simulation__collect_geometry_neuron(__pyx_v_cell, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  /* function exit code */
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("LFPy.run_simulation._collect_geometry_neuron", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":258
- *         # experimental exception made for __getbuffer__ and __releasebuffer__
- *         # -- the details of this may change.
- *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
- *             # This implementation of getbuffer is geared towards Cython
- *             # requirements, and does not yet fulfill the PEP.
- */
-
-/* Python wrapper */
-static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
-  __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
-
-  /* function exit code */
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
-  int __pyx_v_i;
-  int __pyx_v_ndim;
-  int __pyx_v_endian_detector;
-  int __pyx_v_little_endian;
-  int __pyx_v_t;
-  char *__pyx_v_f;
-  PyArray_Descr *__pyx_v_descr = 0;
-  int __pyx_v_offset;
-  int __pyx_r;
-  __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  int __pyx_t_5;
-  int __pyx_t_6;
-  PyArray_Descr *__pyx_t_7;
-  PyObject *__pyx_t_8 = NULL;
-  char *__pyx_t_9;
-  if (__pyx_v_info == NULL) {
-    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
-    return -1;
-  }
-  __Pyx_RefNannySetupContext("__getbuffer__", 0);
-  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
-  __Pyx_GIVEREF(__pyx_v_info->obj);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":265
- * 
- *             cdef int i, ndim
- *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
- *             cdef bint little_endian = ((&endian_detector)[0] != 0)
- * 
- */
-  __pyx_v_endian_detector = 1;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":266
- *             cdef int i, ndim
- *             cdef int endian_detector = 1
- *             cdef bint little_endian = ((&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
- * 
- *             ndim = PyArray_NDIM(self)
- */
-  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":268
- *             cdef bint little_endian = ((&endian_detector)[0] != 0)
- * 
- *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
- * 
- *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
- */
-  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":270
- *             ndim = PyArray_NDIM(self)
- * 
- *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
- *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
- *                 raise ValueError(u"ndarray is not C contiguous")
- */
-  __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
-  if (__pyx_t_2) {
-  } else {
-    __pyx_t_1 = __pyx_t_2;
-    goto __pyx_L4_bool_binop_done;
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":271
- * 
- *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
- *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
- *                 raise ValueError(u"ndarray is not C contiguous")
- * 
- */
-  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
-  __pyx_t_1 = __pyx_t_2;
-  __pyx_L4_bool_binop_done:;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":270
- *             ndim = PyArray_NDIM(self)
- * 
- *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
- *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
- *                 raise ValueError(u"ndarray is not C contiguous")
- */
-  if (unlikely(__pyx_t_1)) {
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":272
- *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
- *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
- *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
- * 
- *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
- */
-    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __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_ERR(1, 272, __pyx_L1_error)
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":270
- *             ndim = PyArray_NDIM(self)
- * 
- *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
- *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
- *                 raise ValueError(u"ndarray is not C contiguous")
- */
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":274
- *                 raise ValueError(u"ndarray is not C contiguous")
- * 
- *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
- *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
- *                 raise ValueError(u"ndarray is not Fortran contiguous")
- */
-  __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
-  if (__pyx_t_2) {
-  } else {
-    __pyx_t_1 = __pyx_t_2;
-    goto __pyx_L7_bool_binop_done;
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":275
- * 
- *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
- *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
- *                 raise ValueError(u"ndarray is not Fortran contiguous")
- * 
- */
-  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
-  __pyx_t_1 = __pyx_t_2;
-  __pyx_L7_bool_binop_done:;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":274
- *                 raise ValueError(u"ndarray is not C contiguous")
- * 
- *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
- *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
- *                 raise ValueError(u"ndarray is not Fortran contiguous")
- */
-  if (unlikely(__pyx_t_1)) {
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":276
- *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
- *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
- *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
- * 
- *             info.buf = PyArray_DATA(self)
- */
-    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __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_ERR(1, 276, __pyx_L1_error)
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":274
- *                 raise ValueError(u"ndarray is not C contiguous")
- * 
- *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
- *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
- *                 raise ValueError(u"ndarray is not Fortran contiguous")
- */
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":278
- *                 raise ValueError(u"ndarray is not Fortran contiguous")
- * 
- *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
- *             info.ndim = ndim
- *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
- */
-  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":279
- * 
- *             info.buf = PyArray_DATA(self)
- *             info.ndim = ndim             # <<<<<<<<<<<<<<
- *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
- *                 # Allocate new buffer for strides and shape info.
- */
-  __pyx_v_info->ndim = __pyx_v_ndim;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":280
- *             info.buf = PyArray_DATA(self)
- *             info.ndim = ndim
- *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
- *                 # Allocate new buffer for strides and shape info.
- *                 # This is allocated as one block, strides first.
- */
-  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
-  if (__pyx_t_1) {
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":283
- *                 # Allocate new buffer for strides and shape info.
- *                 # This is allocated as one block, strides first.
- *                 info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim)             # <<<<<<<<<<<<<<
- *                 info.shape = info.strides + ndim
- *                 for i in range(ndim):
- */
-    __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":284
- *                 # This is allocated as one block, strides first.
- *                 info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim)
- *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
- *                 for i in range(ndim):
- *                     info.strides[i] = PyArray_STRIDES(self)[i]
- */
-    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":285
- *                 info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim)
- *                 info.shape = info.strides + ndim
- *                 for i in range(ndim):             # <<<<<<<<<<<<<<
- *                     info.strides[i] = PyArray_STRIDES(self)[i]
- *                     info.shape[i] = PyArray_DIMS(self)[i]
- */
-    __pyx_t_4 = __pyx_v_ndim;
-    __pyx_t_5 = __pyx_t_4;
-    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
-      __pyx_v_i = __pyx_t_6;
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":286
- *                 info.shape = info.strides + ndim
- *                 for i in range(ndim):
- *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
- *                     info.shape[i] = PyArray_DIMS(self)[i]
- *             else:
- */
-      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":287
- *                 for i in range(ndim):
- *                     info.strides[i] = PyArray_STRIDES(self)[i]
- *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
- *             else:
- *                 info.strides = PyArray_STRIDES(self)
- */
-      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
-    }
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":280
- *             info.buf = PyArray_DATA(self)
- *             info.ndim = ndim
- *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
- *                 # Allocate new buffer for strides and shape info.
- *                 # This is allocated as one block, strides first.
- */
-    goto __pyx_L9;
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":289
- *                     info.shape[i] = PyArray_DIMS(self)[i]
- *             else:
- *                 info.strides = PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
- *                 info.shape = PyArray_DIMS(self)
- *             info.suboffsets = NULL
- */
-  /*else*/ {
-    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":290
- *             else:
- *                 info.strides = PyArray_STRIDES(self)
- *                 info.shape = PyArray_DIMS(self)             # <<<<<<<<<<<<<<
- *             info.suboffsets = NULL
- *             info.itemsize = PyArray_ITEMSIZE(self)
- */
-    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
-  }
-  __pyx_L9:;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":291
- *                 info.strides = PyArray_STRIDES(self)
- *                 info.shape = PyArray_DIMS(self)
- *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
- *             info.itemsize = PyArray_ITEMSIZE(self)
- *             info.readonly = not PyArray_ISWRITEABLE(self)
- */
-  __pyx_v_info->suboffsets = NULL;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":292
- *                 info.shape = PyArray_DIMS(self)
- *             info.suboffsets = NULL
- *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
- *             info.readonly = not PyArray_ISWRITEABLE(self)
- * 
- */
-  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":293
- *             info.suboffsets = NULL
- *             info.itemsize = PyArray_ITEMSIZE(self)
- *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
- * 
- *             cdef int t
- */
-  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":296
- * 
- *             cdef int t
- *             cdef char* f = NULL             # <<<<<<<<<<<<<<
- *             cdef dtype descr = PyArray_DESCR(self)
- *             cdef int offset
- */
-  __pyx_v_f = NULL;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":297
- *             cdef int t
- *             cdef char* f = NULL
- *             cdef dtype descr = PyArray_DESCR(self)             # <<<<<<<<<<<<<<
- *             cdef int offset
- * 
- */
-  __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
-  __pyx_t_3 = ((PyObject *)__pyx_t_7);
-  __Pyx_INCREF(__pyx_t_3);
-  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
-  __pyx_t_3 = 0;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":300
- *             cdef int offset
- * 
- *             info.obj = self             # <<<<<<<<<<<<<<
- * 
- *             if not PyDataType_HASFIELDS(descr):
- */
-  __Pyx_INCREF(((PyObject *)__pyx_v_self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
-  __Pyx_GOTREF(__pyx_v_info->obj);
-  __Pyx_DECREF(__pyx_v_info->obj);
-  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":302
- *             info.obj = self
- * 
- *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
- *                 t = descr.type_num
- *                 if ((descr.byteorder == c'>' and little_endian) or
- */
-  __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
-  if (__pyx_t_1) {
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":303
- * 
- *             if not PyDataType_HASFIELDS(descr):
- *                 t = descr.type_num             # <<<<<<<<<<<<<<
- *                 if ((descr.byteorder == c'>' and little_endian) or
- *                     (descr.byteorder == c'<' and not little_endian)):
- */
-    __pyx_t_4 = __pyx_v_descr->type_num;
-    __pyx_v_t = __pyx_t_4;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":304
- *             if not PyDataType_HASFIELDS(descr):
- *                 t = descr.type_num
- *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
- *                     (descr.byteorder == c'<' and not little_endian)):
- *                     raise ValueError(u"Non-native byte order not supported")
- */
-    __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
-    if (!__pyx_t_2) {
-      goto __pyx_L15_next_or;
-    } else {
-    }
-    __pyx_t_2 = (__pyx_v_little_endian != 0);
-    if (!__pyx_t_2) {
-    } else {
-      __pyx_t_1 = __pyx_t_2;
-      goto __pyx_L14_bool_binop_done;
-    }
-    __pyx_L15_next_or:;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":305
- *                 t = descr.type_num
- *                 if ((descr.byteorder == c'>' and little_endian) or
- *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
- *                     raise ValueError(u"Non-native byte order not supported")
- *                 if   t == NPY_BYTE:        f = "b"
- */
-    __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
-    if (__pyx_t_2) {
-    } else {
-      __pyx_t_1 = __pyx_t_2;
-      goto __pyx_L14_bool_binop_done;
-    }
-    __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
-    __pyx_t_1 = __pyx_t_2;
-    __pyx_L14_bool_binop_done:;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":304
- *             if not PyDataType_HASFIELDS(descr):
- *                 t = descr.type_num
- *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
- *                     (descr.byteorder == c'<' and not little_endian)):
- *                     raise ValueError(u"Non-native byte order not supported")
- */
-    if (unlikely(__pyx_t_1)) {
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":306
- *                 if ((descr.byteorder == c'>' and little_endian) or
- *                     (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"
- */
-      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __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_ERR(1, 306, __pyx_L1_error)
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":304
- *             if not PyDataType_HASFIELDS(descr):
- *                 t = descr.type_num
- *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
- *                     (descr.byteorder == c'<' and not little_endian)):
- *                     raise ValueError(u"Non-native byte order not supported")
- */
-    }
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":307
- *                     (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"
- */
-    switch (__pyx_v_t) {
-      case NPY_BYTE:
-      __pyx_v_f = ((char *)"b");
-      break;
-      case NPY_UBYTE:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":308
- *                     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_v_f = ((char *)"B");
-      break;
-      case NPY_SHORT:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":309
- *                 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_v_f = ((char *)"h");
-      break;
-      case NPY_USHORT:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":310
- *                 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_v_f = ((char *)"H");
-      break;
-      case NPY_INT:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":311
- *                 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_v_f = ((char *)"i");
-      break;
-      case NPY_UINT:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":312
- *                 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_v_f = ((char *)"I");
-      break;
-      case NPY_LONG:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":313
- *                 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_v_f = ((char *)"l");
-      break;
-      case NPY_ULONG:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":314
- *                 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_v_f = ((char *)"L");
-      break;
-      case NPY_LONGLONG:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":315
- *                 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_v_f = ((char *)"q");
-      break;
-      case NPY_ULONGLONG:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":316
- *                 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_v_f = ((char *)"Q");
-      break;
-      case NPY_FLOAT:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":317
- *                 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_v_f = ((char *)"f");
-      break;
-      case NPY_DOUBLE:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":318
- *                 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_v_f = ((char *)"d");
-      break;
-      case NPY_LONGDOUBLE:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":319
- *                 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_v_f = ((char *)"g");
-      break;
-      case NPY_CFLOAT:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":320
- *                 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_v_f = ((char *)"Zf");
-      break;
-      case NPY_CDOUBLE:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":321
- *                 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_v_f = ((char *)"Zd");
-      break;
-      case NPY_CLONGDOUBLE:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":322
- *                 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_v_f = ((char *)"Zg");
-      break;
-      case NPY_OBJECT:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":323
- *                 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_v_f = ((char *)"O");
-      break;
-      default:
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":325
- *                 elif t == NPY_OBJECT:      f = "O"
- *                 else:
- *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
- *                 info.format = f
- *                 return
- */
-      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_8);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__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_ERR(1, 325, __pyx_L1_error)
-      break;
-    }
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":326
- *                 else:
- *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
- *                 info.format = f             # <<<<<<<<<<<<<<
- *                 return
- *             else:
- */
-    __pyx_v_info->format = __pyx_v_f;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":327
- *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
- *                 info.format = f
- *                 return             # <<<<<<<<<<<<<<
- *             else:
- *                 info.format = PyObject_Malloc(_buffer_format_string_len)
- */
-    __pyx_r = 0;
-    goto __pyx_L0;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":302
- *             info.obj = self
- * 
- *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
- *                 t = descr.type_num
- *                 if ((descr.byteorder == c'>' and little_endian) or
- */
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":329
- *                 return
- *             else:
- *                 info.format = PyObject_Malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
- *                 info.format[0] = c'^' # Native data types, manual alignment
- *                 offset = 0
- */
-  /*else*/ {
-    __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":330
- *             else:
- *                 info.format = PyObject_Malloc(_buffer_format_string_len)
- *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
- *                 offset = 0
- *                 f = _util_dtypestring(descr, info.format + 1,
- */
-    (__pyx_v_info->format[0]) = '^';
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":331
- *                 info.format = PyObject_Malloc(_buffer_format_string_len)
- *                 info.format[0] = c'^' # Native data types, manual alignment
- *                 offset = 0             # <<<<<<<<<<<<<<
- *                 f = _util_dtypestring(descr, info.format + 1,
- *                                       info.format + _buffer_format_string_len,
- */
-    __pyx_v_offset = 0;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":332
- *                 info.format[0] = c'^' # Native data types, manual alignment
- *                 offset = 0
- *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
- *                                       info.format + _buffer_format_string_len,
- *                                       &offset)
- */
-    __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 332, __pyx_L1_error)
-    __pyx_v_f = __pyx_t_9;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":335
- *                                       info.format + _buffer_format_string_len,
- *                                       &offset)
- *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
- * 
- *         def __releasebuffer__(ndarray self, Py_buffer* info):
- */
-    (__pyx_v_f[0]) = '\x00';
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":258
- *         # experimental exception made for __getbuffer__ and __releasebuffer__
- *         # -- the details of this may change.
- *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
- *             # This implementation of getbuffer is geared towards Cython
- *             # requirements, and does not yet fulfill the PEP.
- */
-
-  /* function exit code */
-  __pyx_r = 0;
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = -1;
-  if (__pyx_v_info->obj != NULL) {
-    __Pyx_GOTREF(__pyx_v_info->obj);
-    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
-  }
-  goto __pyx_L2;
-  __pyx_L0:;
-  if (__pyx_v_info->obj == Py_None) {
-    __Pyx_GOTREF(__pyx_v_info->obj);
-    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
-  }
-  __pyx_L2:;
-  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":337
- *                 f[0] = c'\0' # Terminate format string
- * 
- *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
- *             if PyArray_HASFIELDS(self):
- *                 PyObject_Free(info.format)
- */
-
-/* Python wrapper */
-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));
-
-  /* function exit code */
-  __Pyx_RefNannyFinishContext();
-}
-
-static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
-  __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  __Pyx_RefNannySetupContext("__releasebuffer__", 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":338
- * 
- *         def __releasebuffer__(ndarray self, Py_buffer* info):
- *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
- *                 PyObject_Free(info.format)
- *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
- */
-  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
-  if (__pyx_t_1) {
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":339
- *         def __releasebuffer__(ndarray self, Py_buffer* info):
- *             if PyArray_HASFIELDS(self):
- *                 PyObject_Free(info.format)             # <<<<<<<<<<<<<<
- *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
- *                 PyObject_Free(info.strides)
- */
-    PyObject_Free(__pyx_v_info->format);
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":338
- * 
- *         def __releasebuffer__(ndarray self, Py_buffer* info):
- *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
- *                 PyObject_Free(info.format)
- *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
- */
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":340
- *             if PyArray_HASFIELDS(self):
- *                 PyObject_Free(info.format)
- *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
- *                 PyObject_Free(info.strides)
- *                 # info.shape was stored after info.strides in the same block
- */
-  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
-  if (__pyx_t_1) {
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":341
- *                 PyObject_Free(info.format)
- *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
- *                 PyObject_Free(info.strides)             # <<<<<<<<<<<<<<
- *                 # info.shape was stored after info.strides in the same block
- * 
- */
-    PyObject_Free(__pyx_v_info->strides);
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":340
- *             if PyArray_HASFIELDS(self):
- *                 PyObject_Free(info.format)
- *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
- *                 PyObject_Free(info.strides)
- *                 # info.shape was stored after info.strides in the same block
- */
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":337
- *                 f[0] = c'\0' # Terminate format string
- * 
- *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
- *             if PyArray_HASFIELDS(self):
- *                 PyObject_Free(info.format)
- */
-
-  /* function exit code */
-  __Pyx_RefNannyFinishContext();
-}
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":821
- * ctypedef npy_cdouble     complex_t
- * 
- * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
- *     return PyArray_MultiIterNew(1, a)
- * 
- */
-
-static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":822
- * 
- * cdef inline object PyArray_MultiIterNew1(a):
- *     return PyArray_MultiIterNew(1, a)             # <<<<<<<<<<<<<<
- * 
- * cdef inline object PyArray_MultiIterNew2(a, b):
- */
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":821
- * ctypedef npy_cdouble     complex_t
- * 
- * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
- *     return PyArray_MultiIterNew(1, a)
- * 
- */
-
-  /* function exit code */
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = 0;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":824
- *     return PyArray_MultiIterNew(1, a)
- * 
- * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
- *     return PyArray_MultiIterNew(2, a, b)
- * 
- */
-
-static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":825
- * 
- * cdef inline object PyArray_MultiIterNew2(a, b):
- *     return PyArray_MultiIterNew(2, a, b)             # <<<<<<<<<<<<<<
- * 
- * cdef inline object PyArray_MultiIterNew3(a, b, c):
- */
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":824
- *     return PyArray_MultiIterNew(1, a)
- * 
- * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
- *     return PyArray_MultiIterNew(2, a, b)
- * 
- */
-
-  /* function exit code */
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = 0;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":827
- *     return PyArray_MultiIterNew(2, a, b)
- * 
- * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
- *     return PyArray_MultiIterNew(3, a, b,  c)
- * 
- */
-
-static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":828
- * 
- * cdef inline object PyArray_MultiIterNew3(a, b, c):
- *     return PyArray_MultiIterNew(3, a, b,  c)             # <<<<<<<<<<<<<<
- * 
- * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
- */
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 828, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":827
- *     return PyArray_MultiIterNew(2, a, b)
- * 
- * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
- *     return PyArray_MultiIterNew(3, a, b,  c)
- * 
- */
-
-  /* function exit code */
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = 0;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":830
- *     return PyArray_MultiIterNew(3, a, b,  c)
- * 
- * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
- *     return PyArray_MultiIterNew(4, a, b, c,  d)
- * 
- */
-
-static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":831
- * 
- * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
- *     return PyArray_MultiIterNew(4, a, b, c,  d)             # <<<<<<<<<<<<<<
- * 
- * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
- */
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 831, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":830
- *     return PyArray_MultiIterNew(3, a, b,  c)
- * 
- * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
- *     return PyArray_MultiIterNew(4, a, b, c,  d)
- * 
- */
-
-  /* function exit code */
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = 0;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":833
- *     return PyArray_MultiIterNew(4, a, b, c,  d)
- * 
- * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
- *     return PyArray_MultiIterNew(5, a, b, c,  d,  e)
- * 
- */
-
-static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":834
- * 
- * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
- *     return PyArray_MultiIterNew(5, a, b, c,  d,  e)             # <<<<<<<<<<<<<<
- * 
- * cdef inline tuple PyDataType_SHAPE(dtype d):
- */
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 834, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":833
- *     return PyArray_MultiIterNew(4, a, b, c,  d)
- * 
- * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
- *     return PyArray_MultiIterNew(5, a, b, c,  d,  e)
- * 
- */
-
-  /* function exit code */
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = 0;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":836
- *     return PyArray_MultiIterNew(5, a, b, c,  d,  e)
- * 
- * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
- *     if PyDataType_HASSUBARRAY(d):
- *         return d.subarray.shape
- */
-
-static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":837
- * 
- * cdef inline tuple PyDataType_SHAPE(dtype d):
- *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
- *         return d.subarray.shape
- *     else:
- */
-  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
-  if (__pyx_t_1) {
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":838
- * cdef inline tuple PyDataType_SHAPE(dtype d):
- *     if PyDataType_HASSUBARRAY(d):
- *         return d.subarray.shape             # <<<<<<<<<<<<<<
- *     else:
- *         return ()
- */
-    __Pyx_XDECREF(__pyx_r);
-    __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
-    __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
-    goto __pyx_L0;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":837
- * 
- * cdef inline tuple PyDataType_SHAPE(dtype d):
- *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
- *         return d.subarray.shape
- *     else:
- */
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":840
- *         return d.subarray.shape
- *     else:
- *         return ()             # <<<<<<<<<<<<<<
- * 
- * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
- */
-  /*else*/ {
-    __Pyx_XDECREF(__pyx_r);
-    __Pyx_INCREF(__pyx_empty_tuple);
-    __pyx_r = __pyx_empty_tuple;
-    goto __pyx_L0;
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":836
- *     return PyArray_MultiIterNew(5, a, b, c,  d,  e)
- * 
- * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
- *     if PyDataType_HASSUBARRAY(d):
- *         return d.subarray.shape
- */
-
-  /* function exit code */
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":842
- *         return ()
- * 
- * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
- *     # Recursive utility function used in __getbuffer__ to get format
- *     # string. The new location in the format string is returned.
- */
-
-static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
-  PyArray_Descr *__pyx_v_child = 0;
-  int __pyx_v_endian_detector;
-  int __pyx_v_little_endian;
-  PyObject *__pyx_v_fields = 0;
-  PyObject *__pyx_v_childname = NULL;
-  PyObject *__pyx_v_new_offset = NULL;
-  PyObject *__pyx_v_t = NULL;
-  char *__pyx_r;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  Py_ssize_t __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  int __pyx_t_5;
-  int __pyx_t_6;
-  int __pyx_t_7;
-  long __pyx_t_8;
-  char *__pyx_t_9;
-  __Pyx_RefNannySetupContext("_util_dtypestring", 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":847
- * 
- *     cdef dtype child
- *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
- *     cdef bint little_endian = ((&endian_detector)[0] != 0)
- *     cdef tuple fields
- */
-  __pyx_v_endian_detector = 1;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":848
- *     cdef dtype child
- *     cdef int endian_detector = 1
- *     cdef bint little_endian = ((&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
- *     cdef tuple fields
- * 
- */
-  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":851
- *     cdef tuple fields
- * 
- *     for childname in descr.names:             # <<<<<<<<<<<<<<
- *         fields = descr.fields[childname]
- *         child, new_offset = fields
- */
-  if (unlikely(__pyx_v_descr->names == Py_None)) {
-    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
-    __PYX_ERR(1, 851, __pyx_L1_error)
-  }
-  __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
-  for (;;) {
-    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
-    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 851, __pyx_L1_error)
-    #else
-    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_3);
-    #endif
-    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
-    __pyx_t_3 = 0;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":852
- * 
- *     for childname in descr.names:
- *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
- *         child, new_offset = fields
- * 
- */
-    if (unlikely(__pyx_v_descr->fields == Py_None)) {
-      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
-      __PYX_ERR(1, 852, __pyx_L1_error)
-    }
-    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __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 %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 852, __pyx_L1_error)
-    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
-    __pyx_t_3 = 0;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":853
- *     for childname in descr.names:
- *         fields = descr.fields[childname]
- *         child, new_offset = fields             # <<<<<<<<<<<<<<
- * 
- *         if (end - f) - (new_offset - offset[0]) < 15:
- */
-    if (likely(__pyx_v_fields != Py_None)) {
-      PyObject* sequence = __pyx_v_fields;
-      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
-      if (unlikely(size != 2)) {
-        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-        __PYX_ERR(1, 853, __pyx_L1_error)
-      }
-      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
-      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
-      __Pyx_INCREF(__pyx_t_3);
-      __Pyx_INCREF(__pyx_t_4);
-      #else
-      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      #endif
-    } else {
-      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error)
-    }
-    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error)
-    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
-    __pyx_t_3 = 0;
-    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
-    __pyx_t_4 = 0;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":855
- *         child, new_offset = fields
- * 
- *         if (end - f) - (new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
- *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
- * 
- */
-    __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error)
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error)
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
-    if (unlikely(__pyx_t_6)) {
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":856
- * 
- *         if (end - f) - (new_offset - offset[0]) < 15:
- *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
- * 
- *         if ((child.byteorder == c'>' and little_endian) or
- */
-      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __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_ERR(1, 856, __pyx_L1_error)
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":855
- *         child, new_offset = fields
- * 
- *         if (end - f) - (new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
- *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
- * 
- */
-    }
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":858
- *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
- * 
- *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
- *             (child.byteorder == c'<' and not little_endian)):
- *             raise ValueError(u"Non-native byte order not supported")
- */
-    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
-    if (!__pyx_t_7) {
-      goto __pyx_L8_next_or;
-    } else {
-    }
-    __pyx_t_7 = (__pyx_v_little_endian != 0);
-    if (!__pyx_t_7) {
-    } else {
-      __pyx_t_6 = __pyx_t_7;
-      goto __pyx_L7_bool_binop_done;
-    }
-    __pyx_L8_next_or:;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":859
- * 
- *         if ((child.byteorder == c'>' and little_endian) or
- *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
- *             raise ValueError(u"Non-native byte order not supported")
- *             # One could encode it in the format string and have Cython
- */
-    __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
-    if (__pyx_t_7) {
-    } else {
-      __pyx_t_6 = __pyx_t_7;
-      goto __pyx_L7_bool_binop_done;
-    }
-    __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
-    __pyx_t_6 = __pyx_t_7;
-    __pyx_L7_bool_binop_done:;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":858
- *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
- * 
- *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
- *             (child.byteorder == c'<' and not little_endian)):
- *             raise ValueError(u"Non-native byte order not supported")
- */
-    if (unlikely(__pyx_t_6)) {
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":860
- *         if ((child.byteorder == c'>' and little_endian) or
- *             (child.byteorder == c'<' and not little_endian)):
- *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
- *             # One could encode it in the format string and have Cython
- *             # complain instead, BUT: < and > in format strings also imply
- */
-      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __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_ERR(1, 860, __pyx_L1_error)
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":858
- *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
- * 
- *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
- *             (child.byteorder == c'<' and not little_endian)):
- *             raise ValueError(u"Non-native byte order not supported")
- */
-    }
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":870
- * 
- *         # Output padding bytes
- *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
- *             f[0] = 120 # "x"; pad byte
- *             f += 1
- */
-    while (1) {
-      __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 870, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (!__pyx_t_6) break;
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":871
- *         # Output padding bytes
- *         while offset[0] < new_offset:
- *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
- *             f += 1
- *             offset[0] += 1
- */
-      (__pyx_v_f[0]) = 0x78;
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":872
- *         while offset[0] < new_offset:
- *             f[0] = 120 # "x"; pad byte
- *             f += 1             # <<<<<<<<<<<<<<
- *             offset[0] += 1
- * 
- */
-      __pyx_v_f = (__pyx_v_f + 1);
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":873
- *             f[0] = 120 # "x"; pad byte
- *             f += 1
- *             offset[0] += 1             # <<<<<<<<<<<<<<
- * 
- *         offset[0] += child.itemsize
- */
-      __pyx_t_8 = 0;
-      (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
-    }
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":875
- *             offset[0] += 1
- * 
- *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
- * 
- *         if not PyDataType_HASFIELDS(child):
- */
-    __pyx_t_8 = 0;
-    (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":877
- *         offset[0] += child.itemsize
- * 
- *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
- *             t = child.type_num
- *             if end - f < 5:
- */
-    __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
-    if (__pyx_t_6) {
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":878
- * 
- *         if not PyDataType_HASFIELDS(child):
- *             t = child.type_num             # <<<<<<<<<<<<<<
- *             if end - f < 5:
- *                 raise RuntimeError(u"Format string allocated too short.")
- */
-      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
-      __pyx_t_4 = 0;
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":879
- *         if not PyDataType_HASFIELDS(child):
- *             t = child.type_num
- *             if end - f < 5:             # <<<<<<<<<<<<<<
- *                 raise RuntimeError(u"Format string allocated too short.")
- * 
- */
-      __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
-      if (unlikely(__pyx_t_6)) {
-
-        /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":880
- *             t = child.type_num
- *             if end - f < 5:
- *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
- * 
- *             # Until ticket #99 is fixed, use integers to avoid warnings
- */
-        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
-        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __PYX_ERR(1, 880, __pyx_L1_error)
-
-        /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":879
- *         if not PyDataType_HASFIELDS(child):
- *             t = child.type_num
- *             if end - f < 5:             # <<<<<<<<<<<<<<
- *                 raise RuntimeError(u"Format string allocated too short.")
- * 
- */
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":883
- * 
- *             # Until ticket #99 is fixed, use integers to avoid warnings
- *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
- *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
- *             elif t == NPY_SHORT:       f[0] = 104 #"h"
- */
-      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 98;
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":884
- *             # Until ticket #99 is fixed, use integers to avoid warnings
- *             if   t == NPY_BYTE:        f[0] =  98 #"b"
- *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
- *             elif t == NPY_SHORT:       f[0] = 104 #"h"
- *             elif t == NPY_USHORT:      f[0] =  72 #"H"
- */
-      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 66;
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":885
- *             if   t == NPY_BYTE:        f[0] =  98 #"b"
- *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
- *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
- *             elif t == NPY_USHORT:      f[0] =  72 #"H"
- *             elif t == NPY_INT:         f[0] = 105 #"i"
- */
-      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 885, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 0x68;
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":886
- *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
- *             elif t == NPY_SHORT:       f[0] = 104 #"h"
- *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
- *             elif t == NPY_INT:         f[0] = 105 #"i"
- *             elif t == NPY_UINT:        f[0] =  73 #"I"
- */
-      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 886, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 72;
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":887
- *             elif t == NPY_SHORT:       f[0] = 104 #"h"
- *             elif t == NPY_USHORT:      f[0] =  72 #"H"
- *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
- *             elif t == NPY_UINT:        f[0] =  73 #"I"
- *             elif t == NPY_LONG:        f[0] = 108 #"l"
- */
-      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 887, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 0x69;
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":888
- *             elif t == NPY_USHORT:      f[0] =  72 #"H"
- *             elif t == NPY_INT:         f[0] = 105 #"i"
- *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
- *             elif t == NPY_LONG:        f[0] = 108 #"l"
- *             elif t == NPY_ULONG:       f[0] = 76  #"L"
- */
-      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 888, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 73;
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":889
- *             elif t == NPY_INT:         f[0] = 105 #"i"
- *             elif t == NPY_UINT:        f[0] =  73 #"I"
- *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
- *             elif t == NPY_ULONG:       f[0] = 76  #"L"
- *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
- */
-      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 889, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 0x6C;
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":890
- *             elif t == NPY_UINT:        f[0] =  73 #"I"
- *             elif t == NPY_LONG:        f[0] = 108 #"l"
- *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
- *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
- *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
- */
-      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 76;
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":891
- *             elif t == NPY_LONG:        f[0] = 108 #"l"
- *             elif t == NPY_ULONG:       f[0] = 76  #"L"
- *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
- *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
- *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
- */
-      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 891, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 0x71;
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":892
- *             elif t == NPY_ULONG:       f[0] = 76  #"L"
- *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
- *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
- *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
- *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
- */
-      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 892, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 81;
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":893
- *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
- *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
- *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
- *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
- *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
- */
-      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 893, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 0x66;
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":894
- *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
- *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
- *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
- *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
- *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
- */
-      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 894, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 0x64;
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":895
- *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
- *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
- *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
- *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
- *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
- */
-      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 895, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 0x67;
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":896
- *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
- *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
- *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
- *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
- *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
- */
-      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 896, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 90;
-        (__pyx_v_f[1]) = 0x66;
-        __pyx_v_f = (__pyx_v_f + 1);
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":897
- *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
- *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
- *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
- *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
- *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
- */
-      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 897, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 90;
-        (__pyx_v_f[1]) = 0x64;
-        __pyx_v_f = (__pyx_v_f + 1);
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":898
- *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
- *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
- *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
- *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
- *             else:
- */
-      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 898, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (__pyx_t_6) {
-        (__pyx_v_f[0]) = 90;
-        (__pyx_v_f[1]) = 0x67;
-        __pyx_v_f = (__pyx_v_f + 1);
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":899
- *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
- *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
- *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
- *             else:
- *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
- */
-      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L1_error)
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 899, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error)
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      if (likely(__pyx_t_6)) {
-        (__pyx_v_f[0]) = 79;
-        goto __pyx_L15;
-      }
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":901
- *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
- *             else:
- *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
- *             f += 1
- *         else:
- */
-      /*else*/ {
-        __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 901, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error)
-        __Pyx_GOTREF(__pyx_t_4);
-        __Pyx_DECREF(__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_ERR(1, 901, __pyx_L1_error)
-      }
-      __pyx_L15:;
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":902
- *             else:
- *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
- *             f += 1             # <<<<<<<<<<<<<<
- *         else:
- *             # Cython ignores struct boundary information ("T{...}"),
- */
-      __pyx_v_f = (__pyx_v_f + 1);
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":877
- *         offset[0] += child.itemsize
- * 
- *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
- *             t = child.type_num
- *             if end - f < 5:
- */
-      goto __pyx_L13;
-    }
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":906
- *             # Cython ignores struct boundary information ("T{...}"),
- *             # so don't output it
- *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
- *     return f
- * 
- */
-    /*else*/ {
-      __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 906, __pyx_L1_error)
-      __pyx_v_f = __pyx_t_9;
-    }
-    __pyx_L13:;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":851
- *     cdef tuple fields
- * 
- *     for childname in descr.names:             # <<<<<<<<<<<<<<
- *         fields = descr.fields[childname]
- *         child, new_offset = fields
- */
-  }
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":907
- *             # so don't output it
- *             f = _util_dtypestring(child, f, end, offset)
- *     return f             # <<<<<<<<<<<<<<
- * 
- * 
- */
-  __pyx_r = __pyx_v_f;
-  goto __pyx_L0;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":842
- *         return ()
- * 
- * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
- *     # Recursive utility function used in __getbuffer__ to get format
- *     # string. The new location in the format string is returned.
- */
-
-  /* function exit code */
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XDECREF((PyObject *)__pyx_v_child);
-  __Pyx_XDECREF(__pyx_v_fields);
-  __Pyx_XDECREF(__pyx_v_childname);
-  __Pyx_XDECREF(__pyx_v_new_offset);
-  __Pyx_XDECREF(__pyx_v_t);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1022
- *     int _import_umath() except -1
- * 
- * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
- *     Py_INCREF(base) # important to do this before stealing the reference below!
- *     PyArray_SetBaseObject(arr, base)
- */
-
-static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("set_array_base", 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1023
- * 
- * cdef inline void set_array_base(ndarray arr, object base):
- *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
- *     PyArray_SetBaseObject(arr, base)
- * 
- */
-  Py_INCREF(__pyx_v_base);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1024
- * cdef inline void set_array_base(ndarray arr, object base):
- *     Py_INCREF(base) # important to do this before stealing the reference below!
- *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
- * 
- * cdef inline object get_array_base(ndarray arr):
- */
-  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1022
- *     int _import_umath() except -1
- * 
- * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
- *     Py_INCREF(base) # important to do this before stealing the reference below!
- *     PyArray_SetBaseObject(arr, base)
- */
-
-  /* function exit code */
-  __Pyx_RefNannyFinishContext();
-}
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1026
- *     PyArray_SetBaseObject(arr, base)
- * 
- * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
- *     base = PyArray_BASE(arr)
- *     if base is NULL:
- */
-
-static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
-  PyObject *__pyx_v_base;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  __Pyx_RefNannySetupContext("get_array_base", 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1027
- * 
- * cdef inline object get_array_base(ndarray arr):
- *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
- *     if base is NULL:
- *         return None
- */
-  __pyx_v_base = PyArray_BASE(__pyx_v_arr);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1028
- * cdef inline object get_array_base(ndarray arr):
- *     base = PyArray_BASE(arr)
- *     if base is NULL:             # <<<<<<<<<<<<<<
- *         return None
- *     return base
- */
-  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
-  if (__pyx_t_1) {
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1029
- *     base = PyArray_BASE(arr)
- *     if base is NULL:
- *         return None             # <<<<<<<<<<<<<<
- *     return base
- * 
- */
-    __Pyx_XDECREF(__pyx_r);
-    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-    goto __pyx_L0;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1028
- * cdef inline object get_array_base(ndarray arr):
- *     base = PyArray_BASE(arr)
- *     if base is NULL:             # <<<<<<<<<<<<<<
- *         return None
- *     return base
- */
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1030
- *     if base is NULL:
- *         return None
- *     return base             # <<<<<<<<<<<<<<
- * 
- * # Versions of the import_* functions which are more suitable for
- */
-  __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_base));
-  __pyx_r = ((PyObject *)__pyx_v_base);
-  goto __pyx_L0;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1026
- *     PyArray_SetBaseObject(arr, base)
- * 
- * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
- *     base = PyArray_BASE(arr)
- *     if base is NULL:
- */
-
-  /* function exit code */
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1034
- * # Versions of the import_* functions which are more suitable for
- * # Cython code.
- * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
- *     try:
- *         _import_array()
- */
-
-static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
-  int __pyx_r;
-  __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;
-  __Pyx_RefNannySetupContext("import_array", 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1035
- * # Cython code.
- * cdef inline int import_array() except -1:
- *     try:             # <<<<<<<<<<<<<<
- *         _import_array()
- *     except Exception:
- */
-  {
-    __Pyx_PyThreadState_declare
-    __Pyx_PyThreadState_assign
-    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
-    __Pyx_XGOTREF(__pyx_t_1);
-    __Pyx_XGOTREF(__pyx_t_2);
-    __Pyx_XGOTREF(__pyx_t_3);
-    /*try:*/ {
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1036
- * cdef inline int import_array() except -1:
- *     try:
- *         _import_array()             # <<<<<<<<<<<<<<
- *     except Exception:
- *         raise ImportError("numpy.core.multiarray failed to import")
- */
-      __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error)
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1035
- * # Cython code.
- * cdef inline int import_array() except -1:
- *     try:             # <<<<<<<<<<<<<<
- *         _import_array()
- *     except Exception:
- */
-    }
-    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
-    goto __pyx_L8_try_end;
-    __pyx_L3_error:;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1037
- *     try:
- *         _import_array()
- *     except Exception:             # <<<<<<<<<<<<<<
- *         raise ImportError("numpy.core.multiarray failed to import")
- * 
- */
-    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
-    if (__pyx_t_4) {
-      __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
-      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error)
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_GOTREF(__pyx_t_7);
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1038
- *         _import_array()
- *     except Exception:
- *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
- * 
- * cdef inline int import_umath() except -1:
- */
-      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __pyx_L5_except_error)
-      __Pyx_GOTREF(__pyx_t_8);
-      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __PYX_ERR(1, 1038, __pyx_L5_except_error)
-    }
-    goto __pyx_L5_except_error;
-    __pyx_L5_except_error:;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1035
- * # Cython code.
- * cdef inline int import_array() except -1:
- *     try:             # <<<<<<<<<<<<<<
- *         _import_array()
- *     except Exception:
- */
-    __Pyx_XGIVEREF(__pyx_t_1);
-    __Pyx_XGIVEREF(__pyx_t_2);
-    __Pyx_XGIVEREF(__pyx_t_3);
-    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
-    goto __pyx_L1_error;
-    __pyx_L8_try_end:;
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1034
- * # Versions of the import_* functions which are more suitable for
- * # Cython code.
- * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
- *     try:
- *         _import_array()
- */
-
-  /* function exit code */
-  __pyx_r = 0;
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1040
- *         raise ImportError("numpy.core.multiarray failed to import")
- * 
- * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
- *     try:
- *         _import_umath()
- */
-
-static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
-  int __pyx_r;
-  __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;
-  __Pyx_RefNannySetupContext("import_umath", 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1041
- * 
- * cdef inline int import_umath() except -1:
- *     try:             # <<<<<<<<<<<<<<
- *         _import_umath()
- *     except Exception:
- */
-  {
-    __Pyx_PyThreadState_declare
-    __Pyx_PyThreadState_assign
-    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
-    __Pyx_XGOTREF(__pyx_t_1);
-    __Pyx_XGOTREF(__pyx_t_2);
-    __Pyx_XGOTREF(__pyx_t_3);
-    /*try:*/ {
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1042
- * cdef inline int import_umath() except -1:
- *     try:
- *         _import_umath()             # <<<<<<<<<<<<<<
- *     except Exception:
- *         raise ImportError("numpy.core.umath failed to import")
- */
-      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error)
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1041
- * 
- * cdef inline int import_umath() except -1:
- *     try:             # <<<<<<<<<<<<<<
- *         _import_umath()
- *     except Exception:
- */
-    }
-    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
-    goto __pyx_L8_try_end;
-    __pyx_L3_error:;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1043
- *     try:
- *         _import_umath()
- *     except Exception:             # <<<<<<<<<<<<<<
- *         raise ImportError("numpy.core.umath failed to import")
- * 
- */
-    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
-    if (__pyx_t_4) {
-      __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
-      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error)
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_GOTREF(__pyx_t_7);
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1044
- *         _import_umath()
- *     except Exception:
- *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
- * 
- * cdef inline int import_ufunc() except -1:
- */
-      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __pyx_L5_except_error)
-      __Pyx_GOTREF(__pyx_t_8);
-      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __PYX_ERR(1, 1044, __pyx_L5_except_error)
-    }
-    goto __pyx_L5_except_error;
-    __pyx_L5_except_error:;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1041
- * 
- * cdef inline int import_umath() except -1:
- *     try:             # <<<<<<<<<<<<<<
- *         _import_umath()
- *     except Exception:
- */
-    __Pyx_XGIVEREF(__pyx_t_1);
-    __Pyx_XGIVEREF(__pyx_t_2);
-    __Pyx_XGIVEREF(__pyx_t_3);
-    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
-    goto __pyx_L1_error;
-    __pyx_L8_try_end:;
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1040
- *         raise ImportError("numpy.core.multiarray failed to import")
- * 
- * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
- *     try:
- *         _import_umath()
- */
-
-  /* function exit code */
-  __pyx_r = 0;
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1046
- *         raise ImportError("numpy.core.umath failed to import")
- * 
- * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
- *     try:
- *         _import_umath()
- */
-
-static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
-  int __pyx_r;
-  __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;
-  __Pyx_RefNannySetupContext("import_ufunc", 0);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1047
- * 
- * cdef inline int import_ufunc() except -1:
- *     try:             # <<<<<<<<<<<<<<
- *         _import_umath()
- *     except Exception:
- */
-  {
-    __Pyx_PyThreadState_declare
-    __Pyx_PyThreadState_assign
-    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
-    __Pyx_XGOTREF(__pyx_t_1);
-    __Pyx_XGOTREF(__pyx_t_2);
-    __Pyx_XGOTREF(__pyx_t_3);
-    /*try:*/ {
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1048
- * cdef inline int import_ufunc() except -1:
- *     try:
- *         _import_umath()             # <<<<<<<<<<<<<<
- *     except Exception:
- *         raise ImportError("numpy.core.umath failed to import")
- */
-      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error)
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1047
- * 
- * cdef inline int import_ufunc() except -1:
- *     try:             # <<<<<<<<<<<<<<
- *         _import_umath()
- *     except Exception:
- */
-    }
-    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
-    goto __pyx_L8_try_end;
-    __pyx_L3_error:;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1049
- *     try:
- *         _import_umath()
- *     except Exception:             # <<<<<<<<<<<<<<
- *         raise ImportError("numpy.core.umath failed to import")
- */
-    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
-    if (__pyx_t_4) {
-      __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
-      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error)
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_GOTREF(__pyx_t_7);
-
-      /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1050
- *         _import_umath()
- *     except Exception:
- *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
- */
-      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __pyx_L5_except_error)
-      __Pyx_GOTREF(__pyx_t_8);
-      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-      __PYX_ERR(1, 1050, __pyx_L5_except_error)
-    }
-    goto __pyx_L5_except_error;
-    __pyx_L5_except_error:;
-
-    /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1047
- * 
- * cdef inline int import_ufunc() except -1:
- *     try:             # <<<<<<<<<<<<<<
- *         _import_umath()
- *     except Exception:
- */
-    __Pyx_XGIVEREF(__pyx_t_1);
-    __Pyx_XGIVEREF(__pyx_t_2);
-    __Pyx_XGIVEREF(__pyx_t_3);
-    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
-    goto __pyx_L1_error;
-    __pyx_L8_try_end:;
-  }
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1046
- *         raise ImportError("numpy.core.umath failed to import")
- * 
- * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
- *     try:
- *         _import_umath()
- */
-
-  /* function exit code */
-  __pyx_r = 0;
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = -1;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-static PyMethodDef __pyx_methods[] = {
-  {"_collect_geometry_neuron", (PyCFunction)__pyx_pw_4LFPy_14run_simulation_5_collect_geometry_neuron, METH_O, __pyx_doc_4LFPy_14run_simulation_4_collect_geometry_neuron},
-  {0, 0, 0, 0}
-};
-
-#if PY_MAJOR_VERSION >= 3
-#if CYTHON_PEP489_MULTI_PHASE_INIT
-static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
-static int __pyx_pymod_exec_run_simulation(PyObject* module); /*proto*/
-static PyModuleDef_Slot __pyx_moduledef_slots[] = {
-  {Py_mod_create, (void*)__pyx_pymod_create},
-  {Py_mod_exec, (void*)__pyx_pymod_exec_run_simulation},
-  {0, NULL}
-};
-#endif
-
-static struct PyModuleDef __pyx_moduledef = {
-    PyModuleDef_HEAD_INIT,
-    "run_simulation",
-    __pyx_k_Copyright_C_2012_Computational_N, /* m_doc */
-  #if CYTHON_PEP489_MULTI_PHASE_INIT
-    0, /* m_size */
-  #else
-    -1, /* m_size */
-  #endif
-    __pyx_methods /* m_methods */,
-  #if CYTHON_PEP489_MULTI_PHASE_INIT
-    __pyx_moduledef_slots, /* m_slots */
-  #else
-    NULL, /* m_reload */
-  #endif
-    NULL, /* m_traverse */
-    NULL, /* m_clear */
-    NULL /* m_free */
-};
-#endif
-#ifndef CYTHON_SMALL_CODE
-#if defined(__clang__)
-    #define CYTHON_SMALL_CODE
-#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
-    #define CYTHON_SMALL_CODE __attribute__((cold))
-#else
-    #define CYTHON_SMALL_CODE
-#endif
-#endif
-
-static __Pyx_StringTabEntry __pyx_string_tab[] = {
-  {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
-  {&__pyx_n_s_CellLFP, __pyx_k_CellLFP, sizeof(__pyx_k_CellLFP), 0, 0, 1, 1},
-  {&__pyx_n_s_DTYPE, __pyx_k_DTYPE, sizeof(__pyx_k_DTYPE), 0, 0, 1, 1},
-  {&__pyx_n_s_File, __pyx_k_File, sizeof(__pyx_k_File), 0, 0, 1, 1},
-  {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
-  {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
-  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
-  {&__pyx_n_s_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 0, 1, 1},
-  {&__pyx_n_s_LFP, __pyx_k_LFP, sizeof(__pyx_k_LFP), 0, 0, 1, 1},
-  {&__pyx_n_s_LFPy_run_simulation, __pyx_k_LFPy_run_simulation, sizeof(__pyx_k_LFPy_run_simulation), 0, 0, 1, 1},
-  {&__pyx_kp_s_LFPy_run_simulation_pyx, __pyx_k_LFPy_run_simulation_pyx, sizeof(__pyx_k_LFPy_run_simulation_pyx), 0, 0, 1, 0},
-  {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
-  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
-  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
-  {&__pyx_n_s_active, __pyx_k_active, sizeof(__pyx_k_active), 0, 0, 1, 1},
-  {&__pyx_n_s_allseclist, __pyx_k_allseclist, sizeof(__pyx_k_allseclist), 0, 0, 1, 1},
-  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
-  {&__pyx_n_s_arc3d, __pyx_k_arc3d, sizeof(__pyx_k_arc3d), 0, 0, 1, 1},
-  {&__pyx_n_s_area, __pyx_k_area, sizeof(__pyx_k_area), 0, 0, 1, 1},
-  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
-  {&__pyx_n_s_atol, __pyx_k_atol, sizeof(__pyx_k_atol), 0, 0, 1, 1},
-  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
-  {&__pyx_n_s_calc_mapping, __pyx_k_calc_mapping, sizeof(__pyx_k_calc_mapping), 0, 0, 1, 1},
-  {&__pyx_n_s_cell, __pyx_k_cell, sizeof(__pyx_k_cell), 0, 0, 1, 1},
-  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
-  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
-  {&__pyx_n_s_coeffs, __pyx_k_coeffs, sizeof(__pyx_k_coeffs), 0, 0, 1, 1},
-  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
-  {&__pyx_n_s_counter, __pyx_k_counter, sizeof(__pyx_k_counter), 0, 0, 1, 1},
-  {&__pyx_n_s_current_dipole_moment, __pyx_k_current_dipole_moment, sizeof(__pyx_k_current_dipole_moment), 0, 0, 1, 1},
-  {&__pyx_n_s_cvode, __pyx_k_cvode, sizeof(__pyx_k_cvode), 0, 0, 1, 1},
-  {&__pyx_n_s_diam, __pyx_k_diam, sizeof(__pyx_k_diam), 0, 0, 1, 1},
-  {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
-  {&__pyx_n_s_dotprodcoeffs, __pyx_k_dotprodcoeffs, sizeof(__pyx_k_dotprodcoeffs), 0, 0, 1, 1},
-  {&__pyx_n_s_dotprodresults, __pyx_k_dotprodresults, sizeof(__pyx_k_dotprodresults), 0, 0, 1, 1},
-  {&__pyx_n_s_dt, __pyx_k_dt, sizeof(__pyx_k_dt), 0, 0, 1, 1},
-  {&__pyx_n_s_el, __pyx_k_el, sizeof(__pyx_k_el), 0, 0, 1, 1},
-  {&__pyx_n_s_el_LFP_file, __pyx_k_el_LFP_file, sizeof(__pyx_k_el_LFP_file), 0, 0, 1, 1},
-  {&__pyx_n_s_electrode, __pyx_k_electrode, sizeof(__pyx_k_electrode), 0, 0, 1, 1},
-  {&__pyx_kp_s_electrode_03d, __pyx_k_electrode_03d, sizeof(__pyx_k_electrode_03d), 0, 0, 1, 0},
-  {&__pyx_n_s_electrodecoeff, __pyx_k_electrodecoeff, sizeof(__pyx_k_electrodecoeff), 0, 0, 1, 1},
-  {&__pyx_n_s_electrodes, __pyx_k_electrodes, sizeof(__pyx_k_electrodes), 0, 0, 1, 1},
-  {&__pyx_n_s_electrodesLFP, __pyx_k_electrodesLFP, sizeof(__pyx_k_electrodesLFP), 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_fadvance, __pyx_k_fadvance, sizeof(__pyx_k_fadvance), 0, 0, 1, 1},
-  {&__pyx_n_s_fcurrent, __pyx_k_fcurrent, sizeof(__pyx_k_fcurrent), 0, 0, 1, 1},
-  {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
-  {&__pyx_n_s_file_name, __pyx_k_file_name, sizeof(__pyx_k_file_name), 0, 0, 1, 1},
-  {&__pyx_n_s_finitialize, __pyx_k_finitialize, sizeof(__pyx_k_finitialize), 0, 0, 1, 1},
-  {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
-  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
-  {&__pyx_n_s_frecord_init, __pyx_k_frecord_init, sizeof(__pyx_k_frecord_init), 0, 0, 1, 1},
-  {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
-  {&__pyx_n_s_h5, __pyx_k_h5, sizeof(__pyx_k_h5), 0, 0, 1, 1},
-  {&__pyx_kp_s_h5_2, __pyx_k_h5_2, sizeof(__pyx_k_h5_2), 0, 0, 1, 0},
-  {&__pyx_n_s_h5py, __pyx_k_h5py, sizeof(__pyx_k_h5py), 0, 0, 1, 1},
-  {&__pyx_kp_s_h5py_not_found_LFP_to_file_not_p, __pyx_k_h5py_not_found_LFP_to_file_not_p, sizeof(__pyx_k_h5py_not_found_LFP_to_file_not_p), 0, 0, 1, 0},
-  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
-  {&__pyx_n_s_i_membrane, __pyx_k_i_membrane, sizeof(__pyx_k_i_membrane), 0, 0, 1, 1},
-  {&__pyx_n_s_imem, __pyx_k_imem, sizeof(__pyx_k_imem), 0, 0, 1, 1},
-  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
-  {&__pyx_n_s_interp, __pyx_k_interp, sizeof(__pyx_k_interp), 0, 0, 1, 1},
-  {&__pyx_n_s_interval, __pyx_k_interval, sizeof(__pyx_k_interval), 0, 0, 1, 1},
-  {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
-  {&__pyx_n_s_lendotprodcoeffs0, __pyx_k_lendotprodcoeffs0, sizeof(__pyx_k_lendotprodcoeffs0), 0, 0, 1, 1},
-  {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1},
-  {&__pyx_n_s_loadspikes, __pyx_k_loadspikes, sizeof(__pyx_k_loadspikes), 0, 0, 1, 1},
-  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
-  {&__pyx_n_s_mapping, __pyx_k_mapping, sizeof(__pyx_k_mapping), 0, 0, 1, 1},
-  {&__pyx_n_s_midpoints, __pyx_k_midpoints, sizeof(__pyx_k_midpoints), 0, 0, 1, 1},
-  {&__pyx_n_s_n3d, __pyx_k_n3d, sizeof(__pyx_k_n3d), 0, 0, 1, 1},
-  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
-  {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
-  {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
-  {&__pyx_n_s_neuron, __pyx_k_neuron, sizeof(__pyx_k_neuron), 0, 0, 1, 1},
-  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
-  {&__pyx_n_s_nseg, __pyx_k_nseg, sizeof(__pyx_k_nseg), 0, 0, 1, 1},
-  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
-  {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
-  {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
-  {&__pyx_n_s_perCellLFP, __pyx_k_perCellLFP, sizeof(__pyx_k_perCellLFP), 0, 0, 1, 1},
-  {&__pyx_kp_s_precalculating_geometry_LFP_mapp, __pyx_k_precalculating_geometry_LFP_mapp, sizeof(__pyx_k_precalculating_geometry_LFP_mapp), 0, 0, 1, 0},
-  {&__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_re_init, __pyx_k_re_init, sizeof(__pyx_k_re_init), 0, 0, 1, 1},
-  {&__pyx_n_s_rec_current_dipole_moment, __pyx_k_rec_current_dipole_moment, sizeof(__pyx_k_rec_current_dipole_moment), 0, 0, 1, 1},
-  {&__pyx_n_s_rtfactor, __pyx_k_rtfactor, sizeof(__pyx_k_rtfactor), 0, 0, 1, 1},
-  {&__pyx_n_s_run_simulation, __pyx_k_run_simulation, sizeof(__pyx_k_run_simulation), 0, 0, 1, 1},
-  {&__pyx_n_s_run_simulation_with_electrode, __pyx_k_run_simulation_with_electrode, sizeof(__pyx_k_run_simulation_with_electrode), 0, 0, 1, 1},
-  {&__pyx_n_s_sec, __pyx_k_sec, sizeof(__pyx_k_sec), 0, 0, 1, 1},
-  {&__pyx_n_s_seg, __pyx_k_seg, sizeof(__pyx_k_seg), 0, 0, 1, 1},
-  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
-  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
-  {&__pyx_n_s_t0, __pyx_k_t0, sizeof(__pyx_k_t0), 0, 0, 1, 1},
-  {&__pyx_kp_s_t_0f_realtime_factor_3f, __pyx_k_t_0f_realtime_factor_3f, sizeof(__pyx_k_t_0f_realtime_factor_3f), 0, 0, 1, 0},
-  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
-  {&__pyx_n_s_ti, __pyx_k_ti, sizeof(__pyx_k_ti), 0, 0, 1, 1},
-  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
-  {&__pyx_n_s_to_file, __pyx_k_to_file, sizeof(__pyx_k_to_file), 0, 0, 1, 1},
-  {&__pyx_n_s_to_memory, __pyx_k_to_memory, sizeof(__pyx_k_to_memory), 0, 0, 1, 1},
-  {&__pyx_n_s_totnsegs, __pyx_k_totnsegs, sizeof(__pyx_k_totnsegs), 0, 0, 1, 1},
-  {&__pyx_n_s_tstart, __pyx_k_tstart, sizeof(__pyx_k_tstart), 0, 0, 1, 1},
-  {&__pyx_n_s_tstep, __pyx_k_tstep, sizeof(__pyx_k_tstep), 0, 0, 1, 1},
-  {&__pyx_n_s_tstop, __pyx_k_tstop, sizeof(__pyx_k_tstop), 0, 0, 1, 1},
-  {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
-  {&__pyx_n_s_v_init, __pyx_k_v_init, sizeof(__pyx_k_v_init), 0, 0, 1, 1},
-  {&__pyx_n_s_variable_dt, __pyx_k_variable_dt, sizeof(__pyx_k_variable_dt), 0, 0, 1, 1},
-  {&__pyx_n_s_verbose, __pyx_k_verbose, sizeof(__pyx_k_verbose), 0, 0, 1, 1},
-  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
-  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
-  {&__pyx_n_s_x3d, __pyx_k_x3d, sizeof(__pyx_k_x3d), 0, 0, 1, 1},
-  {&__pyx_n_s_xend, __pyx_k_xend, sizeof(__pyx_k_xend), 0, 0, 1, 1},
-  {&__pyx_n_s_xmid, __pyx_k_xmid, sizeof(__pyx_k_xmid), 0, 0, 1, 1},
-  {&__pyx_n_s_xstart, __pyx_k_xstart, sizeof(__pyx_k_xstart), 0, 0, 1, 1},
-  {&__pyx_n_s_y3d, __pyx_k_y3d, sizeof(__pyx_k_y3d), 0, 0, 1, 1},
-  {&__pyx_n_s_yend, __pyx_k_yend, sizeof(__pyx_k_yend), 0, 0, 1, 1},
-  {&__pyx_n_s_ymid, __pyx_k_ymid, sizeof(__pyx_k_ymid), 0, 0, 1, 1},
-  {&__pyx_n_s_ystart, __pyx_k_ystart, sizeof(__pyx_k_ystart), 0, 0, 1, 1},
-  {&__pyx_n_s_z3d, __pyx_k_z3d, sizeof(__pyx_k_z3d), 0, 0, 1, 1},
-  {&__pyx_n_s_zend, __pyx_k_zend, sizeof(__pyx_k_zend), 0, 0, 1, 1},
-  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
-  {&__pyx_n_s_zmid, __pyx_k_zmid, sizeof(__pyx_k_zmid), 0, 0, 1, 1},
-  {&__pyx_n_s_zstart, __pyx_k_zstart, sizeof(__pyx_k_zstart), 0, 0, 1, 1},
-  {0, 0, 0, 0, 0, 0, 0}
-};
-static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
-  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 218, __pyx_L1_error)
-  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 324, __pyx_L1_error)
-  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error)
-  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error)
-  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error)
-  return 0;
-  __pyx_L1_error:;
-  return -1;
-}
-
-static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
-
-  /* "LFPy/run_simulation.pyx":219
- *             if to_memory:
- *                 for j, coeffs in enumerate(dotprodcoeffs):
- *                     electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)             # <<<<<<<<<<<<<<
- * 
- *             if to_file:
- */
-  __pyx_slice__2 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 219, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_slice__2);
-  __Pyx_GIVEREF(__pyx_slice__2);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":272
- *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
- *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
- *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
- * 
- *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
- */
-  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 272, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__3);
-  __Pyx_GIVEREF(__pyx_tuple__3);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":276
- *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
- *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
- *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
- * 
- *             info.buf = PyArray_DATA(self)
- */
-  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 276, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__4);
-  __Pyx_GIVEREF(__pyx_tuple__4);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":306
- *                 if ((descr.byteorder == c'>' and little_endian) or
- *                     (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"
- */
-  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 306, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__5);
-  __Pyx_GIVEREF(__pyx_tuple__5);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":856
- * 
- *         if (end - f) - (new_offset - offset[0]) < 15:
- *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
- * 
- *         if ((child.byteorder == c'>' and little_endian) or
- */
-  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 856, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__6);
-  __Pyx_GIVEREF(__pyx_tuple__6);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":880
- *             t = child.type_num
- *             if end - f < 5:
- *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
- * 
- *             # Until ticket #99 is fixed, use integers to avoid warnings
- */
-  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 880, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__7);
-  __Pyx_GIVEREF(__pyx_tuple__7);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1038
- *         _import_array()
- *     except Exception:
- *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
- * 
- * cdef inline int import_umath() except -1:
- */
-  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 1038, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__8);
-  __Pyx_GIVEREF(__pyx_tuple__8);
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1044
- *         _import_umath()
- *     except Exception:
- *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
- * 
- * cdef inline int import_ufunc() except -1:
- */
-  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 1044, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__9);
-  __Pyx_GIVEREF(__pyx_tuple__9);
-
-  /* "LFPy/run_simulation.pyx":29
- * 
- * 
- * def _run_simulation(cell, cvode, variable_dt=False, atol=0.001):             # <<<<<<<<<<<<<<
- *     """
- *     Running the actual simulation in NEURON, simulations in NEURON
- */
-  __pyx_tuple__10 = PyTuple_Pack(10, __pyx_n_s_cell, __pyx_n_s_cvode, __pyx_n_s_variable_dt, __pyx_n_s_atol, __pyx_n_s_counter, __pyx_n_s_interval, __pyx_n_s_tstop, __pyx_n_s_t0, __pyx_n_s_ti, __pyx_n_s_rtfactor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 29, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__10);
-  __Pyx_GIVEREF(__pyx_tuple__10);
-  __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LFPy_run_simulation_pyx, __pyx_n_s_run_simulation, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 29, __pyx_L1_error)
-
-  /* "LFPy/run_simulation.pyx":82
- * 
- * 
- * def _run_simulation_with_electrode(cell, cvode, electrode=None,             # <<<<<<<<<<<<<<
- *                                    variable_dt=False, atol=0.001,
- *                                    to_memory=True, to_file=False,
- */
-  __pyx_tuple__12 = PyTuple_Pack(33, __pyx_n_s_cell, __pyx_n_s_cvode, __pyx_n_s_electrode, __pyx_n_s_variable_dt, __pyx_n_s_atol, __pyx_n_s_to_memory, __pyx_n_s_to_file, __pyx_n_s_file_name, __pyx_n_s_dotprodcoeffs, __pyx_n_s_rec_current_dipole_moment, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_tstep, __pyx_n_s_tstop, __pyx_n_s_counter, __pyx_n_s_lendotprodcoeffs0, __pyx_n_s_interval, __pyx_n_s_t0, __pyx_n_s_ti, __pyx_n_s_rtfactor, __pyx_n_s_dt, __pyx_n_s_coeffs, __pyx_n_s_current_dipole_moment, __pyx_n_s_midpoints, __pyx_n_s_h5py, __pyx_n_s_electrodes, __pyx_n_s_el, __pyx_n_s_imem, __pyx_n_s_electrodesLFP, __pyx_n_s_el_LFP_file, __pyx_n_s_sec, __pyx_n_s_seg, __pyx_n_s_LFP); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 82, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_tuple__12);
-  __Pyx_GIVEREF(__pyx_tuple__12);
-  __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(10, 0, 33, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LFPy_run_simulation_pyx, __pyx_n_s_run_simulation_with_electrode, 82, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 82, __pyx_L1_error)
-  __Pyx_RefNannyFinishContext();
-  return 0;
-  __pyx_L1_error:;
-  __Pyx_RefNannyFinishContext();
-  return -1;
-}
-
-static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
-  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
-  __pyx_float_100_ = PyFloat_FromDouble(100.); if (unlikely(!__pyx_float_100_)) __PYX_ERR(0, 1, __pyx_L1_error)
-  __pyx_float_1Eneg_3 = PyFloat_FromDouble(1E-3); if (unlikely(!__pyx_float_1Eneg_3)) __PYX_ERR(0, 1, __pyx_L1_error)
-  __pyx_float_1Eneg_8 = PyFloat_FromDouble(1E-8); if (unlikely(!__pyx_float_1Eneg_8)) __PYX_ERR(0, 1, __pyx_L1_error)
-  __pyx_float_1Eneg_9 = PyFloat_FromDouble(1E-9); if (unlikely(!__pyx_float_1Eneg_9)) __PYX_ERR(0, 1, __pyx_L1_error)
-  __pyx_float_0_001 = PyFloat_FromDouble(0.001); if (unlikely(!__pyx_float_0_001)) __PYX_ERR(0, 1, __pyx_L1_error)
-  __pyx_float_1000_ = PyFloat_FromDouble(1000.); if (unlikely(!__pyx_float_1000_)) __PYX_ERR(0, 1, __pyx_L1_error)
-  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
-  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
-  return 0;
-  __pyx_L1_error:;
-  return -1;
-}
-
-static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
-static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
-static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
-static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
-static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
-static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
-static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
-
-static int __Pyx_modinit_global_init_code(void) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
-  /*--- Global init code ---*/
-  __Pyx_RefNannyFinishContext();
-  return 0;
-}
-
-static int __Pyx_modinit_variable_export_code(void) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
-  /*--- Variable export code ---*/
-  __Pyx_RefNannyFinishContext();
-  return 0;
-}
-
-static int __Pyx_modinit_function_export_code(void) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
-  /*--- Function export code ---*/
-  __Pyx_RefNannyFinishContext();
-  return 0;
-}
-
-static int __Pyx_modinit_type_init_code(void) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
-  /*--- Type init code ---*/
-  __Pyx_RefNannyFinishContext();
-  return 0;
-}
-
-static int __Pyx_modinit_type_import_code(void) {
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
-  /*--- Type import code ---*/
-  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", 
-  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
-  sizeof(PyTypeObject),
-  #else
-  sizeof(PyHeapTypeObject),
-  #endif
-  __Pyx_ImportType_CheckSize_Warn);
-   if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
-   if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 206, __pyx_L1_error)
-  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
-   if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 229, __pyx_L1_error)
-  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
-   if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 233, __pyx_L1_error)
-  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
-   if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 242, __pyx_L1_error)
-  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
-   if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 918, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_RefNannyFinishContext();
-  return 0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_RefNannyFinishContext();
-  return -1;
-}
-
-static int __Pyx_modinit_variable_import_code(void) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
-  /*--- Variable import code ---*/
-  __Pyx_RefNannyFinishContext();
-  return 0;
-}
-
-static int __Pyx_modinit_function_import_code(void) {
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
-  /*--- Function import code ---*/
-  __Pyx_RefNannyFinishContext();
-  return 0;
-}
-
-
-#if PY_MAJOR_VERSION < 3
-#ifdef CYTHON_NO_PYINIT_EXPORT
-#define __Pyx_PyMODINIT_FUNC void
-#else
-#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
-#endif
-#else
-#ifdef CYTHON_NO_PYINIT_EXPORT
-#define __Pyx_PyMODINIT_FUNC PyObject *
-#else
-#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
-#endif
-#endif
-
-
-#if PY_MAJOR_VERSION < 3
-__Pyx_PyMODINIT_FUNC initrun_simulation(void) CYTHON_SMALL_CODE; /*proto*/
-__Pyx_PyMODINIT_FUNC initrun_simulation(void)
-#else
-__Pyx_PyMODINIT_FUNC PyInit_run_simulation(void) CYTHON_SMALL_CODE; /*proto*/
-__Pyx_PyMODINIT_FUNC PyInit_run_simulation(void)
-#if CYTHON_PEP489_MULTI_PHASE_INIT
-{
-  return PyModuleDef_Init(&__pyx_moduledef);
-}
-static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
-    #if PY_VERSION_HEX >= 0x030700A1
-    static PY_INT64_T main_interpreter_id = -1;
-    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
-    if (main_interpreter_id == -1) {
-        main_interpreter_id = current_id;
-        return (unlikely(current_id == -1)) ? -1 : 0;
-    } else if (unlikely(main_interpreter_id != current_id))
-    #else
-    static PyInterpreterState *main_interpreter = NULL;
-    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
-    if (!main_interpreter) {
-        main_interpreter = current_interpreter;
-    } else if (unlikely(main_interpreter != current_interpreter))
-    #endif
-    {
-        PyErr_SetString(
-            PyExc_ImportError,
-            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
-        return -1;
-    }
-    return 0;
-}
-static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
-    PyObject *value = PyObject_GetAttrString(spec, from_name);
-    int result = 0;
-    if (likely(value)) {
-        if (allow_none || value != Py_None) {
-            result = PyDict_SetItemString(moddict, to_name, value);
-        }
-        Py_DECREF(value);
-    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
-        PyErr_Clear();
-    } else {
-        result = -1;
-    }
-    return result;
-}
-static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
-    PyObject *module = NULL, *moddict, *modname;
-    if (__Pyx_check_single_interpreter())
-        return NULL;
-    if (__pyx_m)
-        return __Pyx_NewRef(__pyx_m);
-    modname = PyObject_GetAttrString(spec, "name");
-    if (unlikely(!modname)) goto bad;
-    module = PyModule_NewObject(modname);
-    Py_DECREF(modname);
-    if (unlikely(!module)) goto bad;
-    moddict = PyModule_GetDict(module);
-    if (unlikely(!moddict)) goto bad;
-    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
-    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
-    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
-    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
-    return module;
-bad:
-    Py_XDECREF(module);
-    return NULL;
-}
-
-
-static CYTHON_SMALL_CODE int __pyx_pymod_exec_run_simulation(PyObject *__pyx_pyinit_module)
-#endif
-#endif
-{
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  __Pyx_RefNannyDeclarations
-  #if CYTHON_PEP489_MULTI_PHASE_INIT
-  if (__pyx_m) {
-    if (__pyx_m == __pyx_pyinit_module) return 0;
-    PyErr_SetString(PyExc_RuntimeError, "Module 'run_simulation' has already been imported. Re-initialisation is not supported.");
-    return -1;
-  }
-  #elif PY_MAJOR_VERSION >= 3
-  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
-  #endif
-  #if CYTHON_REFNANNY
-__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
-if (!__Pyx_RefNanny) {
-  PyErr_Clear();
-  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
-  if (!__Pyx_RefNanny)
-      Py_FatalError("failed to import 'refnanny' module");
-}
-#endif
-  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_run_simulation(void)", 0);
-  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
-  #ifdef __Pxy_PyFrame_Initialize_Offsets
-  __Pxy_PyFrame_Initialize_Offsets();
-  #endif
-  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
-  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
-  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
-  #ifdef __Pyx_CyFunction_USED
-  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
-  #endif
-  #ifdef __Pyx_FusedFunction_USED
-  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
-  #endif
-  #ifdef __Pyx_Coroutine_USED
-  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
-  #endif
-  #ifdef __Pyx_Generator_USED
-  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
-  #endif
-  #ifdef __Pyx_AsyncGen_USED
-  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
-  #endif
-  #ifdef __Pyx_StopAsyncIteration_USED
-  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
-  #endif
-  /*--- Library function declarations ---*/
-  /*--- Threads initialization code ---*/
-  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
-  #ifdef WITH_THREAD /* Python build with threading support? */
-  PyEval_InitThreads();
-  #endif
-  #endif
-  /*--- Module creation code ---*/
-  #if CYTHON_PEP489_MULTI_PHASE_INIT
-  __pyx_m = __pyx_pyinit_module;
-  Py_INCREF(__pyx_m);
-  #else
-  #if PY_MAJOR_VERSION < 3
-  __pyx_m = Py_InitModule4("run_simulation", __pyx_methods, __pyx_k_Copyright_C_2012_Computational_N, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
-  #else
-  __pyx_m = PyModule_Create(&__pyx_moduledef);
-  #endif
-  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
-  #endif
-  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
-  Py_INCREF(__pyx_d);
-  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
-  Py_INCREF(__pyx_b);
-  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
-  Py_INCREF(__pyx_cython_runtime);
-  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
-  /*--- Initialize various global constants etc. ---*/
-  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __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_ERR(0, 1, __pyx_L1_error)
-  #endif
-  if (__pyx_module_is_main_LFPy__run_simulation) {
-    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
-  }
-  #if PY_MAJOR_VERSION >= 3
-  {
-    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
-    if (!PyDict_GetItemString(modules, "LFPy.run_simulation")) {
-      if (unlikely(PyDict_SetItemString(modules, "LFPy.run_simulation", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
-    }
-  }
-  #endif
-  /*--- Builtin init code ---*/
-  if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
-  /*--- Constants init code ---*/
-  if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
-  /*--- Global type/function init code ---*/
-  (void)__Pyx_modinit_global_init_code();
-  (void)__Pyx_modinit_variable_export_code();
-  (void)__Pyx_modinit_function_export_code();
-  (void)__Pyx_modinit_type_init_code();
-  if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
-  (void)__Pyx_modinit_variable_import_code();
-  (void)__Pyx_modinit_function_import_code();
-  /*--- Execution code ---*/
-  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
-  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
-  #endif
-
-  /* "LFPy/run_simulation.pyx":19
- * 
- * from __future__ import division
- * from time import time             # <<<<<<<<<<<<<<
- * import numpy as np
- * cimport numpy as np
- */
-  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(__pyx_n_s_time);
-  __Pyx_GIVEREF(__pyx_n_s_time);
-  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_time);
-  __pyx_t_2 = __Pyx_Import(__pyx_n_s_time, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-
-  /* "LFPy/run_simulation.pyx":20
- * from __future__ import division
- * from time import time
- * import numpy as np             # <<<<<<<<<<<<<<
- * cimport numpy as np
- * import neuron
- */
-  __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-
-  /* "LFPy/run_simulation.pyx":22
- * import numpy as np
- * cimport numpy as np
- * import neuron             # <<<<<<<<<<<<<<
- * 
- * DTYPE = np.float64
- */
-  __pyx_t_2 = __Pyx_Import(__pyx_n_s_neuron, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  if (PyDict_SetItem(__pyx_d, __pyx_n_s_neuron, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-
-  /* "LFPy/run_simulation.pyx":24
- * import neuron
- * 
- * DTYPE = np.float64             # <<<<<<<<<<<<<<
- * ctypedef np.float64_t DTYPE_t
- * ctypedef Py_ssize_t   LTYPE_t
- */
-  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __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_DTYPE, __pyx_t_1) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-  /* "LFPy/run_simulation.pyx":29
- * 
- * 
- * def _run_simulation(cell, cvode, variable_dt=False, atol=0.001):             # <<<<<<<<<<<<<<
- *     """
- *     Running the actual simulation in NEURON, simulations in NEURON
- */
-  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4LFPy_14run_simulation_1_run_simulation, NULL, __pyx_n_s_LFPy_run_simulation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyDict_SetItem(__pyx_d, __pyx_n_s_run_simulation, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-  /* "LFPy/run_simulation.pyx":82
- * 
- * 
- * def _run_simulation_with_electrode(cell, cvode, electrode=None,             # <<<<<<<<<<<<<<
- *                                    variable_dt=False, atol=0.001,
- *                                    to_memory=True, to_file=False,
- */
-  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4LFPy_14run_simulation_3_run_simulation_with_electrode, NULL, __pyx_n_s_LFPy_run_simulation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyDict_SetItem(__pyx_d, __pyx_n_s_run_simulation_with_electrode, __pyx_t_1) < 0) __PYX_ERR(0, 82, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-  /* "LFPy/run_simulation.pyx":1
- * #!/usr/bin/env python             # <<<<<<<<<<<<<<
- * # -*- coding: utf-8 -*-
- * # cython: language_level=2
- */
-  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-  /* "../../../../../usr/lib64/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1046
- *         raise ImportError("numpy.core.umath failed to import")
- * 
- * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
- *     try:
- *         _import_umath()
- */
-
-  /*--- Wrapped vars code ---*/
-
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  if (__pyx_m) {
-    if (__pyx_d) {
-      __Pyx_AddTraceback("init LFPy.run_simulation", __pyx_clineno, __pyx_lineno, __pyx_filename);
-    }
-    Py_CLEAR(__pyx_m);
-  } else if (!PyErr_Occurred()) {
-    PyErr_SetString(PyExc_ImportError, "init LFPy.run_simulation");
-  }
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  #if CYTHON_PEP489_MULTI_PHASE_INIT
-  return (__pyx_m != NULL) ? 0 : -1;
-  #elif PY_MAJOR_VERSION >= 3
-  return __pyx_m;
-  #else
-  return;
-  #endif
-}
-
-/* --- Runtime support code --- */
-/* Refnanny */
-#if CYTHON_REFNANNY
-static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
-    PyObject *m = NULL, *p = NULL;
-    void *r = NULL;
-    m = PyImport_ImportModule(modname);
-    if (!m) goto end;
-    p = PyObject_GetAttrString(m, "RefNannyAPI");
-    if (!p) goto end;
-    r = PyLong_AsVoidPtr(p);
-end:
-    Py_XDECREF(p);
-    Py_XDECREF(m);
-    return (__Pyx_RefNannyAPIStruct *)r;
-}
-#endif
-
-/* PyObjectGetAttrStr */
-#if CYTHON_USE_TYPE_SLOTS
-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);
-}
-#endif
-
-/* GetBuiltinName */
-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 '%.200s' is not defined", PyString_AS_STRING(name));
-#endif
-    }
-    return result;
-}
-
-/* RaiseArgTupleInvalid */
-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,
-                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
-                 func_name, more_or_less, num_expected,
-                 (num_expected == 1) ? "" : "s", num_found);
-}
-
-/* RaiseDoubleKeywords */
-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
-}
-
-/* ParseKeywords */
-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,
-        "%.200s() keywords must be strings", function_name);
-    goto bad;
-invalid_keyword:
-    PyErr_Format(PyExc_TypeError,
-    #if PY_MAJOR_VERSION < 3
-        "%.200s() got an unexpected keyword argument '%.200s'",
-        function_name, PyString_AsString(key));
-    #else
-        "%s() got an unexpected keyword argument '%U'",
-        function_name, key);
-    #endif
-bad:
-    return -1;
-}
-
-/* PyDictVersioning */
-#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
-static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
-    PyObject *dict = Py_TYPE(obj)->tp_dict;
-    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
-}
-static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
-    PyObject **dictptr = NULL;
-    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
-    if (offset) {
-#if CYTHON_COMPILING_IN_CPYTHON
-        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
-#else
-        dictptr = _PyObject_GetDictPtr(obj);
-#endif
-    }
-    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
-}
-static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
-    PyObject *dict = Py_TYPE(obj)->tp_dict;
-    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
-        return 0;
-    return obj_dict_version == __Pyx_get_object_dict_version(obj);
-}
-#endif
-
-/* GetModuleGlobalName */
-#if CYTHON_USE_DICT_VERSIONS
-static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
-#else
-static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
-#endif
-{
-    PyObject *result;
-#if !CYTHON_AVOID_BORROWED_REFS
-#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
-    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
-    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
-    if (likely(result)) {
-        return __Pyx_NewRef(result);
-    } else if (unlikely(PyErr_Occurred())) {
-        return NULL;
-    }
-#else
-    result = PyDict_GetItem(__pyx_d, name);
-    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
-    if (likely(result)) {
-        return __Pyx_NewRef(result);
-    }
-#endif
-#else
-    result = PyObject_GetItem(__pyx_d, name);
-    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
-    if (likely(result)) {
-        return __Pyx_NewRef(result);
-    }
-    PyErr_Clear();
-#endif
-    return __Pyx_GetBuiltinName(name);
-}
-
-/* PyObjectSetAttrStr */
-#if CYTHON_USE_TYPE_SLOTS
-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);
-}
-#endif
-
-/* PyCFunctionFastCall */
-#if CYTHON_FAST_PYCCALL
-static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
-    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
-    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
-    PyObject *self = PyCFunction_GET_SELF(func);
-    int flags = PyCFunction_GET_FLAGS(func);
-    assert(PyCFunction_Check(func));
-    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
-    assert(nargs >= 0);
-    assert(nargs == 0 || args != NULL);
-    /* _PyCFunction_FastCallDict() must not be called with an exception set,
-       because it may clear it (directly or indirectly) and so the
-       caller loses its exception */
-    assert(!PyErr_Occurred());
-    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
-        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
-    } else {
-        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
-    }
-}
-#endif
-
-/* PyFunctionFastCall */
-#if CYTHON_FAST_PYCALL
-static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
-                                               PyObject *globals) {
-    PyFrameObject *f;
-    PyThreadState *tstate = __Pyx_PyThreadState_Current;
-    PyObject **fastlocals;
-    Py_ssize_t i;
-    PyObject *result;
-    assert(globals != NULL);
-    /* XXX Perhaps we should create a specialized
-       PyFrame_New() that doesn't take locals, but does
-       take builtins without sanity checking them.
-       */
-    assert(tstate != NULL);
-    f = PyFrame_New(tstate, co, globals, NULL);
-    if (f == NULL) {
-        return NULL;
-    }
-    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
-    for (i = 0; i < na; i++) {
-        Py_INCREF(*args);
-        fastlocals[i] = *args++;
-    }
-    result = PyEval_EvalFrameEx(f,0);
-    ++tstate->recursion_depth;
-    Py_DECREF(f);
-    --tstate->recursion_depth;
-    return result;
-}
-#if 1 || PY_VERSION_HEX < 0x030600B1
-static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
-    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
-    PyObject *globals = PyFunction_GET_GLOBALS(func);
-    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
-    PyObject *closure;
-#if PY_MAJOR_VERSION >= 3
-    PyObject *kwdefs;
-#endif
-    PyObject *kwtuple, **k;
-    PyObject **d;
-    Py_ssize_t nd;
-    Py_ssize_t nk;
-    PyObject *result;
-    assert(kwargs == NULL || PyDict_Check(kwargs));
-    nk = kwargs ? PyDict_Size(kwargs) : 0;
-    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
-        return NULL;
-    }
-    if (
-#if PY_MAJOR_VERSION >= 3
-            co->co_kwonlyargcount == 0 &&
-#endif
-            likely(kwargs == NULL || nk == 0) &&
-            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
-        if (argdefs == NULL && co->co_argcount == nargs) {
-            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
-            goto done;
-        }
-        else if (nargs == 0 && argdefs != NULL
-                 && co->co_argcount == Py_SIZE(argdefs)) {
-            /* function called with no arguments, but all parameters have
-               a default value: use default values as arguments .*/
-            args = &PyTuple_GET_ITEM(argdefs, 0);
-            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
-            goto done;
-        }
-    }
-    if (kwargs != NULL) {
-        Py_ssize_t pos, i;
-        kwtuple = PyTuple_New(2 * nk);
-        if (kwtuple == NULL) {
-            result = NULL;
-            goto done;
-        }
-        k = &PyTuple_GET_ITEM(kwtuple, 0);
-        pos = i = 0;
-        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
-            Py_INCREF(k[i]);
-            Py_INCREF(k[i+1]);
-            i += 2;
-        }
-        nk = i / 2;
-    }
-    else {
-        kwtuple = NULL;
-        k = NULL;
-    }
-    closure = PyFunction_GET_CLOSURE(func);
-#if PY_MAJOR_VERSION >= 3
-    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
-#endif
-    if (argdefs != NULL) {
-        d = &PyTuple_GET_ITEM(argdefs, 0);
-        nd = Py_SIZE(argdefs);
-    }
-    else {
-        d = NULL;
-        nd = 0;
-    }
-#if PY_MAJOR_VERSION >= 3
-    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
-                               args, (int)nargs,
-                               k, (int)nk,
-                               d, (int)nd, kwdefs, closure);
-#else
-    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
-                               args, (int)nargs,
-                               k, (int)nk,
-                               d, (int)nd, closure);
-#endif
-    Py_XDECREF(kwtuple);
-done:
-    Py_LeaveRecursiveCall();
-    return result;
-}
-#endif
-#endif
-
-/* PyObjectCall */
-#if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
-    PyObject *result;
-    ternaryfunc call = func->ob_type->tp_call;
-    if (unlikely(!call))
-        return PyObject_Call(func, arg, kw);
-    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
-        return NULL;
-    result = (*call)(func, arg, kw);
-    Py_LeaveRecursiveCall();
-    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
-        PyErr_SetString(
-            PyExc_SystemError,
-            "NULL result without error in PyObject_Call");
-    }
-    return result;
-}
-#endif
-
-/* PyObjectCall2Args */
-static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
-    PyObject *args, *result = NULL;
-    #if CYTHON_FAST_PYCALL
-    if (PyFunction_Check(function)) {
-        PyObject *args[2] = {arg1, arg2};
-        return __Pyx_PyFunction_FastCall(function, args, 2);
-    }
-    #endif
-    #if CYTHON_FAST_PYCCALL
-    if (__Pyx_PyFastCFunction_Check(function)) {
-        PyObject *args[2] = {arg1, arg2};
-        return __Pyx_PyCFunction_FastCall(function, args, 2);
-    }
-    #endif
-    args = PyTuple_New(2);
-    if (unlikely(!args)) goto done;
-    Py_INCREF(arg1);
-    PyTuple_SET_ITEM(args, 0, arg1);
-    Py_INCREF(arg2);
-    PyTuple_SET_ITEM(args, 1, arg2);
-    Py_INCREF(function);
-    result = __Pyx_PyObject_Call(function, args, NULL);
-    Py_DECREF(args);
-    Py_DECREF(function);
-done:
-    return result;
-}
-
-/* PyObjectCallMethO */
-#if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
-    PyObject *self, *result;
-    PyCFunction cfunc;
-    cfunc = PyCFunction_GET_FUNCTION(func);
-    self = PyCFunction_GET_SELF(func);
-    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
-        return NULL;
-    result = cfunc(self, arg);
-    Py_LeaveRecursiveCall();
-    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
-        PyErr_SetString(
-            PyExc_SystemError,
-            "NULL result without error in PyObject_Call");
-    }
-    return result;
-}
-#endif
-
-/* PyObjectCallOneArg */
-#if CYTHON_COMPILING_IN_CPYTHON
-static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
-    PyObject *result;
-    PyObject *args = PyTuple_New(1);
-    if (unlikely(!args)) return NULL;
-    Py_INCREF(arg);
-    PyTuple_SET_ITEM(args, 0, arg);
-    result = __Pyx_PyObject_Call(func, args, NULL);
-    Py_DECREF(args);
-    return result;
-}
-static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
-#if CYTHON_FAST_PYCALL
-    if (PyFunction_Check(func)) {
-        return __Pyx_PyFunction_FastCall(func, &arg, 1);
-    }
-#endif
-    if (likely(PyCFunction_Check(func))) {
-        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
-            return __Pyx_PyObject_CallMethO(func, arg);
-#if CYTHON_FAST_PYCCALL
-        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
-            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
-#endif
-        }
-    }
-    return __Pyx__PyObject_CallOneArg(func, arg);
-}
-#else
-static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
-    PyObject *result;
-    PyObject *args = PyTuple_Pack(1, arg);
-    if (unlikely(!args)) return NULL;
-    result = __Pyx_PyObject_Call(func, args, NULL);
-    Py_DECREF(args);
-    return result;
-}
-#endif
-
-/* PyObjectCallNoArg */
-#if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
-#if CYTHON_FAST_PYCALL
-    if (PyFunction_Check(func)) {
-        return __Pyx_PyFunction_FastCall(func, NULL, 0);
-    }
-#endif
-#ifdef __Pyx_CyFunction_USED
-    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
-#else
-    if (likely(PyCFunction_Check(func)))
-#endif
-    {
-        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
-            return __Pyx_PyObject_CallMethO(func, NULL);
-        }
-    }
-    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
-}
-#endif
-
-/* PyFloatBinop */
-#if !CYTHON_COMPILING_IN_PYPY
-#define __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(operand) if (unlikely(zerodivision_check && ((operand) == 0))) {\
-    PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero");\
-    return NULL;\
-}
-static PyObject* __Pyx_PyFloat_TrueDivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
-    const double a = floatval;
-    double b, result;
-    (void)inplace;
-    (void)zerodivision_check;
-    if (likely(PyFloat_CheckExact(op2))) {
-        b = PyFloat_AS_DOUBLE(op2);
-        __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(b)
-    } else
-    #if PY_MAJOR_VERSION < 3
-    if (likely(PyInt_CheckExact(op2))) {
-        b = (double) PyInt_AS_LONG(op2);
-        __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(b)
-    } else
-    #endif
-    if (likely(PyLong_CheckExact(op2))) {
-        #if CYTHON_USE_PYLONG_INTERNALS
-        const digit* digits = ((PyLongObject*)op2)->ob_digit;
-        const Py_ssize_t size = Py_SIZE(op2);
-        switch (size) {
-            case  0: __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(0) break;
-            case -1: b = -(double) digits[0]; break;
-            case  1: b = (double) digits[0]; break;
-            case -2:
-            case 2:
-                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
-                    b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
-                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
-                        if (size == -2)
-                            b = -b;
-                        break;
-                    }
-                }
-                CYTHON_FALLTHROUGH;
-            case -3:
-            case 3:
-                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
-                    b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
-                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
-                        if (size == -3)
-                            b = -b;
-                        break;
-                    }
-                }
-                CYTHON_FALLTHROUGH;
-            case -4:
-            case 4:
-                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
-                    b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
-                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
-                        if (size == -4)
-                            b = -b;
-                        break;
-                    }
-                }
-                CYTHON_FALLTHROUGH;
-            default:
-        #else
-        {
-        #endif
-            b = PyLong_AsDouble(op2);
-            if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL;
-            __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(b)
-        }
-    } else {
-        return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
-    }
-        __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(b)
-        PyFPE_START_PROTECT("divide", return NULL)
-        result = a / b;
-        PyFPE_END_PROTECT(result)
-        return PyFloat_FromDouble(result);
-}
-#endif
-
-/* None */
-  static CYTHON_INLINE double __Pyx_mod_double(double a, double b) {
-    double r = fmod(a, b);
-    r += ((r != 0) & ((r < 0) ^ (b < 0))) * b;
-    return r;
-}
-
-/* PyFloatBinop */
-  #if !CYTHON_COMPILING_IN_PYPY
-static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
-    const double b = floatval;
-    double a, result;
-    (void)inplace;
-    (void)zerodivision_check;
-    if (likely(PyFloat_CheckExact(op1))) {
-        a = PyFloat_AS_DOUBLE(op1);
-        
-    } else
-    #if PY_MAJOR_VERSION < 3
-    if (likely(PyInt_CheckExact(op1))) {
-        a = (double) PyInt_AS_LONG(op1);
-        
-    } else
-    #endif
-    if (likely(PyLong_CheckExact(op1))) {
-        #if CYTHON_USE_PYLONG_INTERNALS
-        const digit* digits = ((PyLongObject*)op1)->ob_digit;
-        const Py_ssize_t size = Py_SIZE(op1);
-        switch (size) {
-            case  0: a = 0.0; break;
-            case -1: a = -(double) digits[0]; break;
-            case  1: a = (double) digits[0]; break;
-            case -2:
-            case 2:
-                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
-                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
-                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
-                        if (size == -2)
-                            a = -a;
-                        break;
-                    }
-                }
-                CYTHON_FALLTHROUGH;
-            case -3:
-            case 3:
-                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
-                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
-                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
-                        if (size == -3)
-                            a = -a;
-                        break;
-                    }
-                }
-                CYTHON_FALLTHROUGH;
-            case -4:
-            case 4:
-                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
-                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
-                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
-                        if (size == -4)
-                            a = -a;
-                        break;
-                    }
-                }
-                CYTHON_FALLTHROUGH;
-            default:
-        #else
-        {
-        #endif
-            a = PyLong_AsDouble(op1);
-            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
-            
-        }
-    } else {
-        return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
-    }
-        
-        PyFPE_START_PROTECT("add", return NULL)
-        result = a + b;
-        PyFPE_END_PROTECT(result)
-        return PyFloat_FromDouble(result);
-}
-#endif
-
-/* Import */
-    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_MAJOR_VERSION < 3
-    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_MAJOR_VERSION >= 3
-        if (level == -1) {
-            if (strchr(__Pyx_MODULE_NAME, '.')) {
-                module = PyImport_ImportModuleLevelObject(
-                    name, global_dict, empty_dict, list, 1);
-                if (!module) {
-                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
-                        goto bad;
-                    PyErr_Clear();
-                }
-            }
-            level = 0;
-        }
-        #endif
-        if (!module) {
-            #if PY_MAJOR_VERSION < 3
-            PyObject *py_level = PyInt_FromLong(level);
-            if (!py_level)
-                goto bad;
-            module = PyObject_CallFunctionObjArgs(py_import,
-                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
-            Py_DECREF(py_level);
-            #else
-            module = PyImport_ImportModuleLevelObject(
-                name, global_dict, empty_dict, list, level);
-            #endif
-        }
-    }
-bad:
-    #if PY_MAJOR_VERSION < 3
-    Py_XDECREF(py_import);
-    #endif
-    Py_XDECREF(empty_list);
-    Py_XDECREF(empty_dict);
-    return module;
-}
-
-/* GetTopmostException */
-    #if CYTHON_USE_EXC_INFO_STACK
-static _PyErr_StackItem *
-__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
-{
-    _PyErr_StackItem *exc_info = tstate->exc_info;
-    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
-           exc_info->previous_item != NULL)
-    {
-        exc_info = exc_info->previous_item;
-    }
-    return exc_info;
-}
-#endif
-
-/* SaveResetException */
-    #if CYTHON_FAST_THREAD_STATE
-static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
-    #if CYTHON_USE_EXC_INFO_STACK
-    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
-    *type = exc_info->exc_type;
-    *value = exc_info->exc_value;
-    *tb = exc_info->exc_traceback;
-    #else
-    *type = tstate->exc_type;
-    *value = tstate->exc_value;
-    *tb = tstate->exc_traceback;
-    #endif
-    Py_XINCREF(*type);
-    Py_XINCREF(*value);
-    Py_XINCREF(*tb);
-}
-static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
-    PyObject *tmp_type, *tmp_value, *tmp_tb;
-    #if CYTHON_USE_EXC_INFO_STACK
-    _PyErr_StackItem *exc_info = tstate->exc_info;
-    tmp_type = exc_info->exc_type;
-    tmp_value = exc_info->exc_value;
-    tmp_tb = exc_info->exc_traceback;
-    exc_info->exc_type = type;
-    exc_info->exc_value = value;
-    exc_info->exc_traceback = tb;
-    #else
-    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;
-    #endif
-    Py_XDECREF(tmp_type);
-    Py_XDECREF(tmp_value);
-    Py_XDECREF(tmp_tb);
-}
-#endif
-
-/* GetException */
-    #if CYTHON_FAST_THREAD_STATE
-static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
-#else
-static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
-#endif
-{
-    PyObject *local_type, *local_value, *local_tb;
-#if CYTHON_FAST_THREAD_STATE
-    PyObject *tmp_type, *tmp_value, *tmp_tb;
-    local_type = tstate->curexc_type;
-    local_value = tstate->curexc_value;
-    local_tb = tstate->curexc_traceback;
-    tstate->curexc_type = 0;
-    tstate->curexc_value = 0;
-    tstate->curexc_traceback = 0;
-#else
-    PyErr_Fetch(&local_type, &local_value, &local_tb);
-#endif
-    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
-#if CYTHON_FAST_THREAD_STATE
-    if (unlikely(tstate->curexc_type))
-#else
-    if (unlikely(PyErr_Occurred()))
-#endif
-        goto bad;
-    #if PY_MAJOR_VERSION >= 3
-    if (local_tb) {
-        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
-            goto bad;
-    }
-    #endif
-    Py_XINCREF(local_tb);
-    Py_XINCREF(local_type);
-    Py_XINCREF(local_value);
-    *type = local_type;
-    *value = local_value;
-    *tb = local_tb;
-#if CYTHON_FAST_THREAD_STATE
-    #if CYTHON_USE_EXC_INFO_STACK
-    {
-        _PyErr_StackItem *exc_info = tstate->exc_info;
-        tmp_type = exc_info->exc_type;
-        tmp_value = exc_info->exc_value;
-        tmp_tb = exc_info->exc_traceback;
-        exc_info->exc_type = local_type;
-        exc_info->exc_value = local_value;
-        exc_info->exc_traceback = local_tb;
-    }
-    #else
-    tmp_type = tstate->exc_type;
-    tmp_value = tstate->exc_value;
-    tmp_tb = tstate->exc_traceback;
-    tstate->exc_type = local_type;
-    tstate->exc_value = local_value;
-    tstate->exc_traceback = local_tb;
-    #endif
-    Py_XDECREF(tmp_type);
-    Py_XDECREF(tmp_value);
-    Py_XDECREF(tmp_tb);
-#else
-    PyErr_SetExcInfo(local_type, local_value, local_tb);
-#endif
-    return 0;
-bad:
-    *type = 0;
-    *value = 0;
-    *tb = 0;
-    Py_XDECREF(local_type);
-    Py_XDECREF(local_value);
-    Py_XDECREF(local_tb);
-    return -1;
-}
-
-/* PyObjectGetMethod */
-    static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
-    PyObject *attr;
-#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
-    PyTypeObject *tp = Py_TYPE(obj);
-    PyObject *descr;
-    descrgetfunc f = NULL;
-    PyObject **dictptr, *dict;
-    int meth_found = 0;
-    assert (*method == NULL);
-    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
-        attr = __Pyx_PyObject_GetAttrStr(obj, name);
-        goto try_unpack;
-    }
-    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
-        return 0;
-    }
-    descr = _PyType_Lookup(tp, name);
-    if (likely(descr != NULL)) {
-        Py_INCREF(descr);
-#if PY_MAJOR_VERSION >= 3
-        #ifdef __Pyx_CyFunction_USED
-        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
-        #else
-        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
-        #endif
-#else
-        #ifdef __Pyx_CyFunction_USED
-        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
-        #else
-        if (likely(PyFunction_Check(descr)))
-        #endif
-#endif
-        {
-            meth_found = 1;
-        } else {
-            f = Py_TYPE(descr)->tp_descr_get;
-            if (f != NULL && PyDescr_IsData(descr)) {
-                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
-                Py_DECREF(descr);
-                goto try_unpack;
-            }
-        }
-    }
-    dictptr = _PyObject_GetDictPtr(obj);
-    if (dictptr != NULL && (dict = *dictptr) != NULL) {
-        Py_INCREF(dict);
-        attr = __Pyx_PyDict_GetItemStr(dict, name);
-        if (attr != NULL) {
-            Py_INCREF(attr);
-            Py_DECREF(dict);
-            Py_XDECREF(descr);
-            goto try_unpack;
-        }
-        Py_DECREF(dict);
-    }
-    if (meth_found) {
-        *method = descr;
-        return 1;
-    }
-    if (f != NULL) {
-        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
-        Py_DECREF(descr);
-        goto try_unpack;
-    }
-    if (descr != NULL) {
-        *method = descr;
-        return 0;
-    }
-    PyErr_Format(PyExc_AttributeError,
-#if PY_MAJOR_VERSION >= 3
-                 "'%.50s' object has no attribute '%U'",
-                 tp->tp_name, name);
-#else
-                 "'%.50s' object has no attribute '%.400s'",
-                 tp->tp_name, PyString_AS_STRING(name));
-#endif
-    return 0;
-#else
-    attr = __Pyx_PyObject_GetAttrStr(obj, name);
-    goto try_unpack;
-#endif
-try_unpack:
-#if CYTHON_UNPACK_METHODS
-    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
-        PyObject *function = PyMethod_GET_FUNCTION(attr);
-        Py_INCREF(function);
-        Py_DECREF(attr);
-        *method = function;
-        return 1;
-    }
-#endif
-    *method = attr;
-    return 0;
-}
-
-/* PyObjectCallMethod1 */
-    static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
-    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
-    Py_DECREF(method);
-    return result;
-}
-static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
-    PyObject *method = NULL, *result;
-    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
-    if (likely(is_method)) {
-        result = __Pyx_PyObject_Call2Args(method, obj, arg);
-        Py_DECREF(method);
-        return result;
-    }
-    if (unlikely(!method)) return NULL;
-    return __Pyx__PyObject_CallMethod1(method, arg);
-}
-
-/* append */
-    static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
-    if (likely(PyList_CheckExact(L))) {
-        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
-    } else {
-        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
-        if (unlikely(!retval))
-            return -1;
-        Py_DECREF(retval);
-    }
-    return 0;
-}
-
-/* ExtTypeTest */
-    static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
-    if (unlikely(!type)) {
-        PyErr_SetString(PyExc_SystemError, "Missing type object");
-        return 0;
-    }
-    if (likely(__Pyx_TypeCheck(obj, type)))
-        return 1;
-    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
-                 Py_TYPE(obj)->tp_name, type->tp_name);
-    return 0;
-}
-
-/* IsLittleEndian */
-    static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
-{
-  union {
-    uint32_t u32;
-    uint8_t u8[4];
-  } S;
-  S.u32 = 0x01020304;
-  return S.u8[0] == 4;
-}
-
-/* BufferFormatCheck */
-    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)
-        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 '?': return "'bool'";
-    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 '?': 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 '?': 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;
-    while (1) {
-      if (field == &ctx->root) {
-        ctx->head = NULL;
-        if (ctx->enc_count != 0) {
-          __Pyx_BufFmt_RaiseExpected(ctx);
-          return -1;
-        }
-        break;
-      }
-      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;
-        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 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 != ')') {
-        switch (*ts) {
-            case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
-            default:  break;
-        }
-        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 '\r':
-      case '\n':
-        ++ts;
-        break;
-      case '<':
-        if (!__Pyx_Is_Little_Endian()) {
-          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
-          return NULL;
-        }
-        ctx->new_packmode = '=';
-        ++ts;
-        break;
-      case '>':
-      case '!':
-        if (__Pyx_Is_Little_Endian()) {
-          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':
-        {
-          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;
-          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 '}':
-        {
-          size_t alignment = ctx->struct_alignment;
-          ++ts;
-          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
-          ctx->enc_type = 0;
-          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;
-        }
-        CYTHON_FALLTHROUGH;
-      case '?': 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 'p':
-        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
-            ctx->enc_packmode == ctx->new_packmode) {
-          ctx->enc_count += ctx->new_count;
-          ctx->new_count = 1;
-          got_Z = 0;
-          ++ts;
-          break;
-        }
-        CYTHON_FALLTHROUGH;
-      case 's':
-        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;
-        }
-    }
-  }
-}
-
-/* BufferGetAndValidate */
-      static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
-  if (unlikely(info->buf == NULL)) return;
-  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
-  __Pyx_ReleaseBuffer(info);
-}
-static 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 int __Pyx__GetBufferAndValidate(
-        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
-        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
-{
-  buf->buf = NULL;
-  if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
-    __Pyx_ZeroBuffer(buf);
-    return -1;
-  }
-  if (unlikely(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 (unlikely((size_t)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_SafeReleaseBuffer(buf);
-  return -1;
-}
-
-/* BufferFallbackError */
-      static void __Pyx_RaiseBufferFallbackError(void) {
-  PyErr_SetString(PyExc_ValueError,
-     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
-}
-
-/* PyIntFromDouble */
-      #if PY_MAJOR_VERSION < 3
-static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value) {
-    if (value >= (double)LONG_MIN && value <= (double)LONG_MAX) {
-        return PyInt_FromLong((long)value);
-    }
-    return PyLong_FromDouble(value);
-}
-#endif
-
-/* GetItemInt */
-      static 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,
-                                                              CYTHON_NCP_UNUSED int wraparound,
-                                                              CYTHON_NCP_UNUSED int boundscheck) {
-#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-    Py_ssize_t wrapped_i = i;
-    if (wraparound & unlikely(i < 0)) {
-        wrapped_i += PyList_GET_SIZE(o);
-    }
-    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
-        PyObject *r = PyList_GET_ITEM(o, wrapped_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,
-                                                              CYTHON_NCP_UNUSED int wraparound,
-                                                              CYTHON_NCP_UNUSED int boundscheck) {
-#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
-    Py_ssize_t wrapped_i = i;
-    if (wraparound & unlikely(i < 0)) {
-        wrapped_i += PyTuple_GET_SIZE(o);
-    }
-    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
-        PyObject *r = PyTuple_GET_ITEM(o, wrapped_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,
-                                                     CYTHON_NCP_UNUSED int wraparound,
-                                                     CYTHON_NCP_UNUSED int boundscheck) {
-#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
-    if (is_list || PyList_CheckExact(o)) {
-        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
-        if ((!boundscheck) || (likely(__Pyx_is_valid_index(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(__Pyx_is_valid_index(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))
-                        return NULL;
-                    PyErr_Clear();
-                }
-            }
-            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));
-}
-
-/* BytesEquals */
-      static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
-#if CYTHON_COMPILING_IN_PYPY
-    return PyObject_RichCompareBool(s1, s2, equals);
-#else
-    if (s1 == s2) {
-        return (equals == Py_EQ);
-    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
-        const char *ps1, *ps2;
-        Py_ssize_t length = PyBytes_GET_SIZE(s1);
-        if (length != PyBytes_GET_SIZE(s2))
-            return (equals == Py_NE);
-        ps1 = PyBytes_AS_STRING(s1);
-        ps2 = PyBytes_AS_STRING(s2);
-        if (ps1[0] != ps2[0]) {
-            return (equals == Py_NE);
-        } else if (length == 1) {
-            return (equals == Py_EQ);
-        } else {
-            int result;
-#if CYTHON_USE_UNICODE_INTERNALS
-            Py_hash_t hash1, hash2;
-            hash1 = ((PyBytesObject*)s1)->ob_shash;
-            hash2 = ((PyBytesObject*)s2)->ob_shash;
-            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
-                return (equals == Py_NE);
-            }
-#endif
-            result = memcmp(ps1, ps2, (size_t)length);
-            return (equals == Py_EQ) ? (result == 0) : (result != 0);
-        }
-    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
-        return (equals == Py_NE);
-    } else if ((s2 == Py_None) & PyBytes_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
-}
-
-/* UnicodeEquals */
-      static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
-#if CYTHON_COMPILING_IN_PYPY
-    return PyObject_RichCompareBool(s1, s2, equals);
-#else
-#if PY_MAJOR_VERSION < 3
-    PyObject* owned_ref = NULL;
-#endif
-    int s1_is_unicode, s2_is_unicode;
-    if (s1 == s2) {
-        goto return_eq;
-    }
-    s1_is_unicode = PyUnicode_CheckExact(s1);
-    s2_is_unicode = PyUnicode_CheckExact(s2);
-#if PY_MAJOR_VERSION < 3
-    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
-        owned_ref = PyUnicode_FromObject(s2);
-        if (unlikely(!owned_ref))
-            return -1;
-        s2 = owned_ref;
-        s2_is_unicode = 1;
-    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
-        owned_ref = PyUnicode_FromObject(s1);
-        if (unlikely(!owned_ref))
-            return -1;
-        s1 = owned_ref;
-        s1_is_unicode = 1;
-    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
-        return __Pyx_PyBytes_Equals(s1, s2, equals);
-    }
-#endif
-    if (s1_is_unicode & s2_is_unicode) {
-        Py_ssize_t length;
-        int kind;
-        void *data1, *data2;
-        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
-            return -1;
-        length = __Pyx_PyUnicode_GET_LENGTH(s1);
-        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
-            goto return_ne;
-        }
-#if CYTHON_USE_UNICODE_INTERNALS
-        {
-            Py_hash_t hash1, hash2;
-        #if CYTHON_PEP393_ENABLED
-            hash1 = ((PyASCIIObject*)s1)->hash;
-            hash2 = ((PyASCIIObject*)s2)->hash;
-        #else
-            hash1 = ((PyUnicodeObject*)s1)->hash;
-            hash2 = ((PyUnicodeObject*)s2)->hash;
-        #endif
-            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
-                goto return_ne;
-            }
-        }
-#endif
-        kind = __Pyx_PyUnicode_KIND(s1);
-        if (kind != __Pyx_PyUnicode_KIND(s2)) {
-            goto return_ne;
-        }
-        data1 = __Pyx_PyUnicode_DATA(s1);
-        data2 = __Pyx_PyUnicode_DATA(s2);
-        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
-            goto return_ne;
-        } else if (length == 1) {
-            goto return_eq;
-        } else {
-            int result = memcmp(data1, data2, (size_t)(length * kind));
-            #if PY_MAJOR_VERSION < 3
-            Py_XDECREF(owned_ref);
-            #endif
-            return (equals == Py_EQ) ? (result == 0) : (result != 0);
-        }
-    } else if ((s1 == Py_None) & s2_is_unicode) {
-        goto return_ne;
-    } else if ((s2 == Py_None) & s1_is_unicode) {
-        goto return_ne;
-    } else {
-        int result;
-        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
-        #if PY_MAJOR_VERSION < 3
-        Py_XDECREF(owned_ref);
-        #endif
-        if (!py_result)
-            return -1;
-        result = __Pyx_PyObject_IsTrue(py_result);
-        Py_DECREF(py_result);
-        return result;
-    }
-return_eq:
-    #if PY_MAJOR_VERSION < 3
-    Py_XDECREF(owned_ref);
-    #endif
-    return (equals == Py_EQ);
-return_ne:
-    #if PY_MAJOR_VERSION < 3
-    Py_XDECREF(owned_ref);
-    #endif
-    return (equals == Py_NE);
-#endif
-}
-
-/* None */
-      static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
-    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
-}
-
-/* ObjectGetItem */
-      #if CYTHON_USE_TYPE_SLOTS
-static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
-    PyObject *runerr;
-    Py_ssize_t key_value;
-    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
-    if (unlikely(!(m && m->sq_item))) {
-        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
-        return NULL;
-    }
-    key_value = __Pyx_PyIndex_AsSsize_t(index);
-    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
-        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
-    }
-    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
-        PyErr_Clear();
-        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
-    }
-    return NULL;
-}
-static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
-    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
-    if (likely(m && m->mp_subscript)) {
-        return m->mp_subscript(obj, key);
-    }
-    return __Pyx_PyObject_GetIndex(obj, key);
-}
-#endif
-
-/* SetItemInt */
-      static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
-    int r;
-    if (!j) return -1;
-    r = PyObject_SetItem(o, j, v);
-    Py_DECREF(j);
-    return r;
-}
-static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
-                                               CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
-#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
-    if (is_list || PyList_CheckExact(o)) {
-        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
-        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
-            PyObject* old = PyList_GET_ITEM(o, n);
-            Py_INCREF(v);
-            PyList_SET_ITEM(o, n, v);
-            Py_DECREF(old);
-            return 1;
-        }
-    } else {
-        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
-        if (likely(m && m->sq_ass_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))
-                        return -1;
-                    PyErr_Clear();
-                }
-            }
-            return m->sq_ass_item(o, i, v);
-        }
-    }
-#else
-#if CYTHON_COMPILING_IN_PYPY
-    if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
-#else
-    if (is_list || PySequence_Check(o))
-#endif
-    {
-        return PySequence_SetItem(o, i, v);
-    }
-#endif
-    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
-}
-
-/* PyErrFetchRestore */
-      #if CYTHON_FAST_THREAD_STATE
-static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
-    PyObject *tmp_type, *tmp_value, *tmp_tb;
-    tmp_type = tstate->curexc_type;
-    tmp_value = tstate->curexc_value;
-    tmp_tb = tstate->curexc_traceback;
-    tstate->curexc_type = type;
-    tstate->curexc_value = value;
-    tstate->curexc_traceback = tb;
-    Py_XDECREF(tmp_type);
-    Py_XDECREF(tmp_value);
-    Py_XDECREF(tmp_tb);
-}
-static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
-    *type = tstate->curexc_type;
-    *value = tstate->curexc_value;
-    *tb = tstate->curexc_traceback;
-    tstate->curexc_type = 0;
-    tstate->curexc_value = 0;
-    tstate->curexc_traceback = 0;
-}
-#endif
-
-/* SliceTupleAndList */
-      #if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
-    Py_ssize_t start = *_start, stop = *_stop, length = *_length;
-    if (start < 0) {
-        start += length;
-        if (start < 0)
-            start = 0;
-    }
-    if (stop < 0)
-        stop += length;
-    else if (stop > length)
-        stop = length;
-    *_length = stop - start;
-    *_start = start;
-    *_stop = stop;
-}
-static CYTHON_INLINE void __Pyx_copy_object_array(PyObject** CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
-    PyObject *v;
-    Py_ssize_t i;
-    for (i = 0; i < length; i++) {
-        v = dest[i] = src[i];
-        Py_INCREF(v);
-    }
-}
-static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
-            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
-    PyObject* dest;
-    Py_ssize_t length = PyList_GET_SIZE(src);
-    __Pyx_crop_slice(&start, &stop, &length);
-    if (unlikely(length <= 0))
-        return PyList_New(0);
-    dest = PyList_New(length);
-    if (unlikely(!dest))
-        return NULL;
-    __Pyx_copy_object_array(
-        ((PyListObject*)src)->ob_item + start,
-        ((PyListObject*)dest)->ob_item,
-        length);
-    return dest;
-}
-static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
-            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
-    PyObject* dest;
-    Py_ssize_t length = PyTuple_GET_SIZE(src);
-    __Pyx_crop_slice(&start, &stop, &length);
-    if (unlikely(length <= 0))
-        return PyTuple_New(0);
-    dest = PyTuple_New(length);
-    if (unlikely(!dest))
-        return NULL;
-    __Pyx_copy_object_array(
-        ((PyTupleObject*)src)->ob_item + start,
-        ((PyTupleObject*)dest)->ob_item,
-        length);
-    return dest;
-}
-#endif
-
-/* GetAttr */
-      static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
-#if CYTHON_USE_TYPE_SLOTS
-#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);
-}
-
-/* HasAttr */
-      static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
-    PyObject *r;
-    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
-        PyErr_SetString(PyExc_TypeError,
-                        "hasattr(): attribute name must be string");
-        return -1;
-    }
-    r = __Pyx_GetAttr(o, n);
-    if (unlikely(!r)) {
-        PyErr_Clear();
-        return 0;
-    } else {
-        Py_DECREF(r);
-        return 1;
-    }
-}
-
-/* BufferIndexError */
-      static void __Pyx_RaiseBufferIndexError(int axis) {
-  PyErr_Format(PyExc_IndexError,
-     "Out of bounds on buffer access (axis %d)", axis);
-}
-
-/* RaiseException */
-      #if PY_MAJOR_VERSION < 3
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
-                        CYTHON_UNUSED PyObject *cause) {
-    __Pyx_PyThreadState_declare
-    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 (PyType_Check(type)) {
-#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;
-        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;
-        }
-    }
-    __Pyx_PyThreadState_assign
-    __Pyx_ErrRestore(type, value, tb);
-    return;
-raise_error:
-    Py_XDECREF(value);
-    Py_XDECREF(type);
-    Py_XDECREF(tb);
-    return;
-}
-#else
-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) {
-                int is_subclass = PyObject_IsSubclass(instance_class, type);
-                if (!is_subclass) {
-                    instance_class = NULL;
-                } else if (unlikely(is_subclass == -1)) {
-                    goto bad;
-                } else {
-                    type = instance_class;
-                }
-            }
-        }
-        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 (cause) {
-        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 {
-            PyErr_SetString(PyExc_TypeError,
-                            "exception causes must derive from "
-                            "BaseException");
-            goto bad;
-        }
-        PyException_SetCause(value, fixed_cause);
-    }
-    PyErr_SetObject(type, value);
-    if (tb) {
-#if CYTHON_COMPILING_IN_PYPY
-        PyObject *tmp_type, *tmp_value, *tmp_tb;
-        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
-        Py_INCREF(tb);
-        PyErr_Restore(tmp_type, tmp_value, tb);
-        Py_XDECREF(tmp_tb);
-#else
-        PyThreadState *tstate = __Pyx_PyThreadState_Current;
-        PyObject* tmp_tb = tstate->curexc_traceback;
-        if (tb != tmp_tb) {
-            Py_INCREF(tb);
-            tstate->curexc_traceback = tb;
-            Py_XDECREF(tmp_tb);
-        }
-#endif
-    }
-bad:
-    Py_XDECREF(owned_instance);
-    return;
-}
-#endif
-
-/* DictGetItem */
-      #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
-static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
-    PyObject *value;
-    value = PyDict_GetItemWithError(d, key);
-    if (unlikely(!value)) {
-        if (!PyErr_Occurred()) {
-            if (unlikely(PyTuple_Check(key))) {
-                PyObject* args = PyTuple_Pack(1, key);
-                if (likely(args)) {
-                    PyErr_SetObject(PyExc_KeyError, args);
-                    Py_DECREF(args);
-                }
-            } else {
-                PyErr_SetObject(PyExc_KeyError, key);
-            }
-        }
-        return NULL;
-    }
-    Py_INCREF(value);
-    return value;
-}
-#endif
-
-/* RaiseTooManyValuesToUnpack */
-      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);
-}
-
-/* RaiseNeedMoreValuesToUnpack */
-      static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
-    PyErr_Format(PyExc_ValueError,
-                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
-                 index, (index == 1) ? "" : "s");
-}
-
-/* RaiseNoneIterError */
-      static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
-    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
-}
-
-/* PyErrExceptionMatches */
-      #if CYTHON_FAST_THREAD_STATE
-static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
-    Py_ssize_t i, n;
-    n = PyTuple_GET_SIZE(tuple);
-#if PY_MAJOR_VERSION >= 3
-    for (i=0; icurexc_type;
-    if (exc_type == err) return 1;
-    if (unlikely(!exc_type)) return 0;
-    if (unlikely(PyTuple_Check(err)))
-        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
-    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
-}
-#endif
-
-/* TypeImport */
-      #ifndef __PYX_HAVE_RT_ImportType
-#define __PYX_HAVE_RT_ImportType
-static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
-    size_t size, enum __Pyx_ImportType_CheckSize check_size)
-{
-    PyObject *result = 0;
-    char warning[200];
-    Py_ssize_t basicsize;
-#ifdef Py_LIMITED_API
-    PyObject *py_basicsize;
-#endif
-    result = PyObject_GetAttrString(module, class_name);
-    if (!result)
-        goto bad;
-    if (!PyType_Check(result)) {
-        PyErr_Format(PyExc_TypeError,
-            "%.200s.%.200s is not a type object",
-            module_name, class_name);
-        goto bad;
-    }
-#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 ((size_t)basicsize < size) {
-        PyErr_Format(PyExc_ValueError,
-            "%.200s.%.200s size changed, may indicate binary incompatibility. "
-            "Expected %zd from C header, got %zd from PyObject",
-            module_name, class_name, size, basicsize);
-        goto bad;
-    }
-    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
-        PyErr_Format(PyExc_ValueError,
-            "%.200s.%.200s size changed, may indicate binary incompatibility. "
-            "Expected %zd from C header, got %zd from PyObject",
-            module_name, class_name, size, basicsize);
-        goto bad;
-    }
-    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
-        PyOS_snprintf(warning, sizeof(warning),
-            "%s.%s size changed, may indicate binary incompatibility. "
-            "Expected %zd from C header, got %zd from PyObject",
-            module_name, class_name, size, basicsize);
-        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
-    }
-    return (PyTypeObject *)result;
-bad:
-    Py_XDECREF(result);
-    return NULL;
-}
-#endif
-
-/* ImportFrom */
-      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
-    }
-    return value;
-}
-
-/* CLineInTraceback */
-      #ifndef CYTHON_CLINE_IN_TRACEBACK
-static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
-    PyObject *use_cline;
-    PyObject *ptype, *pvalue, *ptraceback;
-#if CYTHON_COMPILING_IN_CPYTHON
-    PyObject **cython_runtime_dict;
-#endif
-    if (unlikely(!__pyx_cython_runtime)) {
-        return c_line;
-    }
-    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
-#if CYTHON_COMPILING_IN_CPYTHON
-    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
-    if (likely(cython_runtime_dict)) {
-        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
-            use_cline, *cython_runtime_dict,
-            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
-    } else
-#endif
-    {
-      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
-      if (use_cline_obj) {
-        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
-        Py_DECREF(use_cline_obj);
-      } else {
-        PyErr_Clear();
-        use_cline = NULL;
-      }
-    }
-    if (!use_cline) {
-        c_line = 0;
-        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
-    }
-    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
-        c_line = 0;
-    }
-    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
-    return c_line;
-}
-#endif
-
-/* CodeObjectCache */
-      static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
-    int start = 0, mid = 0, end = count - 1;
-    if (end >= 0 && code_line > entries[end].code_line) {
-        return count;
-    }
-    while (start < end) {
-        mid = start + (end - start) / 2;
-        if (code_line < entries[mid].code_line) {
-            end = mid;
-        } else if (code_line > entries[mid].code_line) {
-             start = mid + 1;
-        } else {
-            return mid;
-        }
-    }
-    if (code_line <= entries[mid].code_line) {
-        return mid;
-    } else {
-        return mid + 1;
-    }
-}
-static PyCodeObject *__pyx_find_code_object(int code_line) {
-    PyCodeObject* code_object;
-    int pos;
-    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
-        return NULL;
-    }
-    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
-    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
-        return NULL;
-    }
-    code_object = __pyx_code_cache.entries[pos].code_object;
-    Py_INCREF(code_object);
-    return code_object;
-}
-static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
-    int pos, i;
-    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
-    if (unlikely(!code_line)) {
-        return;
-    }
-    if (unlikely(!entries)) {
-        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
-        if (likely(entries)) {
-            __pyx_code_cache.entries = entries;
-            __pyx_code_cache.max_count = 64;
-            __pyx_code_cache.count = 1;
-            entries[0].code_line = code_line;
-            entries[0].code_object = code_object;
-            Py_INCREF(code_object);
-        }
-        return;
-    }
-    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
-    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
-        PyCodeObject* tmp = entries[pos].code_object;
-        entries[pos].code_object = code_object;
-        Py_DECREF(tmp);
-        return;
-    }
-    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
-        int new_max = __pyx_code_cache.max_count + 64;
-        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
-            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
-        if (unlikely(!entries)) {
-            return;
-        }
-        __pyx_code_cache.entries = entries;
-        __pyx_code_cache.max_count = new_max;
-    }
-    for (i=__pyx_code_cache.count; i>pos; i--) {
-        entries[i] = entries[i-1];
-    }
-    entries[pos].code_line = code_line;
-    entries[pos].code_object = code_object;
-    __pyx_code_cache.count++;
-    Py_INCREF(code_object);
-}
-
-/* AddTraceback */
-      #include "compile.h"
-#include "frameobject.h"
-#include "traceback.h"
-static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
-            const char *funcname, int c_line,
-            int py_line, const char *filename) {
-    PyCodeObject *py_code = 0;
-    PyObject *py_srcfile = 0;
-    PyObject *py_funcname = 0;
-    #if PY_MAJOR_VERSION < 3
-    py_srcfile = PyString_FromString(filename);
-    #else
-    py_srcfile = PyUnicode_FromString(filename);
-    #endif
-    if (!py_srcfile) goto bad;
-    if (c_line) {
-        #if PY_MAJOR_VERSION < 3
-        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
-        #else
-        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
-        #endif
-    }
-    else {
-        #if PY_MAJOR_VERSION < 3
-        py_funcname = PyString_FromString(funcname);
-        #else
-        py_funcname = PyUnicode_FromString(funcname);
-        #endif
-    }
-    if (!py_funcname) goto bad;
-    py_code = __Pyx_PyCode_New(
-        0,
-        0,
-        0,
-        0,
-        0,
-        __pyx_empty_bytes, /*PyObject *code,*/
-        __pyx_empty_tuple, /*PyObject *consts,*/
-        __pyx_empty_tuple, /*PyObject *names,*/
-        __pyx_empty_tuple, /*PyObject *varnames,*/
-        __pyx_empty_tuple, /*PyObject *freevars,*/
-        __pyx_empty_tuple, /*PyObject *cellvars,*/
-        py_srcfile,   /*PyObject *filename,*/
-        py_funcname,  /*PyObject *name,*/
-        py_line,
-        __pyx_empty_bytes  /*PyObject *lnotab*/
-    );
-    Py_DECREF(py_srcfile);
-    Py_DECREF(py_funcname);
-    return py_code;
-bad:
-    Py_XDECREF(py_srcfile);
-    Py_XDECREF(py_funcname);
-    return NULL;
-}
-static void __Pyx_AddTraceback(const char *funcname, int c_line,
-                               int py_line, const char *filename) {
-    PyCodeObject *py_code = 0;
-    PyFrameObject *py_frame = 0;
-    PyThreadState *tstate = __Pyx_PyThreadState_Current;
-    if (c_line) {
-        c_line = __Pyx_CLineForTraceback(tstate, c_line);
-    }
-    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
-    if (!py_code) {
-        py_code = __Pyx_CreateCodeObjectForTraceback(
-            funcname, c_line, py_line, filename);
-        if (!py_code) goto bad;
-        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
-    }
-    py_frame = PyFrame_New(
-        tstate,            /*PyThreadState *tstate,*/
-        py_code,           /*PyCodeObject *code,*/
-        __pyx_d,    /*PyObject *globals,*/
-        0                  /*PyObject *locals*/
-    );
-    if (!py_frame) goto bad;
-    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
-    PyTraceBack_Here(py_frame);
-bad:
-    Py_XDECREF(py_code);
-    Py_XDECREF(py_frame);
-}
-
-#if PY_MAJOR_VERSION < 3
-static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
-    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
-        if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
-    PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
-    return -1;
-}
-static void __Pyx_ReleaseBuffer(Py_buffer *view) {
-    PyObject *obj = view->obj;
-    if (!obj) return;
-    if (PyObject_CheckBuffer(obj)) {
-        PyBuffer_Release(view);
-        return;
-    }
-    if ((0)) {}
-        else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
-    view->obj = NULL;
-    Py_DECREF(obj);
-}
-#endif
-
-
-      /* Print */
-      #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
-static PyObject *__Pyx_GetStdout(void) {
-    PyObject *f = PySys_GetObject((char *)"stdout");
-    if (!f) {
-        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
-    }
-    return f;
-}
-static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
-    int i;
-    if (!f) {
-        if (!(f = __Pyx_GetStdout()))
-            return -1;
-    }
-    Py_INCREF(f);
-    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
-        PyObject* v;
-        if (PyFile_SoftSpace(f, 1)) {
-            if (PyFile_WriteString(" ", f) < 0)
-                goto error;
-        }
-        v = PyTuple_GET_ITEM(arg_tuple, i);
-        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
-            goto error;
-        if (PyString_Check(v)) {
-            char *s = PyString_AsString(v);
-            Py_ssize_t len = PyString_Size(v);
-            if (len > 0) {
-                switch (s[len-1]) {
-                    case ' ': break;
-                    case '\f': case '\r': case '\n': case '\t': case '\v':
-                        PyFile_SoftSpace(f, 0);
-                        break;
-                    default:  break;
-                }
-            }
-        }
-    }
-    if (newline) {
-        if (PyFile_WriteString("\n", f) < 0)
-            goto error;
-        PyFile_SoftSpace(f, 0);
-    }
-    Py_DECREF(f);
-    return 0;
-error:
-    Py_DECREF(f);
-    return -1;
-}
-#else
-static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
-    PyObject* kwargs = 0;
-    PyObject* result = 0;
-    PyObject* end_string;
-    if (unlikely(!__pyx_print)) {
-        __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
-        if (!__pyx_print)
-            return -1;
-    }
-    if (stream) {
-        kwargs = PyDict_New();
-        if (unlikely(!kwargs))
-            return -1;
-        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_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
-                Py_DECREF(end_string);
-                goto bad;
-            }
-            Py_DECREF(end_string);
-        }
-    } else if (!newline) {
-        if (unlikely(!__pyx_print_kwargs)) {
-            __pyx_print_kwargs = PyDict_New();
-            if (unlikely(!__pyx_print_kwargs))
-                return -1;
-            end_string = PyUnicode_FromStringAndSize(" ", 1);
-            if (unlikely(!end_string))
-                return -1;
-            if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
-                Py_DECREF(end_string);
-                return -1;
-            }
-            Py_DECREF(end_string);
-        }
-        kwargs = __pyx_print_kwargs;
-    }
-    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
-    if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
-        Py_DECREF(kwargs);
-    if (!result)
-        return -1;
-    Py_DECREF(result);
-    return 0;
-bad:
-    if (kwargs != __pyx_print_kwargs)
-        Py_XDECREF(kwargs);
-    return -1;
-}
-#endif
-
-/* CIntToPy */
-      static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
-    const Py_intptr_t neg_one = (Py_intptr_t) ((Py_intptr_t) 0 - (Py_intptr_t) 1), const_zero = (Py_intptr_t) 0;
-    const int is_unsigned = neg_one > const_zero;
-    if (is_unsigned) {
-        if (sizeof(Py_intptr_t) < sizeof(long)) {
-            return PyInt_FromLong((long) value);
-        } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
-            return PyLong_FromUnsignedLong((unsigned long) value);
-#ifdef HAVE_LONG_LONG
-        } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
-            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
-#endif
-        }
-    } else {
-        if (sizeof(Py_intptr_t) <= sizeof(long)) {
-            return PyInt_FromLong((long) value);
-#ifdef HAVE_LONG_LONG
-        } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
-            return PyLong_FromLongLong((PY_LONG_LONG) value);
-#endif
-        }
-    }
-    {
-        int one = 1; int little = (int)*(unsigned char *)&one;
-        unsigned char *bytes = (unsigned char *)&value;
-        return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
-                                     little, !is_unsigned);
-    }
-}
-
-/* CIntToPy */
-      static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
-    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
-    const int is_unsigned = neg_one > const_zero;
-    if (is_unsigned) {
-        if (sizeof(long) < sizeof(long)) {
-            return PyInt_FromLong((long) value);
-        } else if (sizeof(long) <= sizeof(unsigned long)) {
-            return PyLong_FromUnsignedLong((unsigned long) value);
-#ifdef HAVE_LONG_LONG
-        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
-            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
-#endif
-        }
-    } else {
-        if (sizeof(long) <= sizeof(long)) {
-            return PyInt_FromLong((long) value);
-#ifdef HAVE_LONG_LONG
-        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
-            return PyLong_FromLongLong((PY_LONG_LONG) value);
-#endif
-        }
-    }
-    {
-        int one = 1; int little = (int)*(unsigned char *)&one;
-        unsigned char *bytes = (unsigned char *)&value;
-        return _PyLong_FromByteArray(bytes, sizeof(long),
-                                     little, !is_unsigned);
-    }
-}
-
-/* CIntToPy */
-      static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
-    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
-    const int is_unsigned = neg_one > const_zero;
-    if (is_unsigned) {
-        if (sizeof(int) < sizeof(long)) {
-            return PyInt_FromLong((long) value);
-        } else if (sizeof(int) <= sizeof(unsigned long)) {
-            return PyLong_FromUnsignedLong((unsigned long) value);
-#ifdef HAVE_LONG_LONG
-        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
-            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
-#endif
-        }
-    } else {
-        if (sizeof(int) <= sizeof(long)) {
-            return PyInt_FromLong((long) value);
-#ifdef HAVE_LONG_LONG
-        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
-            return PyLong_FromLongLong((PY_LONG_LONG) value);
-#endif
-        }
-    }
-    {
-        int one = 1; int little = (int)*(unsigned char *)&one;
-        unsigned char *bytes = (unsigned char *)&value;
-        return _PyLong_FromByteArray(bytes, sizeof(int),
-                                     little, !is_unsigned);
-    }
-}
-
-/* CIntFromPyVerify */
-      #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
-    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
-#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
-    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
-#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
-    {\
-        func_type value = func_value;\
-        if (sizeof(target_type) < sizeof(func_type)) {\
-            if (unlikely(value != (func_type) (target_type) value)) {\
-                func_type zero = 0;\
-                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
-                    return (target_type) -1;\
-                if (is_unsigned && unlikely(value < zero))\
-                    goto raise_neg_overflow;\
-                else\
-                    goto raise_overflow;\
-            }\
-        }\
-        return (target_type) value;\
-    }
-
-/* Declarations */
-      #if CYTHON_CCOMPLEX
-  #ifdef __cplusplus
-    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
-      return ::std::complex< float >(x, y);
-    }
-  #else
-    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
-      return x + y*(__pyx_t_float_complex)_Complex_I;
-    }
-  #endif
-#else
-    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
-      __pyx_t_float_complex z;
-      z.real = x;
-      z.imag = y;
-      return z;
-    }
-#endif
-
-/* Arithmetic */
-      #if CYTHON_CCOMPLEX
-#else
-    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
-       return (a.real == b.real) && (a.imag == b.imag);
-    }
-    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
-        __pyx_t_float_complex z;
-        z.real = a.real + b.real;
-        z.imag = a.imag + b.imag;
-        return z;
-    }
-    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
-        __pyx_t_float_complex z;
-        z.real = a.real - b.real;
-        z.imag = a.imag - b.imag;
-        return z;
-    }
-    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
-        __pyx_t_float_complex z;
-        z.real = a.real * b.real - a.imag * b.imag;
-        z.imag = a.real * b.imag + a.imag * b.real;
-        return z;
-    }
-    #if 1
-    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
-        if (b.imag == 0) {
-            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
-        } else if (fabsf(b.real) >= fabsf(b.imag)) {
-            if (b.real == 0 && b.imag == 0) {
-                return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
-            } else {
-                float r = b.imag / b.real;
-                float s = (float)(1.0) / (b.real + b.imag * r);
-                return __pyx_t_float_complex_from_parts(
-                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
-            }
-        } else {
-            float r = b.real / b.imag;
-            float s = (float)(1.0) / (b.imag + b.real * r);
-            return __pyx_t_float_complex_from_parts(
-                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
-        }
-    }
-    #else
-    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
-        if (b.imag == 0) {
-            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
-        } else {
-            float denom = b.real * b.real + b.imag * b.imag;
-            return __pyx_t_float_complex_from_parts(
-                (a.real * b.real + a.imag * b.imag) / denom,
-                (a.imag * b.real - a.real * b.imag) / denom);
-        }
-    }
-    #endif
-    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
-        __pyx_t_float_complex z;
-        z.real = -a.real;
-        z.imag = -a.imag;
-        return z;
-    }
-    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
-       return (a.real == 0) && (a.imag == 0);
-    }
-    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
-        __pyx_t_float_complex z;
-        z.real =  a.real;
-        z.imag = -a.imag;
-        return z;
-    }
-    #if 1
-        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
-          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
-            return sqrtf(z.real*z.real + z.imag*z.imag);
-          #else
-            return hypotf(z.real, z.imag);
-          #endif
-        }
-        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
-            __pyx_t_float_complex z;
-            float r, lnr, theta, z_r, z_theta;
-            if (b.imag == 0 && b.real == (int)b.real) {
-                if (b.real < 0) {
-                    float denom = a.real * a.real + a.imag * a.imag;
-                    a.real = a.real / denom;
-                    a.imag = -a.imag / denom;
-                    b.real = -b.real;
-                }
-                switch ((int)b.real) {
-                    case 0:
-                        z.real = 1;
-                        z.imag = 0;
-                        return z;
-                    case 1:
-                        return a;
-                    case 2:
-                        return __Pyx_c_prod_float(a, a);
-                    case 3:
-                        z = __Pyx_c_prod_float(a, a);
-                        return __Pyx_c_prod_float(z, a);
-                    case 4:
-                        z = __Pyx_c_prod_float(a, a);
-                        return __Pyx_c_prod_float(z, z);
-                }
-            }
-            if (a.imag == 0) {
-                if (a.real == 0) {
-                    return a;
-                } else if (b.imag == 0) {
-                    z.real = powf(a.real, b.real);
-                    z.imag = 0;
-                    return z;
-                } else if (a.real > 0) {
-                    r = a.real;
-                    theta = 0;
-                } else {
-                    r = -a.real;
-                    theta = atan2f(0.0, -1.0);
-                }
-            } else {
-                r = __Pyx_c_abs_float(a);
-                theta = atan2f(a.imag, a.real);
-            }
-            lnr = logf(r);
-            z_r = expf(lnr * b.real - theta * b.imag);
-            z_theta = theta * b.real + lnr * b.imag;
-            z.real = z_r * cosf(z_theta);
-            z.imag = z_r * sinf(z_theta);
-            return z;
-        }
-    #endif
-#endif
-
-/* Declarations */
-      #if CYTHON_CCOMPLEX
-  #ifdef __cplusplus
-    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
-      return ::std::complex< double >(x, y);
-    }
-  #else
-    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
-      return x + y*(__pyx_t_double_complex)_Complex_I;
-    }
-  #endif
-#else
-    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
-      __pyx_t_double_complex z;
-      z.real = x;
-      z.imag = y;
-      return z;
-    }
-#endif
-
-/* Arithmetic */
-      #if CYTHON_CCOMPLEX
-#else
-    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
-       return (a.real == b.real) && (a.imag == b.imag);
-    }
-    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
-        __pyx_t_double_complex z;
-        z.real = a.real + b.real;
-        z.imag = a.imag + b.imag;
-        return z;
-    }
-    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
-        __pyx_t_double_complex z;
-        z.real = a.real - b.real;
-        z.imag = a.imag - b.imag;
-        return z;
-    }
-    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
-        __pyx_t_double_complex z;
-        z.real = a.real * b.real - a.imag * b.imag;
-        z.imag = a.real * b.imag + a.imag * b.real;
-        return z;
-    }
-    #if 1
-    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
-        if (b.imag == 0) {
-            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
-        } else if (fabs(b.real) >= fabs(b.imag)) {
-            if (b.real == 0 && b.imag == 0) {
-                return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
-            } else {
-                double r = b.imag / b.real;
-                double s = (double)(1.0) / (b.real + b.imag * r);
-                return __pyx_t_double_complex_from_parts(
-                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
-            }
-        } else {
-            double r = b.real / b.imag;
-            double s = (double)(1.0) / (b.imag + b.real * r);
-            return __pyx_t_double_complex_from_parts(
-                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
-        }
-    }
-    #else
-    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
-        if (b.imag == 0) {
-            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
-        } else {
-            double denom = b.real * b.real + b.imag * b.imag;
-            return __pyx_t_double_complex_from_parts(
-                (a.real * b.real + a.imag * b.imag) / denom,
-                (a.imag * b.real - a.real * b.imag) / denom);
-        }
-    }
-    #endif
-    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
-        __pyx_t_double_complex z;
-        z.real = -a.real;
-        z.imag = -a.imag;
-        return z;
-    }
-    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
-       return (a.real == 0) && (a.imag == 0);
-    }
-    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
-        __pyx_t_double_complex z;
-        z.real =  a.real;
-        z.imag = -a.imag;
-        return z;
-    }
-    #if 1
-        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
-          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
-            return sqrt(z.real*z.real + z.imag*z.imag);
-          #else
-            return hypot(z.real, z.imag);
-          #endif
-        }
-        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
-            __pyx_t_double_complex z;
-            double r, lnr, theta, z_r, z_theta;
-            if (b.imag == 0 && b.real == (int)b.real) {
-                if (b.real < 0) {
-                    double denom = a.real * a.real + a.imag * a.imag;
-                    a.real = a.real / denom;
-                    a.imag = -a.imag / denom;
-                    b.real = -b.real;
-                }
-                switch ((int)b.real) {
-                    case 0:
-                        z.real = 1;
-                        z.imag = 0;
-                        return z;
-                    case 1:
-                        return a;
-                    case 2:
-                        return __Pyx_c_prod_double(a, a);
-                    case 3:
-                        z = __Pyx_c_prod_double(a, a);
-                        return __Pyx_c_prod_double(z, a);
-                    case 4:
-                        z = __Pyx_c_prod_double(a, a);
-                        return __Pyx_c_prod_double(z, z);
-                }
-            }
-            if (a.imag == 0) {
-                if (a.real == 0) {
-                    return a;
-                } else if (b.imag == 0) {
-                    z.real = pow(a.real, b.real);
-                    z.imag = 0;
-                    return z;
-                } else if (a.real > 0) {
-                    r = a.real;
-                    theta = 0;
-                } else {
-                    r = -a.real;
-                    theta = atan2(0.0, -1.0);
-                }
-            } else {
-                r = __Pyx_c_abs_double(a);
-                theta = atan2(a.imag, a.real);
-            }
-            lnr = log(r);
-            z_r = exp(lnr * b.real - theta * b.imag);
-            z_theta = theta * b.real + lnr * b.imag;
-            z.real = z_r * cos(z_theta);
-            z.imag = z_r * sin(z_theta);
-            return z;
-        }
-    #endif
-#endif
-
-/* CIntToPy */
-      static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
-    const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
-    const int is_unsigned = neg_one > const_zero;
-    if (is_unsigned) {
-        if (sizeof(enum NPY_TYPES) < sizeof(long)) {
-            return PyInt_FromLong((long) value);
-        } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
-            return PyLong_FromUnsignedLong((unsigned long) value);
-#ifdef HAVE_LONG_LONG
-        } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
-            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
-#endif
-        }
-    } else {
-        if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
-            return PyInt_FromLong((long) value);
-#ifdef HAVE_LONG_LONG
-        } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
-            return PyLong_FromLongLong((PY_LONG_LONG) value);
-#endif
-        }
-    }
-    {
-        int one = 1; int little = (int)*(unsigned char *)&one;
-        unsigned char *bytes = (unsigned char *)&value;
-        return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
-                                     little, !is_unsigned);
-    }
-}
-
-/* PrintOne */
-      #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
-static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
-    if (!f) {
-        if (!(f = __Pyx_GetStdout()))
-            return -1;
-    }
-    Py_INCREF(f);
-    if (PyFile_SoftSpace(f, 0)) {
-        if (PyFile_WriteString(" ", f) < 0)
-            goto error;
-    }
-    if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
-        goto error;
-    if (PyFile_WriteString("\n", f) < 0)
-        goto error;
-    Py_DECREF(f);
-    return 0;
-error:
-    Py_DECREF(f);
-    return -1;
-    /* the line below is just to avoid C compiler
-     * warnings about unused functions */
-    return __Pyx_Print(f, NULL, 0);
-}
-#else
-static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
-    int res;
-    PyObject* arg_tuple = PyTuple_Pack(1, o);
-    if (unlikely(!arg_tuple))
-        return -1;
-    res = __Pyx_Print(stream, arg_tuple, 1);
-    Py_DECREF(arg_tuple);
-    return res;
-}
-#endif
-
-/* CIntFromPy */
-      static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
-    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
-    const int is_unsigned = neg_one > const_zero;
-#if PY_MAJOR_VERSION < 3
-    if (likely(PyInt_Check(x))) {
-        if (sizeof(int) < sizeof(long)) {
-            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
-        } else {
-            long val = PyInt_AS_LONG(x);
-            if (is_unsigned && unlikely(val < 0)) {
-                goto raise_neg_overflow;
-            }
-            return (int) val;
-        }
-    } else
-#endif
-    if (likely(PyLong_Check(x))) {
-        if (is_unsigned) {
-#if CYTHON_USE_PYLONG_INTERNALS
-            const digit* digits = ((PyLongObject*)x)->ob_digit;
-            switch (Py_SIZE(x)) {
-                case  0: return (int) 0;
-                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
-                case 2:
-                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
-                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
-                        }
-                    }
-                    break;
-                case 3:
-                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
-                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
-                        }
-                    }
-                    break;
-                case 4:
-                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
-                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
-                        }
-                    }
-                    break;
-            }
-#endif
-#if CYTHON_COMPILING_IN_CPYTHON
-            if (unlikely(Py_SIZE(x) < 0)) {
-                goto raise_neg_overflow;
-            }
-#else
-            {
-                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
-                if (unlikely(result < 0))
-                    return (int) -1;
-                if (unlikely(result == 1))
-                    goto raise_neg_overflow;
-            }
-#endif
-            if (sizeof(int) <= sizeof(unsigned long)) {
-                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
-#ifdef HAVE_LONG_LONG
-            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
-                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
-#endif
-            }
-        } else {
-#if CYTHON_USE_PYLONG_INTERNALS
-            const digit* digits = ((PyLongObject*)x)->ob_digit;
-            switch (Py_SIZE(x)) {
-                case  0: return (int) 0;
-                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
-                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
-                case -2:
-                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
-                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
-                        }
-                    }
-                    break;
-                case 2:
-                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
-                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
-                        }
-                    }
-                    break;
-                case -3:
-                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
-                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
-                        }
-                    }
-                    break;
-                case 3:
-                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
-                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
-                        }
-                    }
-                    break;
-                case -4:
-                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
-                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
-                        }
-                    }
-                    break;
-                case 4:
-                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
-                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
-                        }
-                    }
-                    break;
-            }
-#endif
-            if (sizeof(int) <= sizeof(long)) {
-                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
-#ifdef HAVE_LONG_LONG
-            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
-                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
-#endif
-            }
-        }
-        {
-#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
-            PyErr_SetString(PyExc_RuntimeError,
-                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
-#else
-            int val;
-            PyObject *v = __Pyx_PyNumber_IntOrLong(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 (int) -1;
-        }
-    } else {
-        int val;
-        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
-        if (!tmp) return (int) -1;
-        val = __Pyx_PyInt_As_int(tmp);
-        Py_DECREF(tmp);
-        return val;
-    }
-raise_overflow:
-    PyErr_SetString(PyExc_OverflowError,
-        "value too large to convert to int");
-    return (int) -1;
-raise_neg_overflow:
-    PyErr_SetString(PyExc_OverflowError,
-        "can't convert negative value to int");
-    return (int) -1;
-}
-
-/* CIntFromPy */
-      static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
-    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
-    const int is_unsigned = neg_one > const_zero;
-#if PY_MAJOR_VERSION < 3
-    if (likely(PyInt_Check(x))) {
-        if (sizeof(long) < sizeof(long)) {
-            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
-        } else {
-            long val = PyInt_AS_LONG(x);
-            if (is_unsigned && unlikely(val < 0)) {
-                goto raise_neg_overflow;
-            }
-            return (long) val;
-        }
-    } else
-#endif
-    if (likely(PyLong_Check(x))) {
-        if (is_unsigned) {
-#if CYTHON_USE_PYLONG_INTERNALS
-            const digit* digits = ((PyLongObject*)x)->ob_digit;
-            switch (Py_SIZE(x)) {
-                case  0: return (long) 0;
-                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
-                case 2:
-                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
-                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
-                        }
-                    }
-                    break;
-                case 3:
-                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
-                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
-                        }
-                    }
-                    break;
-                case 4:
-                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
-                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
-                        }
-                    }
-                    break;
-            }
-#endif
-#if CYTHON_COMPILING_IN_CPYTHON
-            if (unlikely(Py_SIZE(x) < 0)) {
-                goto raise_neg_overflow;
-            }
-#else
-            {
-                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
-                if (unlikely(result < 0))
-                    return (long) -1;
-                if (unlikely(result == 1))
-                    goto raise_neg_overflow;
-            }
-#endif
-            if (sizeof(long) <= sizeof(unsigned long)) {
-                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
-#ifdef HAVE_LONG_LONG
-            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
-                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
-#endif
-            }
-        } else {
-#if CYTHON_USE_PYLONG_INTERNALS
-            const digit* digits = ((PyLongObject*)x)->ob_digit;
-            switch (Py_SIZE(x)) {
-                case  0: return (long) 0;
-                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
-                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
-                case -2:
-                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
-                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
-                        }
-                    }
-                    break;
-                case 2:
-                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
-                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
-                        }
-                    }
-                    break;
-                case -3:
-                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
-                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
-                        }
-                    }
-                    break;
-                case 3:
-                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
-                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
-                        }
-                    }
-                    break;
-                case -4:
-                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
-                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
-                        }
-                    }
-                    break;
-                case 4:
-                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
-                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
-                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
-                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
-                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
-                        }
-                    }
-                    break;
-            }
-#endif
-            if (sizeof(long) <= sizeof(long)) {
-                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
-#ifdef HAVE_LONG_LONG
-            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
-                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
-#endif
-            }
-        }
-        {
-#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
-            PyErr_SetString(PyExc_RuntimeError,
-                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
-#else
-            long val;
-            PyObject *v = __Pyx_PyNumber_IntOrLong(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 (long) -1;
-        }
-    } else {
-        long val;
-        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
-        if (!tmp) return (long) -1;
-        val = __Pyx_PyInt_As_long(tmp);
-        Py_DECREF(tmp);
-        return val;
-    }
-raise_overflow:
-    PyErr_SetString(PyExc_OverflowError,
-        "value too large to convert to long");
-    return (long) -1;
-raise_neg_overflow:
-    PyErr_SetString(PyExc_OverflowError,
-        "can't convert negative value to long");
-    return (long) -1;
-}
-
-/* FastTypeChecks */
-      #if CYTHON_COMPILING_IN_CPYTHON
-static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
-    while (a) {
-        a = a->tp_base;
-        if (a == b)
-            return 1;
-    }
-    return b == &PyBaseObject_Type;
-}
-static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
-    PyObject *mro;
-    if (a == b) return 1;
-    mro = a->tp_mro;
-    if (likely(mro)) {
-        Py_ssize_t i, n;
-        n = PyTuple_GET_SIZE(mro);
-        for (i = 0; i < n; i++) {
-            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
-                return 1;
-        }
-        return 0;
-    }
-    return __Pyx_InBases(a, b);
-}
-#if PY_MAJOR_VERSION == 2
-static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
-    PyObject *exception, *value, *tb;
-    int res;
-    __Pyx_PyThreadState_declare
-    __Pyx_PyThreadState_assign
-    __Pyx_ErrFetch(&exception, &value, &tb);
-    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
-    if (unlikely(res == -1)) {
-        PyErr_WriteUnraisable(err);
-        res = 0;
-    }
-    if (!res) {
-        res = PyObject_IsSubclass(err, exc_type2);
-        if (unlikely(res == -1)) {
-            PyErr_WriteUnraisable(err);
-            res = 0;
-        }
-    }
-    __Pyx_ErrRestore(exception, value, tb);
-    return res;
-}
-#else
-static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
-    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
-    if (!res) {
-        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
-    }
-    return res;
-}
-#endif
-static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
-    Py_ssize_t i, n;
-    assert(PyExceptionClass_Check(exc_type));
-    n = PyTuple_GET_SIZE(tuple);
-#if PY_MAJOR_VERSION >= 3
-    for (i=0; ip) {
-        #if PY_MAJOR_VERSION < 3
-        if (t->is_unicode) {
-            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
-        } else if (t->intern) {
-            *t->p = PyString_InternFromString(t->s);
-        } else {
-            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
-        }
-        #else
-        if (t->is_unicode | t->is_str) {
-            if (t->intern) {
-                *t->p = PyUnicode_InternFromString(t->s);
-            } else if (t->encoding) {
-                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
-            } else {
-                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
-            }
-        } else {
-            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
-        }
-        #endif
-        if (!*t->p)
-            return -1;
-        if (PyObject_Hash(*t->p) == -1)
-            return -1;
-        ++t;
-    }
-    return 0;
-}
-
-static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
-    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
-}
-static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
-    Py_ssize_t ignore;
-    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
-}
-#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
-#if !CYTHON_PEP393_ENABLED
-static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
-    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
-    *length = PyBytes_GET_SIZE(defenc);
-    return defenc_c;
-}
-#else
-static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
-    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
-#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
-    if (likely(PyUnicode_IS_ASCII(o))) {
-        *length = PyUnicode_GET_LENGTH(o);
-        return PyUnicode_AsUTF8(o);
-    } else {
-        PyUnicode_AsASCIIString(o);
-        return NULL;
-    }
-#else
-    return PyUnicode_AsUTF8AndSize(o, length);
-#endif
-}
-#endif
-#endif
-static CYTHON_INLINE const 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)) {
-        return __Pyx_PyUnicode_AsStringAndSize(o, length);
-    } else
-#endif
-#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
-    if (PyByteArray_Check(o)) {
-        *length = PyByteArray_GET_SIZE(o);
-        return PyByteArray_AS_STRING(o);
-    } else
-#endif
-    {
-        char* result;
-        int r = PyBytes_AsStringAndSize(o, &result, length);
-        if (unlikely(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 int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
-    int retval;
-    if (unlikely(!x)) return -1;
-    retval = __Pyx_PyObject_IsTrue(x);
-    Py_DECREF(x);
-    return retval;
-}
-static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
-#if PY_MAJOR_VERSION >= 3
-    if (PyLong_Check(result)) {
-        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
-                "__int__ returned non-int (type %.200s).  "
-                "The ability to return an instance of a strict subclass of int "
-                "is deprecated, and may be removed in a future version of Python.",
-                Py_TYPE(result)->tp_name)) {
-            Py_DECREF(result);
-            return NULL;
-        }
-        return result;
-    }
-#endif
-    PyErr_Format(PyExc_TypeError,
-                 "__%.4s__ returned non-%.4s (type %.200s)",
-                 type_name, type_name, Py_TYPE(result)->tp_name);
-    Py_DECREF(result);
-    return NULL;
-}
-static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
-#if CYTHON_USE_TYPE_SLOTS
-  PyNumberMethods *m;
-#endif
-  const char *name = NULL;
-  PyObject *res = NULL;
-#if PY_MAJOR_VERSION < 3
-  if (likely(PyInt_Check(x) || PyLong_Check(x)))
-#else
-  if (likely(PyLong_Check(x)))
-#endif
-    return __Pyx_NewRef(x);
-#if CYTHON_USE_TYPE_SLOTS
-  m = Py_TYPE(x)->tp_as_number;
-  #if PY_MAJOR_VERSION < 3
-  if (m && m->nb_int) {
-    name = "int";
-    res = m->nb_int(x);
-  }
-  else if (m && m->nb_long) {
-    name = "long";
-    res = m->nb_long(x);
-  }
-  #else
-  if (likely(m && m->nb_int)) {
-    name = "int";
-    res = m->nb_int(x);
-  }
-  #endif
-#else
-  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
-    res = PyNumber_Int(x);
-  }
-#endif
-  if (likely(res)) {
-#if PY_MAJOR_VERSION < 3
-    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
-#else
-    if (unlikely(!PyLong_CheckExact(res))) {
-#endif
-        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
-    }
-  }
-  else if (!PyErr_Occurred()) {
-    PyErr_SetString(PyExc_TypeError,
-                    "an integer is required");
-  }
-  return res;
-}
-static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
-  Py_ssize_t ival;
-  PyObject *x;
-#if PY_MAJOR_VERSION < 3
-  if (likely(PyInt_CheckExact(b))) {
-    if (sizeof(Py_ssize_t) >= sizeof(long))
-        return PyInt_AS_LONG(b);
-    else
-        return PyInt_AsSsize_t(b);
-  }
-#endif
-  if (likely(PyLong_CheckExact(b))) {
-    #if CYTHON_USE_PYLONG_INTERNALS
-    const digit* digits = ((PyLongObject*)b)->ob_digit;
-    const Py_ssize_t size = Py_SIZE(b);
-    if (likely(__Pyx_sst_abs(size) <= 1)) {
-        ival = likely(size) ? digits[0] : 0;
-        if (size == -1) ival = -ival;
-        return ival;
-    } else {
-      switch (size) {
-         case 2:
-           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
-             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
-           }
-           break;
-         case -2:
-           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
-             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
-           }
-           break;
-         case 3:
-           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
-             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
-           }
-           break;
-         case -3:
-           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
-             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
-           }
-           break;
-         case 4:
-           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
-             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
-           }
-           break;
-         case -4:
-           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
-             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
-           }
-           break;
-      }
-    }
-    #endif
-    return PyLong_AsSsize_t(b);
-  }
-  x = PyNumber_Index(b);
-  if (!x) return -1;
-  ival = PyInt_AsSsize_t(x);
-  Py_DECREF(x);
-  return ival;
-}
-static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
-  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
-}
-static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
-    return PyInt_FromSize_t(ival);
-}
-
-
-#endif /* Py_PYTHON_H */
diff --git a/LFPy-2.0.7/LFPy/run_simulation.py b/LFPy-2.0.7/LFPy/run_simulation.py
deleted file mode 100644
index 1faf6bb..0000000
--- a/LFPy-2.0.7/LFPy/run_simulation.py
+++ /dev/null
@@ -1,333 +0,0 @@
-# -*- coding: utf-8 -*-
-'''Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-'''
-
-from __future__ import division
-from time import time
-import numpy as np
-import neuron
-
-
-def _run_simulation(cell, cvode, variable_dt=False, atol=0.001):
-    '''
-    Running the actual simulation in NEURON, simulations in NEURON
-    are now interruptable.
-    '''
-    neuron.h.dt = cell.dt
-        
-    # variable dt method
-    if variable_dt:
-        cvode.active(1)
-        cvode.atol(atol)
-    else:
-        cvode.active(0)    
-    
-    # re-initialize state
-    neuron.h.finitialize(cell.v_init)
-    
-    # initialize current- and record
-    if cvode.active():
-        cvode.re_init()
-    else:
-        neuron.h.fcurrent()
-    neuron.h.frecord_init()
-    
-    # Starting simulation at tstart
-    neuron.h.t = cell.tstart
-    
-    cell._loadspikes()
-    
-    #print sim.time and realtime factor at intervals
-    counter = 0.
-    t0 = time()
-    ti = neuron.h.t
-    if cell.tstop >= 10000:
-        interval = 1000. / cell.dt
-    else:
-        interval = 100. / cell.dt
-    
-    while neuron.h.t < cell.tstop:
-        neuron.h.fadvance()
-        counter += 1.
-        if counter % interval == 0:
-            rtfactor = (neuron.h.t - ti) * 1E-3 / (time() - t0)
-            if cell.verbose:
-                print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
-                                                                   rtfactor))
-            t0 = time()
-            ti = neuron.h.t
-
-def _run_simulation_with_electrode(cell, cvode, electrode=None,
-                                   variable_dt=False,
-                                   atol=0.001,
-                                   to_memory=True, to_file=False,
-                                   file_name=None, dotprodcoeffs=None,
-                                   rec_current_dipole_moment=False):
-    '''
-    Running the actual simulation in NEURON.
-    electrode argument used to determine coefficient
-    matrix, and calculate the LFP on every time step.
-    '''
-    try:
-        import h5py
-    except:
-        print('h5py not found, LFP to file not possible')
-        to_file = False
-        file_name = None
-
-    # Use electrode object(s) to calculate coefficient matrices for LFP
-    # calculations. If electrode is a list, then
-    if cell.verbose:
-        print('precalculating geometry - LFP mapping')
-        
-    #put electrodecoeff in a list, if it isn't already
-    if dotprodcoeffs is not None:
-        if type(dotprodcoeffs) != list:
-            dotprodcoeffs = [dotprodcoeffs]
-        electrodes = []
-    else:
-        #create empty list if no dotprodcoeffs are supplied
-        dotprodcoeffs = []
-    
-    #just for safekeeping
-    lendotprodcoeffs0 = len(dotprodcoeffs)
-    
-    #access electrode object and append mapping
-    if electrode is not None:
-        #put electrode argument in list if needed
-        if type(electrode) == list:
-            electrodes = electrode
-        else:
-            electrodes = [electrode]
-        
-        for el in electrodes:
-            el.calc_mapping(cell)
-            dotprodcoeffs.append(el.mapping)
-
-    elif electrode is None:
-        electrodes = None
-   
-
-    # Initialize NEURON simulations of cell object    
-    neuron.h.dt = cell.dt
-    
-    #don't know if this is the way to do, but needed for variable dt method
-    if cell.dt <= 1E-8:
-        cvode.active(1)
-        cvode.atol(atol)
-    
-    #re-initialize state
-    neuron.h.finitialize(cell.v_init)
-    neuron.h.frecord_init() # wrong voltages t=0 for tstart < 0 otherwise
-    neuron.h.fcurrent()
-    
-    #Starting simulation at tstart (which may be < 0)
-    neuron.h.t = cell.tstart
-    
-    #load spike times from NetCon
-    cell._loadspikes()
-    
-    #print sim.time at intervals
-    counter = 0.
-    tstep = 0
-    t0 = time()
-    ti = neuron.h.t
-    if cell.tstop >= 10000:
-        interval = 1000. / cell.dt
-    else:
-        interval = 100. / cell.dt
-    
-    #temp vector to store membrane currents at each timestep
-    imem = np.zeros(cell.totnsegs)
-    #LFPs for each electrode will be put here during simulation
-    if to_memory:
-        electrodesLFP = []
-        for coeffs in dotprodcoeffs:
-            electrodesLFP.append(np.zeros((coeffs.shape[0],
-                                int(cell.tstop / cell.dt) + 1)))
-    #LFPs for each electrode will be put here during simulations
-    if to_file:
-        #ensure right ending:
-        if file_name.split('.')[-1] != 'h5':
-            file_name += '.h5'
-        el_LFP_file = h5py.File(file_name, 'w')
-        i = 0
-        for coeffs in dotprodcoeffs:
-            el_LFP_file['electrode{:03d}'.format(i)] = np.zeros((coeffs.shape[0],
-                                    int(cell.tstop / cell.dt + 1)))
-            i += 1
-
-    # create a 2D array representation of segment midpoints for dot product
-    # with transmembrane currents when computing dipole moment
-    if rec_current_dipole_moment:
-        midpoints = np.c_[cell.xmid, cell.ymid, cell.zmid]
-
-    
-    #run fadvance until time limit, and calculate LFPs for each timestep
-    while neuron.h.t < cell.tstop:
-        if neuron.h.t >= 0:
-            i = 0
-            for sec in cell.allseclist:
-                for seg in sec:
-                    imem[i] = seg.i_membrane_
-                    i += 1
-
-            if rec_current_dipole_moment:
-                cell.current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
-            
-            if to_memory:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
-                    
-            if to_file:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    el_LFP_file['electrode{:03d}'.format(j)
-                                ][:, tstep] = np.dot(coeffs, imem)
-            
-            tstep += 1
-
-        neuron.h.fadvance()
-        counter += 1.
-        if counter % interval == 0.:
-            rtfactor = (neuron.h.t - ti) * 1E-3 / (time() - t0)
-            if cell.verbose:
-                print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
-                                                                   rtfactor))
-            t0 = time()
-            ti = neuron.h.t
-    
-    try:
-        #calculate LFP after final fadvance()
-        i = 0
-        for sec in cell.allseclist:
-            for seg in sec:
-                imem[i] = seg.i_membrane_
-                i += 1
-
-        if rec_current_dipole_moment:
-            cell.current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
-            
-        if to_memory:
-            for j, coeffs in enumerate(dotprodcoeffs):
-                electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
-        if to_file:
-            for j, coeffs in enumerate(dotprodcoeffs):
-                el_LFP_file['electrode{:03d}'.format(j)
-                            ][:, tstep] = np.dot(coeffs, imem)
-
-    except:
-        pass
-    
-    # Final step, put LFPs in the electrode object, superimpose if necessary
-    # If electrode.perCellLFP, store individual LFPs
-    if to_memory:
-        #the first few belong to input dotprodcoeffs
-        cell.dotprodresults = electrodesLFP[:lendotprodcoeffs0]
-        #the remaining belong to input electrode arguments
-        if electrodes is not None:
-            for j, LFP in enumerate(electrodesLFP):
-                if not j < lendotprodcoeffs0:
-                    if hasattr(electrodes[j-lendotprodcoeffs0], 'LFP'):
-                        electrodes[j-lendotprodcoeffs0].LFP += LFP
-                    else:
-                        electrodes[j-lendotprodcoeffs0].LFP = LFP
-                    #will save each cell contribution separately
-                    if electrodes[j-lendotprodcoeffs0].perCellLFP:
-                        if not hasattr(electrodes[j], 'CellLFP'):
-                            electrodes[j-lendotprodcoeffs0].CellLFP = []
-                        electrodes[j-lendotprodcoeffs0].CellLFP.append(LFP)
-                    electrodes[j-lendotprodcoeffs0].electrodecoeff = dotprodcoeffs[j]
-
-    if to_file:
-        el_LFP_file.close()
-
-
-def _collect_geometry_neuron(cell):
-    '''Loop over allseclist to determine area, diam, xyz-start- and
-    endpoints, embed geometry to cell object'''
-    
-    
-    areavec = np.zeros(cell.totnsegs)
-    diamvec = np.zeros(cell.totnsegs)
-    lengthvec = np.zeros(cell.totnsegs)
-    
-    xstartvec = np.zeros(cell.totnsegs)
-    xendvec = np.zeros(cell.totnsegs)
-    ystartvec = np.zeros(cell.totnsegs)
-    yendvec = np.zeros(cell.totnsegs)
-    zstartvec = np.zeros(cell.totnsegs)
-    zendvec = np.zeros(cell.totnsegs)
-    
-    counter = 0
-    
-    #loop over all segments
-    for sec in cell.allseclist:
-        n3d = int(neuron.h.n3d())
-        nseg = sec.nseg
-        gsen2 = 1./2/nseg
-        if n3d > 0:
-            #create interpolation objects for the xyz pt3d info:
-            L = np.zeros(n3d)
-            x = np.zeros(n3d)
-            y = np.zeros(n3d)
-            z = np.zeros(n3d)
-            for i in range(n3d):
-                L[i] = neuron.h.arc3d(i)
-                x[i] = neuron.h.x3d(i)
-                y[i] = neuron.h.y3d(i)
-                z[i] = neuron.h.z3d(i)
-            
-            #normalize as seg.x [0, 1]
-            L /= sec.L
-                        
-            #temporary store position of segment midpoints
-            segx = np.zeros(nseg)
-            for i, seg in enumerate(sec):
-                segx[i] = seg.x
-            
-            #can't be >0 which may happen due to NEURON->Python float transfer:
-            segx0 = (segx - gsen2).round(decimals=6)
-            segx1 = (segx + gsen2).round(decimals=6)
-            
-            #fill vectors with interpolated coordinates of start and end points
-            xstartvec[counter:counter+nseg] = np.interp(segx0, L, x)
-            xendvec[counter:counter+nseg] = np.interp(segx1, L, x)
-            
-            ystartvec[counter:counter+nseg] = np.interp(segx0, L, y)
-            yendvec[counter:counter+nseg] = np.interp(segx1, L, y)
-            
-            zstartvec[counter:counter+nseg] = np.interp(segx0, L, z)
-            zendvec[counter:counter+nseg] = np.interp(segx1, L, z)
-                        
-            #fill in values area, diam, length
-            for i, seg in enumerate(sec):
-                areavec[counter] = neuron.h.area(seg.x)
-                diamvec[counter] = seg.diam
-                lengthvec[counter] = sec.L/nseg
-
-                counter += 1
-    
-    #set cell attributes
-    cell.xstart = xstartvec
-    cell.ystart = ystartvec
-    cell.zstart = zstartvec
-    
-    cell.xend = xendvec
-    cell.yend = yendvec
-    cell.zend = zendvec
-    
-    cell.area = areavec
-    cell.diam = diamvec
-    cell.length = lengthvec
-
diff --git a/LFPy-2.0.7/LFPy/run_simulation.pyx b/LFPy-2.0.7/LFPy/run_simulation.pyx
deleted file mode 100644
index 3900411..0000000
--- a/LFPy-2.0.7/LFPy/run_simulation.pyx
+++ /dev/null
@@ -1,376 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# cython: language_level=2
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-from time import time
-import numpy as np
-cimport numpy as np
-import neuron
-
-DTYPE = np.float64
-ctypedef np.float64_t DTYPE_t
-ctypedef Py_ssize_t   LTYPE_t
-
-
-def _run_simulation(cell, cvode, variable_dt=False, atol=0.001):
-    """
-    Running the actual simulation in NEURON, simulations in NEURON
-    is now interruptable.
-    """
-    neuron.h.dt = cell.dt
-
-    # variable dt method
-    if variable_dt:
-        cvode.active(1)
-        cvode.atol(atol)
-    else:
-        cvode.active(0)
-
-    #re-initialize state
-    neuron.h.finitialize(cell.v_init)
-
-    #initialize current- and record
-    if cvode.active():
-        cvode.re_init()
-    else:
-        neuron.h.fcurrent()
-    neuron.h.frecord_init()
-
-    #Starting simulation at t != 0
-    neuron.h.t = cell.tstart
-
-    cell._loadspikes()
-
-    #print sim.time at intervals
-    cdef int counter = 0
-    cdef double interval
-    cdef double tstop = cell.tstop
-    cdef double t0 = time()
-    cdef double ti = neuron.h.t
-    cdef double rtfactor
-    if tstop >= 10000:
-        interval = 1000. / cell.dt
-    else:
-        interval = 100. / cell.dt
-
-    while neuron.h.t < tstop:
-        neuron.h.fadvance()
-        counter += 1
-        if counter % interval == 0:
-            rtfactor = (neuron.h.t - ti)  * 1E-3 / (time() - t0 + 1E-9)
-            if cell.verbose:
-                print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
-                                                                   rtfactor))
-            t0 = time()
-            ti = neuron.h.t
-
-
-def _run_simulation_with_electrode(cell, cvode, electrode=None,
-                                   variable_dt=False, atol=0.001,
-                                   to_memory=True, to_file=False,
-                                   file_name=None, dotprodcoeffs=None,
-                                   rec_current_dipole_moment=False):
-    """
-    Running the actual simulation in NEURON.
-    electrode argument used to determine coefficient
-    matrix, and calculate the LFP on every time step.
-    """
-
-    #c-declare some variables
-    cdef int i, j, tstep#, ncoeffs
-    #cdef int totnsegs = cell.totnsegs
-    cdef double tstop = cell.tstop
-    cdef int counter
-    cdef int lendotprodcoeffs0
-    cdef double interval
-    cdef double t0
-    cdef double ti
-    cdef double rtfactor
-    cdef double dt = cell.dt
-    cdef np.ndarray[DTYPE_t, ndim=2, negative_indices=False] coeffs
-    cdef np.ndarray[DTYPE_t, ndim=2, negative_indices=False] current_dipole_moment
-    cdef np.ndarray[DTYPE_t, ndim=2, negative_indices=False] midpoints
-
-    #check if h5py exist and saving is possible
-    try:
-        import h5py
-    except:
-        print('h5py not found, LFP to file not possible')
-        to_file = False
-        file_name = None
-
-
-    # Use electrode object(s) to calculate coefficient matrices for LFP
-    # calculations. If electrode is a list, then
-    if cell.verbose:
-        print('precalculating geometry - LFP mapping')
-
-    #put electrodecoeff in a list, if it isn't already
-    if dotprodcoeffs is not None:
-        if type(dotprodcoeffs) != list:
-            dotprodcoeffs = [dotprodcoeffs]
-        electrodes = []
-    else:
-        #create empty list if no dotprodcoeffs are supplied
-        dotprodcoeffs = []
-
-    #just for safekeeping
-    lendotprodcoeffs0 = len(dotprodcoeffs)
-
-    #access electrode object and append mapping
-    if electrode is not None:
-        #put electrode argument in list if needed
-        if type(electrode) == list:
-            electrodes = electrode
-        else:
-            electrodes = [electrode]
-
-        for el in electrodes:
-            el.calc_mapping(cell)
-            dotprodcoeffs.append(el.mapping)
-    elif electrode is None:
-        electrodes = None
-
-
-    # Initialize NEURON simulations of cell object
-    neuron.h.dt = dt
-
-    #don't know if this is the way to do, but needed for variable dt method
-    if cell.dt <= 1E-8:
-        cvode.active(1)
-        cvode.atol(atol)
-
-    #re-initialize state
-    neuron.h.finitialize(cell.v_init)
-    neuron.h.frecord_init() # wrong voltages t=0 for tstart < 0 otherwise
-    neuron.h.fcurrent()
-
-    #Starting simulation at t != 0
-    neuron.h.t = cell.tstart
-
-    #load spike times from NetCon
-    cell._loadspikes()
-
-    #print sim.time at intervals
-    counter = 0
-    tstep = 0
-    t0 = time()
-    ti = neuron.h.t
-    if tstop >= 10000:
-        interval = 1000. / dt
-    else:
-        interval = 100. / dt
-
-    #temp vector to store membrane currents at each timestep
-    imem = np.zeros(cell.totnsegs)
-    #LFPs for each electrode will be put here during simulation
-    if to_memory:
-        electrodesLFP = []
-        for coeffs in dotprodcoeffs:
-            electrodesLFP.append(np.zeros((coeffs.shape[0],
-                                    int(tstop / dt + 1))))
-    #LFPs for each electrode will be put here during simulations
-    if to_file:
-        #ensure right ending:
-        if file_name.split('.')[-1] != 'h5':
-            file_name += '.h5'
-        el_LFP_file = h5py.File(file_name, 'w')
-        i = 0
-        for coeffs in dotprodcoeffs:
-            el_LFP_file['electrode{:03d}'.format(i)] = np.zeros((coeffs.shape[0],
-                                            int(tstop / dt + 1)))
-            i += 1
-
-    # create a 2D array representation of segment midpoints for dot product
-    # with transmembrane currents when computing dipole moment
-    if rec_current_dipole_moment:
-        current_dipole_moment = cell.current_dipole_moment.copy()
-        cell.current_dipole_moment = np.array([[]])
-        midpoints = np.c_[cell.xmid, cell.ymid, cell.zmid]
-
-    #run fadvance until time limit, and calculate LFPs for each timestep
-    while neuron.h.t < tstop:
-        if neuron.h.t >= 0:
-            i = 0
-            for sec in cell.allseclist:
-                for seg in sec:
-                    imem[i] = seg.i_membrane_
-                    i += 1
-
-            if rec_current_dipole_moment:
-                current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
-
-            if to_memory:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
-
-            if to_file:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    el_LFP_file['electrode{:03d}'.format(j)
-                                ][:, tstep] = np.dot(coeffs, imem)
-
-            tstep += 1
-        neuron.h.fadvance()
-        counter += 1
-        if counter % interval == 0:
-            rtfactor = (neuron.h.t - ti) * 1E-3 / (time() - t0)
-            if cell.verbose:
-                print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
-                                                                   rtfactor))
-            t0 = time()
-            ti = neuron.h.t
-
-    try:
-        #calculate LFP after final fadvance()
-        i = 0
-        for sec in cell.allseclist:
-            for seg in sec:
-                imem[i] = seg.i_membrane_
-                i += 1
-
-        if rec_current_dipole_moment:
-            current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
-
-        if to_memory:
-            for j, coeffs in enumerate(dotprodcoeffs):
-                electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
-        if to_file:
-            for j, coeffs in enumerate(dotprodcoeffs):
-                el_LFP_file['electrode{:03d}'.format(j)
-                            ][:, tstep] = np.dot(coeffs, imem)
-
-    except:
-        pass
-
-    # update current dipole moment values
-    if rec_current_dipole_moment:
-        cell.current_dipole_moment = current_dipole_moment
-
-    # Final step, put LFPs in the electrode object, superimpose if necessary
-    # If electrode.perCellLFP, store individual LFPs
-    if to_memory:
-        #the first few belong to input dotprodcoeffs
-        cell.dotprodresults = electrodesLFP[:lendotprodcoeffs0]
-        #the remaining belong to input electrode arguments
-        if electrodes is not None:
-            for j, LFP in enumerate(electrodesLFP):
-                if not j < lendotprodcoeffs0:
-                    if hasattr(electrodes[j-lendotprodcoeffs0], 'LFP'):
-                        electrodes[j-lendotprodcoeffs0].LFP += LFP
-                    else:
-                        electrodes[j-lendotprodcoeffs0].LFP = LFP
-                    #will save each cell contribution separately
-                    if electrodes[j-lendotprodcoeffs0].perCellLFP:
-                        if not hasattr(electrodes[j], 'CellLFP'):
-                            electrodes[j-lendotprodcoeffs0].CellLFP = []
-                        electrodes[j-lendotprodcoeffs0].CellLFP.append(LFP)
-                    electrodes[j-lendotprodcoeffs0].electrodecoeff = dotprodcoeffs[j]
-
-    if to_file:
-        el_LFP_file.close()
-
-
-cpdef _collect_geometry_neuron(cell):
-    """Loop over allseclist to determine area, diam, xyz-start- and
-    endpoints, embed geometry to cell object"""
-
-
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] areavec = np.zeros(cell.totnsegs)
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] diamvec = np.zeros(cell.totnsegs)
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] lengthvec = np.zeros(cell.totnsegs)
-
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] xstartvec = np.zeros(cell.totnsegs)
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] xendvec = np.zeros(cell.totnsegs)
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] ystartvec = np.zeros(cell.totnsegs)
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] yendvec = np.zeros(cell.totnsegs)
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] zstartvec = np.zeros(cell.totnsegs)
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] zendvec = np.zeros(cell.totnsegs)
-
-    cdef DTYPE_t gsen2, secL
-    cdef LTYPE_t counter, nseg, n3d, i
-
-
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] L, x, y, z, segx, segx0, segx1
-
-
-    counter = 0
-
-    #loop over all segments
-    for sec in cell.allseclist:
-        n3d = int(neuron.h.n3d())
-        nseg = sec.nseg
-        gsen2 = 1./2/nseg
-        secL = sec.L
-        if n3d > 0:
-            #create interpolation objects for the xyz pt3d info:
-            L = np.zeros(n3d)
-            x = np.zeros(n3d)
-            y = np.zeros(n3d)
-            z = np.zeros(n3d)
-            for i in range(n3d):
-                L[i] = neuron.h.arc3d(i)
-                x[i] = neuron.h.x3d(i)
-                y[i] = neuron.h.y3d(i)
-                z[i] = neuron.h.z3d(i)
-
-            #normalize as seg.x [0, 1]
-            L /= secL
-
-            #temporary store position of segment midpoints
-            segx = np.zeros(nseg)
-            i = 0
-            for seg in sec:
-                segx[i] = seg.x
-                i += 1
-
-            #can't be >0 which may happen due to NEURON->Python float transfer:
-            #segx0 = (segx - gsen2).round(decimals=6)
-            #segx1 = (segx + gsen2).round(decimals=6)
-            segx0 = segx - gsen2
-            segx1 = segx + gsen2
-
-            #fill vectors with interpolated coordinates of start and end points
-            xstartvec[counter:counter+nseg] = np.interp(segx0, L, x)
-            xendvec[counter:counter+nseg] = np.interp(segx1, L, x)
-
-            ystartvec[counter:counter+nseg] = np.interp(segx0, L, y)
-            yendvec[counter:counter+nseg] = np.interp(segx1, L, y)
-
-            zstartvec[counter:counter+nseg] = np.interp(segx0, L, z)
-            zendvec[counter:counter+nseg] = np.interp(segx1, L, z)
-
-            #fill in values area, diam, length
-            for seg in sec:
-                areavec[counter] = neuron.h.area(seg.x)
-                diamvec[counter] = seg.diam
-                lengthvec[counter] = secL/nseg
-
-                counter += 1
-
-
-    #set cell attributes
-    cell.xstart = xstartvec
-    cell.ystart = ystartvec
-    cell.zstart = zstartvec
-
-    cell.xend = xendvec
-    cell.yend = yendvec
-    cell.zend = zendvec
-
-    cell.area = areavec
-    cell.diam = diamvec
-    cell.length = lengthvec
diff --git a/LFPy-2.0.7/LFPy/templatecell.py b/LFPy-2.0.7/LFPy/templatecell.py
deleted file mode 100644
index 238a6ba..0000000
--- a/LFPy-2.0.7/LFPy/templatecell.py
+++ /dev/null
@@ -1,232 +0,0 @@
-"""
-Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-import os
-import posixpath
-import sys
-import pickle
-import numpy as np
-import neuron
-from LFPy import Cell, RecExtElectrode
-from LFPy.run_simulation import _run_simulation, _run_simulation_with_electrode
-
-class TemplateCell(Cell):
-
-    """
-    class LFPy.TemplateCell
-    
-    This class allow using NEURON templates with some limitations.
-
-    This takes all the same parameters as the Cell class, but requires three
-    more template related parameters
-    
-    Parameters
-    ----------
-    morphology : str
-        path to morphology file
-    templatefile : str
-        File with cell template definition(s)
-    templatename : str
-        Cell template-name used for this cell object
-    templateargs : str
-        Parameters provided to template-definition
-    v_init : float
-        Initial membrane potential. Default to -65.
-    Ra : float
-        axial resistance. Defaults to 150.
-    cm : float
-        membrane capacitance. Defaults to 1.0
-    passive : bool
-        Passive mechanisms are initialized if True. Defaults to True
-    passive_parameters : dict
-        parameter dictionary with values for the passive membrane mechanism in
-        NEURON ('pas'). The dictionary must contain keys 'g_pas' and 'e_pas',
-        like the default: passive_parameters=dict(g_pas=0.001, e_pas=-70)
-    extracellular : bool
-        switch for NEURON's extracellular mechanism. Defaults to False
-    dt: float
-        Simulation time step. Defaults to 2**-4
-    tstart : float
-        initialization time for simulation <= 0 ms. Defaults to 0.
-    tstop : float
-        stop time for simulation > 0 ms. Defaults to 100.
-    nsegs_method : 'lambda100' or 'lambda_f' or 'fixed_length' or None
-        nseg rule, used by NEURON to determine number of compartments.
-        Defaults to 'lambda100'
-    max_nsegs_length : float or None
-        max segment length for method 'fixed_length'. Defaults to None
-    lambda_f : int
-        AC frequency for method 'lambda_f'. Defaults to 100
-    d_lambda : float
-        parameter for d_lambda rule. Defaults to 0.1
-    delete_sections : bool
-        delete pre-existing section-references. Defaults to True
-    custom_code : list or None
-        list of model-specific code files ([.py/.hoc]). Defaults to None
-    custom_fun : list or None
-        list of model-specific functions with args. Defaults to None
-    custom_fun_args : list or None
-        list of args passed to custom_fun functions. Defaults to None
-    pt3d : bool
-        use pt3d-info of the cell geometries switch. Defaults to False
-    celsius : float or None
-        Temperature in celsius. If nothing is specified here
-        or in custom code it is 6.3 celcius
-    verbose : bool
-        verbose output switch. Defaults to False
-
-    Examples
-    --------
-
-    >>> import LFPy
-    >>> cellParameters = {
-    >>>     'morphology' : '',
-    >>>     'templatefile' :  ''
-    >>>     'templatename' :  'templatename'
-    >>>     'templateargs' :  None
-    >>>     'v_init' : -65,
-    >>>     'cm' : 1.0,
-    >>>     'Ra' : 150,
-    >>>     'passive' : True,
-    >>>     'passive_parameters' : {'g_pas' : 0.001, 'e_pas' : -65.},
-    >>>     'dt' : 2**-3,
-    >>>     'tstart' : 0,
-    >>>     'tstop' : 50,
-    >>> }
-    >>> cell = LFPy.TemplateCell(**cellParameters)
-    >>> cell.simulate()
-
-    """
-
-    def __init__(self,
-                 templatefile='LFPyCellTemplate.hoc',
-                 templatename='LFPyCellTemplate',
-                 templateargs=None,
-                 verbose=False,
-                 **kwargs):
-        """
-        Initialization of the Template Cell object.
-
-        """
-        if "win32" in sys.platform and type(templatefile) is str:
-            templatefile = templatefile.replace(os.sep, posixpath.sep)
-        self.templatefile = templatefile
-        self.templatename = templatename
-        self.templateargs = templateargs
-        self.verbose = verbose
-        
-        if not hasattr(neuron.h, 'd_lambda'):
-            neuron.h.load_file('stdlib.hoc', 'String')    #NEURON std. library
-            neuron.h.load_file('import3d.hoc')  #import 3D morphology lib
-                
-        #load the cell template specification
-        #check if templatename exist in neuron.h namespace:
-        if hasattr(neuron.h, self.templatename):
-            if self.verbose:
-                print('template %s exist already' % self.templatename)
-        else:
-            if type(self.templatefile) == str:
-                neuron.h.load_file(self.templatefile)
-            elif type(self.templatefile) == list:
-                for template in self.templatefile:
-                    if "win32" in sys.platform:
-                        template = template.replace(os.sep, posixpath.sep)
-                    neuron.h.load_file(template)
-        
-        #initialize the cell object
-        Cell.__init__(self, **kwargs)
-
-    def _load_geometry(self):
-        """Load the morphology-file in NEURON""" 
-        try: 
-            neuron.h.sec_counted = 0
-        except LookupError:
-            neuron.h('sec_counted = 0')
-                
-        #the python cell object we are loading the morphology into:
-        self.template = getattr(neuron.h, self.templatename)(self.templateargs)
-        
-        #perform a test if the morphology is already loaded:
-        seccount = 0
-        for sec in self.template.all:
-            seccount += 1
-        if seccount == 0:
-            #import the morphology, try and determine format
-            fileEnding = self.morphology.split('.')[-1]
-        
-            if not fileEnding == 'hoc' or fileEnding == 'HOC':            
-                #create objects for importing morphologies of different formats
-                if fileEnding == 'asc' or fileEnding == 'ASC':
-                    Import = neuron.h.Import3d_Neurolucida3()
-                    if not self.verbose:
-                        Import.quiet = 1
-                elif fileEnding == 'swc' or fileEnding ==  'SWC':
-                    Import = neuron.h.Import3d_SWC_read()
-                elif fileEnding == 'xml' or fileEnding ==  'XML':
-                    Import = neuron.h.Import3d_MorphML()
-                else:
-                    raise ValueError('%s is not a recognised morphology file format! ').with_traceback('Should be either .hoc, .asc, .swc, .xml!' \
-                         % self.morphology)
-                
-                #assuming now that morphology file is the correct format
-                try:
-                    Import.input(self.morphology)
-                except:
-                    if not hasattr(neuron, 'neuroml'):
-                        raise Exception('Can not import, try and copy the ' + \
-                        'nrn/share/lib/python/neuron/neuroml ' + \
-                        'folder into %s' % neuron.__path__[0])
-                    else:
-                        raise Exception('something wrong with file, see output')
-                try:
-                    imprt = neuron.h.Import3d_GUI(Import, 0)
-                except:
-                    raise Exception('See output, try to correct the file')
-                
-                #instantiate the cell object
-                if fileEnding == 'xml' or fileEnding ==  'XML':
-                    #can not currently assign xml to cell template
-                    try:
-                        imprt.instantiate(self.template)
-                    except:
-                        raise Exception("this xml file is not supported")
-                else:
-                    imprt.instantiate(self.template)
-                
-            else:
-                neuron.h.execute("xopen(\"%s\")" % self.morphology, self.template)
-        
-        #set shapes and create sectionlists
-        neuron.h.define_shape()
-        self._create_sectionlists()
-
-    def _create_sectionlists(self):
-        """Create section lists for different kinds of sections"""
-        
-        self.allsecnames = []
-        for sec in self.template.all:
-            self.allsecnames.append(sec.name())
-        
-        self.allseclist = self.template.all
-        
-        #list of soma sections, assuming it is named on the format "soma*"
-        self.nsomasec = 0
-        self.somalist = neuron.h.SectionList()
-        for sec in self.allseclist:
-            if 'soma' in sec.name():
-                self.somalist.append(sec=sec)
-                self.nsomasec += 1
-
-
diff --git a/LFPy-2.0.7/LFPy/test/__init__.py b/LFPy-2.0.7/LFPy/test/__init__.py
deleted file mode 100644
index c273a5d..0000000
--- a/LFPy-2.0.7/LFPy/test/__init__.py
+++ /dev/null
@@ -1,115 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-def _test(verbosity=1):
-    """run all unit tests included with LFPy.
-    
-    Parameters
-    ----------
-    verbosity : int
-        unittest.TestCase verbosity level, default is 1
-    
-    Examples
-    --------
-    From Python:
-    >>> import LFPy
-    >>> LFPy.run_tests()
-    
-    Using external testing framework (nose, py.test etc.) from command line
-    $ cd 
-    $ nosetests-2.7
-    
-    Run single test modules
-    $ cd 
-    $ nosetests-2.7 LFPy/test/test_cell.py
-    
-    """
-    # import methods here to avoid polluting LFPy.test namespace
-    from .test_cell import testCell
-    from .test_eegmegcalc import testMEG, testFourSphereVolumeConductor, testInfiniteVolumeConductor
-    from .test_alias_method import testAliasMethod
-    from .test_recextelectrode import testRecExtElectrode
-    from .test_lfpcalc import testLfpCalc
-    from .test_misc import testMisc
-    from .test_pointprocess import testPointProcess, testSynapse, testStimIntElectrode 
-    from .test_inputgenerators import testInputGenerators
-    from .test_templatecell import testTemplateCell
-    from .test_networkcell import testNetworkCell
-    from .test_network import testNetworkPopulation, testNetwork
-    import unittest
-
-    print('\ntest LFPy.Cell class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testCell)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.TemplateCell class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testTemplateCell)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.lfpcalc methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testLfpCalc)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.RecExtElectrode class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testRecExtElectrode)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.NetworkCell class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testNetworkCell)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.NetworkPopulation class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testNetworkPopulation)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.Network class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testNetwork)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.MEG class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testMEG)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.FourSphereVolumeConductor class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testFourSphereVolumeConductor)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.InfiniteVolumeConductor class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testInfiniteVolumeConductor)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.alias_method methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testAliasMethod)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.PointProcess class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testPointProcess)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.Synapse class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testSynapse)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.StimIntElectrode class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testStimIntElectrode)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.inputgenerators methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testInputGenerators)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest misc. methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testMisc)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
\ No newline at end of file
diff --git a/LFPy-2.0.7/LFPy/test/ball_and_stick_template.hoc b/LFPy-2.0.7/LFPy/test/ball_and_stick_template.hoc
deleted file mode 100644
index b0a802c..0000000
--- a/LFPy-2.0.7/LFPy/test/ball_and_stick_template.hoc
+++ /dev/null
@@ -1,13 +0,0 @@
-begintemplate ball_and_stick_template
-public soma, dend         
-public all
-objref all
-proc init() {
-    all = new SectionList()
-}
-
-create soma[1], dend[1]
-
-endtemplate ball_and_stick_template
-
-
diff --git a/LFPy-2.0.7/LFPy/test/ball_and_sticks.hoc b/LFPy-2.0.7/LFPy/test/ball_and_sticks.hoc
deleted file mode 100644
index 74f3005..0000000
--- a/LFPy-2.0.7/LFPy/test/ball_and_sticks.hoc
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ----------------------------------------------------
-ball_and_Y.hoc
-
-This hoc file creates a neuron of the following shape:
-
-            \       
-             \     
-              \   /
-               \ /
-                V
-                |
-                |
-                |
-                O
-                
-Note the conventions:
- - soma needs to be a list (soma[0], not soma),
- - use soma for the soma compartment,
- - use a name starting with dend for the dendrites.
------------------------------------------------------*/
-
-
-create soma[1]
-create dend[3]
-
-soma[0] {
-    pt3dadd(0, 0, 0, 25)
-    pt3dadd(0, 0, 35, 25)
-}
-
-dend[0] {
-    pt3dadd(0, 0, 35, 5)
-    pt3dadd(0, 0, 150, 5)
-}
-
-dend[1] {
-    pt3dadd(0, 0, 150, 2)
-    pt3dadd(-50, 20, 200, 1)
-}
-
-dend[2] {
-    pt3dadd(0, 0, 150, 2)
-    pt3dadd(30, 0, 160, 2)
-}
-
-connect dend[0](0), soma[0](0.5)
-connect dend[1](0), dend[0](1)
-connect dend[2](0), dend[0](1)
diff --git a/LFPy-2.0.7/LFPy/test/ball_and_sticks_w_lists.hoc b/LFPy-2.0.7/LFPy/test/ball_and_sticks_w_lists.hoc
deleted file mode 100644
index b35cc3f..0000000
--- a/LFPy-2.0.7/LFPy/test/ball_and_sticks_w_lists.hoc
+++ /dev/null
@@ -1,52 +0,0 @@
-/* ----------------------------------------------------
-ball_and_Y.hoc
-
-This hoc file creates a neuron of the following shape:
-
-            \       
-             \     
-              \   /
-               \ /
-                V
-                |
-                |
-                |
-                O
-                
-Note the conventions:
- - soma needs to be a list (soma[0], not soma),
- - use soma for the soma compartment,
- - use a name starting with dend for the dendrites.
------------------------------------------------------*/
-
-
-create soma[1]
-create dend[3]
-
-soma[0] {
-    pt3dadd(0, 0, 0, 25)
-    pt3dadd(0, 0, 35, 25)
-}
-
-dend[0] {
-    pt3dadd(0, 0, 35, 5)
-    pt3dadd(0, 0, 150, 5)
-}
-
-dend[1] {
-    pt3dadd(0, 0, 150, 2)
-    pt3dadd(-50, 20, 200, 1)
-}
-
-dend[2] {
-    pt3dadd(0, 0, 150, 2)
-    pt3dadd(30, 0, 160, 2)
-}
-
-connect dend[0](0), soma[0](0.5)
-connect dend[1](0), dend[0](1)
-connect dend[2](0), dend[0](1)
-
-forall {
-    all.append()
-}
diff --git a/LFPy-2.0.7/LFPy/test/common.py b/LFPy-2.0.7/LFPy/test/common.py
deleted file mode 100644
index 475ef96..0000000
--- a/LFPy-2.0.7/LFPy/test/common.py
+++ /dev/null
@@ -1,281 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-import os
-import numpy as np
-from scipy.integrate import quad
-from scipy import real, imag
-import LFPy
-import neuron
-
-
-######## Functions used by tests: ##############################################
-def stickSimulation(method):
-    stickParams = {
-        'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-        'cm' : 1,
-        'Ra' : 150,
-        'v_init' : -65,
-        'passive' : True,
-        'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-        'tstart' : -100,
-        'tstop' : 100,
-        'dt' : 2**-6,
-        'nsegs_method' : 'lambda_f',
-        'lambda_f' : 1000,
-
-    }
-
-    electrodeParams = {
-        'sigma' : 0.3,
-        'x' : np.ones(11) * 100.,
-        'y' : np.zeros(11),
-        'z' : np.linspace(1000, 0, 11),
-        'method' : method
-    }
-
-    stimParams = {
-        'pptype' : 'SinSyn',
-        'delay' : -100.,
-        'dur' : 1000.,
-        'pkamp' : 1.,
-        'freq' : 100.,
-        'phase' : -np.pi/2,
-        'bias' : 0.,
-        'record_current' : True
-    }
-
-
-    electrode = LFPy.RecExtElectrode(**electrodeParams)
-
-    stick = LFPy.Cell(**stickParams)
-    stick.set_pos(z=-stick.zstart[0])
-
-    synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                           **stimParams)
-    stick.simulate(electrode, rec_imem=True, rec_vmem=True)
-
-    return electrode.LFP
-
-def stickSimulationAveragingElectrode(contactRadius, contactNPoints, method):
-    stickParams = {
-        'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-        'cm' : 1,
-        'Ra' : 150,
-        'v_init' : -65,
-        'passive' : True,
-        'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-        'tstart' : -100,
-        'tstop' : 100,
-        'dt' : 2**-6,
-        'nsegs_method' : 'lambda_f',
-        'lambda_f' : 1000,
-
-    }
-
-    N = np.empty((11, 3))
-    for i in range(N.shape[0]): N[i,] = [1, 0, 0] #normal unit vec. to contacts
-    electrodeParams = {
-        'sigma' : 0.3,
-        'x' : np.ones(11) * 100.,
-        'y' : np.zeros(11),
-        'z' : np.linspace(1000, 0, 11),
-        'r' : contactRadius,
-        'n' : 10,
-        'N' : N,
-        'method' : method
-    }
-
-    stimParams = {
-        'pptype' : 'SinSyn',
-        'delay' : -100.,
-        'dur' : 1000.,
-        'pkamp' : 1.,
-        'freq' : 100.,
-        'phase' : -np.pi/2,
-        'bias' : 0.,
-        'record_current' : True
-    }
-
-
-    electrode = LFPy.RecExtElectrode(**electrodeParams)
-
-    stick = LFPy.Cell(**stickParams)
-    stick.set_pos(z=-stick.zstart[0])
-    
-    synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                           **stimParams)
-    stick.simulate(electrode, rec_imem=True, rec_vmem=True)
-
-    return electrode.LFP
-
-def stickSimulationDotprodcoeffs(method):
-    stickParams = {
-        'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-        'cm' : 1,
-        'Ra' : 150,
-        'v_init' : -65,
-        'passive' : True,
-        'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-        'tstart' : -100,
-        'tstop' : 100,
-        'dt' : 2**-6,
-        'nsegs_method' : 'lambda_f',
-        'lambda_f' : 1000,
-
-    }
-
-    electrodeParams = {
-        'sigma' : 0.3,
-        'x' : np.ones(11) * 100.,
-        'y' : np.zeros(11),
-        'z' : np.linspace(1000, 0, 11),
-        'method' : method
-    }
-
-    stimParams = {
-        'pptype' : 'SinSyn',
-        'delay' : -100.,
-        'dur' : 1000.,
-        'pkamp' : 1.,
-        'freq' : 100.,
-        'phase' : -np.pi/2,
-        'bias' : 0.,
-        'record_current' : True
-    }
-
-
-
-    stick = LFPy.Cell(**stickParams)
-    stick.set_pos(z=-stick.zstart[0])
-    
-    #dummy variables for mapping
-    stick.imem = np.eye(stick.totnsegs)
-    stick.tvec = np.arange(stick.totnsegs)*stick.dt
-
-    electrode = LFPy.RecExtElectrode(stick, **electrodeParams)
-    electrode.calc_lfp()
-    #not needed anymore:
-    del stick.imem, stick.tvec
-
-    synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                           **stimParams)
-    stick.simulate(dotprodcoeffs=electrode.LFP,
-                   rec_imem=True, rec_vmem=True)
-
-    return stick.dotprodresults[0]
-
-
-def analytical_LFP(time=np.linspace(0, 100, 1001),
-                   stickLength=1000.,
-                   stickDiam=2.,
-                   Rm=30000.,
-                   Cm=1.,
-                   Ri=150.,
-                   stimFrequency=100.,
-                   stimAmplitude=1.,
-                   # stimPos=1.,
-                   sigma=0.3,
-                   electrodeR=100.,
-                   electrodeZ=0.,
-                   ):
-    """
-    Will calculate the analytical LFP from a dendrite stick aligned with z-axis.
-    The synaptic current is always assumed to be at the end of the stick, i.e.
-    Zin = stickLength.
-
-    Parameters
-    ----------
-    time : ndarray
-        The LFP is calculated for values in this np.array (ms)
-    stickLength : float
-        length of stick (mum)
-    stickDiam : float
-        diameter of stick (mum)
-    Rm : float
-        Membrane resistivity (Ohm * cm2)
-    Cm : float
-        Membrane capacitance (muF/cm2)
-    Ri : float
-        Intracellular resistivity (Ohm*cm)
-    stimFrequency : float
-        Frequency of cosine synapse current (Hz)
-    stimAmplitude : float
-        Amplitude of cosine synapse current (nA)
-    # stimPos : float in [0, 1]
-    #     Relative stimulus current position from start (0) to end (1) of stick
-    sigma : float
-        Extracellular conductivity (muS/mum)
-    electrodeR : float
-        Radial distance from stick (mum)
-    electrodeZ : float
-        Longitudal distance along stick(mum)
-    """
-    Gm = 1. / Rm            # specific membrane conductivity (S/cm2)
-    gm = 1E2 * np.pi * stickDiam / Rm     # absolute membrane conductance (muS / mum)
-    ri = 1E-2 * 4. * Ri / (np.pi * stickDiam**2) # intracellular resistance  (Mohm/mum)
-
-    Lambda = 1E2 / np.sqrt(gm * ri) # Electrotonic length constant of stick (mum)
-    Ginf = 10 / (ri * Lambda)   # infinite stick input cond (10*muS)?
-
-    tau_m = Rm * Cm / 1000        # membrane time constant (ms)
-    Omega = 2 * np.pi * stimFrequency * tau_m / 1000 #impedance
-    Zel = electrodeZ / Lambda    # z-position of extracellular point, in units of Lambda
-    L = stickLength / Lambda      # Length of stick in units of Lambda
-    Rel = electrodeR / Lambda    # extracellular, location along x-axis, or radius, in units of Lambda
-    q = np.sqrt(1 + 1j*Omega)	    # Note: j is sqrt(-1)
-    Yin = q * Ginf * np.tanh(q * L)	    # Admittance
-    Zin = stickLength / Lambda  # unitless location of input current
-    # Zin = stickLength / Lambda * stimPos  # unitless location of input current
-
-    PhiExImem = np.empty(time.size)
-    PhiExInput = np.empty(time.size)
-
-    def i_mem(z): #z is location at stick
-        return gm * q**2 * np.cosh(q * z) / np.cosh(q * L) * stimAmplitude / Yin
-
-    def f_to_integrate(z):
-        return 1E-3 / (4 * np.pi * sigma) * i_mem(z) \
-            / np.sqrt(Rel**2 + (z - Zel)**2)
-
-    #calculate contrib from membrane currents
-    Vex_imem = -complex_quadrature(f_to_integrate, 0, L, epsabs=1E-20)
-
-    #adding contrib from input current to Vex
-    Vex_input = stimAmplitude / (4 * np.pi * sigma * Lambda * np.sqrt(Rel**2 + (Zin-Zel)**2))
-
-    PhiExImemComplex = Vex_imem * np.exp(1j * 2 * np.pi * stimFrequency *
-                                              time / 1000)
-    PhiExInputComplex = Vex_input * np.exp(1j * 2 * np.pi * stimFrequency *
-                                             time / 1000)
-
-    #Using only real component
-    PhiExImem = PhiExImemComplex.real
-    PhiExInput = PhiExInputComplex.real
-
-    PhiEx = PhiExImem + PhiExInput
-    return PhiEx
-
-def complex_quadrature(func, a, b, **kwargs):
-    """
-    Will return the complex integral value.
-    """
-    def real_func(x):
-        return real(func(x))
-    def imag_func(x):
-        return imag(func(x))
-    real_integral = quad(real_func, a, b, **kwargs)
-    imag_integral = quad(imag_func, a, b, **kwargs)
-    return real_integral[0] + 1j*imag_integral[0]
-
diff --git a/LFPy-2.0.7/LFPy/test/expsyni.mod b/LFPy-2.0.7/LFPy/test/expsyni.mod
deleted file mode 100644
index f04b555..0000000
--- a/LFPy-2.0.7/LFPy/test/expsyni.mod
+++ /dev/null
@@ -1,86 +0,0 @@
-TITLE Exponential-function synaptic current, with NET_RECEIVE
-
-COMMENT
-This model works with variable time-step methods (although it may not
-be very accurate) but at the expense of having to maintain the queues
-of spike times and weights.
-Andrew P. Davison, UNIC, CNRS, May 2006
-
-Note: converted to Exponential current kernel. 
-
-ENDCOMMENT
-
-DEFINE MAX_SPIKES 1000
-DEFINE CUTOFF 20
-
-NEURON {
-	POINT_PROCESS ExpSynI
-	RANGE tau, i, q
-	NONSPECIFIC_CURRENT i
-}
-
-UNITS {
-	(nA) = (nanoamp)
-}
-
-PARAMETER {
-	tau = 5 (ms) <1e-9,1e9>
-
-}
-
-ASSIGNED {
-	i (nA)
-	q
-	onset_times[MAX_SPIKES] (ms)
-	weight_list[MAX_SPIKES] (nA)
-}
-
-INITIAL {
-	i  = 0
-	q  = 0 : queue index
-}
-
-BREAKPOINT {
-	LOCAL k, expired_spikes, x
-	i = 0
-	expired_spikes = 0
-	FROM k=0 TO q-1 {
-		x = (t - onset_times[k])/tau
-		if (x > CUTOFF) {
-			expired_spikes = expired_spikes + 1
-		} else {
-			i = i - weight_list[k] * exp_current(x)
-		}
-	}
-	update_queue(expired_spikes)
-}
-
-FUNCTION update_queue(n) {
-	LOCAL k
-	:if (n > 0) { printf("Queue changed. t = %4.2f onset_times=[",t) }
-	FROM k=0 TO q-n-1 {
-		onset_times[k] = onset_times[k+n]
-		weight_list[k] = weight_list[k+n]
-		:if (n > 0) { printf("%4.2f ",onset_times[k]) }
-	}
-	:if (n > 0) { printf("]\n") }
-	q = q-n
-}
-
-FUNCTION exp_current(x) {
-	if (x < 0) {
-		exp_current = 0
-	} else {
-		exp_current = exp(-x)
-	}
-}
-
-NET_RECEIVE(weight (nA)) {
-	onset_times[q] = t
-	weight_list[q] = weight
-	if (q >= MAX_SPIKES-1) {
-		printf("Error in ExpSynI. Spike queue is full\n")
-	} else {
-		q = q + 1
-	}
-}
diff --git a/LFPy-2.0.7/LFPy/test/fem_mix_dip.npz b/LFPy-2.0.7/LFPy/test/fem_mix_dip.npz
deleted file mode 100644
index 0441b80..0000000
Binary files a/LFPy-2.0.7/LFPy/test/fem_mix_dip.npz and /dev/null differ
diff --git a/LFPy-2.0.7/LFPy/test/sinsyn.mod b/LFPy-2.0.7/LFPy/test/sinsyn.mod
deleted file mode 100644
index 70dbf93..0000000
--- a/LFPy-2.0.7/LFPy/test/sinsyn.mod
+++ /dev/null
@@ -1,46 +0,0 @@
-COMMENT
-Since this is an electrode current, positive values of i depolarize the cell
-and in the presence of the extracellular mechanism there will be a change
-in vext since i is not a transmembrane current but a current injected
-directly to the inside of the cell.
-ENDCOMMENT
-
-NEURON {
-        POINT_PROCESS SinSyn
-        RANGE del, dur, pkamp, freq, phase, bias
-        NONSPECIFIC_CURRENT i
-}
-
-UNITS {
-        (nA) = (nanoamp)
-             }
-
-PARAMETER {
-        del=5   (ms)
-        dur=200   (ms)
-        pkamp=1 (nA)
-        freq=1  (Hz)
-        phase=0
-        bias=0  (nA)
-        PI=3.14159265358979323846
-}
-
-ASSIGNED {
-        i (nA)
-}
-
-BREAKPOINT {
-       at_time(del)
-       at_time(del + dur)
-
-       if (t < del) {
-      i=0   
-   }else{ 
-            if (t < del+dur) {
-           i = -pkamp*sin(2*PI*freq*(t-del)*(0.001)+phase)-bias
-      }else{ 
-           i = 0
-}}}
-
-NET_RECEIVE(weight (nA)) {
-}
diff --git a/LFPy-2.0.7/LFPy/test/stick.hoc b/LFPy-2.0.7/LFPy/test/stick.hoc
deleted file mode 100644
index 932b4d6..0000000
--- a/LFPy-2.0.7/LFPy/test/stick.hoc
+++ /dev/null
@@ -1,33 +0,0 @@
-proc celldef() {
-  topol()
-  subsets()
-  geom()
-  biophys()
-  geom_nseg()
-}
-
-create dend
-
-proc topol() { local i
-  basic_shape()
-}
-proc basic_shape() {
-  dend {pt3dclear() pt3dadd(0, 0, 0, 2) pt3dadd(0, 0, 1000, 2)}
-}
-
-objref all
-proc subsets() { local i
-  objref all
-  all = new SectionList()
-    dend all.append()
-
-}
-proc geom() {
-}
-proc geom_nseg() {
-}
-proc biophys() {
-}
-access dend
-
-celldef()
diff --git a/LFPy-2.0.7/LFPy/test/stick_template.hoc b/LFPy-2.0.7/LFPy/test/stick_template.hoc
deleted file mode 100644
index 8a459a0..0000000
--- a/LFPy-2.0.7/LFPy/test/stick_template.hoc
+++ /dev/null
@@ -1,14 +0,0 @@
-begintemplate stick_template
-public dend         
-public all, basal
-objref all, basal
-proc init() {
-    all = new SectionList()
-    basal = new SectionList()
-}
-
-create dend[1]
-
-endtemplate stick_template
-
-
diff --git a/LFPy-2.0.7/LFPy/test/sticks_not_connected_head_to_toe.hoc b/LFPy-2.0.7/LFPy/test/sticks_not_connected_head_to_toe.hoc
deleted file mode 100644
index 0485596..0000000
--- a/LFPy-2.0.7/LFPy/test/sticks_not_connected_head_to_toe.hoc
+++ /dev/null
@@ -1,34 +0,0 @@
-/* ----------------------------------------------------
-sticks_not_connected_head_to_toe.hoc
-Note the conventions:
- - soma needs to be a list (soma[0], not soma),
- - use soma for the soma compartment,
- - use a name starting with dend for the dendrites.
------------------------------------------------------*/
-
-
-create soma, dend1, dend2, dend3
-
-soma {
-    pt3dadd(0, 0, -10, 10)
-    pt3dadd(0, 0, 0, 10)
-}
-
-dend1 {
-    pt3dadd(0, 0, 0, 5)
-    pt3dadd(0, 0, 200, 5)
-}
-
-dend2 {
-    pt3dadd(0, 0, 100, 2)
-    pt3dadd(0, 20, 200, 2)
-}
-
-dend3 {
-    pt3dadd(0, 0, 140, 2)
-    pt3dadd(-10, -50, 200, 2)
-}
-
-connect dend1(0), soma(1)
-connect dend2(0), dend1(.5)
-connect dend3(0), dend1(.7)
\ No newline at end of file
diff --git a/LFPy-2.0.7/LFPy/test/test_alias_method.py b/LFPy-2.0.7/LFPy/test/test_alias_method.py
deleted file mode 100644
index 6c80cbe..0000000
--- a/LFPy-2.0.7/LFPy/test/test_alias_method.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import os
-import unittest
-import numpy as np
-import LFPy
-
-
-class testAliasMethod(unittest.TestCase):
-    """
-    test LFPy.alias_method methods
-    """
-
-
-    def test_alias_method_00(self):
-        """deterministic probabilities 0.0 and 1.0"""
-        idx = np.arange(2)
-        probs = np.arange(2).astype(float)
-        nidx = 1000000
-        bins = np.arange(3)
-
-        hist, _ = np.histogram(LFPy.alias_method.alias_method(idx, probs, nidx),
-                               bins)
-
-        self.assertEqual(nidx, hist[1])
-
-    def test_alias_method_01(self):
-        """probabilities 0.25 and 0.75"""
-        idx = np.arange(2)
-        probs = np.array([0.25, 0.75])
-        nidx = 1000000
-        bins = np.arange(3)
-
-        hist, _ = np.histogram(LFPy.alias_method.alias_method(idx, probs, nidx),
-                               bins)
-
-        # compute Pearson correlation coefficients between area and histogram
-        # reporting success if within 7 decimal places
-        self.assertAlmostEqual(np.corrcoef(probs, hist.astype(float))[0, 1], 1., places=7)
-
-    def test_alias_method_02(self):
-        """probabilities 0.75 and 0.25"""
-        idx = np.arange(2)
-        probs = np.array([0.75, 0.25])
-        nidx = 1000000
-        bins = np.arange(3)
-
-        hist, _ = np.histogram(LFPy.alias_method.alias_method(idx, probs, nidx),
-                               bins)
-
-        # compute Pearson correlation coefficients between area and histogram
-        # reporting success if within 7 decimal places
-        self.assertAlmostEqual(np.corrcoef(probs, hist.astype(float))[0, 1], 1., places=7)
-
-    def test_alias_method_03(self):
-        '''over range of normalized probabilities'''
-        size = 5
-        idx = np.arange(size)
-        probs = np.arange(size).astype(float)**2
-        probs /= probs.sum()
-        nidx = 1000000
-        bins = np.arange(probs.size + 1)
-
-        hist, _ = np.histogram(LFPy.alias_method.alias_method(idx, probs, nidx),
-                               bins)
-
-        # compute Pearson correlation coefficients between area and histogram
-        # reporting success if within 5 decimal places
-        self.assertAlmostEqual(np.corrcoef(probs, hist.astype(float))[0, 1], 1., places=4)
-
-
-    def test_alias_method_04(self):
-        """deterministic probabilities 1.0 and 0.0"""
-        idx = np.arange(2)
-        probs = np.arange(2).astype(float)[::-1]
-        nidx = 1000000
-        bins = np.arange(3)
-
-        hist, _ = np.histogram(LFPy.alias_method.alias_method(idx, probs, nidx),
-                               bins)
-
-        self.assertEqual(nidx, hist[0])
diff --git a/LFPy-2.0.7/LFPy/test/test_cell.py b/LFPy-2.0.7/LFPy/test/test_cell.py
deleted file mode 100644
index c76478d..0000000
--- a/LFPy-2.0.7/LFPy/test/test_cell.py
+++ /dev/null
@@ -1,1636 +0,0 @@
-# -*- coding: utf-8 -*-
-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import os
-import posixpath
-import sys
-import unittest
-import numpy as np
-import LFPy
-import neuron
-import pickle
-import random
-
-# for nosetests to run load mechanisms
-if "win32" in sys.platform:
-    pth = os.path.join(LFPy.__path__[0], 'test', 'nrnmech.dll')
-    pth = pth.replace(os.sep, posixpath.sep)
-    if not pth in neuron.nrn_dll_loaded:
-        neuron.h.nrn_load_dll(pth)
-        neuron.nrn_dll_loaded.append(pth)
-else:
-    neuron.load_mechanisms(os.path.join(LFPy.__path__[0], 'test'))
-
-class testCell(unittest.TestCase):
-    """
-    test class LFPy.Cell
-    """
-
-    def test_cell_tvec_00(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : 0.,
-            'tstop' : 100.,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_01(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : 0.,
-            'tstop' : 10000.,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_02(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : 0,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_03(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : 0,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_04(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : 0,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_05(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : 0,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_06(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : -100,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_07(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_08(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        try:
-            stickSimulationTesttvec(**stickParams)
-        except AssertionError:
-            pass
-
-    def test_cell_tvec_09(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        try:
-            stickSimulationTesttvec(**stickParams)
-        except AssertionError:
-            pass
-
-    def test_cell_set_pos_00(self):
-        '''test LFPy.Cell.set_pos'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        np.testing.assert_allclose(cell.somapos, [0, 0, 0])
-
-    def test_cell_set_pos_01(self):
-        '''test LFPy.Cell.set_pos'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-    def test_cell_set_pos_02(self):
-        '''test LFPy.Cell.set_pos'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                          pt3d=True)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-    def test_cell_set_pos_03(self):
-        '''test LFPy.Cell.set_pos'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-    def test_cell_set_pos_04(self):
-        '''test LFPy.Cell.set_pos'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                          pt3d=True)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-
-    def test_cell_set_pos_05(self):
-        '''test LFPy.Cell.set_pos'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        np.testing.assert_allclose(cell.somapos,
-                                   [cell.xmid[0], cell.ymid[0], cell.zmid[0]])
-
-
-    def test_cell_set_pos_06(self):
-        '''test LFPy.Cell.set_pos'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                         pt3d=True)
-        np.testing.assert_allclose(cell.somapos,
-                                   [cell.xmid[0], cell.ymid[0], cell.zmid[0]])
-
-
-    def test_cell_set_rotation_00(self):
-        '''test LFPy.Cell.set_rotation()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.set_rotation(x=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_01(self):
-        '''test LFPy.Cell.set_rotation()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.set_rotation(y=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_02(self):
-        '''test LFPy.Cell.set_rotation()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        # test rotation 180 deg around z-axis
-        cell.set_rotation(z=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-
-    def test_cell_set_rotation_03(self):
-        '''test LFPy.Cell.set_rotation()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                         pt3d=True)
-
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.set_rotation(x=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_04(self):
-        '''test LFPy.Cell.set_rotation()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                         pt3d=True)
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.set_rotation(y=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_05(self):
-        '''test LFPy.Cell.set_rotation()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                         pt3d=True)
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        # test rotation 180 deg around z-axis
-        cell.set_rotation(z=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-
-    def test_cell_set_rotation_06(self):
-        '''test LFPy.Cell.set_rotation()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'))
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation: 90 deg around x-axis, 90 deg around y-axis, 90 deg around z-axis
-        cell.set_rotation(x=np.pi / 2., y=np.pi, z=np.pi / 4.)
-        # revert rotation: -90 deg around x-axis, -90 deg around y-axis, -90 deg around z-axis, rotation_order='zyx'
-        cell.set_rotation(x=-np.pi / 2., y=-np.pi, z=-np.pi / 4., rotation_order='zyx')
-        # assert that x-, y- and z-coordinates are same as beginning, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-
-    def test_cell_chiral_morphology_00(self):
-        '''test LFPy.Cell.chiral_morphology()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.chiral_morphology(axis='x')
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-
-
-    def test_cell_chiral_morphology_01(self):
-        '''test LFPy.Cell.chiral_morphology()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.chiral_morphology(axis='y')
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-
-    def test_cell_chiral_morphology_02(self):
-        '''test LFPy.Cell.chiral_morphology()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around z-axis
-        cell.chiral_morphology(axis='z')
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_get_rand_prob_area_norm_00(self):
-        '''test LFPy.Cell.get_rand_prob_area_norm()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc' ))
-        p = cell.get_rand_prob_area_norm()
-        self.assertAlmostEqual(p.sum(), 1.)
-        self.assertTrue(p.min() >= 0.)
-        self.assertTrue(p.max() <= 1.)
-
-
-    def test_cell_get_rand_prob_area_norm_from_idx(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc' ))
-        p = cell.get_rand_prob_area_norm_from_idx(idx=cell.get_idx(section='allsec'))
-        self.assertListEqual(cell.get_rand_prob_area_norm().tolist(), p.tolist())
-
-
-    def test_cell_get_rand_prob_area_norm_from_idx_00(self):
-        '''test LFPy.Cell.get_rand_prob_area_norm()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        p = cell.get_rand_prob_area_norm_from_idx(idx=np.array([0]))
-        np.testing.assert_equal(p, np.array([1.]))
-
-
-    def test_cell_get_intersegment_vector_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        idx0 = 0
-        idx1 = 1
-        vector = cell.get_intersegment_vector(idx0=idx0, idx1=idx1)
-
-        self.assertListEqual(vector,
-                            [cell.xmid[idx1] - cell.xmid[idx0],
-                             cell.ymid[idx1] - cell.ymid[idx0],
-                             cell.zmid[idx1] - cell.zmid[idx0]])
-
-
-    def test_cell_get_intersegment_distance_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        idx0 = 0
-        idx1 = 1
-        distance = cell.get_intersegment_distance(idx0=idx0, idx1=idx1)
-        vector = cell.get_intersegment_vector(idx0=idx0, idx1=idx1)
-
-        self.assertEqual(np.sqrt(np.array(vector)**2).sum(), distance)
-
-
-    def test_cell_get_idx_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                         nsegs_method=None)
-        self.assertListEqual(cell.get_idx(section='soma').tolist(), [0])
-        self.assertListEqual(cell.get_idx(section='soma[0]').tolist(), [0])
-        self.assertListEqual(cell.get_idx(section='dend[0]').tolist(), [1])
-        self.assertListEqual(cell.get_idx(section='dend[1]').tolist(), [2])
-        self.assertListEqual(cell.get_idx(section='dend[2]').tolist(), [3])
-        self.assertListEqual(cell.get_idx(section='dend').tolist(), [1, 2, 3])
-        self.assertListEqual(cell.get_idx(section='allsec').tolist(),
-                             [0, 1, 2, 3])
-        self.assertListEqual(cell.get_idx(section=['soma', 'dend']).tolist(),
-                             [0, 1, 2, 3])
-        self.assertListEqual(cell.get_idx(section='apic').tolist(), [])
-
-
-    def test_cell_get_closest_idx_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                         nsegs_method=None)
-        self.assertEqual(cell.get_closest_idx(x=0, y=0, z=0),
-                             cell.get_idx(section='soma')[0])
-
-        self.assertEqual(cell.get_closest_idx(x=-25, y=0, z=175),
-                             cell.get_idx(section='dend[1]')[0])
-
-    def test_cell_get_closest_idx_01(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        x = -41.7
-        z = 156.7
-        sec_name = "dend"
-
-        idx1 = cell.get_closest_idx(x=x, z=z)
-        idx2 = cell.get_closest_idx(x=x, z=z, section=sec_name)
-        self.assertEqual(idx1, idx2)
-
-
-    def test_cell_get_idx_children_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-
-        np.testing.assert_array_equal(cell.get_idx_children(parent='soma[0]'),
-                                      cell.get_idx(section='dend[0]'))
-
-
-    def test_cell_get_idx_parent_children_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        np.testing.assert_array_equal(cell.get_idx_parent_children(parent='soma[0]'),
-                                      cell.get_idx(section=['soma[0]',
-                                                            'dend[0]']))
-
-
-    def test_cell_get_idx_name_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        np.testing.assert_array_equal(cell.get_idx_name(idx=np.array([0])),
-                                                np.array([[0, 'soma[0]', 0.5]],
-                                                         dtype=object))
-
-
-    def test_cell_get_rand_idx_area_norm_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        idx = cell.get_rand_idx_area_norm(nidx=1000000)
-
-
-        # compute histogram and correlate with segment area
-        bins = np.arange(cell.totnsegs+1)
-        hist, bin_edges = np.histogram(idx, bins=bins)
-
-        # compute Pearson correlation coefficients between area and histogram
-        # reporting success if within 4 decimal places
-        self.assertAlmostEqual(np.corrcoef(cell.area, hist)[0, 1], 1., places=4)
-
-        # check if min and max is in the range of segment indices
-        self.assertEqual(idx.min(), 0)
-        self.assertEqual(idx.max(), cell.totnsegs-1)
-
-
-    def test_cell_set_synapse_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        cell.set_synapse(idx=0, syntype='ExpSyn', record_curret=False,
-                         record_potential=False, weight=1.,
-                         **dict(e=10., tau=2.))
-
-        self.assertTrue('ExpSyn' in cell.synlist[0].hname())
-        self.assertEqual(len(cell.synlist), 1)
-        self.assertEqual(len(cell.netconlist), 1)
-        self.assertEqual(len(cell.netstimlist), 1)
-        self.assertEqual(cell.synlist[0].e, 10.)
-        self.assertEqual(cell.synlist[0].tau, 2.)
-        self.assertEqual(cell.netconlist[0].weight[0], 1.)
-
-
-    def test_cell_set_point_process_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        cell.set_point_process(idx=0, pptype='IClamp', record_current=False,
-                               **dict(delay=1., amp=1.))
-        self.assertEqual(cell.stimlist[0].hname(), 'IClamp[0]')
-        self.assertEqual(len(cell.stimlist), 1)
-        self.assertEqual(cell.stimlist[0].delay, 1.)
-        self.assertEqual(cell.stimlist[0].amp, 1.)
-
-
-    def test_cell_strip_hoc_objects_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        cell.strip_hoc_objects()
-        for attribute in dir(cell):
-            self.assertNotEqual(str(type(getattr(cell, attribute))),
-                                'hoc.HocObject')
-
-    def test_cell_cellpickler_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        cell_pickle = cell.cellpickler(filename=None, pickler=pickle.dumps)
-        pickled_cell = pickle.loads(cell_pickle)
-
-        for attribute in dir(cell):
-            if attribute.startswith('__') or attribute.startswith('_'):
-                pass
-            else:
-                self.assertEqual(type(getattr(cell, attribute)),
-                                 type(getattr(pickled_cell, attribute)))
-
-    def test_cell_get_axial_currents_from_vmem_00(self):
-        '''
-        Check Kirchhoff in single dend.
-        '''
-        neuron.h('forall delete_section()')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend2.connect(dend1(1.), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0], cell.imem[0], rtol=1E-5)
-        np.testing.assert_almost_equal(iaxial[1], cell.imem[1], decimal=9)
-        np.testing.assert_allclose(iaxial[1], cell.imem[1], rtol=1E-5)
-
-    def test_cell_get_axial_currents_from_vmem_01(self):
-        '''
-        Check Kirchhoff in soma when single dend connected to soma mid.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend = neuron.h.Section(name='dend')
-        dend.connect(soma(0.5), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0], cell.imem[0], decimal=9)
-        np.testing.assert_almost_equal(-iaxial[1], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0], cell.imem[0], rtol=1E-4)
-        np.testing.assert_allclose(-iaxial[1], cell.imem[0], rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_02(self):
-        '''
-        Check Kirchhoff in soma when single dend connected to soma end.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend = neuron.h.Section(name='dend')
-        dend.connect(soma(1.0), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0], cell.imem[0], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[1], cell.imem[1], decimal=9)
-        np.testing.assert_allclose(iaxial[1], cell.imem[1], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[0], iaxial[1], decimal=9)
-        np.testing.assert_allclose(iaxial[0], iaxial[1], rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_03(self):
-        '''
-        Check Kirchhoff in soma when single dend connected to random soma point.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend = neuron.h.Section(name='dend')
-        dend.connect(soma(random.uniform(1e-2, 1.)), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0], cell.imem[0], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[1], cell.imem[1], decimal=9)
-        np.testing.assert_allclose(iaxial[1], cell.imem[1], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[0], iaxial[1], decimal=9)
-        np.testing.assert_allclose(iaxial[0], iaxial[1], rtol=1E-4)
-
-
-    def test_cell_get_axial_currents_from_vmem_04(self):
-        '''
-        Check Kirchhoff in soma when two dends connected to soma mid.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend1.connect(soma(0.5), 0)
-        dend2.connect(soma(0.5), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[1]-iaxial[3], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[1]-iaxial[3], cell.imem[0], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[0], iaxial[1], decimal=9)
-        np.testing.assert_allclose(iaxial[0], iaxial[1], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[2], iaxial[3], decimal=9)
-        np.testing.assert_allclose(iaxial[2], iaxial[3], rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_05(self):
-        '''
-        Check Kirchhoff in soma when two dends connected to soma end.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend1.connect(soma(1.), 0)
-        dend2.connect(soma(1.), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0]-iaxial[2], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0]-iaxial[2], cell.imem[0], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[0]+iaxial[2], iaxial[1] + iaxial[3], decimal=9)
-        np.testing.assert_allclose(iaxial[0]+iaxial[2], iaxial[1] + iaxial[3], rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_06(self):
-        '''
-        Check Kirchhoff in soma when two dends connected to diff soma points.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend1.connect(soma(1.0), 0)
-        dend2.connect(soma(.5), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0]-iaxial[2], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0]-iaxial[2], cell.imem[0], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[0], iaxial[1], decimal=9)
-        np.testing.assert_allclose(iaxial[0], iaxial[1], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[2], iaxial[3], decimal=9)
-        np.testing.assert_allclose(iaxial[2], iaxial[3], rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_07(self):
-        '''
-        Check Kirchhoff in mid dend when two dends connected to dend.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend1.connect(soma(1.0), 0)
-        dend2.connect(dend1(.5), 0)
-        dend3.connect(dend1(1.), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(iaxial[0]+iaxial[4], iaxial[1] + iaxial[5], decimal=9)
-        np.testing.assert_allclose(iaxial[0]+iaxial[4], iaxial[1] + iaxial[5], rtol=1E-4)
-        np.testing.assert_almost_equal(-iaxial[1]+iaxial[2]+iaxial[4], -cell.imem[1], decimal=9)
-        np.testing.assert_allclose(-iaxial[1]+iaxial[2]+iaxial[4], -cell.imem[1], rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_08(self):
-        '''
-        Check Kirchhoff in soma when three dends connected to soma.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend1.connect(soma(1.0), 0)
-        dend2.connect(soma(.5), 0)
-        dend3.connect(soma(.8), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0]-iaxial[2]-iaxial[4], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0]-iaxial[2]-iaxial[4], cell.imem[0], rtol=1E-3)
-
-    def test_cell_get_axial_currents_from_vmem_09(self):
-        '''
-        Check Kirchhoff in 2-comp model where dend 0 is connected to soma 0.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend1.connect(soma(0.0), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(iaxial[0], -cell.imem[0], decimal=9)
-        np.testing.assert_almost_equal(iaxial[0], cell.imem[1], decimal=9)
-        np.testing.assert_allclose(iaxial[0], -cell.imem[0], rtol=1E-3)
-        np.testing.assert_allclose(iaxial[0], cell.imem[1], rtol=1E-3)
-
-    def test_cell_get_axial_currents_from_vmem_10(self):
-        '''
-        Check that len(iaxial) = (cell.totnsegs - 1)*2
-        '''
-        soma = neuron.h.Section(name='soma[0]')
-        dend1 = neuron.h.Section(name='dend1[0]')
-        dend2 = neuron.h.Section(name='dend2[0]')
-        dend3 = neuron.h.Section(name='dend3[0]')
-        dend1.connect(soma(1.0), 0)
-        dend2.connect(soma(.5), 0)
-        dend3.connect(soma(0.8), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        self.assertEqual(iaxial.shape[0], (cell.totnsegs - 1)*2)
-
-    def test_cell_get_axial_currents_from_vmem_11(self):
-        '''
-        Check Kirchhoff in soma when three dends connected to soma mid.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend1.connect(soma(0.5), 0)
-        dend2.connect(soma(0.5), 0)
-        dend3.connect(soma(0.5), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0]-iaxial[2]-iaxial[4], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0]-iaxial[2]-iaxial[4], cell.imem[0], rtol=1E-3)
-
-    def test_cell_get_axial_currents_from_vmem_12(self):
-        '''
-        Check Kirchhoff in morph where secs are connected to arc length 0.5.
-        '''
-        morphology = os.path.join(LFPy.__path__[0], 'test', 'sticks_not_connected_head_to_toe.hoc')
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(iaxial[6]+iaxial[10]+cell.imem[3], iaxial[5], decimal=9)
-        np.testing.assert_allclose(iaxial[6]+iaxial[10]+cell.imem[3], iaxial[5], rtol=1E-5)
-
-    def test_cell_get_axial_currents_from_vmem_13(self):
-        '''
-        Check Kirchhoff in morph where secs are connected to arc length 0.7.
-        '''
-        morphology = os.path.join(LFPy.__path__[0], 'test', 'sticks_not_connected_head_to_toe.hoc')
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(iaxial[8]+iaxial[20]+cell.imem[4], iaxial[7], decimal=9)
-        np.testing.assert_allclose(iaxial[8]+iaxial[20]+cell.imem[4], iaxial[7], rtol=1E-5)
-
-
-    def test_cell_get_axial_currents_from_vmem_14(self):
-        '''
-        Check iaxial current mid positions in three-section stick.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend1.connect(soma(1), 0)
-        dend2.connect(soma(1), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree(sec=soma)
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        new_x = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
-        new_y = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
-        new_z = [[-10, 0, 10], [10, 15, 20], [20, 30, 50]]
-        new_d = [[20, 20, 20], [10, 10, 10], [5, 5, 5]]
-        for j, sec in enumerate(neuron.h.allsec()):
-            for n in range(3):
-                neuron.h.pt3dchange(n,
-                                new_x[j][n],
-                                new_y[j][n],
-                                new_z[j][n],
-                                new_d[j][n])
-                neuron.h.define_shape()
-        cell._collect_geometry()
-        cell2 = cell_w_synapse_from_sections(morphology)
-        iaxial2, d_list2, pos_list2 = cell2.get_axial_currents_from_vmem()
-        mid_current_positions = np.array([[0., 0., 5], [0., 0., 20], [0., 0., 5.], [0., 0., 12.5]])
-        np.testing.assert_almost_equal(mid_current_positions, pos_list2, decimal=9)
-        np.testing.assert_allclose(mid_current_positions, pos_list2, rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_15(self):
-        '''
-        Check iaxial current mid positions in ball-n-y.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend1.connect(soma(1.0), 0)
-        dend2.connect(dend1(1.), 0)
-        dend3.connect(dend1(.5), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree(sec=soma)
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial1, d_list1, pos_list1 = cell.get_axial_currents_from_vmem()
-        new_x = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 5, 10]]
-        new_y = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]
-        new_z = [[-10, 0, 10], [10, 15, 20], [20, 30, 40], [15, 15, 15]]
-        new_d = [[20, 20, 20], [10, 10, 10], [5, 5, 5], [2, 2, 2]]
-        for j, sec in enumerate(neuron.h.allsec()):
-            for n in range(3):
-                neuron.h.pt3dchange(n,
-                                new_x[j][n],
-                                new_y[j][n],
-                                new_z[j][n],
-                                new_d[j][n])
-                neuron.h.define_shape()
-        cell._collect_geometry()
-        cell2 = cell_w_synapse_from_sections(morphology)
-        iaxial2, d_list2, pos_list2 = cell2.get_axial_currents_from_vmem()
-        mid_current_positions = np.array([[0., 0., 5.], [0., 0., 12.5],
-                                          [0., 0., 15.], [2.5, 0., 15.],
-                                          [0., 0., 17.5], [0, 0., 25.]])
-        np.testing.assert_almost_equal(mid_current_positions, pos_list2, decimal=9)
-        np.testing.assert_allclose(mid_current_positions, pos_list2, rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_16(self):
-        '''
-        Check Kirchhoff in soma when three dends connected to soma end.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend1.connect(soma(1.0), 0)
-        dend2.connect(soma(1.0), 0)
-        dend3.connect(soma(1.0), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-cell.imem[0], iaxial[1] + iaxial[3] + iaxial[5], decimal=9)
-        np.testing.assert_allclose(-cell.imem[0], iaxial[1] + iaxial[3] + iaxial[5], rtol=1E-3)
-
-    def test_cell_simulate_recorder_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stick = LFPy.Cell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-
-    def test_cell_simulate_recorder_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_03(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stick = LFPy.Cell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-
-    def test_cell_simulate_recorder_04(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_05(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-
-    def test_cell_simulate_current_dipole_moment_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.Cell(**stickParams)
-                synapse = LFPy.StimIntElectrode(stick, idx=idx,
-                                       **stimParams)
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-
-
-    def test_cell_simulate_current_dipole_moment_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.Cell(**stickParams)
-                synapse = LFPy.StimIntElectrode(stick, idx=idx,
-                                       **stimParams)
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-
-    def test_cell_simulate_current_dipole_moment_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'e' : 0,                                # reversal potential
-            'syntype' : 'Exp2Syn',                   # synapse type
-            'tau1' : 0.1,                              # syn. time constant
-            'tau2' : 2.,                              # syn. time constant
-            'weight' : 0.01,
-        }
-
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.Cell(**stickParams)
-                synapse = LFPy.Synapse(stick, idx=idx,
-                                       **stimParams)
-                synapse.set_spike_times(np.array([10., 20., 30., 40., 50.]))
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-
-    def test_cell_tstart_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick0 = LFPy.Cell(tstart=0, tstop=200, **stickParams)
-        synapse0 = LFPy.StimIntElectrode(stick0,
-                                         stick0.get_closest_idx(0, 0, 1000),
-                                         delay=0, phase=0.,
-                                         **stimParams)
-        stick0.simulate(rec_imem=True, rec_vmem=True, rec_current_dipole_moment=True)
-
-
-        stick1 = LFPy.Cell(tstart=-100, tstop=100, **stickParams)
-        synapse1 = LFPy.StimIntElectrode(stick1,
-                                         stick1.get_closest_idx(0, 0, 1000),
-                                         delay=-100, phase=0.,
-                                         **stimParams)
-        stick1.simulate(rec_imem=True, rec_vmem=True, rec_current_dipole_moment=True)
-
-        inds = stick0.tvec >= 100
-        np.testing.assert_allclose(stick0.vmem[:, inds], stick1.vmem)
-        np.testing.assert_allclose(stick0.imem[:, inds], stick1.imem)
-        np.testing.assert_allclose(stick0.current_dipole_moment[inds, :],
-                                   stick1.current_dipole_moment)
-
-
-    def test_cell_with_recextelectrode_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.Cell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-
-    def test_cell_with_recextelectrode_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.Cell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_cell_with_recextelectrode_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.Cell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_cell_with_recextelectrode_03(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.Cell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_get_multi_current_dipole_moments00(self):
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend1.connect(soma(0.5), 0)
-        dend2.connect(dend1(1.0), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        dipoles, dipole_locs = cell.get_multi_current_dipole_moments()
-        t_point = -1
-        P_from_multi_dipoles = np.sum(dipoles[:,t_point,:],axis=0)
-        P = cell.current_dipole_moment[t_point]
-        np.testing.assert_almost_equal(P, P_from_multi_dipoles)
-        np.testing.assert_allclose(P, P_from_multi_dipoles, rtol=1E-5)
-
-    def test_get_multi_current_dipole_moments01(self):
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend1.connect(soma(1.), 0)
-        dend2.connect(soma(1.), 0)
-        dend3.connect(soma(1.), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        dipoles, dipole_locs = cell.get_multi_current_dipole_moments()
-        t_point = -1
-        P_from_multi_dipoles = np.sum(dipoles[:,t_point,:],axis=0)
-        P = cell.current_dipole_moment[t_point]
-        np.testing.assert_almost_equal(P, P_from_multi_dipoles)
-
-    def test_get_multi_current_dipole_moments02(self):
-        neuron.h('forall delete_section()')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend2.connect(dend1(1.), 0)
-        dend3.connect(dend2(.5), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        dipoles, dipole_locs = cell.get_multi_current_dipole_moments()
-        t_point = -1
-        P_from_multi_dipoles = np.sum(dipoles[:,t_point,:],axis=0)
-        P = cell.current_dipole_moment[t_point]
-        np.testing.assert_almost_equal(P, P_from_multi_dipoles)
-
-    def test_get_multi_current_dipole_moments03(self):
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend4 = neuron.h.Section(name='dend4')
-        dend5 = neuron.h.Section(name='dend5')
-        dend1.connect(soma(1.), 0)
-        dend2.connect(soma(0.), 0)
-        dend3.connect(soma(0.), 0)
-        dend4.connect(soma(0.), 0)
-        dend5.connect(soma(0.432), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        dipoles, dipole_locs = cell.get_multi_current_dipole_moments()
-        t_point = -1
-        P_from_multi_dipoles = np.sum(dipoles[:,t_point,:],axis=0)
-        P = cell.current_dipole_moment[t_point]
-        np.testing.assert_almost_equal(P, P_from_multi_dipoles)
-
-    def test_get_multi_current_dipole_moments04(self):
-        morphology = os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc')
-        cell = cell_w_synapse_from_sections(morphology)
-        dipoles, dipole_locs = cell.get_multi_current_dipole_moments()
-        t_point = -1
-        P_from_multi_dipoles = np.sum(dipoles[:,t_point,:],axis=0)
-        P = cell.current_dipole_moment[t_point]
-        np.testing.assert_almost_equal(P, P_from_multi_dipoles)
-
-
-    def test_cell_distort_geometry_01(self):
-        cell0 = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                          'ball_and_sticks.hoc' ))
-        factors = [-0.2, 0.1, 0., 0.1, 0.2]
-        nus = [-0.5, 0., 0.5]
-        for factor in factors:
-            for nu in nus:
-                for axis in 'xyz':
-                    cell1 = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0],
-                                                      'test',
-                                                      'ball_and_sticks.hoc' ))
-                    cell1.distort_geometry(factor=factor, nu=nu, axis=axis)
-                    for attr in ['start', 'mid', 'end']:
-                        for ax in 'xyz'.replace(axis, ''):
-                            np.testing.assert_allclose(getattr(cell0, ax+attr)*(1+factor*nu),
-                                                       getattr(cell1, ax+attr))
-                        np.testing.assert_allclose(getattr(cell0, axis+attr)*(1-factor),
-                                                   getattr(cell1, axis+attr))
-
-    ######## Functions used by tests: ##########################################
-def stickSimulationTesttvec(**kwargs):
-    stick = LFPy.Cell(morphology = os.path.join(LFPy.__path__[0], 'test',
-                                                'stick.hoc'), verbose=False,
-                      **kwargs)
-    stick.simulate(rec_imem=False)
-    return stick.tvec
-
-
-def cell_w_synapse_from_sections(morphology):
-    '''
-    Make cell and synapse objects, set spike, simulate and return cell
-    '''
-    cellParams = {
-        'morphology': morphology,
-        'cm' : 1,
-        'Ra' : 150,
-        'v_init' : -65,
-        'passive' : True,
-        'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-        'dt' : 2**-6,
-        'tstart' : -50,
-        'tstop' : 50,
-        'delete_sections' : False
-    }
-
-    synapse_parameters = {'e': 0.,
-                      'syntype': 'ExpSyn',
-                      'tau': 5.,
-                      'weight': .001,
-                      'record_current': True,
-                      'idx': 1}
-
-    cell = LFPy.Cell(**cellParams)
-    synapse = LFPy.Synapse(cell, **synapse_parameters)
-    synapse.set_spike_times(np.array([1.]))
-    cell.simulate(rec_imem=True, rec_vmem=True, rec_current_dipole_moment=True)
-    return cell
diff --git a/LFPy-2.0.7/LFPy/test/test_eegmegcalc.py b/LFPy-2.0.7/LFPy/test/test_eegmegcalc.py
deleted file mode 100644
index c03d3c8..0000000
--- a/LFPy-2.0.7/LFPy/test/test_eegmegcalc.py
+++ /dev/null
@@ -1,742 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import unittest
-import os
-import numpy as np
-import LFPy
-import neuron
-
-
-class testMEG(unittest.TestCase):
-    """
-    test class LFPy.MEG
-    """
-
-    def test_MEG_00(self):
-        '''test LFPy.MEG.calculate_H()'''
-        current_dipole_moment = np.zeros((11, 3))
-        current_dipole_moment[:, 0] += 1.
-        dipole_location = np.zeros(3)
-        sensor_locations = np.r_[np.eye(3), -np.eye(3)]
-
-        gt = np.zeros((sensor_locations.shape[0],
-                       current_dipole_moment.shape[0], 3))
-        gt[1, :, 2] = 1./4/np.pi
-        gt[2, :, 1] = -1./4/np.pi
-        gt[4, :, 2] = -1./4/np.pi
-        gt[5, :, 1] = 1./4/np.pi
-
-        meg = LFPy.MEG(sensor_locations)
-        np.testing.assert_equal(gt, meg.calculate_H(current_dipole_moment,
-                                                    dipole_location))
-
-    def test_MEG_01(self):
-        '''test LFPy.MEG.calculate_H()'''
-        current_dipole_moment = np.zeros((11, 3))
-        current_dipole_moment[:, 1] += 1.
-        dipole_location = np.zeros(3)
-        sensor_locations = np.r_[np.eye(3), -np.eye(3)]
-
-        gt = np.zeros((sensor_locations.shape[0],
-                       current_dipole_moment.shape[0], 3))
-        gt[0, :, 2] = -1./4/np.pi
-        gt[2, :, 0] = 1./4/np.pi
-        gt[3, :, 2] = 1./4/np.pi
-        gt[5, :, 0] = -1./4/np.pi
-
-        meg = LFPy.MEG(sensor_locations)
-        np.testing.assert_equal(gt, meg.calculate_H(current_dipole_moment,
-                                                    dipole_location))
-
-    def test_MEG_02(self):
-        '''test LFPy.MEG.calculate_H()'''
-        current_dipole_moment = np.zeros((11, 3))
-        current_dipole_moment[:, 2] += 1.
-        dipole_location = np.zeros(3)
-        sensor_locations = np.r_[np.eye(3), -np.eye(3)]
-
-        # ground truth
-        gt = np.zeros((sensor_locations.shape[0],
-                       current_dipole_moment.shape[0], 3))
-        gt[0, :, 1] = 1./4/np.pi
-        gt[1, :, 0] = -1./4/np.pi
-        gt[3, :, 1] = -1./4/np.pi
-        gt[4, :, 0] = 1./4/np.pi
-
-        meg = LFPy.MEG(sensor_locations)
-        np.testing.assert_equal(gt, meg.calculate_H(current_dipole_moment,
-                                                    dipole_location))
-
-    def test_MEG_03(self):
-        '''test LFPy.MEG.calculate_H()'''
-        current_dipole_moment = np.zeros((1, 3))
-        current_dipole_moment[:, 0] += 1.
-        dipole_location = np.zeros(3)
-        sensor_locations = np.r_[np.eye(3), -np.eye(3)]
-
-        gt = np.zeros((sensor_locations.shape[0],
-                       current_dipole_moment.shape[0], 3))
-        gt[1, :, 2] = 1./4/np.pi
-        gt[2, :, 1] = -1./4/np.pi
-        gt[4, :, 2] = -1./4/np.pi
-        gt[5, :, 1] = 1./4/np.pi
-
-        meg = LFPy.MEG(sensor_locations)
-        np.testing.assert_equal(gt, meg.calculate_H(current_dipole_moment,
-                                                    dipole_location))
-
-    def test_MEG_04(self):
-        '''test LFPy.MEG.calculate_H()'''
-        current_dipole_moment = np.zeros((1, 3))
-        current_dipole_moment[:, 1] += 1.
-        dipole_location = np.zeros(3)
-        sensor_locations = np.r_[np.eye(3), -np.eye(3)]
-
-        gt = np.zeros((sensor_locations.shape[0],
-                       current_dipole_moment.shape[0], 3))
-        gt[0, :, 2] = -1./4/np.pi
-        gt[2, :, 0] = 1./4/np.pi
-        gt[3, :, 2] = 1./4/np.pi
-        gt[5, :, 0] = -1./4/np.pi
-
-        meg = LFPy.MEG(sensor_locations)
-        np.testing.assert_equal(gt, meg.calculate_H(current_dipole_moment,
-                                                    dipole_location))
-
-    def test_MEG_05(self):
-        '''test LFPy.MEG.calculate_H()'''
-        current_dipole_moment = np.zeros((1, 3))
-        current_dipole_moment[:, 2] += 1.
-        dipole_location = np.zeros(3)
-        sensor_locations = np.r_[np.eye(3), -np.eye(3)]
-
-        gt = np.zeros((sensor_locations.shape[0],
-                       current_dipole_moment.shape[0], 3))
-        gt[0, :, 1] = 1./4/np.pi
-        gt[1, :, 0] = -1./4/np.pi
-        gt[3, :, 1] = -1./4/np.pi
-        gt[4, :, 0] = 1./4/np.pi
-
-        meg = LFPy.MEG(sensor_locations)
-        np.testing.assert_equal(gt, meg.calculate_H(current_dipole_moment,
-                                                    dipole_location))
-
-
-class testFourSphereVolumeConductor(unittest.TestCase):
-    """
-    test class LFPy.FourSphereVolumeConductor
-    """
-
-    def test_rz_params(self):
-        radii = [1., 2., 4., 8.]
-        sigmas = [1., 2., 4., 8.]
-        r_el = np.array([[1., 0., 7.]])
-        fs = LFPy.FourSphereVolumeConductor(radii, sigmas, r_el)
-
-        rz1 = np.array([0., 0., 0.])
-        with np.testing.assert_raises(RuntimeError):
-            fs._rz_params(rz1)
-        rz2 = np.array([0., 0., 1.])
-        with np.testing.assert_raises(RuntimeError):
-            fs._rz_params(rz2)
-        rz3 = np.array([0., 0., 1.2])
-        with np.testing.assert_raises(RuntimeError):
-            fs._rz_params(rz3)
-
-    def test_check_params00(self):
-        '''Test that invalid radius values raises RuntimeError'''
-        radii1 = [-1., 2., 4., 8.]
-        radii2 = [1., .5, 4., 8.]
-        radii3 = [1., 2., 1.1, 8.]
-        radii4 = [1., 2., 4., 1.]
-        sigmas = [1., 2., 4., 8.]
-        rz1 = np.array([0., 0., .9])
-        r_el = np.array([[0., 0., 1.5]])
-        with np.testing.assert_raises(RuntimeError):
-            LFPy.FourSphereVolumeConductor(radii1, sigmas, r_el)
-        with np.testing.assert_raises(RuntimeError):
-            LFPy.FourSphereVolumeConductor(radii2, sigmas, r_el)
-        with np.testing.assert_raises(RuntimeError):
-            LFPy.FourSphereVolumeConductor(radii3, sigmas, r_el)
-        with np.testing.assert_raises(RuntimeError):
-            LFPy.FourSphereVolumeConductor(radii4, sigmas, r_el)
-
-    def test_check_params01(self):
-        '''Test that Error is raised if invalid entries in sigmas'''
-        radii = [1., 2., 4., 10.]
-        sigmas1 = [1., 'str', 4., 8.]
-        sigmas2 = [-1., 2., 4., 8.]
-        sigmas3 = [1., 2., -4., 8.]
-        sigmas4 = [1., 2., 4., -8.]
-        rz1 = np.array([0., 0., .9])
-        r_el = np.array([[0., 0., 1.5]])
-        with np.testing.assert_raises(ValueError):
-            LFPy.FourSphereVolumeConductor(radii, sigmas1, r_el)
-        with np.testing.assert_raises(RuntimeError):
-            LFPy.FourSphereVolumeConductor(radii, sigmas2, r_el)
-        with np.testing.assert_raises(RuntimeError):
-            LFPy.FourSphereVolumeConductor(radii, sigmas3, r_el)
-        with np.testing.assert_raises(RuntimeError):
-            LFPy.FourSphereVolumeConductor(radii, sigmas4, r_el)
-
-    def test_check_params02(self):
-        '''Test that ValueError is raised if electrode outside head'''
-        radii = [1., 2., 4., 10.]
-        sigmas = [1., 2., 4., 8.]
-        rz1 = np.array([0., 0., .9])
-        r_el1 = np.array([[0., 0., 15.]])
-        r_el2 = np.array([[0., 0., 1.5], [12., 0., 0.]])
-        with np.testing.assert_raises(ValueError):
-            LFPy.FourSphereVolumeConductor(radii, sigmas, r_el1)
-        with np.testing.assert_raises(ValueError):
-            LFPy.FourSphereVolumeConductor(radii, sigmas, r_el2)
-
-    def test_decompose_dipole01(self):
-        '''Test radial and tangential parts of dipole sums to dipole'''
-        P1 = np.array([[1., 1., 1.]])
-        p_rad, p_tan = decompose_dipole(P1)
-        np.testing.assert_equal(p_rad + p_tan, P1)
-
-    def test_decompose_dipole02(self):
-        '''Test radial and tangential parts of dipole sums to dipole'''
-        radii = [88000, 90000, 95000, 100000]
-        sigmas = [0.3, 1.5, 0.015, 0.3]
-        ps = np.array([[ 1000., 0., 0.],
-                       [-1000., 0., 0.],
-                       [0.,  1000., 0.],
-                       [0., -1000., 0.],
-                       [0., 0.,  1000.],
-                       [0., 0., -1000.],
-                       [10., 20., 30.],
-                       [-10., -20., -30.]])
-        p_locs = np.array([[ 87000., 0., 0.],
-                           [-87000., 0., 0.],
-                           [0.,  87000., 0.],
-                           [0., -87000., 0.],
-                           [0., 0.,  87000.],
-                           [0., 0., -87000.],
-                           [80000., 2000., 3000.],
-                           [-2000., -80000., -3000.]])
-        el_locs = np.array([[90000., 5000., -5000.]])
-        fs = LFPy.FourSphereVolumeConductor(radii, sigmas, el_locs)
-        for p_loc in p_locs:
-            fs._rz_params(p_loc)
-            p_rads, p_tans = fs._decompose_dipole(ps)
-            np.testing.assert_equal(p_rads + p_tans, ps)
-
-    def test_rad_dipole(self):
-        '''Test that radial part of decomposed dipole is correct'''
-        P1 = np.array([[1., 1., 1.]])
-        p_rad, p_tan = decompose_dipole(P1)
-        np.testing.assert_equal(p_rad, np.array([[0., 0., 1.]]))
-
-    def test_tan_dipole(self):
-        '''Test that tangential part of decomposed dipole is correct'''
-        P1 = np.array([[1., 1., 1.]])
-        p_rad, p_tan = decompose_dipole(P1)
-        np.testing.assert_equal(p_tan, np.array([[1., 1., 0.]]))
-
-    def test_calc_theta(self):
-        '''Test theta: angle between rz and r'''
-        rz1 = np.array([0., 0., 10.])
-        r_el = np.array([[0., 0., 90.], [0., 0., -90.],[0., 70., 0.], [0., -70., 0.], [0., 10., 10.]])
-        fs = make_class_object(rz1, r_el)
-        theta = fs.calc_theta()
-        np.testing.assert_almost_equal(theta, np.array([0., np.pi, np.pi/2, np.pi/2, np.pi/4]))
-
-    def test_calc_phi01(self):
-        '''Test phi: azimuthal angle between rx and rxy'''
-        rz1 = np.array([0., 0., 0.5])
-        r_el = np.array([[0., 1., 0], [-1., -1., 1.],
-                         [1., 1., 4.], [0., 0., 89.], [0., 0., -80.]])
-        fs = make_class_object(rz1, r_el)
-        P_tan = np.array([[0., 1., 0.], [1., 0., 0.], [0., 0., 0.]])
-        phi = fs.calc_phi(P_tan)
-        np.testing.assert_almost_equal(phi, np.array([[np.pi/2, np.pi, 0.],
-                                                      [-3*np.pi/4, -np.pi/4, 0.],
-                                                      [np.pi/4, 3*np.pi/4, 0.],
-                                                      [0., 0., 0.],
-                                                      [0., 0., 0.]]))
-
-    def test_calc_phi02(self):
-        '''Test phi: azimuthal angle between rx and rxy,
-           check that theta is not NaN, due to round-off errors'''
-        radii = [79000., 80000., 85000., 100000.]
-        sigmas = [0.3, 0.015, 15, 0.3]
-        rz = np.array([0., 0., 76500.])
-        r_el = np.array([[1e-5, 0, 99999.],
-                         [0, 0.000123, 99998.9],
-                         [-5.59822325e3, -9.69640709e3, -9.93712111e4],
-                         [99990., 0., 0.001]])
-
-        fs = LFPy.FourSphereVolumeConductor(radii, sigmas, r_el)
-        fs._rz_params(rz)
-
-        P1 = np.array([[0., 0., 123456789.],
-                       [0., 0., 0.05683939],
-                       [89892340., 0., -123456789],
-                       [0.00004, 0.002, .0987654321],
-                       [0., 0., 0.05683939],
-                       [0.0003, 0.001, 123456789.],
-                       [1e-11, 1e-12, 1000.],
-                       [1e-15, 0, 1000.]])
-        p_rad, p_tan = fs._decompose_dipole(P1)
-        phi = fs.calc_phi(p_tan)
-
-        np.testing.assert_equal(np.isnan(phi).any(), False)
-
-    def test_rad_sign(self):
-        '''Test if radial dipole points inwards or outwards'''
-        rz1 = np.array([0., 0., 70.])
-        r_el = np.array([[0., 0., 90.]])
-        fs = make_class_object(rz1, r_el)
-        P1 = np.array([[0., 0., 1.], [0., 0., -2.]])
-        s_vector = fs._sign_rad_dipole(P1)
-        np.testing.assert_almost_equal(s_vector, np.array([1., -1.]))
-
-    def test_calc_vn(self):
-        '''test that calc_vn gives correct values'''
-        n = 1
-        fs = make_simple_class_object()
-        v1 = fs._calc_vn(1)
-        np.testing.assert_almost_equal(v1, -4.75)
-
-    def test_calc_yn(self):
-        '''test that calc_yn gives correct values'''
-        n = 1
-        fs = make_simple_class_object()
-        y1 = fs._calc_yn(1)
-        np.testing.assert_almost_equal(y1, -2.3875)
-
-    def test_calc_zn(self):
-        '''test that calc_zn gives correct values'''
-        n = 1
-        fs = make_simple_class_object()
-        z1 = fs._calc_zn(1)
-        np.testing.assert_almost_equal(z1, -2.16574585635359)
-
-    def test_calc_potential(self):
-        '''test comparison between four-sphere model and model for
-        infinite homogeneous space
-        when sigma is constant and r4 goes to infinity'''
-        sigmas = [0.3, 0.3, 0.3+1e-16, 0.3]
-        radii = [10., 20*1e6, 30.*1e6, 40.*1e6]
-        rz = np.array([0., 0., 3.])
-        p = np.array([[0., 0., 100.], [50., 50., 0.]])
-        r_elec = np.array([[0., 0., 9.],
-                           [0., 0., 15.],
-                           [0., 0., 25.],
-                           [0., 0., 40.],
-                           [0., 9., 0.],
-                           [0., 15., 0.],
-                           [0., 25., 0.],
-                           [0., 40., 0.]])
-        four_s = LFPy.FourSphereVolumeConductor(radii, sigmas, r_elec)
-        pots_4s = four_s.calc_potential(p, rz)
-        inf_s = LFPy.InfiniteVolumeConductor(0.3)
-        pots_inf = inf_s.get_dipole_potential(p, r_elec - rz)
-
-        np.testing.assert_allclose(pots_4s, pots_inf, rtol=1e-6)
-
-    def test_calc_potential01(self):
-        '''test comparison between analytical 4S-model and FEM simulation'''
-        # load data
-        fem_sim = np.load(os.path.join(LFPy.__path__[0], 'test', 'fem_mix_dip.npz'))
-        pot_fem = fem_sim['pot_fem'] # [µV]
-        p = fem_sim['p'] # [nAµm]
-        rz = fem_sim['rz'] # [µm]
-        radii = fem_sim['radii'] # [µm]
-        sigmas = fem_sim['sigmas'] # [S/cm]
-        ele_coords = fem_sim['ele_coords'] # [µm]
-
-        fs = LFPy.FourSphereVolumeConductor(radii, sigmas, ele_coords)
-        k_mV_to_muV = 1e3
-        pot_analytical = fs.calc_potential(p, rz).reshape((len(ele_coords),)).reshape(pot_fem.shape)*k_mV_to_muV
-        global_error = np.abs(pot_analytical - pot_fem)/(np.max(np.abs(pot_fem)))
-        np.testing.assert_array_less(global_error, 0.01)
-
-    def test_calc_potential02(self):
-        '''Test radial and tangential parts of dipole sums to dipole'''
-        radii = [88000, 90000, 95000, 100000]
-        sigmas = [0.3, 1.5, 0.015, 0.3]
-
-        dips = np.array([[[ 1000., 0., 0.]],
-                         [[-1000., 0., 0.]],
-                         [[0.,  1000., 0.]],
-                         [[0., -1000., 0.]],
-                         [[0., 0.,  1000.]],
-                         [[0., 0., -1000.]]])
-
-        p_locs = np.array([[ 87000., 0., 0.],
-                           [-87000., 0., 0.],
-                           [0.,  87000., 0.],
-                           [0., -87000., 0.],
-                           [0., 0.,  87000],
-                           [0., 0., -87000]])
-
-        el_locs = np.array([[[ 99000., 0., 0.]],
-                            [[-99000., 0., 0.]],
-                            [[0.,  99000., 0.]],
-                            [[0., -99000., 0.]],
-                            [[0., 0.,  99000.]],
-                            [[0., 0., -99000.]]])
-
-
-        for i in range(len(p_locs)):
-            fs = LFPy.FourSphereVolumeConductor(radii, sigmas, el_locs[i])
-            phi = fs.calc_potential(dips[i], p_locs[i])
-            if i == 0:
-                phi0 = phi[0][0]
-            else:
-                np.testing.assert_equal(phi0, phi[0][0])
-
-
-    def test_calc_potential_from_multi_dipoles00(self):
-        """test comparison between multi-dipoles and single dipole approach"""
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend1.connect(soma(0.5), 0)
-        dend2.connect(dend1(1.0), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        radii = [300, 400, 500, 600]
-        sigmas = [0.3, 1.5, 0.015, 0.3]
-        electrode_locs = np.array([[0., 0., 290.],
-                                   [10., 90., 300.],
-                                   [-90, 50., 400.],
-                                   [110.3, -100., 500.]])
-        cell = cell_w_synapse_from_sections(morphology)
-        cell.set_pos(x=0, y=0, z=100)
-        t_point = [1,100,-1]
-
-        MD_4s = LFPy.FourSphereVolumeConductor(radii, sigmas, electrode_locs)
-        p, dipole_locs = cell.get_multi_current_dipole_moments(t_point)
-        Np, Nt, Nd = p.shape
-        Ne = electrode_locs.shape[0]
-        pot_MD = MD_4s.calc_potential_from_multi_dipoles(cell, t_point)
-
-        pot_sum = np.zeros((Ne, Nt))
-        for i in range(Np):
-            dip = p[i]
-            dip_loc = dipole_locs[i]
-            fs = LFPy.FourSphereVolumeConductor(radii, sigmas, electrode_locs)
-            pot = fs.calc_potential(dip, dip_loc)
-            pot_sum += pot
-
-        np.testing.assert_almost_equal(pot_MD, pot_sum)
-        np.testing.assert_allclose(pot_MD, pot_sum, rtol=1E-4)
-
-    def test_calc_potential_from_multi_dipoles01(self):
-        """test comparison between multi-dipoles and single dipole approach"""
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend1.connect(soma(1.0), 0)
-        dend2.connect(soma(1.0), 0)
-        dend3.connect(soma(1.0), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        radii = [300, 400, 500, 600]
-        sigmas = [0.3, 1.5, 0.015, 0.3]
-        electrode_locs = np.array([[0., 0., 290.],
-                                   [10., 90., 300.],
-                                   [-90, 50., 400.],
-                                   [110.3, -100., 500.]])
-        cell = cell_w_synapse_from_sections(morphology)
-        cell.set_pos(x=0, y=0, z=100)
-        t_point = [1,100,-1]
-
-        MD_4s = LFPy.FourSphereVolumeConductor(radii, sigmas, electrode_locs)
-        p, dipole_locs = cell.get_multi_current_dipole_moments(t_point)
-        Np, Nt, Nd = p.shape
-        Ne = electrode_locs.shape[0]
-        pot_MD = MD_4s.calc_potential_from_multi_dipoles(cell, t_point)
-
-        pot_sum = np.zeros((Ne, Nt))
-        for i in range(Np):
-            dip = p[i]
-            dip_loc = dipole_locs[i]
-            fs = LFPy.FourSphereVolumeConductor(radii, sigmas, electrode_locs)
-            pot = fs.calc_potential(dip, dip_loc)
-            pot_sum += pot
-
-        np.testing.assert_almost_equal(pot_MD, pot_sum)
-        np.testing.assert_allclose(pot_MD, pot_sum, rtol=1E-4)
-
-class testInfiniteVolumeConductor(unittest.TestCase):
-    """
-    test class InfiniteVolumeConductor
-    """
-    def test_get_dipole_potential(self):
-        sigma = 0.3
-        r = np.array([[0., 0., 1.], [0., 1., 0.]])
-        p = np.array([[0., 0., 4*np.pi*0.3], [0., 4*np.pi*0.3, 0.]])
-        inf_model = LFPy.InfiniteVolumeConductor(sigma)
-        phi = inf_model.get_dipole_potential(p, r)
-        np.testing.assert_allclose(phi, np.array([[1., 0.], [0., 1.]]))
-
-    def test_get_multi_dipole_potential00(self):
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend4 = neuron.h.Section(name='dend4')
-        dend5 = neuron.h.Section(name='dend5')
-        dend1.connect(soma(0.5), 0)
-        dend2.connect(dend1(1.0), 0)
-        dend3.connect(dend2(1.0), 0)
-        dend4.connect(dend3(1.0), 0)
-        dend5.connect(dend4(1.0), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        electrode_locs = np.array([[0., 0., 10000.]])
-        cell, electrode = cell_w_synapse_from_sections_w_electrode(morphology, electrode_locs)
-        sigma = 0.3
-        t_point = 0
-
-        MD_inf = LFPy.InfiniteVolumeConductor(sigma)
-        pot_MD = MD_inf.get_multi_dipole_potential(cell, electrode_locs)
-        pot_cb = electrode.LFP
-
-        np.testing.assert_almost_equal(pot_MD, pot_cb)
-        np.testing.assert_allclose(pot_MD, pot_cb, rtol=1E-4)
-
-    def test_get_multi_dipole_potential01(self):
-        morphology = os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc')
-        electrode_locs = np.array([[0., 0., 10000.]])
-        cell, electrode = cell_w_synapse_from_sections_w_electrode(morphology, electrode_locs)
-        sigma = 0.3
-        t_point = 0
-
-        MD_inf = LFPy.InfiniteVolumeConductor(sigma)
-        pot_MD = MD_inf.get_multi_dipole_potential(cell, electrode_locs)
-        pot_cb = electrode.LFP
-
-        np.testing.assert_almost_equal(pot_MD, pot_cb)
-        np.testing.assert_allclose(pot_MD, pot_cb, rtol=1E-3)
-
-    def test_get_multi_dipole_potential02(self):
-        morphology = os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc')
-        electrode_locs = np.array([[0., 0., 10000.]])
-        cell, electrode = cell_w_synapse_from_sections_w_electrode(morphology, electrode_locs)
-        sigma = 0.3
-        t_point = [10, 100, 1000]
-
-        MD_inf = LFPy.InfiniteVolumeConductor(sigma)
-        pot_MD = MD_inf.get_multi_dipole_potential(cell, electrode_locs, t_point)
-        pot_cb = electrode.LFP[:,t_point]
-
-        np.testing.assert_almost_equal(pot_MD, pot_cb)
-        np.testing.assert_allclose(pot_MD, pot_cb, rtol=1E-3)
-
-
-class testOneSphereVolumeConductor(unittest.TestCase):
-    """
-    test class OneSphereVolumeConductor
-    """
-    def test_OneSphereVolumeConductor_00(self):
-        """test case where sigma_i == sigma_o which
-        should be identical to the standard point-source potential in
-        infinite homogeneous media
-        """
-        # current magnitude
-        I = 1.
-        # conductivity
-        sigma = 0.3
-        # sphere radius
-        R = 1000
-        # source location (along x-axis)
-        rs = 800
-        # sphere coordinates of observation points
-        radius = np.r_[np.arange(0, rs), np.arange(rs+1, rs*2)]
-        theta = np.zeros(radius.shape)
-        phi = np.zeros(radius.shape)
-        r = np.array([radius, theta, phi])
-
-        # predict potential
-        sphere = LFPy.OneSphereVolumeConductor(r=r, R=R, sigma_i=sigma, sigma_o=sigma)
-        phi = sphere.calc_potential(rs=rs, I=I)
-
-        # ground truth
-        phi_gt = I / (4*np.pi*sigma*abs(radius-rs))
-
-        # test
-        np.testing.assert_almost_equal(phi, phi_gt)
-
-    def test_OneSphereVolumeConductor_01(self):
-        """test case where sigma_i == sigma_o which
-        should be identical to the standard point-source potential in
-        infinite homogeneous media
-        """
-        # current magnitude
-        I = np.ones(10)
-        # conductivity
-        sigma = 0.3
-        # sphere radius
-        R = 1000
-        # source location (along x-axis)
-        rs = 800
-        # sphere coordinates of observation points
-        radius = np.r_[np.arange(0, rs), np.arange(rs+1, rs*2)]
-        theta = np.zeros(radius.shape)
-        phi = np.zeros(radius.shape)
-        r = np.array([radius, theta, phi])
-
-        # predict potential
-        sphere = LFPy.OneSphereVolumeConductor(r=r, R=R, sigma_i=sigma, sigma_o=sigma)
-        phi = sphere.calc_potential(rs=rs, I=I)
-
-        # ground truth
-        phi_gt = I[0] / (4*np.pi*sigma*abs(radius-rs))
-
-        # test
-        np.testing.assert_almost_equal(phi, np.array([phi_gt]*I.size).T)
-
-    def test_OneSphereVolumeConductor_02(self):
-        """test case where sigma_i == sigma_o which
-        should be identical to the standard point-source potential in
-        infinite homogeneous media
-        """
-        # current magnitude
-        I = 1.
-        # conductivity
-        sigma = 0.3
-        # sphere radius
-        R = 10000
-        # cell body position
-        xs = 8000.
-        # sphere coordinates of observation points
-        radius = np.r_[np.arange(0, xs), np.arange(xs+1, xs*2)][::10]
-        theta = np.zeros(radius.shape)+np.pi/2
-        phi = np.zeros(radius.shape)
-        r = np.array([radius, theta, phi])
-        # set up cell
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'))
-        cell.set_pos(x=xs, y=0, z=0)
-        cell.set_rotation(y=np.pi/2)
-
-        # predict potential
-        sphere = LFPy.OneSphereVolumeConductor(r=r, R=R, sigma_i=sigma, sigma_o=sigma)
-        mapping = sphere.calc_mapping(cell=cell, n_max=100)
-
-        # ground truth and tests
-        for i, x in enumerate(cell.xmid):
-            dist = radius-x
-            dist[abs(dist) < cell.diam[i]] = cell.diam[i]
-            phi_gt = I / (4*np.pi*sigma*abs(dist))
-            np.testing.assert_almost_equal(mapping[:, i], phi_gt)
-
-
-######## Functions used by tests: ##############################################
-
-def make_class_object(rz, r_el):
-    '''Return class object fs'''
-    radii = [79., 80., 85., 90.]
-    sigmas = [0.3, 0.015, 15, 0.3]
-    fs = LFPy.FourSphereVolumeConductor(radii, sigmas, r_el)
-    fs._rz_params(rz)
-    return fs
-
-def make_simple_class_object():
-    '''Return class object fs'''
-    radii = [1., 2., 4., 8.]
-    sigmas = [1., 2., 4., 8.]
-    rz1 = np.array([0., 0., .9])
-    r_el = np.array([[0., 0., 1.5]])
-    fs = LFPy.FourSphereVolumeConductor(radii, sigmas, r_el)
-    fs._rz_params(rz1)
-    return fs
-
-def decompose_dipole(P1):
-    '''Return decomposed current dipole'''
-    rz1 = np.array([0., 0., 70.])
-    r_el = np.array([[0., 0., 90.]])
-    fs = make_class_object(rz1, r_el)
-    p_rad, p_tan = fs._decompose_dipole(P1)
-    return p_rad, p_tan
-
-def cell_w_synapse_from_sections(morphology):
-    '''
-    Make cell and synapse objects, set spike, simulate and return cell
-    '''
-    cellParams = {
-        'morphology': morphology,
-        'cm' : 1,
-        'Ra' : 150,
-        'v_init' : -65,
-        'passive' : True,
-        'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-        'dt' : 2**-6,
-        'tstart' : -50,
-        'tstop' : 50,
-        'delete_sections' : False
-    }
-
-    synapse_parameters = {'e': 0.,
-                      'syntype': 'ExpSyn',
-                      'tau': 5.,
-                      'weight': .001,
-                      'record_current': True,
-                      'idx': 1}
-
-    cell = LFPy.Cell(**cellParams)
-    synapse = LFPy.Synapse(cell, **synapse_parameters)
-    synapse.set_spike_times(np.array([1.]))
-    cell.simulate(rec_current_dipole_moment=True, rec_vmem=True)
-    return cell
-
-def cell_w_synapse_from_sections_w_electrode(morphology, electrode_locs):
-    '''
-    Make cell and synapse objects, set spike, simulate and return cell
-    '''
-    cellParams = {
-        'morphology': morphology,
-        'cm' : 1,
-        'Ra' : 150,
-        'v_init' : -65,
-        'passive' : True,
-        'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-        'dt' : 2**-6,
-        'tstart' : -50,
-        'tstop' : 50,
-        'delete_sections' : False
-    }
-
-    electrodeParams = {'sigma': 0.3,
-                        'x': electrode_locs[:,0],
-                        'y': electrode_locs[:,1],
-                        'z': electrode_locs[:,2],
-                        }
-    cell = LFPy.Cell(**cellParams)
-    electrode = LFPy.RecExtElectrode(cell, **electrodeParams)
-
-    synapse_parameters = {'e': 0.,
-                      'syntype': 'ExpSyn',
-                      'tau': 5.,
-                      'weight': .1,
-                      'record_current': True,
-                      'idx': cell.totnsegs-1}
-
-    synapse = LFPy.Synapse(cell, **synapse_parameters)
-    synapse.set_spike_times(np.array([1.]))
-    cell.simulate(electrode=[electrode],rec_current_dipole_moment=True, rec_vmem=True)
-    return cell, electrode
diff --git a/LFPy-2.0.7/LFPy/test/test_inputgenerators.py b/LFPy-2.0.7/LFPy/test/test_inputgenerators.py
deleted file mode 100644
index fa22f5a..0000000
--- a/LFPy-2.0.7/LFPy/test/test_inputgenerators.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import unittest
-import numpy as np
-import scipy.stats as st
-import LFPy
-
-
-class testInputGenerators(unittest.TestCase):
-    """
-    test LFPy.inputgenerators module
-    """
-    def test_get_activation_times_from_distribution(self):
-        """test LFPy.inputgenerators.get_activation_times_from_distribution
-        """
-        n = 10
-        tstart = 0.
-        tstop = 1E4
-        distribution = st.expon
-        rvs_args = dict(loc=0, scale=100.)
-        times = LFPy.inputgenerators.get_activation_times_from_distribution(
-            n=n, tstart=tstart, tstop=tstop, rvs_args=rvs_args, maxiter=1E6
-        )
-        self.assertTrue(len(times) == n)
-        for t in times:
-            self.assertTrue((t.min() >= tstart) & (t.max() <= tstop))
-        
-        
\ No newline at end of file
diff --git a/LFPy-2.0.7/LFPy/test/test_lfpcalc.py b/LFPy-2.0.7/LFPy/test/test_lfpcalc.py
deleted file mode 100644
index af9e25c..0000000
--- a/LFPy-2.0.7/LFPy/test/test_lfpcalc.py
+++ /dev/null
@@ -1,583 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-from __future__ import division
-import unittest
-import numpy as np
-from LFPy import lfpcalc
-
-class testLfpCalc(unittest.TestCase):
-    """
-    test class LFPy.lfpcalc
-    """
-    def test_return_dist_from_segment(self):
-        cell = DummyCell()
-        dist, clostest_point = lfpcalc.return_dist_from_segments(
-                                           cell.xstart, cell.ystart,
-                                           cell.zstart, cell.xend,
-                                           cell.yend, cell.zend, [1, 10, 0])
-        np.testing.assert_equal([10], dist)
-        np.testing.assert_equal([1, 0, 0], clostest_point.T[0])
-
-        dist, clostest_point = lfpcalc.return_dist_from_segments(
-                                           cell.xstart, cell.ystart,
-                                           cell.zstart, cell.xend,
-                                           cell.yend, cell.zend, [-1, 10, 0])
-        np.testing.assert_equal([np.sqrt(101)], dist)
-        np.testing.assert_equal([0, 0, 0], clostest_point.T[0])
-
-
-    def test_calc_lfp_pointsource(self):
-        """Test that function calc_lfp_pointsource
-        reproduces analytic formula"""
-        sigma = 0.3
-        cell = DummyCell()
-        np.testing.assert_equal(1./(4*np.pi*sigma),
-                                lfpcalc.calc_lfp_pointsource(cell,
-                                x=0.5, y=0, z=1, sigma=sigma,
-                                r_limit=cell.diam/2))
-
-    def test_calc_lfp_pointsource_moi_homogeneous(self):
-        """
-        Test that slice where all layers have same conductivity reproduces
-        in vivo results.
-        """
-        sigma_T = 0.3
-        sigma_G = 0.3
-        sigma_S = 0.3
-        h = 300
-        steps = 20
-        cell = DummyCell()
-        cell.zmid[0] = h/2
-        cell.zstart[0] = h/2
-        cell.zend[0] = h/2
-
-        in_vivo = lfpcalc.calc_lfp_pointsource(cell,
-                                x=0.5, y=0, z=1, sigma=sigma_T,
-                                r_limit=cell.diam/2)
-        in_vitro = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=0.5, y=0, z=1, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_equal(in_vivo, in_vitro)
-
-
-    def test_calc_lfp_moi_ecog(self):
-        """
-        Test that LFPy ECoG scenario gives expected analytical result
-        """
-
-        sigma_T = 0.3
-        sigma_G = 0.3
-        sigma_S = 1.5
-        h = 5000
-        steps = 20
-        cell = DummyCell()
-        cell.zmid[0] = h - 50
-        cell.zstart[0] = h - 50
-        cell.zend[0] = h - 50
-
-        cell.xmid[0] = 0
-        cell.xstart[0] = 0
-        cell.xend[0] = 0
-
-        source_scaling = (sigma_T - sigma_S) / (sigma_S + sigma_T)
-
-        z = h - 20  # Recording position z <= h, z != cell.zmid[0]
-
-        analytic = cell.imem[0] / (4 * np.pi * sigma_T) * (
-                   1 / np.abs(z - cell.zmid[0]) +  # real source
-                   source_scaling / np.abs(z - (2 * h - cell.zmid[0]))  # image source
-                   )
-
-        moi_method_lfpy = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=0., y=0, z=z, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_equal(analytic, moi_method_lfpy)
-
-
-
-    def test_calc_lfp_pointsource_moi_too_close(self):
-        """
-        Very close to point source, in vivo and in vitro have similar results,
-        e.g., the positions should be adjusted similarly.
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 2000
-        steps = 20
-        cell = DummyCell()
-        cell.zmid[0] = h/2
-        cell.zstart[0] = h/2
-        cell.zend[0] = h/2
-
-        in_vivo = lfpcalc.calc_lfp_pointsource(cell,
-                                x=0.5, y=0, z=h/2, sigma=sigma_T,
-                                r_limit=cell.diam/2)
-        in_vitro = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=0.5, y=0, z=h/2, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(in_vivo, in_vitro, 4)
-
-    def test_calc_lfp_linesource_moi_too_close(self):
-        """
-        Very close to point source, in vivo and in vitro have similar results,
-        e.g., the positions should be adjusted similarly.
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 0.3
-        h = 200
-
-        steps = 20
-        cell = DummyCell()
-        cell.zstart[0] = 0.0
-        cell.zend[0] = 0.0
-
-        in_vivo = lfpcalc.calc_lfp_linesource(cell,
-                                x=0.5, y=0, z=0, sigma=sigma_T,
-                                r_limit=cell.diam/2)
-        in_vitro = lfpcalc.calc_lfp_linesource_moi(cell,
-                                x=0.5, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(2*in_vivo, in_vitro, 4)
-
-    def test_calc_lfp_soma_as_point_moi_too_close(self):
-        """
-        Very close to point source, in vivo and in vitro have similar results,
-        e.g., the positions should be adjusted similarly.
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 2000
-        steps = 20
-        cell = DummyCell()
-        cell.zmid[0] = 0
-        cell.zstart[0] = 0
-        cell.zend[0] = 0
-
-        in_vivo = lfpcalc.calc_lfp_soma_as_point(cell,
-                                x=0.0, y=0, z=0, sigma=sigma_T,
-                                r_limit=cell.diam/2)
-        in_vitro = lfpcalc.calc_lfp_soma_as_point_moi(cell,
-                                x=0.0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(2*in_vivo, in_vitro, 4)
-
-
-    def test_calc_lfp_linesource_too_close(self):
-        """
-        Test that calc_lfp_linesource method does not give infinite potential
-        """
-        sigma_T = 0.3
-        cell = DummyCell()
-        cell.zmid[0] = 0.0
-        cell.zstart[0] = 0.0
-        cell.zend[0] = 0.0
-
-        in_vivo = lfpcalc.calc_lfp_linesource(cell,
-                                x=0.5, y=0.0, z=0, sigma=sigma_T,
-                                r_limit=cell.diam/2)[0]
-        np.testing.assert_array_less(in_vivo, 1e12)
-
-    def test_calc_lfp_pointsource_moi_doubling(self):
-        """
-        Test that slice with zero-conductivity MEA region (z<0) has twice
-        the potential as in vivo case at MEA electrode plane
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 0.3
-        h = 200
-        steps = 3
-
-        cell = DummyCell()
-        cell.zstart[0] = 50
-        cell.zmid[0] = 50
-        cell.zend[0] = 50
-
-        in_vivo = lfpcalc.calc_lfp_pointsource(cell,
-                                x=50., y=0, z=0, sigma=sigma_T,
-                                r_limit=cell.diam/2)
-        in_vitro = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=50, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(2 * in_vivo, in_vitro, decimal=9)
-
-    def test_calc_lfp_linesource_moi_doubling(self):
-        """
-        Test that slice with zero conductivity in MEA region (z<0) has twice
-        the potential as in vivo case at MEA electrode plane
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 0.3
-        h = 200
-        steps = 3
-
-        cell = DummyCell()
-        cell.zstart[0] = 50
-        cell.zmid[0] = 50
-        cell.zend[0] = 50
-
-        in_vivo = lfpcalc.calc_lfp_linesource(cell,
-                                x=50., y=0, z=0, sigma=sigma_T,
-                                r_limit=cell.diam/2)
-        in_vitro = lfpcalc.calc_lfp_linesource_moi(cell,
-                                x=50, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(2*in_vivo, in_vitro, decimal=9)
-
-    def test_calc_lfp_soma_as_point_moi_doubling(self):
-        """
-        Test that slice with zero conductivity in MEA region (z<0) has twice
-        the potential as in vivo case at MEA electrode plane
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 0.3
-        h = 200
-        steps = 3
-
-        cell = DummyCell()
-        cell.zstart[0] = 50
-        cell.zmid[0] = 50
-        cell.zend[0] = 50
-
-        in_vivo = lfpcalc.calc_lfp_soma_as_point(cell,
-                                x=50., y=0, z=0, sigma=sigma_T,
-                                r_limit=cell.diam/2)
-        in_vitro = lfpcalc.calc_lfp_soma_as_point_moi(cell,
-                                x=50, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(2*in_vivo, in_vitro, decimal=9)
-
-
-    def test_calc_lfp_pointsource_moi_saline_effect(self):
-        """
-        Test that the saline bath decreases signal as expected
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 200
-        steps = 20
-
-        cell = DummyCell()
-        cell.zstart[0] = 100
-        cell.zmid[0] = 100
-        cell.zend[0] = 100
-
-        with_saline = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        without_saline = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_T,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_array_less(with_saline, without_saline)
-
-    def test_calc_lfp_linesource_moi_saline_effect(self):
-        """
-        Test that the saline bath decreases signal as expected
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 200
-        steps = 20
-
-        cell = DummyCell()
-        cell.zstart[0] = 100
-        cell.zmid[0] = 100
-        cell.zend[0] = 100
-
-
-        with_saline = lfpcalc.calc_lfp_linesource_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        without_saline = lfpcalc.calc_lfp_linesource_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_T,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_array_less(with_saline, without_saline)
-
-    def test_calc_lfp_soma_as_point_moi_saline_effect(self):
-        """
-        Test that the saline bath decreases signal as expected
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 200
-        steps = 20
-
-        cell = DummyCell()
-        cell.zstart[0] = 100
-        cell.zmid[0] = 100
-        cell.zend[0] = 100
-
-        with_saline = lfpcalc.calc_lfp_soma_as_point_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        without_saline = lfpcalc.calc_lfp_soma_as_point_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_T,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_array_less(with_saline, without_saline)
-
-
-
-    def test_calc_lfp_pointsource_moi_20steps(self):
-        """
-        Test that the calc_lfp_pointsource_moi reproduces previously known
-        nummerical value
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 200
-        steps = 20
-
-        correct = 0.00108189
-
-        cell = DummyCell()
-        cell.zmid[0] = 110
-        cell.xmid[0] = -100
-
-        calculated = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=100, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(correct, calculated, 5)
-
-
-    def test_calc_lfp_linesource_moi_20steps(self):
-        """
-        Test that the calc_lfp_linesource_moi reproduces previously known
-        nummerical value
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 200
-        steps = 20
-
-        correct = 0.00246539
-
-        cell = DummyCell()
-        cell.zstart[0] = 0
-        cell.zend[0] = 110
-        cell.xstart[0] = -100
-        cell.xend[0] = 50
-
-        calculated = lfpcalc.calc_lfp_linesource_moi(cell,
-                                x=100, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(correct, calculated, 5)
-
-    def test_calc_lfp_soma_as_point_moi_20steps(self):
-        """
-        Test that the calc_lfp_soma_as_point_moi reproduces previously known
-        nummerical value
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 200
-        steps = 20
-
-        correct = 0.00108189
-
-        cell = DummyCell()
-        cell.zmid[0] = 110
-        cell.xmid[0] = -100
-
-        calculated = lfpcalc.calc_lfp_soma_as_point_moi(cell,
-                                x=100, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(correct, calculated, 5)
-
-
-
-    def test_calc_lfp_pointsource_moi_infinite_slice(self):
-        """
-        Test that infinitely thick slice does not affect potential.
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 1e10
-        steps = 20
-
-        cell = DummyCell()
-        cell.zstart[0] = 100
-        cell.zmid[0] = 100
-        cell.zend[0] = 100
-
-        with_saline = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=0, y=0, z=50, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        without_saline = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=0, y=0, z=50, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_T,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(with_saline, without_saline)
-
-
-    def test_calc_lfp_linesource_moi_infinite_slice(self):
-        """
-        Test that infinitely thick slice does not affect potential.
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 1e10
-        steps = 20
-
-        cell = DummyCell()
-        cell.zstart[0] = 100
-        cell.zmid[0] = 100
-        cell.zend[0] = 100
-
-        with_saline = lfpcalc.calc_lfp_linesource_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        without_saline = lfpcalc.calc_lfp_linesource_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_T,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(with_saline, without_saline)
-
-    def test_calc_lfp_soma_as_point_moi_infinite_slice(self):
-        """
-        Test that infinitely thick slice does not affect potential.
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 1e10
-        steps = 20
-
-        cell = DummyCell()
-        cell.zstart[0] = 100
-        cell.zmid[0] = 100
-        cell.zend[0] = 100
-
-        with_saline = lfpcalc.calc_lfp_soma_as_point_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        without_saline = lfpcalc.calc_lfp_soma_as_point_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_T,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(with_saline, without_saline)
-
-
-
-    def test_calc_lfp_pointsource_anisotropic(self):
-
-        sigma = [0.6, 0.3, 0.45]
-        cell = DummyCell()
-        cell.xmid = cell.ymid = cell.zmid = np.array([1.2])
-        sigma_r = np.sqrt(sigma[1] * sigma[2] * 1.2**2
-                        + sigma[0] * sigma[2] * 1.2**2
-                        + sigma[0] * sigma[1] * 1.2**2)
-
-        phi_analytic = 1./(4*np.pi * sigma_r)
-        np.testing.assert_equal(phi_analytic,
-                                lfpcalc.calc_lfp_pointsource_anisotropic(cell,
-                                x=0, y=0, z=0, sigma=sigma,
-                                r_limit=cell.diam/2))
-
-
-    def test_deltaS_calc(self):
-        cell = DummyCell()
-        cell.yend[0] = 5
-        ds = lfpcalc._deltaS_calc(cell.xstart, cell.xend,
-                                  cell.ystart, cell.yend,
-                                  cell.zstart, cell.zend)
-        np.testing.assert_equal(ds, np.sqrt(26))
-
-
-
-class DummyCell(object):
-    """Cell like object with attributes for predicting extracellular potentials,
-    but with:
-        - 1 compartment
-        - position in (0.5,0,0)
-        - length 1
-        - diam 1
-        - current amplitude 1
-        - 1 timestep
-    """
-    def __init__(self):
-        self.imem = np.array([[1.]])
-        self.xstart = np.array([0.])
-        self.ystart = np.array([0.])
-        self.zstart = np.array([0.])
-        self.xmid = np.array([0.5])
-        self.ymid = np.array([0.])
-        self.zmid = np.array([0.])
-        self.xend = np.array([1.])
-        self.yend = np.array([0.])
-        self.zend = np.array([0.])
-        self.diam = np.array([1.])
-        self.totnsegs = len(self.xmid)
-    
-    def get_idx(self, section="soma"):
-        if section == "soma":
-            return np.array([0])
-        else:
-            return np.array([])
diff --git a/LFPy-2.0.7/LFPy/test/test_misc.py b/LFPy-2.0.7/LFPy/test/test_misc.py
deleted file mode 100644
index cde574d..0000000
--- a/LFPy-2.0.7/LFPy/test/test_misc.py
+++ /dev/null
@@ -1,198 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import unittest
-import numpy as np
-import neuron
-
-
-class testMisc(unittest.TestCase):
-    """
-    test misc. code
-    """
-
-    def test_neuron_record_i_membrane_methods_00(self):
-        '''not a test of LFPy per se, but we're using this method for
-        calculating with the i_membrane_ attribute on each time step'''
-        # sections
-        soma = neuron.h.Section(name='soma')
-        dend = neuron.h.Section(name='dend')
-
-        # connect sections
-        dend.connect(soma, 1, 0)
-
-        # geometry
-        soma.L = 30.
-        soma.diam = 30.
-        soma.nseg = 1
-        dend.L = 500.
-        dend.diam = 2.
-        dend.nseg = 50
-
-        # biophysical parameters
-        for sec in [soma, dend]:
-            sec.Ra = 100
-            sec.cm = 1
-            sec.insert('pas')
-            for seg in sec:
-                seg.pas.g = 0.0002
-                seg.pas.e = -65.
-
-        # stimulus
-        syn = neuron.h.ExpSyn(0.5, sec=dend)
-        syn.e = 0.
-        syn.tau = 2.
-
-        # generators
-        ns = neuron.h.NetStim(0.5)
-        ns.noise = 1.
-        ns.start = 0.
-        ns.number = 1000
-        ns.interval = 10.
-        nc = neuron.h.NetCon(ns, syn)
-        nc.weight[0] = .01
-
-        # integrator
-        cvode = neuron.h.CVode()
-        cvode.use_fast_imem(1)
-
-        # record
-        i_membrane_control = []     # record currents using Vector.record method
-        i_membrane_fadvance = []    # record seg.i_membrane_ at each timestep
-        for sec in [soma, dend]:
-            for seg in sec:
-                i = neuron.h.Vector()
-                i.record(seg._ref_i_membrane_)
-                i_membrane_control.append(i)
-                i_membrane_fadvance.append([])
-
-        # Simulation control
-        neuron.h.dt =  2**-4          # simulation time resolution
-        tstop = 500.        # simulation duration
-        v_init = -65.       # membrane voltage(s) at t = 0
-
-        def initialize():
-            neuron.h.finitialize(v_init)
-            neuron.h.fcurrent()
-
-        def collect_i_membrane():
-            j = 0
-            for sec in [soma, dend]:
-                for seg in sec:
-                    i_membrane_fadvance[j].append(seg.i_membrane_)
-                    j += 1
-
-        def integrate():
-            while neuron.h.t < tstop:
-                collect_i_membrane()
-                neuron.h.fadvance()
-            collect_i_membrane() # otherwise shape mismatch
-
-        initialize()
-        integrate()
-
-        i_membrane_control = np.array(i_membrane_control)
-        i_membrane_fadvance = np.array(i_membrane_fadvance)
-
-        np.testing.assert_equal(i_membrane_control, i_membrane_fadvance)
-
-
-    def test_neuron_record_i_membrane_methods_01(self):
-        '''not a test of LFPy per se, but we're using this method for
-        calculating with the i_membrane_ attribute on each time step'''
-        # sections
-        soma = neuron.h.Section(name='soma')
-        dend = neuron.h.Section(name='dend')
-
-        # connect sections
-        dend.connect(soma, 1, 0)
-
-        # geometry
-        soma.L = 30.
-        soma.diam = 30.
-        soma.nseg = 1
-        dend.L = 500.
-        dend.diam = 2.
-        dend.nseg = 50
-
-        # biophysical parameters
-        for sec in [soma, dend]:
-            sec.Ra = 100
-            sec.cm = 1
-            sec.insert('pas')
-            for seg in sec:
-                seg.pas.g = 0.0002
-                seg.pas.e = -65.
-
-        # stimulus
-        syn = neuron.h.ExpSyn(0.5, sec=dend)
-        syn.e = 0.
-        syn.tau = 2.
-
-        # generators
-        ns = neuron.h.NetStim(0.5)
-        ns.noise = 1.
-        ns.start = 0.
-        ns.number = 1000
-        ns.interval = 10.
-        nc = neuron.h.NetCon(ns, syn)
-        nc.weight[0] = .01
-
-        # integrator
-        cvode = neuron.h.CVode()
-        cvode.use_fast_imem(1)
-
-        # record
-        i_membrane_control = []     # record currents using Vector.record method
-        i_membrane_fadvance = []    # record seg.i_membrane_ at each timestep
-        for sec in [soma, dend]:
-            for seg in sec:
-                i = neuron.h.Vector()
-                i.record(seg._ref_i_membrane_)
-                i_membrane_control.append(i)
-                i_membrane_fadvance.append([])
-
-        # Simulation control
-        neuron.h.dt = 2**-4          # simulation time resolution
-        tstop = 500.        # simulation duration
-        v_init = -65.       # membrane voltage(s) at t = 0
-
-        def initialize():
-            neuron.h.finitialize(v_init)
-            neuron.h.fcurrent()
-            neuron.h.frecord_init()
-            neuron.h.t = -100. # force simulations to start at some negative t
-
-        def collect_i_membrane():
-            j = 0
-            for sec in [soma, dend]:
-                for seg in sec:
-                    i_membrane_fadvance[j].append(seg.i_membrane_)
-                    j += 1
-
-        def integrate():
-            while neuron.h.t < tstop:
-                collect_i_membrane()
-                neuron.h.fadvance()
-            collect_i_membrane() # otherwise shape mismatch
-
-        initialize()
-        integrate()
-
-        i_membrane_control = np.array(i_membrane_control)
-        i_membrane_fadvance = np.array(i_membrane_fadvance)
-
-        np.testing.assert_equal(i_membrane_control, i_membrane_fadvance)
diff --git a/LFPy-2.0.7/LFPy/test/test_network.py b/LFPy-2.0.7/LFPy/test/test_network.py
deleted file mode 100644
index 4529921..0000000
--- a/LFPy-2.0.7/LFPy/test/test_network.py
+++ /dev/null
@@ -1,502 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import os
-import unittest
-import numpy as np
-import LFPy
-import neuron
-import h5py
-import scipy.signal as ss
-
-class testNetworkPopulation(unittest.TestCase):
-    """
-    class LFPy.NetworkPopulation test suite
-    """
-    def test_NetworkPopulation_00(self):
-        cellParameters = dict(
-            morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks_w_lists.hoc'),
-            templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-            templatename='ball_and_stick_template',
-            templateargs=None,
-            passive=False,
-            dt=2**-3,
-            tstop=100,
-            delete_sections=False,
-        )
-
-        populationParameters = dict(
-            CWD=None,
-            CELLPATH=None,
-            Cell=LFPy.NetworkCell,
-            cell_args = cellParameters,
-            pop_args = dict(
-                radius=100,
-                loc=0.,
-                scale=20.),
-            rotation_args = dict(x=0, y=0),
-            POP_SIZE = 4,
-            name = 'ball_and_sticks',
-            OUTPUTPATH='tmp_testNetworkPopulation'
-        )
-
-        population = LFPy.NetworkPopulation(**populationParameters)
-
-        self.assertTrue(len(population.cells) == population.POP_SIZE)
-        for cell, soma_pos, gid in zip(population.cells, population.soma_pos, population.gids):
-            self.assertTrue(type(cell) is LFPy.NetworkCell)
-            self.assertTrue((cell.somapos[0] == soma_pos['x']) &
-                            (cell.somapos[1] == soma_pos['y']) &
-                            (cell.somapos[2] == soma_pos['z']))
-            self.assertEqual(cell.gid, gid)
-            self.assertTrue(np.sqrt(soma_pos['x']**2 + soma_pos['y']**2) <= 100.)
-        np.testing.assert_equal(population.gids, np.arange(4))
-
-
-        os.system('rm -r tmp_testNetworkPopulation')
-        neuron.h('forall delete_section()')
-
-
-class testNetwork(unittest.TestCase):
-    """
-    class LFPy.Network test suite
-    """
-    def test_Network_00(self):
-        cellParameters = dict(
-            morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks_w_lists.hoc'),
-            templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-            templatename='ball_and_stick_template',
-            templateargs=None,
-            passive=False,
-            dt=2**-3,
-            tstop=100,
-            delete_sections=False,
-        )
-
-        populationParameters = dict(
-            CWD=None,
-            CELLPATH=None,
-            Cell=LFPy.NetworkCell,
-            cell_args = cellParameters,
-            pop_args = dict(
-                radius=100,
-                loc=0.,
-                scale=20.),
-            rotation_args = dict(x=0, y=0),
-            POP_SIZE = 4,
-            name = 'test',
-        )
-        networkParameters = dict(
-            dt=2**-3,
-            tstart=0.,
-            tstop=100.,
-            v_init=-65.,
-            celsius=6.3,
-            OUTPUTPATH='tmp_testNetworkPopulation'
-            )
-        # set up
-        network = LFPy.Network(**networkParameters)
-        network.create_population(**populationParameters)
-        connectivity = network.get_connectivity_rand(pre='test', post='test', connprob=0.5)
-
-        # test set up
-        for population in network.populations.values():
-            self.assertTrue(len(population.cells) == population.POP_SIZE)
-            for cell, soma_pos, gid in zip(population.cells, population.soma_pos, population.gids):
-                self.assertTrue(type(cell) is LFPy.NetworkCell)
-                self.assertTrue((cell.somapos[0] == soma_pos['x']) &
-                                (cell.somapos[1] == soma_pos['y']) &
-                                (cell.somapos[2] == soma_pos['z']))
-                self.assertEqual(cell.gid, gid)
-                self.assertTrue(np.sqrt(soma_pos['x']**2 + soma_pos['y']**2) <= 100.)
-            np.testing.assert_equal(population.gids, np.arange(4))
-
-        np.testing.assert_equal(connectivity.shape, (population.POP_SIZE, population.POP_SIZE))
-        np.testing.assert_equal(connectivity.diagonal(), np.zeros(population.POP_SIZE))
-
-        # connect and run sim
-        network.connect(pre='test', post='test', connectivity=connectivity)
-        network.simulate()
-
-        # test output
-        for population in network.populations.values():
-            for cell in population.cells:
-                self.assertTrue(np.all(cell.somav == network.v_init))
-
-        network.pc.gid_clear()
-        os.system('rm -r tmp_testNetworkPopulation')
-        neuron.h('forall delete_section()')
-
-
-    def test_Network_01(self):
-        cellParameters = dict(
-            morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks_w_lists.hoc'),
-            templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-            templatename='ball_and_stick_template',
-            templateargs=None,
-            passive=False,
-            dt=2**-3,
-            tstop=100,
-            delete_sections=False,
-        )
-
-        populationParameters = dict(
-            CWD=None,
-            CELLPATH=None,
-            Cell=LFPy.NetworkCell,
-            cell_args = cellParameters,
-            pop_args = dict(
-                radius=100,
-                loc=0.,
-                scale=20.),
-            rotation_args = dict(x=0, y=0),
-            POP_SIZE = 4,
-            name = 'test',
-        )
-        networkParameters = dict(
-            dt=2**-3,
-            tstart=0.,
-            tstop=100.,
-            v_init=-65.,
-            celsius=6.3,
-            OUTPUTPATH='tmp_testNetworkPopulation'
-            )
-        # set up
-        network = LFPy.Network(**networkParameters)
-        network.create_population(**populationParameters)
-        connectivity = network.get_connectivity_rand(pre='test', post='test', connprob=0.5)
-
-        # connect and run sim
-        network.connect(pre='test', post='test', connectivity=connectivity)
-        SPIKES, LFP, P = network.simulate(rec_current_dipole_moment=True)
-
-        # test output
-        for population in network.populations.values():
-            for cell in population.cells:
-                self.assertTrue(np.all(cell.somav == network.v_init))
-
-        self.assertTrue(np.all(P['test'] == 0.))
-        self.assertTrue(P.shape[0] == cell.somav.size)
-        self.assertTrue(len(LFP) == 0)
-
-        network.pc.gid_clear()
-        os.system('rm -r tmp_testNetworkPopulation')
-        neuron.h('forall delete_section()')
-
-
-    def test_Network_02(self):
-        cellParameters = dict(
-            morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks_w_lists.hoc'),
-            templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-            templatename='ball_and_stick_template',
-            templateargs=None,
-            passive=False,
-            dt=2**-3,
-            tstop=100,
-            delete_sections=False,
-        )
-
-        populationParameters = dict(
-            CWD=None,
-            CELLPATH=None,
-            Cell=LFPy.NetworkCell,
-            cell_args = cellParameters,
-            pop_args = dict(
-                radius=100,
-                loc=0.,
-                scale=20.),
-            rotation_args = dict(x=0, y=0),
-            POP_SIZE = 4,
-            name = 'test',
-        )
-        networkParameters = dict(
-            dt=2**-3,
-            tstart=0.,
-            tstop=100.,
-            v_init=-65.,
-            celsius=6.3,
-            OUTPUTPATH='tmp_testNetworkPopulation'
-            )
-        clampParams = {
-            'idx' : 0,
-            'pptype' : 'VClamp',
-            'amp[0]' : -65,
-            'dur[0]' : 10,
-            'amp[1]' : 0,
-            'dur[1]' : 1,
-            'amp[2]' : -65,
-            'dur[2]' : 1E8,
-        }
-
-        # set up
-        network = LFPy.Network(**networkParameters)
-        network.create_population(**populationParameters)
-        connectivity = network.get_connectivity_rand(pre='test', post='test', connprob=1)
-
-        # test connectivity
-        self.assertTrue(np.all(connectivity == (np.eye(populationParameters['POP_SIZE']) == 0)))
-
-        # connect
-        network.connect(pre='test', post='test', connectivity=connectivity,
-                        multapseargs=dict(loc=1, scale=1E-9))
-
-        # create synthetic AP in cell with gid == 0
-        for population in network.populations.values():
-            for cell in population.cells:
-                if cell.gid == 0:
-                    vclamp = LFPy.StimIntElectrode(cell=cell, **clampParams)
-
-        # simulate
-        network.simulate()
-
-        # test output
-        for population in network.populations.values():
-            for cell in population.cells:
-                self.assertFalse(np.all(cell.somav == network.v_init))
-
-        network.pc.gid_clear()
-        os.system('rm -r tmp_testNetworkPopulation')
-        neuron.h('forall delete_section()')
-
-
-    def test_Network_03(self):
-        cellParameters = dict(
-            morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks_w_lists.hoc'),
-            templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-            templatename='ball_and_stick_template',
-            templateargs=None,
-            passive=False,
-            dt=2**-3,
-            tstop=100,
-            delete_sections=False,
-        )
-
-        populationParameters = dict(
-            CWD=None,
-            CELLPATH=None,
-            Cell=LFPy.NetworkCell,
-            cell_args = cellParameters,
-            pop_args = dict(
-                radius=100,
-                loc=0.,
-                scale=20.),
-            rotation_args = dict(x=0, y=0),
-            POP_SIZE = 4,
-            name = 'test',
-        )
-        networkParameters = dict(
-            dt=2**-3,
-            tstart=0.,
-            tstop=100.,
-            v_init=-65.,
-            celsius=6.3,
-            OUTPUTPATH='tmp_testNetworkPopulation'
-            )
-        electrodeParameters = dict(
-            sigma=0.3,
-            x = np.arange(10)*100,
-            y = np.arange(10)*100,
-            z = np.arange(10)*100
-        )
-        # set up
-        network = LFPy.Network(**networkParameters)
-        network.create_population(**populationParameters)
-        connectivity = network.get_connectivity_rand(pre='test', post='test', connprob=0.5)
-
-        # test set up
-        for population in network.populations.values():
-            self.assertTrue(len(population.cells) == population.POP_SIZE)
-            for cell, soma_pos, gid in zip(population.cells, population.soma_pos, population.gids):
-                self.assertTrue(type(cell) is LFPy.NetworkCell)
-                self.assertTrue((cell.somapos[0] == soma_pos['x']) &
-                                (cell.somapos[1] == soma_pos['y']) &
-                                (cell.somapos[2] == soma_pos['z']))
-                self.assertEqual(cell.gid, gid)
-                self.assertTrue(np.sqrt(soma_pos['x']**2 + soma_pos['y']**2) <= 100.)
-            np.testing.assert_equal(population.gids, np.arange(4))
-
-        np.testing.assert_equal(connectivity.shape, (population.POP_SIZE, population.POP_SIZE))
-        np.testing.assert_equal(connectivity.diagonal(), np.zeros(population.POP_SIZE))
-
-        # set up electrode
-        electrode = LFPy.RecExtElectrode(**electrodeParameters)
-
-        # connect and run sim
-        network.connect(pre='test', post='test', connectivity=connectivity)
-        network.simulate(electrode=electrode, to_file=True, to_memory=False,
-                         file_name='OUTPUT.h5')
-
-        # test output
-        for population in network.populations.values():
-            for cell in population.cells:
-                self.assertTrue(np.all(cell.somav == network.v_init))
-            
-        f = h5py.File(os.path.join(network.OUTPUTPATH, 'OUTPUT.h5'), 'r')        
-        np.testing.assert_equal(f['OUTPUT[0]'][()], np.zeros_like(f['OUTPUT[0]'][()]))
-        f.close()
-
-
-        network.pc.gid_clear()
-        os.system('rm -r tmp_testNetworkPopulation')
-        neuron.h('forall delete_section()')
-
-
-    def test_Network_04(self):
-        cellParameters = dict(
-            morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks_w_lists.hoc'),
-            templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-            templatename='ball_and_stick_template',
-            templateargs=None,
-            passive=True,
-            dt=2**-3,
-            tstop=100,
-            delete_sections=False,
-        )
-        
-        synapseParameters = dict(idx=0, syntype='Exp2Syn', weight=0.002,
-                                 tau1=0.1, tau2=0.1, e=0)
-        
-        populationParameters = dict(
-            CWD=None,
-            CELLPATH=None,
-            Cell=LFPy.NetworkCell,
-            cell_args = cellParameters,
-            pop_args = dict(
-                radius=100,
-                loc=0.,
-                scale=20.),
-            rotation_args = dict(x=0, y=0),
-            POP_SIZE = 1,
-            name = 'test',
-        )
-        networkParameters = dict(
-            dt=2**-3,
-            tstart=0.,
-            tstop=100.,
-            v_init=-70.,
-            celsius=6.3,
-            OUTPUTPATH='tmp_testNetworkPopulation'
-            )
-        # set up
-        network = LFPy.Network(**networkParameters)
-        network.create_population(**populationParameters)
-        
-        cell = network.populations['test'].cells[0]
-        
-        # create synapses
-        synlist = []
-        numsynapses = 2
-        for i in range(numsynapses):
-            synlist.append(LFPy.Synapse(cell=cell, **synapseParameters))
-            synlist[-1].set_spike_times(np.array([10+(i*10)]))
-        
-        network.simulate()
-        
-        # test that the input results in the correct amount of PSPs
-        np.testing.assert_equal(ss.argrelextrema(cell.somav, np.greater)[0].size, numsynapses)
-
-        # clean up
-        network.pc.gid_clear()
-        os.system('rm -r tmp_testNetworkPopulation')
-        neuron.h('forall delete_section()')
-
-
-    def test_Network_05(self):
-        cellParameters = dict(
-            morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks_w_lists.hoc'),
-            templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-            templatename='ball_and_stick_template',
-            templateargs=None,
-            passive=False,
-            dt=2**-3,
-            tstop=100,
-            delete_sections=False,
-        )
-
-        populationParameters = dict(
-            CWD=None,
-            CELLPATH=None,
-            Cell=LFPy.NetworkCell,
-            cell_args = cellParameters,
-            pop_args = dict(
-                radius=100,
-                loc=0.,
-                scale=20.),
-            rotation_args = dict(x=0, y=0),
-            POP_SIZE = 4,
-            name = 'test',
-        )
-        networkParameters = dict(
-            dt=2**-3,
-            tstart=0.,
-            tstop=100.,
-            v_init=-65.,
-            celsius=6.3,
-            OUTPUTPATH='tmp_testNetworkPopulation'
-            )
-        electrodeParameters = dict(
-            sigma=0.3,
-            x = np.arange(10)*100,
-            y = np.arange(10)*100,
-            z = np.arange(10)*100
-        )
-        # set up
-        network = LFPy.Network(**networkParameters)
-        network.create_population(**populationParameters)
-        connectivity = network.get_connectivity_rand(pre='test', post='test',
-                                                     connprob=0.5)
-
-        # test set up
-        for population in network.populations.values():
-            self.assertTrue(len(population.cells) == population.POP_SIZE)
-            for cell, soma_pos, gid in zip(population.cells,
-                                           population.soma_pos,
-                                           population.gids):
-                self.assertTrue(type(cell) is LFPy.NetworkCell)
-                self.assertTrue((cell.somapos[0] == soma_pos['x']) &
-                                (cell.somapos[1] == soma_pos['y']) &
-                                (cell.somapos[2] == soma_pos['z']))
-                self.assertEqual(cell.gid, gid)
-                self.assertTrue(np.sqrt(soma_pos['x']**2 + soma_pos['y']**2) <= 100.)
-            np.testing.assert_equal(population.gids, np.arange(4))
-
-        np.testing.assert_equal(connectivity.shape,
-                                (population.POP_SIZE, population.POP_SIZE))
-        np.testing.assert_equal(connectivity.diagonal(),
-                                np.zeros(population.POP_SIZE))
-
-        # set up electrode
-        electrode = LFPy.RecExtElectrode(**electrodeParameters)
-
-        # connect and run sim
-        network.connect(pre='test', post='test', connectivity=connectivity)
-        SPIKES, RESULTS, P = network.simulate(electrode=electrode, to_file=True,
-                                      to_memory=True, file_name='OUTPUT.h5')
-
-        # test output
-        for population in network.populations.values():
-            for cell in population.cells:
-                self.assertTrue(np.all(cell.somav == network.v_init))
-            
-        f = h5py.File(os.path.join(network.OUTPUTPATH, 'OUTPUT.h5'), 'r')        
-        np.testing.assert_equal(f['OUTPUT[0]'][()], RESULTS[0])
-        f.close()
-
-
-        network.pc.gid_clear()
-        os.system('rm -r tmp_testNetworkPopulation')
-        neuron.h('forall delete_section()')
-
diff --git a/LFPy-2.0.7/LFPy/test/test_networkcell.py b/LFPy-2.0.7/LFPy/test/test_networkcell.py
deleted file mode 100644
index 8ed6463..0000000
--- a/LFPy-2.0.7/LFPy/test/test_networkcell.py
+++ /dev/null
@@ -1,1343 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import sys
-import os
-import posixpath
-import unittest
-import numpy as np
-import LFPy
-import neuron
-import pickle
-
-# for nosetests to run load the SinSyn sinusoid synapse currrent mechanism
-if "win32" in sys.platform:
-    pth = os.path.join(LFPy.__path__[0], 'test', 'nrnmech.dll')
-    pth = pth.replace(os.sep, posixpath.sep)
-    if not pth in neuron.nrn_dll_loaded:
-        neuron.h.nrn_load_dll(pth)
-        neuron.nrn_dll_loaded.append(pth)
-else:
-    neuron.load_mechanisms(os.path.join(LFPy.__path__[0], 'test'))
-
-
-class testNetworkCell(unittest.TestCase):
-    """
-
-    """
-    def test_cell_tvec_00(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : 0.,
-            'tstop' : 100.,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_01(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : 0.,
-            'tstop' : 10000.,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_02(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : 0,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_03(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : 0,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_04(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : 0,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_05(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : 0,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_06(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : -100,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_07(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_08(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        try:
-            stickSimulationTesttvec(**stickParams)
-        except AssertionError:
-            pass
-
-    def test_cell_tvec_09(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        try:
-            stickSimulationTesttvec(**stickParams)
-        except AssertionError:
-            pass
-    
-    def test_cell_set_pos_00(self):
-        '''test LFPy.NetworkCell.set_pos'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                         )
-        np.testing.assert_allclose(cell.somapos, [0, 0, 0])
-    
-    def test_cell_set_pos_01(self):
-        '''test LFPy.NetworkCell.set_pos'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-    
-    def test_cell_set_pos_02(self):
-        '''test LFPy.NetworkCell.set_pos'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                          pt3d=True)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-    
-    def test_cell_set_pos_03(self):
-        '''test LFPy.NetworkCell.set_pos'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                         )
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-    
-    def test_cell_set_pos_04(self):
-        '''test LFPy.NetworkCell.set_pos'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc'),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-    
-    
-    def test_cell_set_pos_05(self):
-        '''test LFPy.NetworkCell.set_pos'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        np.testing.assert_allclose(cell.somapos,
-                                   [cell.xmid[0], cell.ymid[0], cell.zmid[0]])
-    
-    
-    def test_cell_set_pos_06(self):
-        '''test LFPy.NetworkCell.set_pos'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-        np.testing.assert_allclose(cell.somapos,
-                                   [cell.xmid[0], cell.ymid[0], cell.zmid[0]])
-    
-    
-    def test_cell_set_rotation_00(self):
-        '''test LFPy.NetworkCell.set_rotation()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-    
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.set_rotation(x=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-    
-    
-    def test_cell_set_rotation_01(self):
-        '''test LFPy.NetworkCell.set_rotation()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-    
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.set_rotation(y=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-    
-    
-    def test_cell_set_rotation_02(self):
-        '''test LFPy.NetworkCell.set_rotation()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        # test rotation 180 deg around z-axis
-        cell.set_rotation(z=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-    
-    def test_cell_set_rotation_03(self):
-        '''test LFPy.NetworkCell.set_rotation()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-    
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.set_rotation(x=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-    
-    
-    def test_cell_set_rotation_04(self):
-        '''test LFPy.NetworkCell.set_rotation()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-    
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.set_rotation(y=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-    
-    
-    def test_cell_set_rotation_05(self):
-        '''test LFPy.NetworkCell.set_rotation()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-    
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        # test rotation 180 deg around z-axis
-        cell.set_rotation(z=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-    
-    def test_cell_set_rotation_06(self):
-        '''test LFPy.NetworkCell.set_rotation()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-    
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation: 90 deg around x-axis, 90 deg around y-axis, 90 deg around z-axis
-        cell.set_rotation(x=np.pi / 2., y=np.pi, z=np.pi / 4.)
-        # revert rotation: -90 deg around x-axis, -90 deg around y-axis, -90 deg around z-axis, rotation_order='zyx'
-        cell.set_rotation(x=-np.pi / 2., y=-np.pi, z=-np.pi / 4., rotation_order='zyx')
-        # assert that x-, y- and z-coordinates are same as beginning, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-    
-    def test_cell_chiral_morphology_00(self):
-        '''test LFPy.NetworkCell.chiral_morphology()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                         )
-    
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.chiral_morphology(axis='x')
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-    
-    
-    def test_cell_chiral_morphology_01(self):
-        '''test LFPy.NetworkCell.chiral_morphology()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-    
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.chiral_morphology(axis='y')
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-    
-    def test_cell_chiral_morphology_02(self):
-        '''test LFPy.NetworkCell.chiral_morphology()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-    
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around z-axis
-        cell.chiral_morphology(axis='z')
-        # assert that y- and z-coordinates are inverted, using absolute
-    
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-    
-    
-    def test_cell_get_rand_prob_area_norm_00(self):
-        '''test LFPy.NetworkCell.get_rand_prob_area_norm()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        p = cell.get_rand_prob_area_norm()
-        self.assertAlmostEqual(p.sum(), 1.)
-        self.assertTrue(p.min() >= 0.)
-        self.assertTrue(p.max() <= 1.)
-    
-    
-    def test_cell_get_rand_prob_area_norm_from_idx(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        p = cell.get_rand_prob_area_norm_from_idx(idx=cell.get_idx(section='allsec'))
-        self.assertListEqual(cell.get_rand_prob_area_norm().tolist(), p.tolist())
-    
-    
-    def test_cell_get_rand_prob_area_norm_from_idx_00(self):
-        '''test LFPy.NetworkCell.get_rand_prob_area_norm()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        p = cell.get_rand_prob_area_norm_from_idx(idx=np.array([0]))
-        np.testing.assert_equal(p, np.array([1.]))
-    
-    
-    def test_cell_get_intersegment_vector_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        idx0 = 0
-        idx1 = 1
-        vector = cell.get_intersegment_vector(idx0=idx0, idx1=idx1)
-    
-        self.assertListEqual(vector,
-                            [cell.xmid[idx1] - cell.xmid[idx0],
-                             cell.ymid[idx1] - cell.ymid[idx0],
-                             cell.zmid[idx1] - cell.zmid[idx0]])
-    
-    
-    def test_cell_get_intersegment_distance_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        idx0 = 0
-        idx1 = 1
-        distance = cell.get_intersegment_distance(idx0=idx0, idx1=idx1)
-        vector = cell.get_intersegment_vector(idx0=idx0, idx1=idx1)
-    
-        self.assertEqual(np.sqrt(np.array(vector)**2).sum(), distance)
-    
-    
-    def test_cell_get_idx_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        nsegs_method=None)
-        self.assertListEqual(cell.get_idx(section='soma').tolist(), [0])
-        self.assertListEqual(cell.get_idx(section='soma[0]').tolist(), [0])
-        self.assertListEqual(cell.get_idx(section='dend[0]').tolist(), [1])
-        self.assertListEqual(cell.get_idx(section='dend[1]').tolist(), [2])
-        self.assertListEqual(cell.get_idx(section='dend[2]').tolist(), [3])
-        self.assertListEqual(cell.get_idx(section='dend').tolist(), [1, 2, 3])
-        self.assertListEqual(cell.get_idx(section='allsec').tolist(),
-                             [0, 1, 2, 3])
-        self.assertListEqual(cell.get_idx(section=['soma', 'dend']).tolist(),
-                             [0, 1, 2, 3])
-        self.assertListEqual(cell.get_idx(section='apic').tolist(), [])
-    
-    
-    def test_cell_get_closest_idx_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        nsegs_method=None)
-        self.assertEqual(cell.get_closest_idx(x=0, y=0, z=0),
-                             cell.get_idx(section='soma')[0])
-    
-        self.assertEqual(cell.get_closest_idx(x=-25, y=0, z=175),
-                             cell.get_idx(section='dend[1]')[0])
-    
-    
-    def test_cell_get_idx_children_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-    
-        np.testing.assert_array_equal(cell.get_idx_children(parent='soma[0]'),
-                                      cell.get_idx(section='dend[0]'))
-    
-    
-    def test_cell_get_idx_parent_children_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        np.testing.assert_array_equal(cell.get_idx_parent_children(parent='soma[0]'),
-                                      cell.get_idx(section=['soma[0]',
-                                                            'dend[0]']))
-    
-    
-    def test_cell_get_idx_name_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        np.testing.assert_array_equal(cell.get_idx_name(idx=np.array([0])),
-                                                np.array([[0, 'ball_and_stick_template[0].soma[0]', 0.5]],
-                                                         dtype=object))
-    
-    
-    def test_cell_get_rand_idx_area_norm_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        idx = cell.get_rand_idx_area_norm(nidx=1000000)
-    
-    
-        # compute histogram and correlate with segment area
-        bins = np.arange(cell.totnsegs+1)
-        hist, bin_edges = np.histogram(idx, bins=bins)
-    
-        # compute Pearson correlation coefficients between area and histogram
-        # reporting success if within 4 decimal places
-        self.assertAlmostEqual(np.corrcoef(cell.area, hist)[0, 1], 1., places=4)
-    
-        # check if min and max is in the range of segment indices
-        self.assertEqual(idx.min(), 0)
-        self.assertEqual(idx.max(), cell.totnsegs-1)
-    
-    
-    def test_cell_set_synapse_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.set_synapse(idx=0, syntype='ExpSyn', record_curret=False,
-                         record_potential=False, weight=1.,
-                         **dict(e=10., tau=2.))
-    
-        self.assertTrue('ExpSyn' in cell.synlist[0].hname())
-        self.assertEqual(len(cell.synlist), 1)
-        self.assertEqual(len(cell.netconlist), 1)
-        self.assertEqual(len(cell.netstimlist), 1)
-        self.assertEqual(cell.synlist[0].e, 10.)
-        self.assertEqual(cell.synlist[0].tau, 2.)
-        self.assertEqual(cell.netconlist[0].weight[0], 1.)
-    
-    
-    def test_cell_set_point_process_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.set_point_process(idx=0, pptype='IClamp', record_current=False,
-                               **dict(delay=1., amp=1.))
-        self.assertEqual(cell.stimlist[0].hname(), 'IClamp[0]')
-        self.assertEqual(len(cell.stimlist), 1)
-        self.assertEqual(cell.stimlist[0].delay, 1.)
-        self.assertEqual(cell.stimlist[0].amp, 1.)
-    
-    
-    def test_cell_strip_hoc_objects_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.strip_hoc_objects()
-        for attribute in dir(cell):
-            self.assertNotEqual(str(type(getattr(cell, attribute))),
-                                'hoc.HocObject')
-    
-    def test_cell_cellpickler_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell_pickle = cell.cellpickler(filename=None, pickler=pickle.dumps)
-        pickled_cell = pickle.loads(cell_pickle)
-    
-        for attribute in dir(cell):
-            if attribute.startswith('__') or attribute.startswith('_'):
-                pass
-            else:
-                self.assertEqual(type(getattr(cell, attribute)),
-                                 type(getattr(pickled_cell, attribute)))
-    
-    def test_cell_simulate_recorder_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stick = LFPy.NetworkCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-        
-
-    def test_cell_simulate_recorder_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.NetworkCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.NetworkCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_03(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stick = LFPy.NetworkCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-        
-
-    def test_cell_simulate_recorder_04(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.NetworkCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_05(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.NetworkCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-        
-    def test_cell_simulate_current_dipole_moment_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-    
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.NetworkCell(**stickParams)
-                synapse = LFPy.StimIntElectrode(stick, idx=idx,
-                                       **stimParams)
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-    
-    
-    def test_cell_simulate_current_dipole_moment_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-    
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-    
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.NetworkCell(**stickParams)
-                synapse = LFPy.StimIntElectrode(stick, idx=idx,
-                                       **stimParams)
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-    
-    def test_cell_simulate_current_dipole_moment_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-    
-        stimParams = {
-            'e' : 0,                                # reversal potential
-            'syntype' : 'Exp2Syn',                   # synapse type
-            'tau1' : 0.1,                              # syn. time constant
-            'tau2' : 2.,                              # syn. time constant
-            'weight' : 0.01,
-        }
-    
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.NetworkCell(**stickParams)
-                synapse = LFPy.Synapse(stick, idx=idx,
-                                       **stimParams)
-                synapse.set_spike_times(np.array([10., 20., 30., 40., 50.]))
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-    
-    def test_cell_tstart_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-    
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'bias' : 0.,
-            'record_current' : False
-        }
-    
-        stick0 = LFPy.NetworkCell(tstart=0, tstop=200, **stickParams)
-        synapse0 = LFPy.StimIntElectrode(stick0,
-                                         stick0.get_closest_idx(0, 0, 1000),
-                                         delay=0, phase=0.,
-                                         **stimParams)
-        stick0.simulate(rec_imem=True, rec_vmem=True, rec_current_dipole_moment=True)
-    
-    
-        stick1 = LFPy.NetworkCell(tstart=-100, tstop=100, **stickParams)
-        synapse1 = LFPy.StimIntElectrode(stick1,
-                                         stick1.get_closest_idx(0, 0, 1000),
-                                         delay=-100, phase=0.,
-                                         **stimParams)
-        stick1.simulate(rec_imem=True, rec_vmem=True, rec_current_dipole_moment=True)
-    
-        inds = stick0.tvec >= 100
-        np.testing.assert_allclose(stick0.vmem[:, inds], stick1.vmem)
-        np.testing.assert_allclose(stick0.imem[:, inds], stick1.imem)
-        np.testing.assert_allclose(stick0.current_dipole_moment[inds, :],
-                                   stick1.current_dipole_moment)
-    
-    
-    def test_cell_with_recextelectrode_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-    
-        }
-    
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-    
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-    
-        stick = LFPy.NetworkCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-    
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-    
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-    
-    
-    def test_cell_with_recextelectrode_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-    
-        }
-    
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-    
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-    
-        stick = LFPy.NetworkCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-    
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-    
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_cell_with_recextelectrode_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-    
-        }
-    
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-    
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-    
-        stick = LFPy.NetworkCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-    
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-    
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_cell_with_recextelectrode_03(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-    
-        }
-    
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-    
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-    
-        stick = LFPy.NetworkCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-    
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-    
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_cell_distort_geometry_01(self):
-        cell0 = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        factors = [-0.2, 0.1, 0., 0.1, 0.2]
-        nus = [-0.5, 0., 0.5]
-        for factor in factors:
-            for nu in nus:
-                for axis in 'xyz':
-                    cell1 = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-                    cell1.distort_geometry(factor=factor, nu=nu, axis=axis)
-                    for attr in ['start', 'mid', 'end']:
-                        for ax in 'xyz'.replace(axis, ''):
-                            np.testing.assert_allclose(getattr(cell0, ax+attr)*(1+factor*nu),
-                                                       getattr(cell1, ax+attr))
-                        np.testing.assert_allclose(getattr(cell0, axis+attr)*(1-factor),
-                                                   getattr(cell1, axis+attr))
-
-def stickSimulationTesttvec(**kwargs):
-    stick = LFPy.NetworkCell(morphology = os.path.join(LFPy.__path__[0], 'test',
-                                                'stick.hoc'), verbose=False,
-                              templatefile=os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-                              templatename='stick_template',
-                              templateargs=None,
-                              **kwargs)
-    stick.simulate(rec_imem=False)
-    return stick.tvec
diff --git a/LFPy-2.0.7/LFPy/test/test_pointprocess.py b/LFPy-2.0.7/LFPy/test/test_pointprocess.py
deleted file mode 100644
index e17b0eb..0000000
--- a/LFPy-2.0.7/LFPy/test/test_pointprocess.py
+++ /dev/null
@@ -1,347 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import sys
-import os
-import posixpath
-import unittest
-import numpy as np
-import LFPy
-import neuron
-
-# for nosetests to run load mechanisms
-if "win32" in sys.platform:
-    pth = os.path.join(LFPy.__path__[0], 'test', 'nrnmech.dll')
-    pth = pth.replace(os.sep, posixpath.sep)
-    if not pth in neuron.nrn_dll_loaded:
-        neuron.h.nrn_load_dll(pth)
-        neuron.nrn_dll_loaded.append(pth)
-else:
-    neuron.load_mechanisms(os.path.join(LFPy.__path__[0], 'test'))
-
-class testPointProcess(unittest.TestCase):
-    """
-    test class LFPy.PointProcess
-    """
-    def test_PointProcess_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        pp = LFPy.PointProcess(cell=cell, idx=0)
-        self.assertTrue(np.alltrue(np.array([pp.x, pp.y, pp.z])==cell.somapos))
-        self.assertEqual(pp.idx, 0)
-    
-
-class testSynapse(unittest.TestCase):
-    """
-    test class LFPy.Synapse
-    """
-    def test_Synapse_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        syn = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=5., record_current=True,
-                           record_potential=True)
-        syn.set_spike_times(np.array([10.]))
-        cell.simulate()
-        
-        i = np.zeros(cell.tvec.size)
-        i[cell.tvec > 10.] = -np.exp(-np.arange((cell.tvec > 10.).sum())*cell.dt / 5.)
-
-        np.testing.assert_allclose(i, syn.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn.v)
-        
-
-    def test_Synapse_01(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        syn0 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=5., record_current=True,
-                           record_potential=True)
-        syn0.set_spike_times(np.array([10.]))
-
-        syn1 = LFPy.Synapse(cell=cell, idx=1, syntype='ExpSynI',
-                           weight=1., tau=5., record_current=True,
-                           record_potential=False)
-        syn1.set_spike_times(np.array([20.]))
-
-        syn2 = LFPy.Synapse(cell=cell, idx=2, syntype='ExpSynI',
-                           weight=1., tau=5., record_current=False,
-                           record_potential=True)
-        syn2.set_spike_times(np.array([30.]))
-
-        syn3 = LFPy.Synapse(cell=cell, idx=3, syntype='ExpSynI',
-                           weight=1., tau=5., record_current=False,
-                           record_potential=False)
-        syn3.set_spike_times(np.array([40.]))
-
-        cell.simulate()
-        
-        i = np.zeros(cell.tvec.size)
-        i[cell.tvec > 10.] = -np.exp(-np.arange((cell.tvec > 10.).sum())*cell.dt / 5.)
-
-        np.testing.assert_allclose(i, syn0.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn0.v)
-
-        self.assertTrue(hasattr(syn1, 'i'))
-        i = np.zeros(cell.tvec.size)
-        i[cell.tvec > 20.] = -np.exp(-np.arange((cell.tvec > 20.).sum())*cell.dt / 5.)
-        self.assertFalse(hasattr(syn1, 'v'))
-        np.testing.assert_allclose(i, syn1.i, rtol=1E-1)
-        
-        self.assertFalse(hasattr(syn2, 'i'))
-        self.assertTrue(hasattr(syn2, 'v'))
-        
-        self.assertFalse(hasattr(syn3, 'i'))
-        self.assertFalse(hasattr(syn3, 'v'))
-
-
-    def test_Synapse_02(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        t0 = 10.
-        t1 = 30.
-        tau = 5.
-        syn0 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-        syn0.set_spike_times_w_netstim(noise=0., start=t0-1, number=1) # -1 to acct for delay
-
-        syn1 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-        syn1.set_spike_times(np.array([t1]))
-
-        cell.simulate()
-        
-        i0 = np.zeros(cell.tvec.size)
-        i0[cell.tvec > t0] = -np.exp(-np.arange((cell.tvec > t0).sum())*cell.dt / tau)
-
-        i1 = np.zeros(cell.tvec.size)
-        i1[cell.tvec > t1] = -np.exp(-np.arange((cell.tvec > t1).sum())*cell.dt / tau)
-
-        np.testing.assert_allclose(i0, syn0.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn0.v)
-
-        np.testing.assert_allclose(i1, syn1.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn1.v)
-
-
-    def test_Synapse_03(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        t0 = 10.
-        t1 = 30.
-        tau = 5.
-        syn0 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-        syn0.set_spike_times_w_netstim(noise=0., start=t0-1, number=1) # -1 to acct for delay
-
-        syn1 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-        syn1.set_spike_times_w_netstim(noise=0., start=t1-1, number=1) # -1 to acct for delay
-
-        cell.simulate()
-        
-        i0 = np.zeros(cell.tvec.size)
-        i0[cell.tvec > t0] = -np.exp(-np.arange((cell.tvec > t0).sum())*cell.dt / tau)
-
-        i1 = np.zeros(cell.tvec.size)
-        i1[cell.tvec > t1] = -np.exp(-np.arange((cell.tvec > t1).sum())*cell.dt / tau)
-
-        np.testing.assert_allclose(i0, syn0.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn0.v)
-
-        np.testing.assert_allclose(i1, syn1.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn1.v)
-
-
-    def test_Synapse_04(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        t0 = 10.
-        t1 = 30.
-        tau = 5.
-        syn0 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-
-        syn1 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-
-        syn0.set_spike_times_w_netstim(noise=0., start=t0-1, number=1) # -1 to acct for delay
-        syn1.set_spike_times(np.array([t1]))
-
-        cell.simulate()
-        
-        i0 = np.zeros(cell.tvec.size)
-        i0[cell.tvec > t0] = -np.exp(-np.arange((cell.tvec > t0).sum())*cell.dt / tau)
-
-        i1 = np.zeros(cell.tvec.size)
-        i1[cell.tvec > t1] = -np.exp(-np.arange((cell.tvec > t1).sum())*cell.dt / tau)
-
-        np.testing.assert_allclose(i0, syn0.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn0.v)
-
-        np.testing.assert_allclose(i1, syn1.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn1.v)
-        
-        
-    def test_Synapse_05(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        t0 = 10.
-        t1 = 30.
-        tau = 5.
-        syn0 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-
-        syn1 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-
-        syn1.set_spike_times(np.array([t1]))
-        syn0.set_spike_times_w_netstim(noise=0., start=t0-1, number=1) # -1 to acct for delay
-
-        cell.simulate()
-        
-        i0 = np.zeros(cell.tvec.size)
-        i0[cell.tvec > t0] = -np.exp(-np.arange((cell.tvec > t0).sum())*cell.dt / tau)
-
-        i1 = np.zeros(cell.tvec.size)
-        i1[cell.tvec > t1] = -np.exp(-np.arange((cell.tvec > t1).sum())*cell.dt / tau)
-
-        np.testing.assert_allclose(i0, syn0.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn0.v)
-
-        np.testing.assert_allclose(i1, syn1.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn1.v)
-
-
-class testStimIntElectrode(unittest.TestCase):
-    """
-    test class LFPy.StimIntElectrode
-    """
-    def test_StimIntElectrode_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        stim = LFPy.StimIntElectrode(cell=cell, idx=0, pptype='IClamp',
-                            amp=1., dur=20., delay=10.,
-                            record_potential=True,
-                            record_current=True)
-        cell.simulate()
-        gt = np.zeros(cell.tvec.size)
-        gt[(cell.tvec > 10.) & (cell.tvec <= 30.)] = 1.
-        np.testing.assert_equal(gt, stim.i)
-        np.testing.assert_equal(cell.somav, stim.v)
-
-    def test_StimIntElectrode_01(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'), dt=1.,
-                         v_init=-65.,
-                         Ra = 150.,
-                         cm = 1.,
-                         passive=True,
-                         passive_parameters=dict(g_pas=1./30000, e_pas=-65)
-                         )
-        stim = LFPy.StimIntElectrode(cell=cell,
-                                     record_potential=True,
-                                     **{'idx' : 0,
-                                        'pptype' : 'VClamp',
-                                        'amp[0]' : -65,
-                                        'dur[0]' : 10,
-                                        'amp[1]' : -55.,
-                                        'dur[1]' : 20,
-                                        'amp[2]' : -65,
-                                        'dur[2]' : 10,
-                                   })
-        cell.simulate()
-        gt = np.zeros(cell.tvec.size)-65.
-        gt[(cell.tvec > 10.) & (cell.tvec <= 30.)] = -55.
-        np.testing.assert_allclose(gt, cell.somav, rtol=1E-3)
-        np.testing.assert_equal(cell.somav, stim.v)
-
-    def test_StimIntElectrode_02(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'), dt=1.,
-                         v_init=-65.,
-                         Ra = 150.,
-                         cm = 1.,
-                         passive=True,
-                         passive_parameters=dict(g_pas=1./30000, e_pas=-65)
-                         )
-        stim = LFPy.StimIntElectrode(cell=cell,
-                                     record_potential=True,
-                                     **{'idx' : 0,
-                                        'pptype' : 'SEClamp',
-                                        'amp1' : -65,
-                                        'dur1' : 10,
-                                        'amp2' : -55.,
-                                        'dur2' : 20,
-                                        'amp3' : -65,
-                                        'dur3' : 10,
-                                   })
-        cell.simulate()
-        gt = np.zeros(cell.tvec.size)-65.
-        gt[(cell.tvec > 10.) & (cell.tvec <= 30.)] = -55.
-        np.testing.assert_allclose(gt, cell.somav, rtol=1E-2)
-        np.testing.assert_equal(cell.somav, stim.v)
-
-
-    def test_StimIntElectrode_03(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        stim0 = LFPy.StimIntElectrode(cell=cell, idx=0, pptype='IClamp',
-                            amp=1., dur=20., delay=10.,
-                            record_potential=True,
-                            record_current=True)
-
-        stim1 = LFPy.StimIntElectrode(cell=cell, idx=1, pptype='IClamp',
-                            amp=1., dur=20., delay=30.,
-                            record_potential=True,
-                            record_current=False)
-
-        stim2 = LFPy.StimIntElectrode(cell=cell, idx=2, pptype='IClamp',
-                            amp=1., dur=20., delay=50.,
-                            record_potential=False,
-                            record_current=True)
-
-        stim3 = LFPy.StimIntElectrode(cell=cell, idx=3, pptype='IClamp',
-                            amp=1., dur=20., delay=70.,
-                            record_potential=False,
-                            record_current=False)
-
-
-        cell.simulate()
-        gt = np.zeros(cell.tvec.size)
-        gt[(cell.tvec > 10.) & (cell.tvec <= 30.)] = 1.
-        np.testing.assert_equal(gt, stim0.i)
-        np.testing.assert_equal(cell.somav, stim0.v)
-        
-        self.assertTrue(hasattr(stim1, 'v'))
-        self.assertTrue(cell.tvec.shape == stim1.v.shape)
-        self.assertFalse(hasattr(stim2, 'v'))
-        self.assertFalse(hasattr(stim3, 'v'))
-        self.assertFalse(hasattr(stim1, 'i'))
-        self.assertTrue(hasattr(stim2, 'i'))
-        self.assertTrue(cell.tvec.shape == stim2.i.shape)        
-        self.assertFalse(hasattr(stim3, 'i'))
-        
-  
-    
diff --git a/LFPy-2.0.7/LFPy/test/test_recextelectrode.py b/LFPy-2.0.7/LFPy/test/test_recextelectrode.py
deleted file mode 100644
index b48cdff..0000000
--- a/LFPy-2.0.7/LFPy/test/test_recextelectrode.py
+++ /dev/null
@@ -1,599 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import sys
-import os
-import posixpath
-import unittest
-import numpy as np
-import LFPy
-import neuron
-from .common import *
-
-# for nosetests to run load the SinSyn sinusoid synapse currrent mechanism
-if "win32" in sys.platform:
-    pth = os.path.join(LFPy.__path__[0], 'test', 'nrnmech.dll')
-    pth = pth.replace(os.sep, posixpath.sep)
-    if not pth in neuron.nrn_dll_loaded:
-        neuron.h.nrn_load_dll(pth)
-        neuron.nrn_dll_loaded.append(pth)
-else:
-    neuron.load_mechanisms(os.path.join(LFPy.__path__[0], 'test'))
-
-class testRecExtElectrode(unittest.TestCase):
-    """
-    test class LFPy.RecExtElectrode
-    """
-
-    def test_method_pointsource(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulation(method='pointsource')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-    
-    def test_method_linesource(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulation(method='linesource')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    
-    def test_method_soma_as_point(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulation(method='soma_as_point')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    
-    
-    def test_method_pointsource_dotprodcoeffs(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulationDotprodcoeffs(method='pointsource')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    
-    def test_method_linesource_dotprodcoeffs(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulationDotprodcoeffs(method='linesource')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    
-    def test_method_soma_as_point_dotprodcoeffs(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulationDotprodcoeffs(method='soma_as_point')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    
-    def test_method_pointsource_contact_average_r10n100(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulationAveragingElectrode(
-            contactRadius=10, contactNPoints=100, method='soma_as_point')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    
-    def test_method_linesource_contact_average_r10n100(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulationAveragingElectrode(
-            contactRadius=10, contactNPoints=100, method='linesource')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    
-    def test_method_soma_as_point_contact_average_r10n100(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulationAveragingElectrode(
-            contactRadius=10, contactNPoints=100, method='soma_as_point')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    def test_sigma_inputs(self):
-
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : 0,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 1000,
-
-        }
-        stick = LFPy.Cell(**stickParams)
-
-        electrodeParams = {
-            'sigma' : [0.3, 0.3, 0.3, 0.3],
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-        }
-
-        np.testing.assert_raises(ValueError, LFPy.RecExtElectrode, **electrodeParams)
-
-    def test_bad_cell_position_in_slice(self):
-
-        electrodeParams = {
-            'sigma_T' : 0.3,
-            'sigma_S' : 1.5,
-            'sigma_G' : 0.0,
-            'h': 200,
-            'x' : np.linspace(0, 1000, 11),
-            'y' : np.zeros(11),
-            'z' : np.zeros(11),
-            'method': "pointsource",
-        }
-
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : -10,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 1000,
-
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.set_rotation(y=np.pi/2)
-        stick.simulate(rec_imem=True)
-
-        stick.set_pos(z=-100)
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        np.testing.assert_raises(RuntimeError, MEA.calc_lfp)
-
-        stick.set_pos(z=300)
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        np.testing.assert_raises(RuntimeError, MEA.calc_lfp)
-
-    def test_sqeeze_cell_and_bad_position(self):
-
-        electrodeParams = {
-            'sigma_T' : 0.3,
-            'sigma_S' : 1.5,
-            'sigma_G' : 0.0,
-            'h': 200,
-            'x' : np.linspace(0, 1000, 11),
-            'y' : np.zeros(11),
-            'z' : np.zeros(11),
-            'method': "pointsource",
-            'squeeze_cell_factor': None,
-        }
-
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : -10,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 1000,
-
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.set_rotation(y=np.pi/2)
-        stick.simulate(rec_imem=True)
-
-        stick.set_pos(z=1)
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        np.testing.assert_raises(RuntimeError, MEA.test_cell_extent)
-
-        stick.set_pos(z=199)
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        np.testing.assert_raises(RuntimeError, MEA.test_cell_extent)
-
-        electrodeParams = {
-            'sigma_T' : 0.3,
-            'sigma_S' : 1.5,
-            'sigma_G' : 0.0,
-            'h': 200,
-            'x' : np.linspace(0, 1000, 11),
-            'y' : np.zeros(11),
-            'z' : np.zeros(11),
-            'method': "pointsource",
-            'squeeze_cell_factor': 0.1,
-        }
-
-        stick.set_pos(z=-1)
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        np.testing.assert_raises(RuntimeError, MEA.test_cell_extent)
-
-        stick.set_pos(z=201)
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        np.testing.assert_raises(RuntimeError, MEA.test_cell_extent)
-
-
-    def test_return_comp_outside_slice(self):
-
-        electrodeParams = {
-            'sigma_T' : 0.3,
-            'sigma_S' : 1.5,
-            'sigma_G' : 0.0,
-            'h': 200,
-            'x' : np.linspace(0, 1000, 11),
-            'y' : np.zeros(11),
-            'z' : np.zeros(11),
-            'method': "pointsource",
-            'squeeze_cell_factor': None,
-        }
-
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : -10,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 1000,
-
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.set_rotation(y=np.pi/2)
-        stick.set_pos(z=100)
-        stick.simulate(rec_imem=True)
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        np.testing.assert_raises(RuntimeError, MEA._return_comp_outside_slice)
-        true_bad_comp = np.array([2, 3, 6])
-
-        stick.zstart[true_bad_comp] = 1000
-        bad_comp, reason = MEA._return_comp_outside_slice()
-        np.testing.assert_equal(reason, "zstart above")
-        np.testing.assert_equal(true_bad_comp, bad_comp)
-        stick.zstart[true_bad_comp] = 100
-
-        stick.zstart[true_bad_comp] = -1000
-        bad_comp, reason = MEA._return_comp_outside_slice()
-        np.testing.assert_equal(reason, "zstart below")
-        np.testing.assert_equal(true_bad_comp, bad_comp)
-        stick.zstart[true_bad_comp] = 100
-
-        stick.zend[true_bad_comp] = 1000
-        bad_comp, reason = MEA._return_comp_outside_slice()
-        np.testing.assert_equal(reason, "zend above")
-        np.testing.assert_equal(true_bad_comp, bad_comp)
-        stick.zend[true_bad_comp] = 100
-
-        stick.zend[true_bad_comp] = -1000
-        bad_comp, reason = MEA._return_comp_outside_slice()
-        np.testing.assert_equal(reason, "zend below")
-        np.testing.assert_equal(true_bad_comp, bad_comp)
-        stick.zend[true_bad_comp] = 100
-
-    def test_position_shifted_slice(self):
-
-        electrodeParams = {
-            'sigma_T' : 0.3,
-            'sigma_S' : 1.5,
-            'sigma_G' : 0.0,
-            'h': 200,
-            'z_shift': -200,
-            'x' : np.linspace(0, 1000, 11),
-            'y' : np.zeros(11),
-            'z' : np.zeros(11) - 100,
-            'method': "pointsource",
-            'squeeze_cell_factor': None,
-        }
-
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : -10,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.set_rotation(y=np.pi/2)
-        stick.set_pos(z=-100)
-
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        MEA.test_cell_extent()
-
-    def test_slice_shift_invariance_pointsource(self):
-        h = 200
-        z_shift_1 = 0
-        z_shift_2 = -352
-
-        electrodeParams_1 = {
-            'sigma_T' : 0.3,
-            'sigma_S' : 1.5,
-            'sigma_G' : 0.0,
-            'h': h,
-            'z_shift': z_shift_1,
-            'x' : np.linspace(0, 1000, 11),
-            'y' : np.zeros(11),
-            'z' : np.zeros(11) + z_shift_1,
-            'squeeze_cell_factor': None,
-        }
-
-        electrodeParams_2 = {
-            'sigma_T' : 0.3,
-            'sigma_S' : 1.5,
-            'sigma_G' : 0.0,
-            'h': h,
-            'z_shift': z_shift_2,
-            'x' : np.linspace(0, 1000, 11),
-            'y' : np.zeros(11),
-            'z' : np.zeros(11) + z_shift_2,
-            'squeeze_cell_factor': None,
-        }
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : -100.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : -np.pi/2,
-            'bias' : 0.,
-            'record_current' : True
-        }
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : -10,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.set_rotation(y=np.pi/2)
-
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 0),
-                                   **stimParams)
-
-        stick.simulate(rec_imem=True)
-
-        methods = ["pointsource", "linesource", "soma_as_point"]
-
-        for method in methods:
-            electrodeParams_1["method"] = method
-            electrodeParams_2["method"] = method
-
-
-            stick.set_pos(z=z_shift_1 + h/2)
-            MEA_shift_1 = LFPy.RecMEAElectrode(stick, **electrodeParams_1)
-            MEA_shift_1.calc_lfp()
-
-            stick.set_pos(z=z_shift_2 + h/2)
-            MEA_shift_2 = LFPy.RecMEAElectrode(stick, **electrodeParams_2)
-            MEA_shift_2.calc_lfp()
-
-            np.testing.assert_allclose(MEA_shift_1.LFP,
-                                       MEA_shift_2.LFP, rtol=1E-7)
-
-    def test_isotropic_version_of_anisotropic_methods(self):
-
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : 0,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 1000,
-
-        }
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : -100.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : -np.pi/2,
-            'bias' : 0.,
-            'record_current' : True
-        }
-
-        isotropic_electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-        }
-        anisotropic_electrodeParams = isotropic_electrodeParams.copy()
-        anisotropic_electrodeParams["sigma"] = [isotropic_electrodeParams["sigma"]] * 3
-
-
-        methods = ["pointsource", "linesource", "soma_as_point"]
-
-        for method in methods:
-            isotropic_electrodeParams["method"] = method
-            anisotropic_electrodeParams["method"] = method
-
-            isotropic_electrode = LFPy.RecExtElectrode(**isotropic_electrodeParams)
-            anisotropic_electrode = LFPy.RecExtElectrode(**anisotropic_electrodeParams)
-
-            stick = LFPy.Cell(**stickParams)
-            stick.set_pos(z=-stick.zstart[0])
-
-            synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                                   **stimParams)
-            stick.simulate([isotropic_electrode, anisotropic_electrode],
-                           rec_imem=True, rec_vmem=True)
-
-            np.testing.assert_allclose(isotropic_electrode.LFP,
-                                       anisotropic_electrode.LFP, rtol=1E-7)
-
-    def test_compare_anisotropic_lfp_methods(self):
-
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : 0,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 1000,
-
-        }
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : -100.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : -np.pi/2,
-            'bias' : 0.,
-            'record_current' : True
-        }
-
-        electrodeParams = {
-            'sigma' : [0.3, 0.3, 0.45],
-            'x' : np.array([0, 1000]),
-            'y' : np.zeros(2),
-            'z' : np.zeros(2),
-
-        }
-
-        ps_electrodeParams = electrodeParams.copy()
-        ls_electrodeParams = electrodeParams.copy()
-        sap_electrodeParams = electrodeParams.copy()
-
-        ps_electrodeParams["method"] = "pointsource"
-        ls_electrodeParams["method"] = "linesource"
-        sap_electrodeParams["method"] = "soma_as_point"
-
-        electrode_ps = LFPy.RecExtElectrode(**ps_electrodeParams)
-        electrode_ls = LFPy.RecExtElectrode(**ls_electrodeParams)
-        electrode_sap = LFPy.RecExtElectrode(**sap_electrodeParams)
-
-        stick = LFPy.Cell(**stickParams)
-        stick.set_pos(z=-stick.zstart[0])
-
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        stick.simulate([electrode_ps, electrode_ls, electrode_sap],
-                       rec_imem=True, rec_vmem=True)
-
-        # Test that distant electrode is independent of choice of method
-        np.testing.assert_almost_equal(electrode_ps.LFP[1,:],
-                                   electrode_ls.LFP[1,:])
-
-        np.testing.assert_almost_equal(electrode_ps.LFP[1,:],
-                                   electrode_sap.LFP[1,:])
-
-        # Hack to test that LFP close to stick is dependent on choice of method
-        np.testing.assert_raises(AssertionError, np.testing.assert_array_equal,
-                                 electrode_ps.LFP[0,:], electrode_ls.LFP[0,:])
-
-        np.testing.assert_raises(AssertionError, np.testing.assert_array_equal,
-                                 electrode_ps.LFP[0,:], electrode_sap.LFP[0,:])
-
-
-    
-
diff --git a/LFPy-2.0.7/LFPy/test/test_templatecell.py b/LFPy-2.0.7/LFPy/test/test_templatecell.py
deleted file mode 100644
index 780734e..0000000
--- a/LFPy-2.0.7/LFPy/test/test_templatecell.py
+++ /dev/null
@@ -1,1346 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import sys
-import os
-import posixpath
-import unittest
-import numpy as np
-import LFPy
-import neuron
-import pickle
-
-# for nosetests to run load the SinSyn sinusoid synapse currrent mechanism
-if "win32" in sys.platform:
-    pth = os.path.join(LFPy.__path__[0], 'test', 'nrnmech.dll')
-    pth = pth.replace(os.sep, posixpath.sep)
-    if not pth in neuron.nrn_dll_loaded:
-        neuron.h.nrn_load_dll(pth)
-        neuron.nrn_dll_loaded.append(pth)
-else:
-    neuron.load_mechanisms(os.path.join(LFPy.__path__[0], 'test'))
-
-
-class testTemplateCell(unittest.TestCase):
-    """
-    test class LFPy.TemplateCell
-    """
-    def test_cell_tvec_00(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : 0.,
-            'tstop' : 100.,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_01(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : 0.,
-            'tstop' : 10000.,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_02(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : 0,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_03(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : 0,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_04(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : 0,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_05(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : 0,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_06(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : -100,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_07(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_08(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        try:
-            stickSimulationTesttvec(**stickParams)
-        except AssertionError:
-            pass
-
-    def test_cell_tvec_09(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        try:
-            stickSimulationTesttvec(**stickParams)
-        except AssertionError:
-            pass
-
-    def test_cell_set_pos_00(self):
-        '''test LFPy.TemplateCell.set_pos'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                         )
-        np.testing.assert_allclose(cell.somapos, [0, 0, 0])
-
-    def test_cell_set_pos_01(self):
-        '''test LFPy.TemplateCell.set_pos'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-    def test_cell_set_pos_02(self):
-        '''test LFPy.TemplateCell.set_pos'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                          pt3d=True)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-    def test_cell_set_pos_03(self):
-        '''test LFPy.TemplateCell.set_pos'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                         )
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-    def test_cell_set_pos_04(self):
-        '''test LFPy.TemplateCell.set_pos'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc'),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-
-    def test_cell_set_pos_05(self):
-        '''test LFPy.TemplateCell.set_pos'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        np.testing.assert_allclose(cell.somapos,
-                                   [cell.xmid[0], cell.ymid[0], cell.zmid[0]])
-
-
-    def test_cell_set_pos_06(self):
-        '''test LFPy.TemplateCell.set_pos'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-        np.testing.assert_allclose(cell.somapos,
-                                   [cell.xmid[0], cell.ymid[0], cell.zmid[0]])
-
-
-    def test_cell_set_rotation_00(self):
-        '''test LFPy.TemplateCell.set_rotation()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.set_rotation(x=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_01(self):
-        '''test LFPy.TemplateCell.set_rotation()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.set_rotation(y=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_02(self):
-        '''test LFPy.TemplateCell.set_rotation()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        # test rotation 180 deg around z-axis
-        cell.set_rotation(z=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-
-    def test_cell_set_rotation_03(self):
-        '''test LFPy.TemplateCell.set_rotation()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.set_rotation(x=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_04(self):
-        '''test LFPy.TemplateCell.set_rotation()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.set_rotation(y=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_05(self):
-        '''test LFPy.TemplateCell.set_rotation()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        # test rotation 180 deg around z-axis
-        cell.set_rotation(z=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-
-    def test_cell_set_rotation_06(self):
-        '''test LFPy.TemplateCell.set_rotation()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation: 90 deg around x-axis, 90 deg around y-axis, 90 deg around z-axis
-        cell.set_rotation(x=np.pi / 2., y=np.pi, z=np.pi / 4.)
-        # revert rotation: -90 deg around x-axis, -90 deg around y-axis, -90 deg around z-axis, rotation_order='zyx'
-        cell.set_rotation(x=-np.pi / 2., y=-np.pi, z=-np.pi / 4., rotation_order='zyx')
-        # assert that x-, y- and z-coordinates are same as beginning, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-
-    def test_cell_chiral_morphology_00(self):
-        '''test LFPy.TemplateCell.chiral_morphology()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                         )
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.chiral_morphology(axis='x')
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-
-
-    def test_cell_chiral_morphology_01(self):
-        '''test LFPy.TemplateCell.chiral_morphology()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.chiral_morphology(axis='y')
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-
-    def test_cell_chiral_morphology_02(self):
-        '''test LFPy.TemplateCell.chiral_morphology()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around z-axis
-        cell.chiral_morphology(axis='z')
-        # assert that y- and z-coordinates are inverted, using absolute
-
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_get_rand_prob_area_norm_00(self):
-        '''test LFPy.TemplateCell.get_rand_prob_area_norm()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        p = cell.get_rand_prob_area_norm()
-        self.assertAlmostEqual(p.sum(), 1.)
-        self.assertTrue(p.min() >= 0.)
-        self.assertTrue(p.max() <= 1.)
-
-
-    def test_cell_get_rand_prob_area_norm_from_idx(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        p = cell.get_rand_prob_area_norm_from_idx(idx=cell.get_idx(section='allsec'))
-        self.assertListEqual(cell.get_rand_prob_area_norm().tolist(), p.tolist())
-
-
-    def test_cell_get_rand_prob_area_norm_from_idx_00(self):
-        '''test LFPy.TemplateCell.get_rand_prob_area_norm()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        p = cell.get_rand_prob_area_norm_from_idx(idx=np.array([0]))
-        np.testing.assert_equal(p, np.array([1.]))
-
-
-    def test_cell_get_intersegment_vector_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        idx0 = 0
-        idx1 = 1
-        vector = cell.get_intersegment_vector(idx0=idx0, idx1=idx1)
-
-        self.assertListEqual(vector,
-                            [cell.xmid[idx1] - cell.xmid[idx0],
-                             cell.ymid[idx1] - cell.ymid[idx0],
-                             cell.zmid[idx1] - cell.zmid[idx0]])
-
-
-    def test_cell_get_intersegment_distance_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        idx0 = 0
-        idx1 = 1
-        distance = cell.get_intersegment_distance(idx0=idx0, idx1=idx1)
-        vector = cell.get_intersegment_vector(idx0=idx0, idx1=idx1)
-
-        self.assertEqual(np.sqrt(np.array(vector)**2).sum(), distance)
-
-
-    def test_cell_get_idx_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        nsegs_method=None)
-        self.assertListEqual(cell.get_idx(section='soma').tolist(), [0])
-        self.assertListEqual(cell.get_idx(section='soma[0]').tolist(), [0])
-        self.assertListEqual(cell.get_idx(section='dend[0]').tolist(), [1])
-        self.assertListEqual(cell.get_idx(section='dend[1]').tolist(), [2])
-        self.assertListEqual(cell.get_idx(section='dend[2]').tolist(), [3])
-        self.assertListEqual(cell.get_idx(section='dend').tolist(), [1, 2, 3])
-        self.assertListEqual(cell.get_idx(section='allsec').tolist(),
-                             [0, 1, 2, 3])
-        self.assertListEqual(cell.get_idx(section=['soma', 'dend']).tolist(),
-                             [0, 1, 2, 3])
-        self.assertListEqual(cell.get_idx(section='apic').tolist(), [])
-
-
-    def test_cell_get_closest_idx_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        nsegs_method=None)
-        self.assertEqual(cell.get_closest_idx(x=0, y=0, z=0),
-                             cell.get_idx(section='soma')[0])
-
-        self.assertEqual(cell.get_closest_idx(x=-25, y=0, z=175),
-                             cell.get_idx(section='dend[1]')[0])
-
-
-    def test_cell_get_idx_children_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-
-        np.testing.assert_array_equal(cell.get_idx_children(parent='soma[0]'),
-                                      cell.get_idx(section='dend[0]'))
-
-
-    def test_cell_get_idx_parent_children_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        np.testing.assert_array_equal(cell.get_idx_parent_children(parent='soma[0]'),
-                                      cell.get_idx(section=['soma[0]',
-                                                            'dend[0]']))
-
-
-    def test_cell_get_idx_name_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        np.testing.assert_array_equal(cell.get_idx_name(idx=np.array([0])),
-                                                np.array([[0, 'ball_and_stick_template[0].soma[0]', 0.5]],
-                                                         dtype=object))
-
-
-    def test_cell_get_rand_idx_area_norm_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        idx = cell.get_rand_idx_area_norm(nidx=1000000)
-
-
-        # compute histogram and correlate with segment area
-        bins = np.arange(cell.totnsegs+1)
-        hist, bin_edges = np.histogram(idx, bins=bins)
-
-        # compute Pearson correlation coefficients between area and histogram
-        # reporting success if within 5 decimal places
-        self.assertAlmostEqual(np.corrcoef(cell.area, hist)[0, 1], 1., places=5)
-
-        # check if min and max is in the range of segment indices
-        self.assertEqual(idx.min(), 0)
-        self.assertEqual(idx.max(), cell.totnsegs-1)
-
-
-    def test_cell_set_synapse_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.set_synapse(idx=0, syntype='ExpSyn', record_curret=False,
-                         record_potential=False, weight=1.,
-                         **dict(e=10., tau=2.))
-
-        self.assertTrue('ExpSyn' in cell.synlist[0].hname())
-        self.assertEqual(len(cell.synlist), 1)
-        self.assertEqual(len(cell.netconlist), 1)
-        self.assertEqual(len(cell.netstimlist), 1)
-        self.assertEqual(cell.synlist[0].e, 10.)
-        self.assertEqual(cell.synlist[0].tau, 2.)
-        self.assertEqual(cell.netconlist[0].weight[0], 1.)
-
-
-    def test_cell_set_point_process_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.set_point_process(idx=0, pptype='IClamp', record_current=False,
-                               **dict(delay=1., amp=1.))
-        self.assertEqual(cell.stimlist[0].hname(), 'IClamp[0]')
-        self.assertEqual(len(cell.stimlist), 1)
-        self.assertEqual(cell.stimlist[0].delay, 1.)
-        self.assertEqual(cell.stimlist[0].amp, 1.)
-
-
-    def test_cell_strip_hoc_objects_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.strip_hoc_objects()
-        for attribute in dir(cell):
-            self.assertNotEqual(str(type(getattr(cell, attribute))),
-                                'hoc.HocObject')
-
-    def test_cell_cellpickler_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell_pickle = cell.cellpickler(filename=None, pickler=pickle.dumps)
-        pickled_cell = pickle.loads(cell_pickle)
-
-        for attribute in dir(cell):
-            if attribute.startswith('__') or attribute.startswith('_'):
-                pass
-            else:
-                self.assertEqual(type(getattr(cell, attribute)),
-                                 type(getattr(pickled_cell, attribute)))
-
-    def test_cell_simulate_recorder_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stick = LFPy.TemplateCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-        
-
-    def test_cell_simulate_recorder_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.TemplateCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.TemplateCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_03(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stick = LFPy.TemplateCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-        
-
-    def test_cell_simulate_recorder_04(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.TemplateCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_05(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.TemplateCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-        
-    def test_cell_simulate_current_dipole_moment_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.TemplateCell(**stickParams)
-                synapse = LFPy.StimIntElectrode(stick, idx=idx,
-                                       **stimParams)
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-
-
-    def test_cell_simulate_current_dipole_moment_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.TemplateCell(**stickParams)
-                synapse = LFPy.StimIntElectrode(stick, idx=idx,
-                                       **stimParams)
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-
-    def test_cell_simulate_current_dipole_moment_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'e' : 0,                                # reversal potential
-            'syntype' : 'Exp2Syn',                   # synapse type
-            'tau1' : 0.1,                              # syn. time constant
-            'tau2' : 2.,                              # syn. time constant
-            'weight' : 0.01,
-        }
-
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.TemplateCell(**stickParams)
-                synapse = LFPy.Synapse(stick, idx=idx,
-                                       **stimParams)
-                synapse.set_spike_times(np.array([10., 20., 30., 40., 50.]))
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-
-    def test_cell_tstart_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick0 = LFPy.TemplateCell(tstart=0, tstop=200, **stickParams)
-        synapse0 = LFPy.StimIntElectrode(stick0,
-                                         stick0.get_closest_idx(0, 0, 1000),
-                                         delay=0, phase=0.,
-                                         **stimParams)
-        stick0.simulate(rec_imem=True, rec_vmem=True, rec_current_dipole_moment=True)
-
-
-        stick1 = LFPy.TemplateCell(tstart=-100, tstop=100, **stickParams)
-        synapse1 = LFPy.StimIntElectrode(stick1,
-                                         stick1.get_closest_idx(0, 0, 1000),
-                                         delay=-100, phase=0.,
-                                         **stimParams)
-        stick1.simulate(rec_imem=True, rec_vmem=True, rec_current_dipole_moment=True)
-
-        inds = stick0.tvec >= 100
-        np.testing.assert_allclose(stick0.vmem[:, inds], stick1.vmem)
-        np.testing.assert_allclose(stick0.imem[:, inds], stick1.imem)
-        np.testing.assert_allclose(stick0.current_dipole_moment[inds, :],
-                                   stick1.current_dipole_moment)
-
-
-    def test_cell_with_recextelectrode_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.TemplateCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-
-    def test_cell_with_recextelectrode_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.TemplateCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_cell_with_recextelectrode_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.TemplateCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_cell_with_recextelectrode_03(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.TemplateCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-        
-    def test_cell_distort_geometry_01(self):
-        cell0 = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        factors = [-0.2, 0.1, 0., 0.1, 0.2]
-        nus = [-0.5, 0., 0.5]
-        for factor in factors:
-            for nu in nus:
-                for axis in 'xyz':
-                    cell1 = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-                    cell1.distort_geometry(factor=factor, nu=nu, axis=axis)
-                    for attr in ['start', 'mid', 'end']:
-                        for ax in 'xyz'.replace(axis, ''):
-                            np.testing.assert_allclose(getattr(cell0, ax+attr)*(1+factor*nu),
-                                                       getattr(cell1, ax+attr))
-                        np.testing.assert_allclose(getattr(cell0, axis+attr)*(1-factor),
-                                                   getattr(cell1, axis+attr))
-
-
-    ######## Functions used by tests: ##########################################
-
-def stickSimulationTesttvec(**kwargs):
-    stick = LFPy.TemplateCell(morphology = os.path.join(LFPy.__path__[0], 'test',
-                                                'stick.hoc'), verbose=False,
-                              templatefile=os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-                              templatename='stick_template',
-                              templateargs=None,
-                              **kwargs)
-    stick.simulate(rec_imem=False)
-    return stick.tvec
diff --git a/LFPy-2.0.7/LFPy/test/test_tools.py b/LFPy-2.0.7/LFPy/test/test_tools.py
deleted file mode 100644
index e81a0bf..0000000
--- a/LFPy-2.0.7/LFPy/test/test_tools.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import os
-import unittest
-import numpy as np
-import LFPy
-import pickle
-
-class testTools(unittest.TestCase):
-    """
-    test LFPy.tools methods
-    """
-    def test_tools_load_00(self):
-        filename = 'test.cpickle'
-        x = object()
-        f = open(filename, 'wb')
-        pickle.dump(x, f)
-        f.close()
-        self.assertTrue(isinstance(LFPy.tools.load(filename), object))
-        os.remove(filename)
-        
-    
-    def test_tools_noise_brown(self):
-        ncols=3
-        nrows=2
-        self.assertEqual(LFPy.tools.noise_brown(ncols, nrows).shape, (nrows, ncols))
\ No newline at end of file
diff --git a/LFPy-2.0.7/LFPy/tools.py b/LFPy-2.0.7/LFPy/tools.py
deleted file mode 100644
index 423f5c5..0000000
--- a/LFPy-2.0.7/LFPy/tools.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import numpy as np
-import scipy.signal as ss
-
-def load(filename):
-    """Generic loading of cPickled objects from file"""
-    import pickle
-    
-    filen = open(filename,'rb')
-    obj = pickle.load(filen)
-    filen.close()
-    return obj
-
-def noise_brown(ncols, nrows=1, weight=1., filter=None, filterargs=None):
-    """Return 1/f^2 noise of shape(nrows, ncols obtained by taking
-    the cumulative sum of gaussian white noise, with rms weight.
-    
-    If filter is not None, this function will apply
-    the filter coefficients obtained
-    by:
-        
-    >>> b, a = filter(**filterargs)
-    >>> signal = scipy.signal.lfilter(b, a, signal)
-    """
-    def rms_flat(a):
-        """
-        Return the root mean square of all the elements of *a*, flattened out.
-        """
-        return np.sqrt(np.mean(np.absolute(a)**2))
-
-    if filter is not None:
-        coeff_b, coeff_a = list(filter(**filterargs))
-    
-    noise = np.zeros((nrows, ncols))    
-    for i in range(nrows):
-        signal = np.random.normal(size=ncols+10000).cumsum()
-        if filter is not None:
-            signal = ss.lfilter(coeff_b, coeff_a, signal)
-        noise[i, :] = signal[10000:]
-        noise[i, :] /= rms_flat(noise[i, :])
-        noise[i, :] *= weight
-    return noise
-
diff --git a/LFPy-2.0.7/LICENSE b/LFPy-2.0.7/LICENSE
deleted file mode 100644
index 20d40b6..0000000
--- a/LFPy-2.0.7/LICENSE
+++ /dev/null
@@ -1,674 +0,0 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. 
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    
-    Copyright (C)   
-
-    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 .
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-      Copyright (C)   
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-.
\ No newline at end of file
diff --git a/LFPy-2.0.7/MANIFEST.in b/LFPy-2.0.7/MANIFEST.in
deleted file mode 100644
index 2da95c6..0000000
--- a/LFPy-2.0.7/MANIFEST.in
+++ /dev/null
@@ -1,14 +0,0 @@
-include README.md
-include LICENSE
-
-recursive-include LFPy *.pyx
-recursive-include LFPy/test x86_64 *
-
-recursive-include examples *.py
-recursive-include examples *.ipynb
-recursive-include examples *.hoc
-recursive-include examples morphologies
-
-recursive-include documentation *
-
-recursive-include html *
diff --git a/LFPy-2.0.7/README.md b/LFPy-2.0.7/README.md
deleted file mode 100644
index 476e117..0000000
--- a/LFPy-2.0.7/README.md
+++ /dev/null
@@ -1,158 +0,0 @@
-LFPy  
-====
-
-LFPy is a Python-module for calculation of extracellular potentials from multicompartment neuron models.
-It relies on the NEURON simulator (http://www.neuron.yale.edu/neuron) and uses the
-Python interface (http://www.frontiersin.org/neuroinformatics/10.3389/neuro.11.001.2009/abstract) it provides.
-
-You can now test some LFPy examples online without installation: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/LFPy/LFPy_binder_examples/master)
-
-LFPy provides a set of easy-to-use Python classes for setting up your model, running your simulations and calculating the extracellular potentials arising from activity in your model neuron. If you have a model working in NEURON (www.neuron.yale.edu)
-already, it is likely that it can be adapted to work with LFPy.
-
-The extracellular potentials are calculated from transmembrane currents in multi-compartment neuron models using the line-source method (Holt & Koch, J Comp Neurosci 1999),
-but a simpler point-source method is also available. The calculations assume that the neuron are surrounded by an infinite extracellular medium with homogeneous and frequency
-independent conductivity, and compartments are assumed to be at least at a minimal distance from the electrode (which can be specified by the user). For more information on
-the biophysics underlying the numerical framework used see this coming book chapter:
-
-- K.H. Pettersen, H. Linden, A.M. Dale and G.T. Einevoll: Extracellular spikes and current-source density, in *Handbook of Neural Activity Measurement*, edited by R. Brette and A. Destexhe, Cambridge, to appear (preprint PDF, 5.7MB http://arken.umb.no/~gautei/forskning/PettersenLindenDaleEinevoll-BookChapter-revised.pdf
-
-The first release of LFPy (v1.x) was mainly designed for simulation extracellular potentials of single neurons, described in our paper on the package in Frontiers in Neuroinformatics entitled "LFPy: A tool for biophysical simulation of extracellular potentials generated by detailed model neurons".
-The article can be found at http://dx.doi.org/10.3389%2Ffninf.2013.00041.
-Since version 2 (LFPy v2.x), the tool also facilitates simulations of extracellular potentials and current dipole moment from ongoing activity in recurrently connected networks of multicompartment neurons, prediction of EEG scalp surface potentials,
-MEG scalp surface magnetic fields, as described in the bioRXiv preprint "Multimodal modeling of neural network activity: computing LFP, ECoG, EEG and MEG signals with LFPy2.0" by Espen Hagen, Solveig Naess, Torbjoern V Ness, Gaute T Einevoll, found at https://doi.org/10.1101/281717.
-
-Citing LFPy:
-
-- LFPy v2.x: Hagen E, Næss S, Ness TV and Einevoll GT (2018) Multimodal Modeling of Neural Network Activity: Computing LFP, ECoG, EEG, and MEG Signals With LFPy 2.0. Front. Neuroinform. 12:92. doi: 10.3389/fninf.2018.00092. https://dx.doi.org/10.3389/fninf.2018.00092
-- LFPy v1.x: Linden H, Hagen E, Leski S, Norheim ES, Pettersen KH and Einevoll GT (2013). LFPy: A tool for biophysical simulation of extracellular potentials generated by detailed model neurons. Front. Neuroinform. 7:41. doi: 10.3389/fninf.2013.00041. https://dx.doi.org/10.3389/fninf.2013.00041
-
-LFPy was developed in the Computational Neuroscience Group, Department of Mathemathical Sciences and Technology (http://www.nmbu.no/imt),
-at the Norwegian University of Life Sciences (http://www.nmbu.no),
-in collaboration with the Laboratory of Neuroinformatics (http://www.nencki.gov.pl/en/laboratory-of-neuroinformatics),
-Nencki Institute of Experimental Biology (http://www.nencki.gov.pl), Warsaw, Poland. The effort was supported by
-International Neuroinformatics Coordinating Facility (http://incf.org), the Research Council of Norway (http://www.forskningsradet.no/english) (eScience, NevroNor) and EU-FP7 (BrainScaleS, http://www.brainscales.org).
-
-For updated information on LFPy and online documentation, see the LFPy homepage (http://lfpy.readthedocs.io).
-
-This scientific software is released under the GNU Public License GPLv3.
-
-Code status
-===========
-[![PyPI version](https://badge.fury.io/py/LFPy.svg)](https://badge.fury.io/py/LFPy)
-[![Build Status](https://travis-ci.org/LFPy/LFPy.svg?branch=master)](https://travis-ci.org/LFPy/LFPy)
-[![Coverage Status](https://coveralls.io/repos/github/LFPy/LFPy/badge.svg?branch=master)](https://coveralls.io/github/LFPy/LFPy?branch=master)
-[![Documentation Status](https://readthedocs.org/projects/lfpy/badge/?version=latest)](http://lfpy.readthedocs.io/en/latest/?badge=latest)
-[![DOI](https://zenodo.org/badge/78627256.svg)](https://zenodo.org/badge/latestdoi/78627256)
-
-Conda-forge release info
-========================
-
-| Name | Downloads | Version | Platforms |
-| --- | --- | --- | --- |
-| [![Conda Recipe](https://img.shields.io/badge/recipe-lfpy-green.svg)](https://anaconda.org/conda-forge/lfpy) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/lfpy.svg)](https://anaconda.org/conda-forge/lfpy) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/lfpy.svg)](https://anaconda.org/conda-forge/lfpy) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/lfpy.svg)](https://anaconda.org/conda-forge/lfpy) |
-
-Requirements
-============
-
-To install LFPy you will need the following:
-
-- Python modules numpy, scipy, matplotlib, h5py, mpi4py, Cython
-- NEURON (from http://www.neuron.yale.edu, v7.6.4 or newer) and corresponding Python module. The following should execute without error in a Python console:
-
-        import neuron
-        neuron.test()
-
-- Cython (C-extensions for python, http://cython.org) to speed up simulations of extracellular fields
-
-
-Installation
-============
-
-There are few options to install LFPy:
-
-1.  From the Python Package Index with only local access using pip:
-
-        pip install LFPy --user
-
-    as sudoer (in general not recommended as system Python files may be overwritten):
-
-        sudo pip install LFPy
-
-    Upgrading LFPy from the Python package index (without attempts at upgrading dependencies):
-
-        pip install --upgrade --no-deps LFPy --user
-
-    LFPy release candidates can be installed as:
-
-        pip install --pre --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple LFPy --user
-
-
-2.  From the Python Package Index with only local access using easy_install:
-
-        easy_install --user LFPy
-
-    As sudoer:
-
-        sudo easy_install LFPy
-
-3.  From source:
-
-        tar -xzf LFPy-x.x.tar.gz
-        cd LFPy-x.x
-        (sudo) python setup.py develop (--user)
-
-4.  Development version from the GitHub repository:
-
-        git clone https://github.com/LFPy/LFPy.git
-        cd LFPy
-        (sudo) pip install -r requirements.txt (--user) # install dependencies
-        (sudo) python setup.py develop (--user)
-
-5. Anaconda Python (macos/linux):
-
-        conda install lfpy neuron=*=mpi* # installs LFPy and Neuron in the current conda environment
-
-    or
-
-        conda create -n lfpy lfpy neuron=*=mpi* # creates new conda environment with LFPy and Neuron
-
-Uninstall
-=========
-
-To remove installed LFPy files it should suffice to issue (repeat until no more LFPy files are found):
-
-    (sudo) pip uninstall LFPy
-
-
-Docker
-======
-
-We provide a Docker (https://www.docker.com) container build file with LFPy.
-To get started, install Docker and issue:
-
-    docker build -t lfpy https://raw.githubusercontent.com/LFPy/LFPy/master/Dockerfile
-    docker run -it -p 5000:5000 lfpy
-
-Various LFPy example files can be found in the folder ``/opt/LFPy/examples/``
-when the container is running. Jupyter notebook servers running from within the
-container can be accessed after invoking them by issuing:
-
-    cd /opt/LFPy/examples/
-    jupyter notebook --ip 0.0.0.0 --port=5000 --no-browser --allow-root
-
-and opening the resulting URL in a browser the host computer, similar to:
-http://127.0.0.1:5000/?token=dcf8f859f859740fc858c568bdd5b015e0cf15bfc2c5b0c1
-
-
-Documentation
-=============
-
-To generate the html documentation using Sphinx, issue from the LFPy source code directory:
-
-    sphinx-build -b html /doc 
-
-The main html file is in ``/index.html``. Numpydoc and the ReadTheDocs theme may be needed:
-
-    pip install numpydoc --user
-    pip install sphinx-rtd-theme --user
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/__init__.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/__init__.py
deleted file mode 100644
index 0502e75..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/__init__.py
+++ /dev/null
@@ -1,55 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Initialization of LFPy, a Python module for simulating extracellular potentials.
-
-Group of Computational Neuroscience,
-Department of Mathematical Sciences and Technology,
-Norwegian University of Life Sciences.
-
-Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-:Classes:
-  * Cell - The pythonic neuron object itself laying on top of NEURON representing cells
-  * TemplateCell - Similar to Cell, but for models using cell templates
-  * Synapse - Convenience class for inserting synapses onto Cell objects
-  * StimIntElectrode - Convenience class for inserting electrodes onto Cell objects
-  * PointProcess - Parent class of Synapse and StimIntElectrode
-  * RecExtElectrode - Class for performing simulations of extracellular potentials
-  * RecMEAElectrode - Class for performing simulations of in vitro (slice) extracellular potentials
-  * Network - Class for creating distributed populations of cells and handling connections between cells in populations
-  * NetworkCell - Similar to `TemplateCell` with some attributes and methods for spike communication between parallel RANKs
-  * NetworkPopulation - Class representing group of Cell objects distributed across MPI RANKs
-  * OneSphereVolumeConductor - For computing extracellular potentials within and outside a homogeneous sphere
-  * FourSphereVolumeConductor - For computing extracellular potentials in 4-sphere model (brain, CSF, skull, scalp)
-  * InfiniteVolumeConductor - To compute extracellular potentials with current dipoles in infinite volume conductor
-  * MEG - Class for computing magnetic field from current dipole moment
-:Modules:
-  * lfpcalc - Functions used by RecExtElectrode class
-  * tools - Some convenient functions
-  * inputgenerators - Functions for synaptic input time generation
-  * eegcalc - Functions for calculating current dipole moment vector P and P_tot from currents and distances.
-  * run_simulations - Functions to run NEURON simulations
-"""
-
-__version__ = "2.0.7"
-
-from .pointprocess import Synapse, PointProcess, StimIntElectrode
-from .recextelectrode import RecExtElectrode, RecMEAElectrode
-from .cell import Cell
-from .templatecell import TemplateCell
-from .network import NetworkCell, NetworkPopulation, Network
-from .test import _test as run_tests
-from .eegmegcalc import OneSphereVolumeConductor, FourSphereVolumeConductor, InfiniteVolumeConductor, get_current_dipole_moment, MEG
-from . import lfpcalc
-from . import tools
-from . import inputgenerators
-from . import run_simulation
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/alias_method.cpython-38-x86_64-linux-gnu.so b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/alias_method.cpython-38-x86_64-linux-gnu.so
deleted file mode 100755
index 0b14906..0000000
Binary files a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/alias_method.cpython-38-x86_64-linux-gnu.so and /dev/null differ
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/alias_method.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/alias_method.py
deleted file mode 100644
index 7c45a48..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/alias_method.py
+++ /dev/null
@@ -1,108 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import division
-import numpy as np
-
-
-def alias_method(idx, probs, nsyn):
-    """
-    Alias method for drawing random numbers from a discrete probability
-    distribution. See http://www.keithschwarz.com/darts-dice-coins/
-    
-    Parameters
-    ----------
-    idx : np.ndarray
-        compartment indices as array of ints
-    probs : np.ndarray
-        compartment areas as array of floats
-    nsyn : int
-        number of randomized compartment indices
-
-    Returns
-    -------
-    out : np.ndarray
-        integer array of randomly drawn compartment indices
-
-    """
-    try:
-        assert idx.size == probs.size
-    except AssertionError as ae:
-        raise ae('length of idx and probs arrays must be equal')
-
-    # Construct the table.
-    J, q = alias_setup(probs)
-     
-    #output array
-    spc = np.zeros(nsyn, dtype=int)
-    
-    #prefetch random numbers, alias_draw needs nsyn x 2 numbers
-    rands = np.random.rand(nsyn, 2)
-    
-    K = J.size 
-    # Generate variates using alias draw method
-    for nn in range(nsyn):
-        kk = np.floor(rands[nn, 0]*K).astype(int)
-        if rands[nn, 1] < q[kk]:
-            spc[nn] = idx[kk]
-        else:
-            spc[nn] = idx[J[kk]]
-        
-    return spc
-
-
-def alias_setup(probs):
-    """Set up function for alias method.
-    See http://www.keithschwarz.com/darts-dice-coins/
-    
-    Parameters
-    ----------
-    probs : np.ndarray
-        float array of compartment areas
-
-    Returns
-    -------
-    J : np.ndarray
-        array of ints
-    q : np.ndarray
-        array of floats
-
-    """        
-    K = probs.size
-    q = probs*K
-    J = np.zeros(K, dtype=int)
-
-    # Sort the data into the outcomes with probabilities
-    # that are larger and smaller than 1/K.
-    smaller = np.zeros(K, dtype=int)
-    larger = np.zeros(K, dtype=int)
-    s_i = 0
-    l_i = 0
-    for kk in range(K):
-        if q[kk] < 1:
-            smaller[s_i] = kk
-            s_i += 1
-        else:
-            larger[l_i] = kk
-            l_i += 1
-
-    s_i -= 1
-    l_i -= 1
-    
-    # Loop though and create little binary mixtures that
-    # appropriately allocate the larger outcomes over the
-    # overall uniform mixture.
-    while s_i >= 0 and l_i >= 0:
-        small = smaller[s_i]
-        large = larger[l_i]
-        
-        J[small] = large
-        q[large] = q[large] + q[small] - 1
-
-        s_i -= 1
-    
-        if q[large] < 1:
-            s_i += 1
-            l_i -= 1
-            smaller[s_i] = large
- 
-    return J, q
-
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/alias_method.pyx b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/alias_method.pyx
deleted file mode 100644
index 45856de..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/alias_method.pyx
+++ /dev/null
@@ -1,138 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# cython: language_level=2
-
-from __future__ import division
-import numpy as np
-cimport numpy as np
-cimport cython
-
-DTYPE = np.float64
-ctypedef np.float64_t DTYPE_t
-ctypedef Py_ssize_t   LTYPE_t
-
-cdef extern from "math.h":
-    int floor(DTYPE_t x)
-
-
-@cython.boundscheck(False)
-@cython.wraparound(False)
-cpdef np.ndarray[long, ndim=1, negative_indices=False] alias_method(np.ndarray[long, ndim=1, negative_indices=False] idx,
-                 np.ndarray[DTYPE_t, ndim=1, negative_indices=False] probs,
-                 int nsyn):
-    """
-    Alias method for drawing random numbers from a discrete probability
-    distribution. See http://www.keithschwarz.com/darts-dice-coins/
-
-    Parameters
-    ----------
-    idx : np.ndarray
-        compartment indices as array of ints
-    probs : np.ndarray
-        compartment areas as array of floats
-    nsyn : int
-        number of randomized compartment indices
-
-    Returns
-    -------
-    out : np.ndarray
-        integer array of randomly drawn compartment indices
-
-    """
-    try:
-        assert idx.size == probs.size
-    except AssertionError as ae:
-        raise ae('length of idx and probs arrays must be equal')
-
-    #C-declare variables
-    cdef np.ndarray[long, ndim=1, negative_indices=False] J, spc
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] q
-    cdef np.ndarray[DTYPE_t, ndim=2, negative_indices=False] rands
-    cdef int nn, j, ad, K, kk
-
-    # Construct the table.
-    J, q = alias_setup(probs)
-
-    #output array
-    spc = np.zeros(nsyn, dtype=int)
-
-    #prefetch random numbers, alias_draw needs nsyn x 2 numbers
-    rands = np.random.rand(nsyn, 2)
-
-    K = J.size
-    # Generate variates using alias draw method
-    for nn in range(nsyn):
-        kk = floor(rands[nn, 0]*K)
-        if rands[nn, 1] < q[kk]:
-            spc[nn] = idx[kk]
-        else:
-            spc[nn] = idx[J[kk]]
-
-    return spc
-
-
-@cython.boundscheck(False)
-@cython.wraparound(False)
-cpdef alias_setup(np.ndarray[DTYPE_t, ndim=1, negative_indices=False] probs):
-    """Set up function for alias method.
-    See http://www.keithschwarz.com/darts-dice-coins/
-
-    Parameters
-    ----------
-    probs : np.ndarray
-        float array of compartment areas
-
-    Returns
-    -------
-    J : np.ndarray
-        array of ints
-    q : np.ndarray
-        array of floats
-
-    """
-    #C-declare variables
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] q
-    cdef np.ndarray[long, ndim=1, negative_indices=False] J, smaller, larger
-    cdef long K
-    cdef int small, large, kk, s_i, l_i
-    cdef DTYPE_t prob
-
-    K = probs.size
-    q = probs*K
-    J = np.zeros(K, dtype=int)
-
-    # Sort the data into the outcomes with probabilities
-    # that are larger and smaller than 1/K.
-    smaller = np.zeros(K, dtype=int)
-    larger = np.zeros(K, dtype=int)
-    s_i = 0
-    l_i = 0
-    for kk in range(K):
-        if q[kk] < 1:
-            smaller[s_i] = kk
-            s_i += 1
-        else:
-            larger[l_i] = kk
-            l_i += 1
-
-    s_i -= 1
-    l_i -= 1
-
-    # Loop though and create little binary mixtures that
-    # appropriately allocate the larger outcomes over the
-    # overall uniform mixture.
-    while s_i >= 0 and l_i >= 0:
-        small = smaller[s_i]
-        large = larger[l_i]
-
-        J[small] = large
-        q[large] = q[large] + q[small] - 1
-
-        s_i -= 1
-
-        if q[large] < 1:
-            s_i += 1
-            l_i -= 1
-            smaller[s_i] = large
-
-    return J, q
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/cell.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/cell.py
deleted file mode 100644
index 5d73b5a..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/cell.py
+++ /dev/null
@@ -1,2428 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-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.
-"""
-
-from __future__ import division
-import os
-import neuron
-import numpy as np
-import scipy.stats
-import sys
-import posixpath
-from warnings import warn
-import pickle
-from .run_simulation import _run_simulation, _run_simulation_with_electrode
-from .run_simulation import _collect_geometry_neuron
-from .alias_method import alias_method
-
-# check neuron version:
-try:
-    try:
-        assert(neuron.version >= '7.6.4')
-    except:
-        warn('LFPy could not read NEURON version info. v7.6.4 or newer required')
-except AssertionError:
-    warn('LFPy requires NEURON v7.6.4 or newer. Found v{}'.format(neuron.version))
-
-
-class Cell(object):
-    """
-    The main cell class used in LFPy.
-    Parameters
-    ----------
-    morphology : str or neuron.h.SectionList
-        File path of morphology on format that NEURON can understand (w. file
-        ending .hoc, .asc, .swc or .xml), or neuron.h.SectionList instance
-        filled with references to neuron.h.Section instances.
-    v_init : float
-        Initial membrane potential. Defaults to -70 mV.
-    Ra : float
-        Axial resistance. Defaults to 35.4 Ohm*cm
-    cm : float
-        Membrane capacitance. Defaults to 1.0 uF/cm2.
-    passive : bool
-        Passive mechanisms are initialized if True. Defaults to False
-    passive_parameters : dict
-        parameter dictionary with values for the passive membrane mechanism in
-        NEURON ('pas'). The dictionary must contain keys 'g_pas' [S/cm^2] and
-        'e_pas' [mV], like the default:
-        passive_parameters=dict(g_pas=0.001, e_pas=-70)
-    extracellular : bool
-        Switch for NEURON's extracellular mechanism. Defaults to False
-    dt : float
-        simulation timestep. Defaults to 2^-4 ms
-    tstart : float
-        Initialization time for simulation <= 0 ms. Defaults to 0.
-    tstop : float
-        Stop time for simulation > 0 ms. Defaults to 100 ms.
-    nsegs_method : 'lambda100' or 'lambda_f' or 'fixed_length' or None
-        nseg rule, used by NEURON to determine number of compartments.
-        Defaults to 'lambda100'
-    max_nsegs_length : float or None
-        Maximum segment length for method 'fixed_length'. Defaults to None
-    lambda_f : int
-        AC frequency for method 'lambda_f'. Defaults to 100
-    d_lambda : float
-        Parameter for d_lambda rule. Defaults to 0.1
-    delete_sections : bool
-        Delete pre-existing section-references. Defaults to True
-    custom_code : list or None
-        List of model-specific code files ([.py/.hoc]). Defaults to None
-    custom_fun : list or None
-        List of model-specific functions with args. Defaults to None
-    custom_fun_args : list or None
-        List of args passed to custom_fun functions. Defaults to None
-    pt3d : bool
-        Use pt3d-info of the cell geometries switch. Defaults to False
-    celsius : float or None
-        Temperature in celsius. If nothing is specified here
-        or in custom code it is 6.3 celcius
-    verbose : bool
-        Verbose output switch. Defaults to False
-    Examples
-    --------
-    Simple example of how to use the Cell class with a passive-circuit
-    morphology (modify morphology path accordingly):
-    >>> import os
-    >>> import LFPy
-    >>> cellParameters = {
-    >>>     'morphology' : os.path.join('examples', 'morphologies', 'L5_Mainen96_LFPy.hoc'),
-    >>>     'v_init' : -65.,
-    >>>     'cm' : 1.0,
-    >>>     'Ra' : 150,
-    >>>     'passive' : True,
-    >>>     'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-    >>>     'dt' : 2**-3,
-    >>>     'tstart' : 0,
-    >>>     'tstop' : 50,
-    >>> }
-    >>> cell = LFPy.Cell(**cellParameters)
-    >>> cell.simulate()
-    >>> print(cell.somav)
-    """
-    def __init__(self, morphology,
-                    v_init=-70.,
-                    Ra=35.4,
-                    cm=1.0,
-                    passive=False,
-                    passive_parameters = dict(
-                        g_pas=0.001,
-                        e_pas=-70.),
-                    extracellular=False,
-                    tstart=0.,
-                    tstop=100.,
-                    dt = 2**-4,
-                    nsegs_method='lambda100',
-                    lambda_f = 100,
-                    d_lambda = 0.1,
-                    max_nsegs_length=None,
-                    delete_sections = True,
-                    custom_code=None,
-                    custom_fun=None,
-                    custom_fun_args=None,
-                    pt3d=False,
-                    celsius=None,
-                    verbose=False,
-                    **kwargs):
-        """
-        Initialization of the Cell object.
-        """
-        self.verbose = verbose
-        self.pt3d = pt3d
-
-        # raise Exceptions on deprecated input arguments
-        for key in ['timeres_NEURON', 'timeres_python']:
-            if key in kwargs.keys():
-                raise DeprecationWarning('cell parameter {} is deprecated. Use dt=float instead'.format(key))
-        if 'tstartms' in kwargs.keys():
-            raise DeprecationWarning('cell parameter tstartms is deprecated. Use tstart=float instead')
-        if 'tstopms' in kwargs.keys():
-            raise DeprecationWarning('cell parameter tstopms is deprecated. Use tstop=float instead')
-        if 'rm' in kwargs.keys():
-            raise DeprecationWarning('Cell parameter rm is deprecated, set parameter passive_parameters=dict(g_pas=1/rm, e_pas=e_pas) instead')
-        if 'e_pas' in kwargs.keys():
-            raise DeprecationWarning('Cell parameter e_pas is deprecated, set parameter passive_parameters=dict(g_pas=1/rm, e_pas=e_pas) instead')
-
-        # check if there are un-used keyword arguments present in kwargs
-        for key, value in kwargs.items():
-            raise ValueError('The keyword and argument {}={} is not valid input to class LFPy.Cell'.format(key, value))
-
-        if passive:
-            try:
-                assert(type(passive_parameters) is dict)
-            except AssertionError:
-                raise AssertionError('passive_parameters must be a dictionary')
-            for key in ['g_pas', 'e_pas']:
-                try:
-                    assert(key in passive_parameters.keys())
-                except AssertionError:
-                    raise AssertionError('key {} not found in passive_parameters'.format(key))
-
-
-        if not hasattr(neuron.h, 'd_lambda'):
-            neuron.h.load_file('stdlib.hoc')    #NEURON std. library
-            neuron.h.load_file('import3d.hoc')  #import 3D morphology lib
-
-        if delete_sections:
-            numsec = 0
-            for numsec, sec in enumerate(neuron.h.allsec()):
-                pass
-            if numsec > 0 and self.verbose:
-                print('%s existing sections deleted from memory' % numsec)
-            neuron.h('forall delete_section()')
-
-        #print a warning if neuron have existing sections
-        numsec = 0
-        for numsec, sec in enumerate(neuron.h.allsec()):
-            pass
-        if numsec > 0 and self.verbose:
-            mssg = "%s sections detected! " % numsec + \
-                   "Consider setting 'delete_sections=True'"
-            warn(mssg)
-
-        #load morphology
-        try:
-            assert(morphology is not None)
-        except AssertionError:
-            raise AssertionError('deprecated keyword argument morphology==None, value must be a file path or neuron.h.SectionList instance with neuron.h.Section instances')
-        if "win32" in sys.platform and type(morphology) is str:
-            # fix Path on windows
-            morphology = morphology.replace(os.sep, posixpath.sep)
-        self.morphology = morphology
-        if type(self.morphology) is str:
-            if os.path.isfile(self.morphology):
-                self._load_geometry()
-            else:
-                raise Exception('non-existent file %s' % self.morphology)
-        else:
-            try:
-                assert(type(self.morphology) is type(neuron.h.SectionList))
-                # #will try to import top level cell and create sectionlist,
-                # #in case there were no morphology file loaded
-                # neuron.h.define_shape()
-                # self._create_sectionlists()
-            except AssertionError:
-                raise Exception("Could not recognize Cell keyword argument morphology as neuron.h.SectionList instance")
-
-            # instantiate 3D geometry of all sections
-            neuron.h.define_shape()
-            # set some additional attributes
-            self._create_sectionlists_from_morphology_value()
-
-
-
-        #Some parameters and lists initialised
-        try:
-            assert(tstart <= 0)
-        except AssertionError:
-            raise AssertionError('tstart must be <= 0.')
-
-        try:
-            assert(dt in 2.**np.arange(-16, -1))
-        except AssertionError:
-            if tstart == 0.:
-                if self.verbose:
-                    print('int(1./dt) not factorizable in base 2. '
-                          'cell.tvec errors may occur, continuing initialization.')
-            elif tstart < 0:
-                raise AssertionError('int(1./dt) must be factorizable in base 2 if tstart < 0.')
-
-        self.dt = dt
-
-        self.tstart = tstart
-        self.tstop = tstop
-
-        self.synapses = []
-        self.synidx = []
-        self.pointprocesses = []
-        self.pointprocess_idx = []
-
-        self.v_init = v_init
-
-        self.default_rotation = self._get_rotation()
-
-        if passive:
-            #Set passive properties, insert passive on all segments
-            self.Ra = Ra
-            self.cm = cm
-            self.passive_parameters = passive_parameters
-            self._set_passive()
-        else:
-            self.Ra = Ra
-            self.cm = cm
-            self.passive_parameters = passive_parameters
-            if self.verbose:
-                print('No passive properties added')
-
-        #run user specified code and functions if argument given
-        if custom_code is not None or custom_fun is not None:
-            self._run_custom_codes(custom_code, custom_fun, custom_fun_args)
-
-        #Insert extracellular mech on all segments
-        self.extracellular = extracellular
-        if self.extracellular:
-            self._set_extracellular()
-        else:
-            if self.verbose:
-                print("no extracellular mechanism inserted")
-
-        #set number of segments accd to rule, and calculate the number
-        self._set_nsegs(nsegs_method, lambda_f, d_lambda, max_nsegs_length)
-        self.totnsegs = self._calc_totnsegs()
-        if self.verbose:
-            print("Total number of segments: %i" % self.totnsegs)
-
-        #extract pt3d info from NEURON, and set these with the same rotation
-        #and position in space as in our simulations, assuming RH rule, which
-        #NEURON do NOT use in shape plot
-        if self.pt3d:
-            self.x3d, self.y3d, self.z3d, self.diam3d = self._collect_pt3d()
-
-        #Gather geometry, set position and rotation of morphology
-        if self.pt3d:
-            self._update_pt3d()
-        else: # self._update_pt3d itself makes a call to self._collect_geometry()
-            self._collect_geometry()
-        if hasattr(self, 'somapos'):
-            self.set_pos()
-        else:
-            if self.verbose:
-                print('no soma, using the midpoint if initial segment.')
-        self.set_rotation(**self.default_rotation)
-
-        if celsius is not None:
-            if neuron.h.celsius != 6.3:
-                print("Overwriting custom temperature of %1.2f. New temperature is %1.2f"
-                      % (neuron.h.celsius, celsius))
-            neuron.h.celsius = celsius
-
-        # initialize membrane voltage in all segments.
-        neuron.h.finitialize(self.v_init)
-
-
-    def _load_geometry(self):
-        """Load the morphology-file in NEURON"""
-        try:
-            neuron.h.sec_counted = 0
-        except LookupError:
-            neuron.h('sec_counted = 0')
-
-        #import the morphology, try and determine format
-        fileEnding = self.morphology.split('.')[-1]
-        if fileEnding == 'hoc' or fileEnding == 'HOC':
-            neuron.h.load_file(1, self.morphology)
-        else:
-            neuron.h('objref this')
-            if fileEnding == 'asc' or fileEnding == 'ASC':
-                Import = neuron.h.Import3d_Neurolucida3()
-                if not self.verbose:
-                    Import.quiet = 1
-            elif fileEnding == 'swc' or fileEnding == 'SWC':
-                Import = neuron.h.Import3d_SWC_read()
-            elif fileEnding == 'xml' or fileEnding == 'XML':
-                Import = neuron.h.Import3d_MorphML()
-            else:
-                raise ValueError('%s is not a recognised morphology file format!'
-                                 ).with_traceback(
-                    'Should be either .hoc, .asc, .swc, .xml!' % self.morphology)
-
-            #assuming now that morphologies file is the correct format
-            try:
-                Import.input(self.morphology)
-            except:
-                if not hasattr(neuron, 'neuroml'):
-                    raise Exception('Can not import, try and copy the ' +
-                    'nrn/share/lib/python/neuron/neuroml ' +
-                    'folder into %s' % neuron.__path__[0])
-                else:
-                    raise Exception('something wrong with file, see output')
-            try:
-                imprt = neuron.h.Import3d_GUI(Import, 0)
-            except:
-                raise Exception('See output, try to correct the file')
-            imprt.instantiate(neuron.h.this)
-
-        neuron.h.define_shape()
-        self._create_sectionlists()
-
-
-    def _run_custom_codes(self, custom_code, custom_fun, custom_fun_args):
-        """Execute custom model code and functions with arguments"""
-        # load custom codes
-        if custom_code is not None:
-            for code in custom_code:
-                if "win32" in sys.platform:
-                    code = code.replace(os.sep, posixpath.sep)
-                if code.split('.')[-1] == 'hoc':
-                    try:
-                        neuron.h.xopen(code)
-                    except RuntimeError:
-                        ERRMSG = '\n'.join(['',
-                            'Could not load custom model code (%s)' %code,
-                            'while creating a Cell object.',
-                            'One possible cause is the NEURON mechanisms have',
-                            'not been compiled, ',
-                            'try running nrnivmodl or mknrndll (Windows) in ',
-                            'the mod-file-containing folder. ',])
-                        raise Exception(ERRMSG)
-                elif code.split('.')[-1] == 'py':
-                    if sys.version >= "3.4":
-                        exec(code, globals())
-                    else:
-                        exec(code)
-                else:
-                    raise Exception('%s not a .hoc- nor .py-file' % code)
-
-        # run custom functions with arguments
-        i = 0
-        if custom_fun is not None:
-            for fun in custom_fun:
-                fun(**custom_fun_args[i])
-                i += 1
-
-        #recreate sectionlists in case something changed
-        neuron.h.define_shape()
-        self._create_sectionlists()
-
-
-    def _set_nsegs(self, nsegs_method, lambda_f, d_lambda, max_nsegs_length):
-        """Set number of segments per section according to the lambda-rule,
-        or according to maximum length of segments"""
-        if nsegs_method == 'lambda100':
-            self._set_nsegs_lambda100(d_lambda)
-        elif nsegs_method == 'lambda_f':
-            self._set_nsegs_lambda_f(lambda_f, d_lambda)
-        elif nsegs_method == 'fixed_length':
-            self._set_nsegs_fixed_length(max_nsegs_length)
-        else:
-            if self.verbose:
-                print('No nsegs_method applied (%s)' % nsegs_method)
-
-    def _get_rotation(self):
-        """Check if there exists a corresponding file
-        with rotation angles"""
-        if type(self.morphology) is str:
-            base = os.path.splitext(self.morphology)[0]
-            if os.path.isfile(base+'.rot'):
-                rotation_file = base+'.rot'
-                rotation_data = open(rotation_file)
-                rotation = {}
-                for line in rotation_data:
-                    var, val = line.split('=')
-                    val = val.strip()
-                    val = float(str(val))
-                    rotation[var] = val
-            else:
-                rotation = {}
-        else:
-            rotation = {}
-        return rotation
-
-    def _create_sectionlists(self):
-        """Create section lists for different kinds of sections"""
-        #list with all sections
-        self.allsecnames = []
-        self.allseclist = neuron.h.SectionList()
-        for sec in neuron.h.allsec():
-            self.allsecnames.append(sec.name())
-            self.allseclist.append(sec=sec)
-
-
-        #list of soma sections, assuming it is named on the format "soma*"
-        self.nsomasec = 0
-        self.somalist = neuron.h.SectionList()
-        for sec in neuron.h.allsec():
-            if sec.name().find('soma') >= 0:
-                self.somalist.append(sec=sec)
-                self.nsomasec += 1
-
-    def _create_sectionlists_from_morphology_value(self):
-        """Variant of Cell._create_sectionlists() used if keyword argument
-        morphology is a neuron.h.SectionList instance"""
-        #list with all sections
-        self.allsecnames = []
-        self.allseclist = self.morphology
-        for sec in self.allseclist:
-            self.allsecnames.append(sec.name())
-
-        #list of soma sections, assuming it is named on the format "soma*"
-        self.nsomasec = 0
-        self.somalist = neuron.h.SectionList()
-        for sec in self.allseclist:
-            if sec.name().find('soma') >= 0:
-                self.somalist.append(sec=sec)
-                self.nsomasec += 1
-
-
-
-    def _get_idx(self, seclist):
-        """Return boolean vector which indexes where segments in seclist
-        matches segments in neuron.h.allsec(), rewritten from
-        LFPy.hoc function get_idx()"""
-        if neuron.h.allsec() == seclist:
-            return np.ones(self.totnsegs, dtype=bool)
-        else:
-            idxvec = np.zeros(self.totnsegs, dtype=bool)
-            #get sectionnames from seclist
-            seclistnames = []
-            for sec in seclist:
-                seclistnames.append(sec.name())
-            seclistnames = np.array(seclistnames, dtype='|S128')
-            segnames = np.empty(self.totnsegs, dtype='|S128')
-            i = 0
-            for sec in self.allseclist:
-                secname = sec.name()
-                for seg in sec:
-                    segnames[i] = secname
-                    i += 1
-            for name in seclistnames:
-                idxvec[segnames == name] = True
-
-            return idxvec
-
-    def _set_nsegs_lambda_f(self, frequency=100, d_lambda=0.1):
-        """Set the number of segments for section according to the
-        d_lambda-rule for a given input frequency
-        Parameters
-        ----------
-        frequency : float
-            frequency at which AC length constant is computed
-        d_lambda : float
-        """
-        for sec in self.allseclist:
-            sec.nseg = int((sec.L / (d_lambda*neuron.h.lambda_f(frequency,
-                                                sec=sec)) + .9) / 2)*2 + 1
-        if self.verbose:
-            print("set nsegs using lambda-rule with frequency %i." % frequency)
-
-    def _set_nsegs_lambda100(self, d_lambda=0.1):
-        """Set the numbers of segments using d_lambda(100)"""
-        self._set_nsegs_lambda_f(frequency=100, d_lambda=d_lambda)
-
-    def _set_nsegs_fixed_length(self, maxlength):
-        """Set nseg for sections so that every segment L < maxlength"""
-        for sec in self.allseclist:
-            sec.nseg = int(sec.L / maxlength) + 1
-
-    def _calc_totnsegs(self):
-        """Calculate the number of segments in the allseclist"""
-        i = 0
-        for sec in self.allseclist:
-            i += sec.nseg
-
-        return i
-
-    def _check_currents(self):
-        """Check that the sum of all membrane and electrode currents over all
-        segments is sufficiently close to zero"""
-        raise NotImplementedError('this function need to be written')
-
-    def _set_passive(self):
-        """Insert passive mechanism on all segments"""
-        for sec in self.allseclist:
-            sec.insert('pas')
-            sec.Ra = self.Ra
-            sec.cm = self.cm
-            sec.g_pas = self.passive_parameters['g_pas']
-            sec.e_pas = self.passive_parameters['e_pas']
-
-    def _set_extracellular(self):
-        """Insert extracellular mechanism on all sections
-        to set an external potential V_ext as boundary condition.
-        """
-
-        for sec in self.allseclist:
-            sec.insert('extracellular')
-
-    def set_synapse(self, idx, syntype,
-                    record_current=False,
-                    record_potential=False,
-                    weight=None, **kwargs):
-        """Insert synapse on cell segment
-        Parameters
-        ----------
-        idx : int
-            Index of compartment where synapse is inserted
-        syntype : str
-            Type of synapse. Built-in types in NEURON: ExpSyn, Exp2Syn
-        record_current : bool
-            If True, record synapse current
-        record_potential : bool
-            If True, record postsynaptic potential seen by the synapse
-        weight : float
-            Strength of synapse
-        kwargs
-            arguments passed on from class Synapse
-        """
-        if not hasattr(self, 'synlist'):
-            self.synlist = neuron.h.List()
-        if not hasattr(self, 'synireclist'):
-            self.synireclist = neuron.h.List()
-        if not hasattr(self, 'synvreclist'):
-            self.synvreclist = neuron.h.List()
-        if not hasattr(self, 'netstimlist'):
-           self.netstimlist = neuron.h.List()
-        if not hasattr(self, 'netconlist'):
-            self.netconlist = neuron.h.List()
-        if not hasattr(self, 'sptimeslist'):
-            self.sptimeslist = neuron.h.List()
-
-        i = 0
-        cmd = 'syn = neuron.h.{}(seg.x, sec=sec)'
-        for sec in self.allseclist:
-            for seg in sec:
-                if i == idx:
-                    command = cmd.format(syntype)
-                    if sys.version >= "3.4":
-                        exec(command, locals(), globals())
-                    else:
-                        exec(command)
-                    for param in list(kwargs.keys()):
-                        try:
-                            if sys.version >= "3.4":
-                                exec('syn.' + param + '=' + str(kwargs[param]),
-                                     locals(), globals())
-                            else:
-                                exec('syn.' + param + '=' + str(kwargs[param]))
-                        except:
-                            pass
-                    self.synlist.append(syn)
-
-                    #create NetStim (generator) and NetCon (connection) objects
-                    self.netstimlist.append(neuron.h.NetStim(0.5))
-                    self.netstimlist[-1].number = 0
-
-                    nc = neuron.h.NetCon(self.netstimlist[-1], syn)
-                    nc.weight[0] = weight
-                    self.netconlist.append(nc)
-
-                    #record currents
-                    if record_current:
-                        synirec = neuron.h.Vector(int(self.tstop //
-                                                      self.dt+1))
-                        synirec.record(syn._ref_i, self.dt)
-                        self.synireclist.append(synirec)
-                    else:
-                        synirec = neuron.h.Vector(0)
-                        self.synireclist.append(synirec)
-
-                    #record potential
-                    if record_potential:
-                        synvrec = neuron.h.Vector(int(self.tstop //
-                                                      self.dt+1))
-                        synvrec.record(seg._ref_v, self.dt)
-                        self.synvreclist.append(synvrec)
-                    else:
-                        synvrec = neuron.h.Vector(0)
-                        self.synvreclist.append(synvrec)
-
-                i += 1
-
-        return self.synlist.count() - 1
-
-    def set_point_process(self, idx, pptype, record_current=False,
-                          record_potential=False, **kwargs):
-        """Insert pptype-electrode type pointprocess on segment numbered
-        idx on cell object
-        Parameters
-        ----------
-        idx : int
-            Index of compartment where point process is inserted
-        pptype : str
-            Type of pointprocess. Examples: SEClamp, VClamp,
-            IClamp, SinIClamp, ChirpIClamp
-        record_current : bool
-            Decides if current is stored
-        kwargs
-            Parameters passed on from class StimIntElectrode
-        """
-
-        if not hasattr(self, 'stimlist'):
-            self.stimlist = neuron.h.List()
-        if not hasattr(self, 'stimireclist'):
-            self.stimireclist = neuron.h.List()
-        if not hasattr(self, 'stimvreclist'):
-            self.stimvreclist = neuron.h.List()
-
-        i = 0
-        cmd1 = 'stim = neuron.h.'
-        cmd2 = '(seg.x, sec=sec)'
-        for sec in self.allseclist:
-            for seg in sec:
-                if i == idx:
-                    command = cmd1 + pptype + cmd2
-                    if sys.version >= "3.4":
-                        exec(command, locals(), globals())
-                    else:
-                        exec(command)
-                    for param in list(kwargs.keys()):
-                        try:
-                            if sys.version >= "3.4":
-                                exec('stim.' + param + '=' + str(kwargs[param]),
-                                     locals(), globals())
-                            else:
-                                exec('stim.' + param + '=' + str(kwargs[param]))
-                        except SyntaxError:
-                            ERRMSG = ''.join(['',
-                                'Point process type "{0}" might not '.format(
-                                    pptype),
-                                'recognize attribute "{0}". '.format(param),
-                                'Check for misspellings'])
-                            raise Exception(ERRMSG)
-                    self.stimlist.append(stim)
-
-                    #record current
-                    if record_current:
-                        stimirec = neuron.h.Vector(int(self.tstop /
-                                                       self.dt+1))
-                        stimirec.record(stim._ref_i, self.dt)
-                        self.stimireclist.append(stimirec)
-                    else:
-                        stimirec = neuron.h.Vector(0)
-                        self.stimireclist.append(stimirec)
-
-
-                    # record potential
-                    if record_potential:
-                        stimvrec = neuron.h.Vector(int(self.tstop /
-                                                      self.dt+1))
-                        stimvrec.record(seg._ref_v, self.dt)
-                        self.stimvreclist.append(stimvrec)
-                    else:
-                        stimvrec = neuron.h.Vector(0)
-                        self.stimvreclist.append(stimvrec)
-
-
-                i += 1
-
-        return self.stimlist.count() - 1
-
-    def _collect_geometry(self):
-        """Collects x, y, z-coordinates from NEURON"""
-        #None-type some attributes if they do not exis:
-        if not hasattr(self, 'xstart'):
-            self.xstart = None
-            self.ystart = None
-            self.zstart = None
-            self.xend = None
-            self.yend = None
-            self.zend = None
-            self.area = None
-            self.diam = None
-            self.length = None
-
-        _collect_geometry_neuron(self)
-        self._calc_midpoints()
-
-        self.somaidx = self.get_idx(section='soma')
-
-        if self.somaidx.size > 1:
-            xmids = self.xmid[self.somaidx]
-            ymids = self.ymid[self.somaidx]
-            zmids = self.zmid[self.somaidx]
-            self.somapos = np.zeros(3)
-            self.somapos[0] = xmids.mean()
-            self.somapos[1] = ymids.mean()
-            self.somapos[2] = zmids.mean()
-        elif self.somaidx.size == 1:
-            self.somapos = np.zeros(3)
-            self.somapos[0] = self.xmid[self.somaidx]
-            self.somapos[1] = self.ymid[self.somaidx]
-            self.somapos[2] = self.zmid[self.somaidx]
-        elif self.somaidx.size == 0:
-            if self.verbose:
-                print('There is no soma!')
-                print('using first segment as root point')
-            self.somaidx = np.array([0])
-            self.somapos = np.zeros(3)
-            self.somapos[0] = self.xmid[self.somaidx]
-            self.somapos[1] = self.ymid[self.somaidx]
-            self.somapos[2] = self.zmid[self.somaidx]
-        else:
-            raise Exception('Huh?!')
-
-    def _calc_midpoints(self):
-        """Calculate midpoints of each segment"""
-        self.xmid = .5*(self.xstart+self.xend).flatten()
-        self.ymid = .5*(self.ystart+self.yend).flatten()
-        self.zmid = .5*(self.zstart+self.zend).flatten()
-
-    def get_idx(self, section='allsec', z_min=-np.inf, z_max=np.inf):
-        """Returns compartment idx of segments from sections with names that match
-        the pattern defined in input section on interval [z_min, z_max].
-        Parameters
-        ----------
-        section : str
-            Any entry in cell.allsecnames or just 'allsec'.
-        z_min : float
-            Depth filter. Specify minimum z-position
-        z_max : float
-            Depth filter. Specify maximum z-position
-        Examples
-        --------
-        >>> idx = cell.get_idx(section='allsec')
-        >>> print(idx)
-        >>> idx = cell.get_idx(section=['soma', 'dend', 'apic'])
-        >>> print(idx)
-        """
-
-        if section == 'allsec':
-            seclist = neuron.h.allsec()
-        else:
-            seclist = neuron.h.SectionList()
-            if type(section) == str:
-                for sec in self.allseclist:
-                    if sec.name().find(section) >= 0:
-                        seclist.append(sec=sec)
-            elif type(section) == list:
-                for secname in section:
-                    for sec in self.allseclist:
-                        if sec.name().find(secname) >= 0:
-                            seclist.append(sec=sec)
-            else:
-                if self.verbose:
-                    print('%s did not match any section name' % str(section))
-
-        idx = self._get_idx(seclist)
-        sel_z_idx = (self.zmid[idx] > z_min) & (self.zmid[idx] < z_max)
-        return np.arange(self.totnsegs)[idx][sel_z_idx]
-
-    def get_closest_idx(self, x=0., y=0., z=0., section='allsec'):
-        """Get the index number of a segment in specified section which
-        midpoint is closest to the coordinates defined by the user
-        Parameters
-        ----------
-        x: float
-            x-coordinate
-        y: float
-            y-coordinate
-        z: float
-            z-coordinate
-        section: str
-            String matching a section-name. Defaults to 'allsec'.
-        """
-        idx = self.get_idx(section)
-        dist = ((self.xmid[idx] - x)**2 +
-                (self.ymid[idx] - y)**2 +
-                (self.zmid[idx] - z)**2)
-        return idx[np.argmin(dist)]
-
-    def get_rand_idx_area_norm(self, section='allsec', nidx=1,
-                               z_min=-1E6, z_max=1E6):
-        """Return nidx segment indices in section with random probability
-        normalized to the membrane area of segment on
-        interval [z_min, z_max]
-        Parameters
-        ----------
-        section : str
-            String matching a section-name
-        nidx : int
-            Number of random indices
-        z_min : float
-            Depth filter
-        z_max : float
-            Depth filter
-        """
-        poss_idx = self.get_idx(section=section, z_min=z_min, z_max=z_max)
-        if nidx < 1:
-            print('nidx < 1, returning empty array')
-            return np.array([])
-        elif poss_idx.size == 0:
-            print('No possible segment idx match enquire! returning empty array')
-            return np.array([])
-        else:
-            area = self.area[poss_idx]
-            area /= area.sum()
-            return alias_method(poss_idx, area, nidx)
-
-
-    def get_rand_idx_area_and_distribution_norm(self, section='allsec', nidx=1,
-                                                z_min=-1E6, z_max=1E6,
-                                                fun=scipy.stats.norm,
-                                                funargs=dict(loc=0, scale=100),
-                                                funweights=None):
-        """
-        Return nidx segment indices in section with random probability
-        normalized to the membrane area of each segment multiplied by
-        the value of the probability density function of "fun", a function
-        in the scipy.stats module with corresponding function arguments
-        in "funargs" on the interval [z_min, z_max]
-        Parameters
-        ----------
-        section: str
-            string matching a section-name
-        nidx: int
-            number of random indices
-        z_min: float
-            depth filter
-        z_max: float
-            depth filter
-        fun : function or str, or iterable of function or str
-            if function a scipy.stats method, if str, must be method in
-            scipy.stats module with the same name (like 'norm'),
-            if iterable (list, tuple, numpy.array) of function or str some
-            probability distribution in scipy.stats module
-        funargs : dict or iterable
-            iterable (list, tuple, numpy.array) of dict, arguments to fun.pdf
-            method (e.g., w. keys 'loc' and 'scale')
-        funweights : None or iterable
-            iterable (list, tuple, numpy.array) of floats, scaling of each
-            individual fun (i.e., introduces layer specificity)
-        Examples
-        --------
-        >>> import LFPy
-        >>> import numpy as np
-        >>> import scipy.stats as ss
-        >>> import matplotlib.pyplot as plt
-        >>> from os.path import join
-        >>> cell = LFPy.Cell(morphology=join('cells', 'cells', 'j4a.hoc'))
-        >>> cell.set_rotation(x=4.99, y=-4.33, z=3.14)
-        >>> idx = cell.get_rand_idx_area_and_distribution_norm(nidx=10000,
-                                                           fun=ss.norm,
-                                                           funargs=dict(loc=0, scale=200))
-        >>> bins = np.arange(-30, 120)*10
-        >>> plt.hist(cell.zmid[idx], bins=bins, alpha=0.5)
-        >>> plt.show()
-        """
-        poss_idx = self.get_idx(section=section, z_min=z_min, z_max=z_max)
-        if nidx < 1:
-            print('nidx < 1, returning empty array')
-            return np.array([])
-        elif poss_idx.size == 0:
-            print('No possible segment idx match enquire! returning empty array')
-            return np.array([])
-        else:
-            p = self.area[poss_idx]
-            # scale with density function
-            if type(fun) in [list, tuple, np.ndarray]:
-                assert(type(funargs) in [list, tuple, np.ndarray])
-                assert(type(funweights) in [list, tuple, np.ndarray])
-                assert((len(fun) == len(funargs)) & (len(fun) == len(funweights)))
-                mod = np.zeros(poss_idx.shape)
-                for f, args, scl in zip(fun, funargs, funweights):
-                    if type(f) is str and f in dir(scipy.stats):
-                        f = getattr(scipy.stats, f)
-                    df = f(**args)
-                    mod += df.pdf(x=self.zmid[poss_idx])*scl
-                p *= mod
-            else:
-                if type(fun) is str and fun in dir(scipy.stats):
-                    fun = getattr(scipy.stats, fun)
-                df = fun(**funargs)
-                p *= df.pdf(x=self.zmid[poss_idx])
-            # normalize
-            p /= p.sum()
-            return alias_method(poss_idx, p, nidx)
-
-
-    def simulate(self, electrode=None, rec_imem=False, rec_vmem=False,
-                 rec_ipas=False, rec_icap=False,
-                 rec_current_dipole_moment=False,
-                 rec_variables=[], variable_dt=False, atol=0.001,
-                 to_memory=True, to_file=False, file_name=None,
-                 dotprodcoeffs=None, **kwargs):
-        """
-        This is the main function running the simulation of the NEURON model.
-        Start NEURON simulation and record variables specified by arguments.
-        Parameters
-        ----------
-        electrode : :obj: or list, optional
-            Either an LFPy.RecExtElectrode object or a list of such.
-            If supplied, LFPs will be calculated at every time step
-            and accessible as `electrode.LFP`. If a list of objects
-            is given, accessible as `electrode[0].LFP` etc.
-        rec_imem : bool
-            If true, segment membrane currents will be recorded
-            If no electrode argument is given, it is necessary to
-            set rec_imem=True in order to calculate LFP later on.
-            Units of (nA).
-        rec_vmem : bool
-            Record segment membrane voltages (mV)
-        rec_ipas : bool
-            Record passive segment membrane currents (nA)
-        rec_icap : bool
-            Record capacitive segment membrane currents (nA)
-        rec_current_dipole_moment : bool
-            If True, compute and record current-dipole moment from
-            transmembrane currents as in Linden et al. (2010) J Comput Neurosci,
-            DOI: 10.1007/s10827-010-0245-4. Will set the `LFPy.Cell` attribute
-            `current_dipole_moment` as n_timesteps x 3 `np.ndarray` where the
-            last dimension contains the x,y,z components of the dipole moment.
-        rec_variables : list
-            List of variables to record, i.e arg=['cai', ]
-        variable_dt : bool
-            Use variable timestep in NEURON
-        atol : float
-            Absolute tolerance used with NEURON variable timestep
-        to_memory : bool
-            Only valid with electrode, store lfp in -> electrode.LFP
-        to_file : bool
-            Only valid with electrode, save LFPs in hdf5 file format
-        file_name : str
-            Name of hdf5 file, '.h5' is appended if it doesnt exist
-        dotprodcoeffs : list
-            List of N x Nseg ndarray. These arrays will at
-            every timestep be multiplied by the membrane currents.
-            Presumably useful for memory efficient csd or lfp calcs
-        """
-        for key in kwargs.keys():
-            if key in ['rec_isyn', 'rec_vmemsyn', 'rec_istim', 'rec_vmemstim']:
-                raise DeprecationWarning('Cell.simulate parameter {} is deprecated.'.format(key))
-
-
-        self._set_soma_volt_recorder()
-        self._collect_tvec()
-
-        # set up integrator, use the CVode().fast_imem method by default
-        # as it doesn't hurt sim speeds much if at all.
-        cvode = neuron.h.CVode()
-        try:
-            cvode.use_fast_imem(1)
-        except AttributeError as ae:
-            raise Exception('neuron.h.CVode().use_fast_imem() method not found. Please update NEURON to v.7.4 or newer')
-
-        if rec_imem:
-            self._set_imem_recorders()
-        if rec_vmem:
-            self._set_voltage_recorders()
-        if rec_ipas:
-            self._set_ipas_recorders()
-        if rec_icap:
-            self._set_icap_recorders()
-        if rec_current_dipole_moment:
-            self._set_current_dipole_moment_array()
-        if len(rec_variables) > 0:
-            self._set_variable_recorders(rec_variables)
-
-
-        #run fadvance until t >= tstop, and calculate LFP if asked for
-        if electrode is None and dotprodcoeffs is None and not rec_current_dipole_moment:
-            if not rec_imem and self.verbose:
-                print("rec_imem = %s, membrane currents will not be recorded!"
-                                  % str(rec_imem))
-            _run_simulation(self, cvode, variable_dt, atol)
-
-        else:
-            #allow using both electrode and additional coefficients:
-            _run_simulation_with_electrode(self, cvode, electrode, variable_dt, atol,
-                                           to_memory, to_file, file_name,
-                                           dotprodcoeffs,
-                                           rec_current_dipole_moment)
-        # somatic trace
-        if self.nsomasec >= 1:
-            self.somav = np.array(self.somav)
-
-        if rec_imem:
-            self._calc_imem()
-        if rec_ipas:
-            self._calc_ipas()
-        if rec_icap:
-            self._calc_icap()
-        if rec_vmem:
-            self._collect_vmem()
-        self._collect_isyn()
-        self._collect_vsyn()
-        self._collect_istim()
-        self._collect_vstim()
-        if len(rec_variables) > 0:
-            self._collect_rec_variables(rec_variables)
-        if hasattr(self, 'netstimlist'):
-            del self.netstimlist
-
-    def _collect_tvec(self):
-        """
-        Set the tvec to be a monotonically increasing numpy array after sim.
-        """
-        self.tvec = np.arange(self.tstop / self.dt + 1) * self.dt
-
-    def _calc_imem(self):
-        """
-        Fetch the vectors from the memireclist and calculate self.imem
-        containing all the membrane currents.
-        """
-        self.imem = np.array(self.memireclist)
-        self.memireclist = None
-        del self.memireclist
-
-    def _calc_ipas(self):
-        """
-        Get the passive currents
-        """
-        self.ipas = np.array(self.memipasreclist)
-        for i in range(self.ipas.shape[0]):
-            self.ipas[i, ] *= self.area[i] * 1E-2
-        self.memipasreclist = None
-        del self.memipasreclist
-
-    def _calc_icap(self):
-        """
-        Get the capacitive currents
-        """
-        self.icap = np.array(self.memicapreclist)
-        for i in range(self.icap.shape[0]):
-            self.icap[i, ] *= self.area[i] * 1E-2
-        self.memicapreclist = None
-        del self.memicapreclist
-
-    def _collect_vmem(self):
-        """
-        Get the membrane currents
-        """
-        self.vmem = np.array(self.memvreclist)
-        self.memvreclist = None
-        del self.memvreclist
-
-    def _collect_isyn(self):
-        """
-        Get the synaptic currents
-        """
-        for syn in self.synapses:
-            if syn.record_current:
-                syn.collect_current(self)
-        self.synireclist = None
-        del self.synireclist
-
-    def _collect_vsyn(self):
-        """
-        Collect the membrane voltage of segments with synapses
-        """
-        for syn in self.synapses:
-            if syn.record_potential:
-                syn.collect_potential(self)
-        self.synvreclist = None
-        del self.synvreclist
-
-    def _collect_istim(self):
-        """
-        Get the pointprocess currents
-        """
-        for pp in self.pointprocesses:
-            if pp.record_current:
-                pp.collect_current(self)
-        self.stimireclist = None
-        del self.stimireclist
-
-    def _collect_vstim(self):
-        """
-        Collect the membrane voltage of segments with stimulus
-        """
-        for pp in self.pointprocesses:
-            if pp.record_potential:
-                pp.collect_potential(self)
-        self.stimvreclist = None
-        del self.stimvreclist
-
-    def _collect_rec_variables(self, rec_variables):
-        """
-        Create dict of np.arrays from recorded variables, each dictionary
-        element named as the corresponding recorded variable name, i.e 'cai'
-        """
-        self.rec_variables = {}
-        i = 0
-        for values in self.recvariablesreclist:
-            self.rec_variables.update({rec_variables[i] : np.array(values)})
-            if self.verbose:
-                print('collected recorded variable %s' % rec_variables[i])
-            i += 1
-        del self.recvariablesreclist
-
-    def _loadspikes(self):
-        """
-        Initialize spiketimes from netcon if they exist
-        """
-        if hasattr(self, 'synlist'):
-            if len(self.synlist) == len(self.sptimeslist):
-                for i in range(int(self.synlist.count())):
-                    for ii in range(int(self.sptimeslist.o(i).size)):
-                        self.netconlist.o(i).event(float(self.sptimeslist.o(i)[ii]))
-
-    def _set_soma_volt_recorder(self):
-        """Record somatic membrane potential"""
-
-        if self.nsomasec == 0:
-            if self.verbose:
-                warn('Cell instance appears to have no somatic section. '
-                     'No somav attribute will be set.')
-        elif self.nsomasec == 1:
-            self.somav = neuron.h.Vector(int(self.tstop / self.dt+1))
-            for sec in self.somalist:
-                self.somav.record(sec(0.5)._ref_v, self.dt)
-        elif self.nsomasec > 1:
-            self.somav = neuron.h.Vector(int(self.tstop / self.dt+1))
-            nseg = self.get_idx('soma').size
-            i, j = divmod(nseg, 2)
-            k = 1
-            for sec in self.somalist:
-                for seg in sec:
-                    if nseg==2 and k == 1:
-                        #if 2 segments, record from the first one:
-                        self.somav.record(seg._ref_v, self.dt)
-                    else:
-                        if k == i*2:
-                            #record from one of the middle segments:
-                            self.somav.record(seg._ref_v, self.dt)
-                    k += 1
-
-    def _set_imem_recorders(self):
-        """
-        Record membrane currents for all segments
-        """
-        self.memireclist = neuron.h.List()
-        for sec in self.allseclist:
-            for seg in sec:
-                memirec = neuron.h.Vector(int(self.tstop / self.dt+1))
-                memirec.record(seg._ref_i_membrane_, self.dt)
-                self.memireclist.append(memirec)
-
-
-    def _set_ipas_recorders(self):
-        """
-        Record passive membrane currents for all segments
-        """
-        self.memipasreclist = neuron.h.List()
-        for sec in self.allseclist:
-            for seg in sec:
-                memipasrec = neuron.h.Vector(int(self.tstop / self.dt+1))
-                memipasrec.record(seg._ref_i_pas, self.dt)
-                self.memipasreclist.append(memipasrec)
-
-    def _set_icap_recorders(self):
-        """
-        Record capacitive membrane currents for all segments
-        """
-        self.memicapreclist = neuron.h.List()
-        for sec in self.allseclist:
-            for seg in sec:
-                memicaprec = neuron.h.Vector(int(self.tstop / self.dt+1))
-                memicaprec.record(seg._ref_i_cap, self.dt)
-                self.memicapreclist.append(memicaprec)
-
-    def _set_voltage_recorders(self):
-        """
-        Record membrane potentials for all segments
-        """
-        self.memvreclist = neuron.h.List()
-        for sec in self.allseclist:
-            for seg in sec:
-                memvrec = neuron.h.Vector(int(self.tstop / self.dt+1))
-                memvrec.record(seg._ref_v, self.dt)
-                self.memvreclist.append(memvrec)
-
-    def _set_current_dipole_moment_array(self):
-        """
-        Creates container for current dipole moment, an empty
-        n_timesteps x 3 `numpy.ndarray` that will be filled with values during
-        the course of each simulation
-        """
-        self.current_dipole_moment = np.zeros((self.tvec.size, 3))
-
-    def _set_variable_recorders(self, rec_variables):
-        """
-        Create a recorder for each variable name in list
-        rec_variables
-        Variables is stored in nested list self.recvariablesreclist
-        """
-        self.recvariablesreclist = neuron.h.List()
-        for variable in rec_variables:
-            variablereclist = neuron.h.List()
-            self.recvariablesreclist.append(variablereclist)
-            for sec in self.allseclist:
-                for seg in sec:
-                    recvector = neuron.h.Vector(int(self.tstop / self.dt + 1))
-                    try:
-                        recvector.record(getattr(seg, '_ref_%s' % variable),
-                                         self.dt)
-                    except(NameError, AttributeError):
-                        print('non-existing variable %s, section %s.%f' %
-                                (variable, sec.name(), seg.x))
-                    variablereclist.append(recvector)
-
-
-    def set_pos(self, x=0., y=0., z=0.):
-        """Set the cell position.
-        Move the cell geometry so that midpoint of soma section is
-        in (x, y, z). If no soma pos, use the first segment
-        Parameters
-        ----------
-        x : float
-            x position defaults to 0.0
-        y : float
-            y position defaults to 0.0
-        z : float
-            z position defaults to 0.0
-        """
-        diffx = x-self.somapos[0]
-        diffy = y-self.somapos[1]
-        diffz = z-self.somapos[2]
-
-        #also update the pt3d_pos:
-        if self.pt3d and hasattr(self, 'x3d'):
-            self._set_pt3d_pos(diffx, diffy, diffz)
-        else:
-            self.somapos[0] = x
-            self.somapos[1] = y
-            self.somapos[2] = z
-
-            self.xstart += diffx
-            self.ystart += diffy
-            self.zstart += diffz
-
-            self.xend += diffx
-            self.yend += diffy
-            self.zend += diffz
-
-        self._calc_midpoints()
-        self._update_synapse_positions()
-
-    def strip_hoc_objects(self):
-        """Destroy any NEURON hoc objects in the cell object"""
-        for varname in dir(self):
-            if type(getattr(self, varname)) == type(neuron.h.List()):
-                setattr(self, varname, None)
-                if self.verbose:
-                    print('None-typed %s in cell instance' % varname)
-
-    def cellpickler(self, filename, pickler=pickle.dump):
-        """Save data in cell to filename, using cPickle. It will however destroy
-        any neuron.h objects upon saving, as c-objects cannot be pickled
-        Parameters
-        ----------
-        filename : str
-            Where to save cell
-        Examples
-        --------
-        To save a cell, use:
-        >>> cell.cellpickler('cell.cpickle')
-        To load this cell again in another session:
-        >>> import cPickle
-        >>> f = file('cell.cpickle', 'rb')
-        >>> cell = cPickle.load(f)
-        >>> f.close()
-        alternatively:
-        >>> import LFPy
-        >>> cell = LFPy.tools.load('cell.cpickle')
-        """
-        self.strip_hoc_objects()
-        if pickler==pickle.dump:
-            filen = open(filename, 'wb')
-            pickle.dump(self, filen, protocol=2)
-            filen.close()
-            return None
-        elif pickler==pickle.dumps:
-            return pickle.dumps(self)
-
-    def _update_synapse_positions(self):
-        """
-        Update synapse positions after rotation of morphology
-        """
-        for i in range(len(self.synapses)):
-            self.synapses[i].update_pos(self)
-
-    def set_rotation(self, x=None, y=None, z=None, rotation_order='xyz'):
-        """
-        Rotate geometry of cell object around the x-, y-, z-axis in the order
-        described by rotation_order parameter.
-        rotation_order should be a string with 3 elements containing x, y, and z
-        e.g. 'xyz', 'zyx'
-        Input should be angles in radians.
-        using rotation matrices, takes dict with rot. angles,
-        where x, y, z are the rotation angles around respective axes.
-        All rotation angles are optional.
-        Examples
-        --------
-        >>> cell = LFPy.Cell(**kwargs)
-        >>> rotation = {'x' : 1.233, 'y' : 0.236, 'z' : np.pi}
-        >>> cell.set_rotation(**rotation)
-        """
-        if type(rotation_order) is not str:
-            raise AttributeError('rotation_order must be a string')
-        elif 'x' not in rotation_order or 'y' not in rotation_order or 'z' not in rotation_order:
-            raise AttributeError("'x', 'y', and 'z' must be in rotation_order")
-        elif len(rotation_order) != 3:
-            raise AttributeError("rotation_order should have 3 elements (e.g. 'zyx')")
-
-        for ax in rotation_order:
-            if ax == 'x' and x is not None:
-                theta = -x
-                rotation_x = np.array([[1, 0, 0],
-                                       [0, np.cos(theta), -np.sin(theta)],
-                                       [0, np.sin(theta), np.cos(theta)]])
-
-                rel_start, rel_end = self._rel_positions()
-
-                rel_start = np.dot(rel_start, rotation_x)
-                rel_end = np.dot(rel_end, rotation_x)
-
-                self._real_positions(rel_start, rel_end)
-                if self.verbose:
-                    print('Rotated geometry %g radians around x-axis' % (-theta))
-            else:
-                if self.verbose:
-                    print('Geometry not rotated around x-axis')
-
-            if ax == 'y' and y is not None:
-                phi = -y
-                rotation_y = np.array([[np.cos(phi), 0, np.sin(phi)],
-                                       [0, 1, 0],
-                                       [-np.sin(phi), 0, np.cos(phi)]])
-
-                rel_start, rel_end = self._rel_positions()
-
-                rel_start = np.dot(rel_start, rotation_y)
-                rel_end = np.dot(rel_end, rotation_y)
-
-                self._real_positions(rel_start, rel_end)
-                if self.verbose:
-                    print('Rotated geometry %g radians around y-axis' % (-phi))
-            else:
-                if self.verbose:
-                    print('Geometry not rotated around y-axis')
-
-            if ax == 'z' and z is not None:
-                gamma = -z
-                rotation_z = np.array([[np.cos(gamma), -np.sin(gamma), 0],
-                                       [np.sin(gamma), np.cos(gamma), 0],
-                                       [0, 0, 1]])
-
-                rel_start, rel_end = self._rel_positions()
-
-                rel_start = np.dot(rel_start, rotation_z)
-                rel_end = np.dot(rel_end, rotation_z)
-
-                self._real_positions(rel_start, rel_end)
-                if self.verbose:
-                    print('Rotated geometry %g radians around z-axis' % (-gamma))
-            else:
-                if self.verbose:
-                    print('Geometry not rotated around z-axis')
-
-        #rotate the pt3d geometry accordingly
-        if self.pt3d and hasattr(self, 'x3d'):
-            self._set_pt3d_rotation(x, y, z, rotation_order)
-
-    def chiral_morphology(self, axis='x'):
-        """
-        Mirror the morphology around given axis, (default x-axis),
-        useful to introduce more heterogeneouties in morphology shapes
-        Parameters
-        ----------
-        axis : str
-            'x' or 'y' or 'z'
-        """
-        #morphology relative to soma-position
-        rel_start, rel_end = self._rel_positions()
-        if axis == 'x':
-            rel_start[:, 0] = -rel_start[:, 0]
-            rel_end[:, 0] = -rel_end[:, 0]
-        elif axis == 'y':
-            rel_start[:, 1] = -rel_start[:, 1]
-            rel_end[:, 1] = -rel_end[:, 1]
-        elif axis == 'z':
-            rel_start[:, 2] = -rel_start[:, 2]
-            rel_end[:, 2] = -rel_end[:, 2]
-        else:
-            raise Exception("axis must be either 'x', 'y' or 'z'")
-
-        if self.verbose:
-            print('morphology mirrored across %s-axis' % axis)
-
-        #set the proper 3D positions
-        self._real_positions(rel_start, rel_end)
-
-    def _squeeze_me_macaroni(self):
-        """
-        Reducing the dimensions of the morphology matrices from 3D->1D
-        """
-        self.xstart = np.array(self.xstart).flatten()
-        self.xend = np.array(self.xend).flatten()
-
-        self.ystart = np.array(self.ystart).flatten()
-        self.yend = np.array(self.yend).flatten()
-
-        self.zstart = np.array(self.zstart).flatten()
-        self.zend = np.array(self.zend).flatten()
-
-    def _rel_positions(self):
-        """
-        Morphology relative to soma position
-        """
-        rel_start = np.array([self.xstart-self.somapos[0],
-                              self.ystart-self.somapos[1],
-                              self.zstart-self.somapos[2]]).T
-        rel_end = np.array([self.xend-self.somapos[0],
-                            self.yend-self.somapos[1],
-                            self.zend-self.somapos[2]]).T
-
-        return rel_start, rel_end
-
-    def _real_positions(self, rel_start, rel_end):
-        """
-        Morphology coordinates relative to Origo
-        """
-        self.xstart = rel_start[:, 0] + self.somapos[0]
-        self.ystart = rel_start[:, 1] + self.somapos[1]
-        self.zstart = rel_start[:, 2] + self.somapos[2]
-
-        self.xend = rel_end[:, 0] + self.somapos[0]
-        self.yend = rel_end[:, 1] + self.somapos[1]
-        self.zend = rel_end[:, 2] + self.somapos[2]
-
-        self._squeeze_me_macaroni()
-        self._calc_midpoints()
-        self._update_synapse_positions()
-
-    def get_rand_prob_area_norm(self, section='allsec',
-                                z_min=-10000, z_max=10000):
-        """
-        Return the probability (0-1) for synaptic coupling on segments
-        in section sum(prob)=1 over all segments in section.
-        Probability normalized by area.
-        Parameters
-        ----------
-        section : str
-            string matching a section-name. Defaults to 'allsec'
-        z_min : float
-            depth filter
-        z_max : float
-            depth filter
-        """
-        idx = self.get_idx(section=section, z_min=z_min, z_max = z_max)
-        prob = self.area[idx] / sum(self.area[idx])
-        return prob
-
-    def get_rand_prob_area_norm_from_idx(self, idx=np.array([0])):
-        """
-        Return the normalized probability (0-1) for synaptic coupling on
-        segments in idx-array.
-        Normalised probability determined by area of segments.
-        Parameters
-        ----------
-        idx : ndarray, dtype=int.
-            array of segment indices
-        """
-        prob = self.area[idx] / sum(self.area[idx])
-        return prob
-
-    def get_intersegment_vector(self, idx0=0, idx1=0):
-        """Return the distance between midpoints of two segments with index
-        idx0 and idx1. The argument returned is a vector [x, y, z], where
-        x = self.xmid[idx1] - self.xmid[idx0] etc.
-        Parameters
-        ----------
-        idx0 : int
-        idx1 : int
-        """
-        vector = []
-        try:
-            if idx1 < 0 or idx0 < 0:
-                raise Exception('idx0 < 0 or idx1 < 0')
-            vector.append(self.xmid[idx1] - self.xmid[idx0])
-            vector.append(self.ymid[idx1] - self.ymid[idx0])
-            vector.append(self.zmid[idx1] - self.zmid[idx0])
-            return vector
-        except:
-            ERRMSG = 'idx0 and idx1 must be ints on [0, %i]' % self.totnsegs
-            raise ValueError(ERRMSG)
-
-    def get_intersegment_distance(self, idx0=0, idx1=0):
-        """
-        Return the Euclidean distance between midpoints of two segments.
-        Parameters
-        ----------
-        idx0 : int
-        idx1 : int
-        Returns
-        -------
-        float
-            Will return a float in unit of micrometers.
-        """
-        try:
-            vector = np.array(self.get_intersegment_vector(idx0, idx1))
-            return np.sqrt((vector**2).sum())
-        except:
-            ERRMSG = 'idx0 and idx1 must be ints on [0, %i]' % self.totnsegs
-            raise ValueError(ERRMSG)
-
-    def get_idx_children(self, parent="soma[0]"):
-        """Get the idx of parent's children sections, i.e. compartments ids
-        of sections connected to parent-argument
-        Parameters
-        ----------
-        parent : str
-            name-pattern matching a sectionname. Defaults to "soma[0]"
-        """
-        idxvec = np.zeros(self.totnsegs)
-        secnamelist = []
-        childseclist = []
-        #filling list of sectionnames for all sections, one entry per segment
-        for sec in self.allseclist:
-            for seg in sec:
-                secnamelist.append(sec.name())
-        #filling list of children section-names
-        sref = neuron.h.SectionRef(parent)
-        for sec in sref.child:
-            childseclist.append(sec.name())
-        #idxvec=1 where both coincide
-        i = 0
-        for sec in secnamelist:
-            for childsec in childseclist:
-                if sec == childsec:
-                    idxvec[i] += 1
-            i += 1
-
-        [idx] = np.where(idxvec)
-        return idx
-
-    def get_idx_parent_children(self, parent="soma[0]"):
-        """
-        Get all idx of segments of parent and children sections, i.e. segment
-        idx of sections connected to parent-argument, and also of the parent
-        segments
-        Parameters
-        ----------
-        parent : str
-            name-pattern matching a sectionname. Defaults to "soma[0]"
-        """
-        seclist = [parent]
-        sref = neuron.h.SectionRef(parent)
-        for sec in sref.child:
-            seclist.append(sec.name())
-
-        return self.get_idx(section=seclist)
-
-    def get_idx_name(self, idx=np.array([0], dtype=int)):
-        '''
-        Return NEURON convention name of segments with index idx.
-        The returned argument is a list of tuples with corresponding
-        segment idx, section name, and position along the section, like;
-        [(0, 'neuron.h.soma[0]', 0.5),]
-        kwargs:
-        ::
-            idx : ndarray, dtype int
-                segment indices, must be between 0 and cell.totnsegs
-        '''
-        #ensure idx is array-like, or convert
-        if type(idx) == int or np.int64:
-            idx = np.array([idx])
-        elif len(idx) == 0:
-            return
-        else:
-            idx = np.array(idx).astype(int)
-
-        #ensure all idx are valid
-        if np.any(idx >= self.totnsegs):
-            wrongidx = idx[np.where(idx >= self.totnsegs)]
-            raise Exception('idx %s >= number of compartments' % str(wrongidx))
-
-        #create list of seg names:
-        allsegnames = []
-        segidx = 0
-        for sec in self.allseclist:
-            for seg in sec:
-                allsegnames.append((segidx, '%s' % sec.name(), seg.x))
-                segidx += 1
-
-        return np.array(allsegnames, dtype=object)[idx][0]
-
-    def _collect_pt3d(self):
-        """collect the pt3d info, for each section"""
-        x = []
-        y = []
-        z = []
-        d = []
-
-        for sec in self.allseclist:
-            n3d = int(neuron.h.n3d())
-            x_i, y_i, z_i = np.zeros(n3d), np.zeros(n3d), np.zeros(n3d),
-            d_i = np.zeros(n3d)
-            for i in range(n3d):
-                x_i[i] = neuron.h.x3d(i)
-                y_i[i] = neuron.h.y3d(i)
-                z_i[i] = neuron.h.z3d(i)
-                d_i[i] = neuron.h.diam3d(i)
-
-
-            x.append(x_i)
-            y.append(y_i)
-            z.append(z_i)
-            d.append(d_i)
-
-        #remove offsets which may be present if soma is centred in Origo
-        if len(x) > 1:
-            xoff = x[0].mean()
-            yoff = y[0].mean()
-            zoff = z[0].mean()
-            for i in range(len(x)):
-                x[i] -= xoff
-                y[i] -= yoff
-                z[i] -= zoff
-
-        return x, y, z, d
-
-    def _update_pt3d(self):
-        """
-        update the locations in neuron.hoc.space using neuron.h.pt3dchange()
-        """
-        for i, sec in enumerate(self.allseclist):
-            n3d = int(neuron.h.n3d())
-            for n in range(n3d):
-                neuron.h.pt3dchange(n,
-                                self.x3d[i][n],
-                                self.y3d[i][n],
-                                self.z3d[i][n],
-                                self.diam3d[i][n])
-            #let NEURON know about the changes we just did:
-            neuron.h.define_shape()
-        #must recollect the geometry, otherwise we get roundoff errors!
-        self._collect_geometry()
-
-    def _set_pt3d_pos(self, diffx=0, diffy=0, diffz=0):
-        """
-        Offset pt3d geometry with differential displacement
-        indicated in Cell.set_pos()
-        """
-        for i in range(len(self.x3d)):
-            self.x3d[i] += diffx
-            self.y3d[i] += diffy
-            self.z3d[i] += diffz
-        self._update_pt3d()
-
-
-    def _set_pt3d_rotation(self, x=None, y=None, z=None, rotation_order='xyz'):
-        """
-        Rotate pt3d geometry of cell object around the x-, y-, z-axis
-        in the order described by rotation_order parameter.
-        rotation_order should be a string with 3 elements containing x, y, and z
-        e.g. 'xyz', 'zyx'
-        Input should be angles in radians.
-        using rotation matrices, takes dict with rot. angles,
-        where x, y, z are the rotation angles around respective axes.
-        All rotation angles are optional.
-        Examples
-        --------
-        >>> cell = LFPy.Cell(**kwargs)
-        >>> rotation = {'x' : 1.233, 'y' : 0.236, 'z' : np.pi}
-        >>> cell.set_pt3d_rotation(**rotation)
-        """
-        for ax in rotation_order:
-            if ax == 'x' and x is not None:
-                theta = -x
-                rotation_x = np.array([[1, 0, 0],
-                                       [0, np.cos(theta), -np.sin(theta)],
-                                       [0, np.sin(theta), np.cos(theta)]])
-                for i in range(len(self.x3d)):
-                    rel_pos = self._rel_pt3d_positions(self.x3d[i],
-                                                       self.y3d[i], self.z3d[i])
-
-                    rel_pos = np.dot(rel_pos, rotation_x)
-
-                    self.x3d[i], self.y3d[i], self.z3d[i] = \
-                                                self._real_pt3d_positions(rel_pos)
-                if self.verbose:
-                    print(('Rotated geometry %g radians around x-axis' % (-theta)))
-            else:
-                if self.verbose:
-                    print('Geometry not rotated around x-axis')
-
-            if ax == 'y' and y is not None:
-                phi = -y
-                rotation_y = np.array([[np.cos(phi), 0, np.sin(phi)],
-                                       [0, 1, 0],
-                                       [-np.sin(phi), 0, np.cos(phi)]])
-                for i in range(len(self.x3d)):
-                    rel_pos = self._rel_pt3d_positions(self.x3d[i],
-                                                       self.y3d[i], self.z3d[i])
-
-                    rel_pos = np.dot(rel_pos, rotation_y)
-
-                    self.x3d[i], self.y3d[i], self.z3d[i] = \
-                                                self._real_pt3d_positions(rel_pos)
-                if self.verbose:
-                    print('Rotated geometry %g radians around y-axis' % (-phi))
-            else:
-                if self.verbose:
-                    print('Geometry not rotated around y-axis')
-
-            if ax == 'z' and z is not None:
-                gamma = -z
-                rotation_z = np.array([[np.cos(gamma), -np.sin(gamma), 0],
-                                       [np.sin(gamma), np.cos(gamma), 0],
-                                       [0, 0, 1]])
-                for i in range(len(self.x3d)):
-                    rel_pos = self._rel_pt3d_positions(self.x3d[i],
-                                                       self.y3d[i], self.z3d[i])
-
-                    rel_pos = np.dot(rel_pos, rotation_z)
-
-                    self.x3d[i], self.y3d[i], self.z3d[i] = \
-                                                self._real_pt3d_positions(rel_pos)
-                if self.verbose:
-                    print('Rotated geometry %g radians around z-axis' % (-gamma))
-            else:
-                if self.verbose:
-                    print('Geometry not rotated around z-axis')
-        self._update_pt3d()
-
-    def _rel_pt3d_positions(self, x, y, z):
-        """Morphology relative to soma position """
-        rel_pos = np.transpose(np.array([x - self.somapos[0],
-                                         y - self.somapos[1],
-                                         z - self.somapos[2]]))
-
-        return rel_pos
-
-    def _real_pt3d_positions(self, rel_pos):
-        """Morphology coordinates relative to Origo """
-        x = rel_pos[:, 0] + self.somapos[0]
-        y = rel_pos[:, 1] + self.somapos[1]
-        z = rel_pos[:, 2] + self.somapos[2]
-
-        x = np.array(x).flatten()
-        y = np.array(y).flatten()
-        z = np.array(z).flatten()
-
-        return x, y, z
-
-    def _create_polygon(self, i, projection=('x', 'z')):
-        """create a polygon to fill for each section"""
-        x = getattr(self, projection[0]+'3d')[i]
-        y = getattr(self, projection[1]+'3d')[i]
-        #x = self.x3d[i]
-        #z = self.z3d[i]
-        d = self.diam3d[i]
-
-        #calculate angles
-        dx = np.diff(x)
-        dy = np.diff(y)
-        theta = np.arctan2(dy, dx)
-
-        x = np.r_[x, x[::-1]]
-        y = np.r_[y, y[::-1]]
-
-        theta = np.r_[theta, theta[::-1]]
-        d = np.r_[d, d[::-1]]
-
-        #1st corner:
-        x[0] -= 0.5 * d[0] * np.sin(theta[0])
-        y[0] += 0.5 * d[0] * np.cos(theta[0])
-
-        ##pt3d points between start and end of section, first side
-        x[1:dx.size] -= 0.25 * d[1:dx.size] * (
-            np.sin(theta[:dx.size-1]) + np.sin(theta[1:dx.size]))
-        y[1:dy.size] += 0.25 * d[1:dy.size] * (
-            np.cos(theta[:dy.size-1]) + np.cos(theta[1:dx.size]))
-
-        #end of section, first side
-        x[dx.size] -= 0.5 * d[dx.size] * np.sin(theta[dx.size])
-        y[dy.size] += 0.5 * d[dy.size] * np.cos(theta[dy.size])
-
-        #other side
-        #end of section, second side
-        x[dx.size+1] += 0.5 * d[dx.size+1] * np.sin(theta[dx.size])
-        y[dy.size+1] -= 0.5 * d[dy.size+1] * np.cos(theta[dy.size])
-
-        ##pt3d points between start and end of section, second side
-        x[::-1][1:dx.size] += 0.25 * d[::-1][1:dx.size] * (
-            np.sin(theta[::-1][:dx.size-1]) + np.sin(theta[::-1][1:dx.size]))
-        y[::-1][1:dy.size] -= 0.25 * d[::-1][1:dy.size] * (
-            np.cos(theta[::-1][:dy.size-1]) + np.cos(theta[::-1][1:dx.size]))
-
-        #last corner:
-        x[-1] += 0.5 * d[-1] * np.sin(theta[-1])
-        y[-1] -= 0.5 * d[-1] * np.cos(theta[-1])
-
-        return x, y
-
-    def get_pt3d_polygons(self, projection=('x', 'z')):
-        """For each section create a polygon in the plane determined by keyword
-        argument projection=('x', 'z'), that can be
-        visualized using e.g., plt.fill()
-        Returns
-        -------
-        list
-            list of (x, z) tuples giving the trajectory
-            of each section that can be plotted using PolyCollection
-        Examples
-        --------
-        >>> from matplotlib.collections import PolyCollection
-        >>> import matplotlib.pyplot as plt
-        >>> cell = LFPy.Cell(morphology='PATH/TO/MORPHOLOGY')
-        >>> zips = []
-        >>> for x, z in cell.get_pt3d_polygons(projection=('x', 'z')):
-        >>>     zips.append(zip(x, z))
-        >>> polycol = PolyCollection(zips,
-        >>>                          edgecolors='none',
-        >>>                          facecolors='gray')
-        >>> fig = plt.figure()
-        >>> ax = fig.add_subplot(111)
-        >>> ax.add_collection(polycol)
-        >>> ax.axis(ax.axis('equal'))
-        >>> plt.show()
-        """
-        if len(projection) != 2:
-            raise ValueError("projection arg be a tuple like ('x', 'y')")
-        if 'x' in projection and 'y' in projection:
-            pass
-        elif 'x' in projection and 'z' in projection:
-            pass
-        elif 'y' in projection and 'z' in projection:
-            pass
-        else:
-            mssg = "projection must be a length 2 tuple of 'x', 'y' or 'z'!"
-            raise ValueError(mssg)
-
-        try:
-            assert(self.pt3d is True)
-        except AssertionError:
-            raise AssertionError('Cell keyword argument pt3d != True')
-        polygons = []
-        for i in range(len(self.x3d)):
-            polygons.append(self._create_polygon(i, projection))
-
-        return polygons
-
-    def _create_segment_polygon(self, i, projection=('x', 'z')):
-        """Create a polygon to fill for segment i, in the plane
-        determined by kwarg projection"""
-        x = [getattr(self, projection[0]+'start')[i],
-             getattr(self, projection[0]+'end')[i]]
-        z = [getattr(self, projection[1]+'start')[i],
-             getattr(self, projection[1]+'end')[i]]
-        #x = [self.xstart[i], self.xend[i]]
-        #z = [self.zstart[i], self.zend[i]]
-        d = self.diam[i]
-
-        #calculate angles
-        dx = np.diff(x)
-        dz = np.diff(z)
-        theta = np.arctan2(dz, dx)
-
-        x = np.r_[x, x[::-1]]
-        z = np.r_[z, z[::-1]]
-
-        #1st corner:
-        x[0] -= 0.5 * d * np.sin(theta)
-        z[0] += 0.5 * d * np.cos(theta)
-
-        #end of section, first side
-        x[1] -= 0.5 * d * np.sin(theta)
-        z[1] += 0.5 * d * np.cos(theta)
-
-        #other side
-        #end of section, second side
-        x[2] += 0.5 * d * np.sin(theta)
-        z[2] -= 0.5 * d * np.cos(theta)
-
-        #last corner:
-        x[3] += 0.5 * d * np.sin(theta)
-        z[3] -= 0.5 * d * np.cos(theta)
-
-        return x, z
-
-    def get_idx_polygons(self, projection=('x', 'z')):
-        """For each segment idx in cell create a polygon in the plane
-        determined by the projection kwarg (default ('x', 'z')),
-        that can be visualized using plt.fill() or
-        mpl.collections.PolyCollection
-        Parameters
-        ----------
-        projection : tuple of strings
-            Determining projection. Defaults to ('x', 'z')
-        Returns
-        -------
-        polygons : list
-            list of (ndarray, ndarray) tuples
-            giving the trajectory of each section
-        Examples
-        --------
-        The most efficient way of using this would be something like
-        >>> from matplotlib.collections import PolyCollection
-        >>> import matplotlib.pyplot as plt
-        >>> cell = LFPy.Cell(morphology='PATH/TO/MORPHOLOGY')
-        >>> zips = []
-        >>> for x, z in cell.get_idx_polygons(projection=('x', 'z')):
-        >>>     zips.append(zip(x, z))
-        >>> polycol = PolyCollection(zips,
-        >>>                          edgecolors='none',
-        >>>                          facecolors='gray')
-        >>> fig = plt.figure()
-        >>> ax = fig.add_subplot(111)
-        >>> ax.add_collection(polycol)
-        >>> ax.axis(ax.axis('equal'))
-        >>> plt.show()
-        """
-        if len(projection) != 2:
-            raise ValueError("projection arg be a tuple like ('x', 'y')")
-        if 'x' in projection and 'y' in projection:
-            pass
-        elif 'x' in projection and 'z' in projection:
-            pass
-        elif 'y' in projection and 'z' in projection:
-            pass
-        else:
-            mssg = "projection must be a length 2 tuple of 'x', 'y' or 'z'!"
-            raise ValueError(mssg)
-
-        polygons = []
-        for i in np.arange(self.totnsegs):
-            polygons.append(self._create_segment_polygon(i, projection))
-
-        return polygons
-
-    def insert_v_ext(self, v_ext, t_ext):
-        """Set external extracellular potential around cell.
-        Playback of some extracellular potential v_ext on each cell.totnseg
-        compartments. Assumes that the "extracellular"-mechanism is inserted
-        on each compartment.
-        Can be used to study ephaptic effects and similar
-        The inputs will be copied and attached to the cell object as
-        cell.v_ext, cell.t_ext, and converted
-        to (list of) neuron.h.Vector types, to allow playback into each
-        compartment e_extracellular reference.
-        Can not be deleted prior to running cell.simulate()
-        Parameters
-        ----------
-        v_ext : ndarray
-            Numpy array of size cell.totnsegs x t_ext.size, unit mV
-        t_ext : ndarray
-            Time vector of v_ext
-        Examples
-        --------
-        >>> import LFPy
-        >>> import numpy as np
-        >>> import matplotlib.pyplot as plt
-        >>> #create cell
-        >>> cell = LFPy.Cell(morphology='morphologies/example_morphology.hoc',
-        >>>                  passive=True)
-        >>> #time vector and extracellular field for every segment:
-        >>> t_ext = np.arange(cell.tstop / cell.dt+ 1) * cell.dt
-        >>> v_ext = np.random.rand(cell.totnsegs, t_ext.size)-0.5
-        >>> #insert potentials and record response:
-        >>> cell.insert_v_ext(v_ext, t_ext)
-        >>> cell.simulate(rec_imem=True, rec_vmem=True)
-        >>> fig = plt.figure()
-        >>> ax1 = fig.add_subplot(311)
-        >>> ax2 = fig.add_subplot(312)
-        >>> ax3 = fig.add_subplot(313)
-        >>> eim = ax1.matshow(np.array(cell.v_ext), cmap='spectral')
-        >>> cb1 = fig.colorbar(eim, ax=ax1)
-        >>> cb1.set_label('v_ext')
-        >>> ax1.axis(ax1.axis('tight'))
-        >>> iim = ax2.matshow(cell.imem, cmap='spectral')
-        >>> cb2 = fig.colorbar(iim, ax=ax2)
-        >>> cb2.set_label('imem')
-        >>> ax2.axis(ax2.axis('tight'))
-        >>> vim = ax3.matshow(cell.vmem, cmap='spectral')
-        >>> ax3.axis(ax3.axis('tight'))
-        >>> cb3 = fig.colorbar(vim, ax=ax3)
-        >>> cb3.set_label('vmem')
-        >>> ax3.set_xlabel('tstep')
-        >>> plt.show()
-        """
-
-        #test dimensions of input
-        try:
-            if v_ext.shape[0] != self.totnsegs:
-                raise ValueError("v_ext.shape[0] != cell.totnsegs")
-            if v_ext.shape[1] != t_ext.size:
-                raise ValueError('v_ext.shape[1] != t_ext.size')
-        except:
-            raise ValueError('v_ext, t_ext must both be np.array types')
-
-        if not self.extracellular:
-            raise Exception('LFPy.Cell arg extracellular != True')
-
-        #create list of extracellular potentials on each segment, time vector
-        self.t_ext = neuron.h.Vector(t_ext)
-        self.v_ext = []
-        for v in v_ext:
-            self.v_ext.append(neuron.h.Vector(v))
-        #play v_ext into e_extracellular reference
-        i = 0
-        for sec in self.allseclist:
-            for seg in sec:
-                self.v_ext[i].play(seg._ref_e_extracellular, self.t_ext)
-                i += 1
-
-        return
-
-    def get_axial_currents_from_vmem(self, timepoints=None):
-        """Compute axial currents from cell sim: get current magnitude,
-        distance vectors and position vectors.
-        Parameters
-        ----------
-        timepoints : ndarray, dtype=int
-            array of timepoints in simulation at which you want to compute
-            the axial currents. Defaults to False. If not given,
-            all simulation timesteps will be included.
-        Returns
-        -------
-        i_axial : ndarray, dtype=float
-            Shape ((cell.totnsegs-1)*2, len(timepoints)) array of axial current
-            magnitudes I in units of (nA) in cell at all timesteps in timepoints,
-            or at all timesteps of the simulation if timepoints=None.
-            Contains two current magnitudes per segment,
-            (except for the root segment): 1) the current from the mid point of
-            the segment to the segment start point, and 2) the current from
-            the segment start point to the mid point of the parent segment.
-        d_vectors : ndarray, dtype=float
-            Shape ((cell.totnsegs-1)*2, 3) array of distance vectors traveled by
-            each axial current in i_axial in units of (µm). The indices of the
-            first axis, correspond to the first axis of i_axial and pos_vectors.
-        pos_vectors : ndarray, dtype=float
-            Shape ((cell.totnsegs-1)*2, 3) array of position vectors pointing to
-            the mid point of each axial current in i_axial in units of (µm). The
-            indices of the first axis, correspond to the first axis
-            of i_axial and d_vectors.
-
-        Raises
-        ------
-        AttributeError
-            Raises an exeption if the cell.vmem attribute cannot be found
-        """
-        if not hasattr(self, 'vmem'):
-            raise AttributeError('no vmem, run cell.simulate(rec_vmem=True)')
-        i_axial = []
-        d_vectors = []
-        pos_vectors = []
-        dseg = np.c_[self.xmid - self.xstart,
-                     self.ymid - self.ystart,
-                     self.zmid - self.zstart]
-        dpar = np.c_[self.xend - self.xmid,
-                     self.yend - self.ymid,
-                     self.zend - self.zmid]
-
-        children_dict = self.get_dict_of_children_idx()
-        for sec in self.allseclist:
-            if not neuron.h.SectionRef(sec.name()).has_parent():
-                if sec.nseg == 1:
-                    # skip soma, since soma is an orphan
-                    continue
-                else:
-                    # the first segment has more than one segment,
-                    # need to compute axial currents within this section.
-                    seg_idx = 1
-                    parent_idx = 0
-                    bottom_seg = False
-                    first_sec = True
-                    branch = False
-                    parentsec = None
-                    children_dict = None
-                    connection_dict = None
-                    conn_point = 1
-            else:
-                # section has parent section
-                first_sec = False
-                bottom_seg = True
-                secref = neuron.h.SectionRef(sec.name())
-                parentseg = secref.parent()
-                parentsec = parentseg.sec
-                children_dict = self.get_dict_of_children_idx()
-                branch = len(children_dict[parentsec.name()]) > 1
-                connection_dict = self.get_dict_parent_connections()
-                conn_point = connection_dict[sec.name()]
-                # find parent index
-                if conn_point == 1 or parentsec.nseg == 1:
-                    internal_parent_idx = -1 # last seg in sec
-                elif conn_point == 0:
-                    internal_parent_idx = 0 # first seg in sec
-                else:
-                    # if parentseg is not first or last seg in parentsec
-                    segment_xlist = np.array([segment.x for segment in parentsec])
-                    internal_parent_idx = np.abs(segment_xlist - conn_point).argmin()
-                parent_idx = self.get_idx(section=parentsec.name())[internal_parent_idx]
-                # find segment index
-                seg_idx = self.get_idx(section=sec.name())[0]
-            for _ in sec:
-                if first_sec:
-                    first_sec = False
-                    continue
-                iseg, ipar = self._parent_and_segment_current(seg_idx,
-                                                              parent_idx,
-                                                              bottom_seg,
-                                                              branch,
-                                                              parentsec,
-                                                              children_dict,
-                                                              connection_dict,
-                                                              conn_point,
-                                                              timepoints
-                                                              )
-
-                if bottom_seg:
-                    # if a seg is connected to soma, it is
-                    # connected to the middle of soma,
-                    # and dpar needs to be altered.
-                    par_dist = np.array([(self.xstart[seg_idx] -
-                                        self.xmid[parent_idx]),
-                                        (self.ystart[seg_idx] -
-                                        self.ymid[parent_idx]),
-                                        (self.zstart[seg_idx] -
-                                        self.zmid[parent_idx])])
-
-                else:
-                    par_dist = dpar[parent_idx]
-                d_vectors.append(par_dist)
-                d_vectors.append(dseg[seg_idx])
-                i_axial.append(ipar)
-                i_axial.append(iseg)
-
-                pos_par = np.array([self.xstart[seg_idx],
-                                    self.ystart[seg_idx],
-                                    self.zstart[seg_idx]]) - 0.5*par_dist
-
-                pos_seg = np.array([self.xmid[seg_idx],
-                                    self.ymid[seg_idx],
-                                    self.zmid[seg_idx]]) - 0.5*dseg[seg_idx]
-                pos_vectors.append(pos_par)
-                pos_vectors.append(pos_seg)
-
-                parent_idx = seg_idx
-                seg_idx += 1
-                branch = False
-                bottom_seg = False
-                parent_ri = 0
-        return np.array(i_axial), np.array(d_vectors), np.array(pos_vectors)
-
-    def get_axial_resistance(self):
-        """
-        Return NEURON axial resistance for all cell compartments.
-        Returns
-        -------
-        ri_list : ndarray, dtype=float
-            Shape (cell.totnsegs, ) array containing neuron.h.ri(seg.x) in units
-            of (MOhm) for all segments in cell calculated using the
-            neuron.h.ri(seg.x) method. neuron.h.ri(seg.x) returns the
-            axial resistance from the middle of the segment to the middle of
-            the parent segment. Note: If seg is the first segment in a section,
-            i.e. the parent segment belongs to a different section or there is
-            no parent section, then neuron.h.ri(seg.x) returns the axial
-            resistance from the middle of the segment to the node connecting the
-            segment to the parent section (or a ghost node if there is no
-            parent)
-        """
-
-        ri_list = np.zeros(self.totnsegs)
-        comp = 0
-        for sec in self.allseclist:
-            for seg in sec:
-                ri_list[comp] = neuron.h.ri(seg.x)
-                comp += 1
-
-        return ri_list
-
-    def get_dict_of_children_idx(self):
-        """
-        Return dictionary with children segment indices for all sections.
-        Returns
-        -------
-        children_dict : dictionary
-            Dictionary containing a list for each section,
-            with the segment index of all the section's children.
-            The dictionary is needed to find the
-            sibling of a segment.
-        """
-        children_dict = {}
-        for sec in self.allseclist:
-            children_dict[sec.name()] = []
-            for child in neuron.h.SectionRef(sec.name()).child:
-                # add index of first segment of each child
-                children_dict[sec.name()].append(int(self.get_idx(
-                    section=child.name())[0]))
-
-        return children_dict
-
-    def get_dict_parent_connections(self):
-        """
-        Return dictionary with parent connection point for all sections.
-        Returns
-        -------
-        connection_dict : dictionary
-            Dictionary containing a float in range [0, 1] for each section
-            in cell. The float gives the location on the parent segment
-            to which the section is connected.
-            The dictionary is needed for computing axial currents.
-        """
-        connection_dict = {}
-        for sec in self.allseclist:
-            connection_dict[sec.name()] = neuron.h.parent_connection()
-        return connection_dict
-
-    def _parent_and_segment_current(self, seg_idx, parent_idx, bottom_seg,
-                                    branch=False, parentsec=None,
-                                    children_dict=None, connection_dict=None,
-                                    conn_point=1, timepoints=None):
-        """
-        Return axial current from segment (seg_idx) mid to segment start,
-        and current from parent segment (parent_idx) end to parent segment mid.
-        Parameters
-        ----------
-        seg_idx : int
-            Segment index
-        parent_idx : int
-            Parent index
-        parent_ri : float
-            Axial resistance from parent end to mid in units of (MΩ)
-        bottom_seg : boolean
-        branch : boolean
-        parentsec : neuron.Section object
-        timepoints : ndarray, dtype=int
-            array of timepoints in simulation at which you want to compute
-            the axial currents. Defaults to None. If not given,
-            all simulation timesteps will be included.
-        Returns
-        -------
-        iseg : dtype=float
-            Axial current in units of (nA)
-            from segment mid point to segment start point.
-        ipar : dtype=float
-            Axial current in units of (nA)
-            from parent segment end point to parent segment mid point.
-        """
-        # list of axial resistance between segments
-        ri_list = self.get_axial_resistance()
-        # axial resistance between segment mid and parent node
-        seg_ri = ri_list[seg_idx]
-        vmem = self.vmem
-        if timepoints is not None:
-            vmem = self.vmem[:,timepoints]
-        vpar = vmem[parent_idx]
-        vseg = vmem[seg_idx]
-        # if segment is the first in its section and it is connected to
-        # top or bottom of parent section, we need to find parent_ri explicitly
-        if bottom_seg and (conn_point == 0 or conn_point == 1):
-            if conn_point == 0:
-                parent_ri = ri_list[parent_idx]
-            else:
-                parent_ri = neuron.h.ri(0)
-            if not branch:
-                ri = parent_ri + seg_ri
-                iseg = (vpar - vseg) / ri
-                ipar = iseg
-            else:
-                # if branch, need to compute iseg and ipar separately
-                [sib_idcs] = np.take(children_dict[parentsec.name()],
-                                  np.where(children_dict[parentsec.name()]
-                                           != seg_idx))
-                sibs = [self.get_idx_name(sib_idcs)[i][1] for i in range(len(sib_idcs))]
-                # compute potential in branch point between parent and siblings
-                v_branch_num = vpar/parent_ri + vseg/seg_ri
-                v_branch_denom = 1./parent_ri + 1./seg_ri
-                for sib_idx, sib in zip(sib_idcs, sibs):
-                    sib_conn_point = connection_dict[sib]
-                    if sib_conn_point == conn_point:
-                        v_branch_num += vmem[sib_idx]/ri_list[sib_idx]
-                        v_branch_denom += 1./ ri_list[sib_idx]
-                v_branch = v_branch_num/v_branch_denom
-                iseg = (v_branch - vseg)/seg_ri
-                # set ipar=iseg
-                # only fraction of total current into parent is added per sibling
-                ipar = iseg
-        else:
-            iseg = (vpar - vseg) / seg_ri
-            ipar = iseg
-        return iseg, ipar
-
-    def distort_geometry(self, factor=0., axis='z', nu=0.0):
-        """
-        Distorts cellular morphology with a relative factor along a chosen axis
-        preserving Poisson's ratio. A ratio nu=0.5 assumes uncompressible and
-        isotropic media that embeds the cell. A ratio nu=0 will only affect
-        geometry along the chosen axis. A ratio nu=-1 will isometrically scale
-        the neuron geometry along each axis.
-        This method does not affect the underlying cable properties of the cell,
-        only predictions of extracellular measurements (by affecting the
-        relative locations of sources representing the compartments).
-        Parameters
-        ----------
-        factor : float
-            relative compression/stretching factor of morphology. Default is 0
-            (no compression/stretching). Positive values implies a compression
-            along the chosen axis.
-        axis : str
-            which axis to apply compression/stretching. Default is "z".
-        nu : float
-            Poisson's ratio. Ratio between axial and transversal
-            compression/stretching. Default is 0.
-        """
-        try:
-            assert(abs(factor) < 1.)
-        except AssertionError:
-            raise AssertionError('abs(factor) >= 1, factor must be in <-1, 1>')
-        try:
-            assert(axis in ['x', 'y', 'z'])
-        except AssertionError:
-            raise AssertionError('axis={} not "x", "y" or "z"'.format(axis))
-
-        for pos, dir_ in zip(self.somapos, 'xyz'):
-            geometry = np.c_[getattr(self, dir_+'start'),
-                             getattr(self, dir_+'mid'),
-                             getattr(self, dir_+'end')]
-            if dir_ == axis:
-                geometry -= pos
-                geometry *= (1. - factor)
-                geometry += pos
-            else:
-                geometry -= pos
-                geometry *= (1. + factor*nu)
-                geometry += pos
-
-            setattr(self, dir_+'start', geometry[:, 0])
-            setattr(self, dir_+'mid', geometry[:, 1])
-            setattr(self, dir_+'end', geometry[:, 2])
-
-        # recompute length of each segment
-        self.length = np.sqrt((self.xend - self.xstart)**2 +
-                              (self.yend - self.ystart)**2 +
-                              (self.zend - self.zstart)**2)
-
-    def get_multi_current_dipole_moments(self, timepoints=None):
-        '''
-        Return 3D current dipole moment vector and middle position vector
-        from each axial current in space.
-        Parameters
-        ----------
-        timepoints : ndarray, dtype=int
-            array of timepoints at which you want to compute
-            the current dipole moments. Defaults to None. If not given,
-            all simulation timesteps will be included.
-        Returns
-        -------
-        multi_dipoles : ndarray, dtype = float
-            Shape (n_axial_currents, n_timepoints, 3) array
-            containing the x-,y-,z-components of the current dipole moment
-            from each axial current in cell, at all timepoints.
-            The number of axial currents, n_axial_currents = (cell.totnsegs-1)*2
-            and the number of timepoints, n_timepoints = cell.tvec.size.
-            The current dipole moments are given in units of (nA µm).
-        pos_axial : ndarray, dtype = float
-            Shape (n_axial_currents, 3) array containing the x-, y-, and
-            z-components giving the mid position in space of each multi_dipole
-            in units of (µm).
-        Examples
-        --------
-        Get all current dipole moments and positions from all axial currents in a
-        single neuron simulation.
-        >>> import LFPy
-        >>> import numpy as np
-        >>> cell = LFPy.Cell('PATH/TO/MORPHOLOGY', extracellular=False)
-        >>> syn = LFPy.Synapse(cell, idx=cell.get_closest_idx(0,0,1000),
-        >>>                   syntype='ExpSyn', e=0., tau=1., weight=0.001)
-        >>> syn.set_spike_times(np.mgrid[20:100:20])
-        >>> cell.simulate(rec_vmem=True, rec_imem=False)
-        >>> timepoints = np.array([1,2,3,4])
-        >>> multi_dipoles, dipole_locs = cell.get_multi_current_dipole_moments(timepoints=timepoints)
-        '''
-        i_axial, d_axial, pos_axial = self.get_axial_currents_from_vmem(timepoints=timepoints)
-        Ni, Nt = i_axial.shape
-        multi_dipoles = np.array([i_axial[i][:, np.newaxis]*d_axial[i] for i in range(Ni)])
-
-        return multi_dipoles, pos_axial
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/eegmegcalc.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/eegmegcalc.py
deleted file mode 100644
index 99bfa09..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/eegmegcalc.py
+++ /dev/null
@@ -1,1437 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-Copyright (C) 2017 Computational Neuroscience Group, NMBU.
-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.
-"""
-
-from __future__ import division
-from scipy.special import eval_legendre, lpmv, legendre
-import numpy as np
-from warnings import warn
-
-
-class OneSphereVolumeConductor(object):
-    """
-    Computes extracellular potentials within and outside a spherical volume-
-    conductor model that assumes homogeneous, isotropic, linear (frequency
-    independent) conductivity in and outside the sphere with a radius R. The
-    conductivity in and outside the sphere must be greater than 0, and the
-    current source(s) must be located within the radius R.
-
-    The implementation is based on the description of electric potentials of
-    point charge in an dielectric sphere embedded in dielectric media, which is
-    mathematically equivalent to a current source in conductive media, as
-    published by Deng (2008), Journal of Electrostatics 66:549-560
-
-    Parameters
-    ----------
-    r : ndarray, dtype=float
-        shape(3, n_points) observation points in space in spherical coordinates
-        (radius, theta, phi) relative to the center of the sphere.
-    R : float
-        sphere radius (µm)
-    sigma_i : float
-        electric conductivity for radius r <= R (S/m)
-    sigma_o : float
-        electric conductivity for radius r > R (S/m)
-
-    Examples
-    --------
-    Compute the potential for a single monopole along the x-axis:
-
-    >>> # import modules
-    >>> from LFPy import OneSphereVolumeConductor
-    >>> import numpy as np
-    >>> import matplotlib.pyplot as plt
-    >>> # observation points in spherical coordinates (flattened)
-    >>> X, Y = np.mgrid[-15000:15100:1000., -15000:15100:1000.]
-    >>> r = np.array([np.sqrt(X**2 + Y**2).flatten(),
-    >>>               np.arctan2(Y, X).flatten(),
-    >>>               np.zeros(X.size)])
-    >>> # set up class object and compute electric potential in all locations
-    >>> sphere = OneSphereVolumeConductor(r, R=10000.,
-    >>>                                   sigma_i=0.3, sigma_o=0.03)
-    >>> Phi = sphere.calc_potential(rs=8000, I=1.).reshape(X.shape)
-    >>> # plot
-    >>> fig, ax = plt.subplots(1,1)
-    >>> im=ax.contourf(X, Y, Phi,
-    >>>              levels=np.linspace(Phi.min(), np.median(Phi[np.isfinite(Phi)])*4, 30))
-    >>> circle = plt.Circle(xy=(0,0), radius=sphere.R, fc='none', ec='k')
-    >>> ax.add_patch(circle)
-    >>> fig.colorbar(im, ax=ax)
-    >>> plt.show()
-    """
-    def __init__(self,
-                 r,
-                 R=10000.,
-                 sigma_i=0.3,
-                 sigma_o=0.03):
-        """initialize class OneSphereVolumeConductor"""
-        # check inputs
-        try:
-            assert(r.shape[0] == 3)
-            assert(r.ndim == 2)
-        except AssertionError as ae:
-            raise AssertionError('r must be a shape (3, n_points) ndarray')
-        try:
-            assert((type(R) is float) or (type(R) is int))
-        except AssertionError as ae:
-            raise AssertionError('sphere radius R must be a float value')
-        try:
-            assert((sigma_i > 0) & (sigma_o > 0))
-        except AssertionError as ae:
-            raise AssertionError('sigma_i and sigma_o must both be positive values')
-
-        self.r = r
-        self.R = R
-        self.sigma_i = sigma_i
-        self.sigma_o = sigma_o
-
-
-    def calc_potential(self, rs, I, min_distance=1., n_max=1000):
-        """
-        Return the electric potential at observation points for source current
-        with magnitude I as function of time.
-
-        Parameters
-        ----------
-        rs : float
-            monopole source location along the horizontal x-axis (µm)
-        I : float or ndarray, dtype float
-            float or shape (n_tsteps, ) array containing source current (nA)
-        min_distance : None or float
-            minimum distance between source location and observation point (µm)
-            (in order to avoid singular values)
-        n_max : int
-            Number of elements in polynomial expansion to sum over
-            (see Deng 2008).
-
-        Returns
-        -------
-        Phi : ndarray
-            shape (n-points, ) ndarray of floats if I is float like. If I is
-            an 1D ndarray, and shape (n-points, I.size) ndarray is returned.
-            Unit (mV).
-        """
-        try:
-            assert(type(rs) in [int, float, np.float64])
-            assert(abs(rs) < self.R)
-        except AssertionError as ae:
-            raise AssertionError('source location rs must be a float value and |rs| must be less than sphere radius R')
-        try:
-            assert((min_distance is None) or (type(min_distance) in [float, int, np.float64]))
-        except AssertionError:
-            raise AssertionError('min_distance must be None or a float')
-
-        r = self.r[0]
-        theta = self.r[1]
-
-
-        # add harmonical contributions due to inhomogeneous media
-        inds_i = r <= self.R
-        inds_o = r > self.R
-
-        # observation points r <= R
-        phi_i = np.zeros(r.size)
-        for j, (theta_i, r_i) in enumerate(zip(theta[inds_i], r[inds_i])):
-            coeffs_i = np.zeros(n_max)
-            for n in range(n_max):
-                coeffs_i[n] = ((self.sigma_i - self.sigma_o)*(n+1))  / (self.sigma_i*n + self.sigma_o*(n+1)) * ((r_i*rs)/self.R**2)**n
-            poly_i = np.polynomial.legendre.Legendre(coeffs_i)
-            phi_i[np.where(inds_i)[0][j]] = poly_i(np.cos(theta_i))
-        phi_i[inds_i] *= 1./self.R
-
-        # observation points r > R
-        phi_o = np.zeros(r.size)
-        for j, (theta_o, r_o) in enumerate(zip(theta[inds_o], r[inds_o])):
-            coeffs_o = np.zeros(n_max)
-            for n in range(n_max):
-                coeffs_o[n] = (self.sigma_i*(2*n+1) ) / (self.sigma_i*n + self.sigma_o*(n+1)) * (rs / r_o)**n
-            poly_o = np.polynomial.legendre.Legendre(coeffs_o)
-            phi_o[np.where(inds_o)[0][j]] = poly_o(np.cos(theta_o))
-        phi_o[inds_o] *= 1./r[inds_o]
-
-        # potential in homogeneous media
-        if min_distance is None:
-            phi_i[inds_i] += 1. / np.sqrt(r[r <= self.R]**2 + rs**2 - 2*r[inds_i]*rs*np.cos(theta[inds_i]))
-        else:
-            denom = np.sqrt(r[inds_i]**2 + rs**2 - 2*r[inds_i]*rs*np.cos(theta[inds_i]))
-            denom[denom < min_distance] = min_distance
-            phi_i[inds_i] += 1./denom
-
-
-
-        if type(I) is np.ndarray:
-            try:
-                assert(np.all(np.isfinite(I)))
-                assert(np.all(np.isreal(I)))
-                assert(I.ndim == 1)
-            except AssertionError:
-                raise AssertionError('input argument I must be float or 1D ndarray with float values')
-
-            return np.dot((phi_i + phi_o).reshape((1, -1)).T,
-                I.reshape((1, -1))) / (4.*np.pi*self.sigma_i)
-        else:
-            try:
-                assert(np.isfinite(I)) and (np.shape(I) == ())
-            except AssertionError:
-                raise AssertionError('input argument I must be float or 1D ndarray with float values')
-            return I / (4.*np.pi*self.sigma_i)*(phi_i + phi_o)
-
-
-    def calc_mapping(self, cell, n_max=1000):
-        """
-        Compute linear mapping between transmembrane currents of LFPy.Cell like
-        object instantiation and extracellular potential in and outside of
-        sphere. Cell position must be set in space, using the method
-        ``Cell.set_pos(**kwargs)``.
-
-        Parameters
-        ----------
-        cell : LFPy.Cell like instance
-            Instantiation of class LFPy.Cell, TemplateCell or NetworkCell.
-        n_max : int
-            Number of elements in polynomial expansion to sum over
-            (see Deng 2008).
-
-        Examples
-        --------
-        Compute extracellular potential in one-sphere volume conductor model
-        from LFPy.Cell object:
-
-        >>> # import modules
-        >>> import LFPy
-        >>> import os
-        >>> import numpy as np
-        >>> import matplotlib.pyplot as plt
-        >>> from matplotlib.collections import PolyCollection
-        >>> # create cell
-        >>> cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc'),
-        >>>                  tstop=10.)
-        >>> cell.set_pos(z=9800.)
-        >>> # stimulus
-        >>> syn = LFPy.Synapse(cell, idx=cell.totnsegs-1, syntype='Exp2Syn', weight=0.01)
-        >>> syn.set_spike_times(np.array([1.]))
-        >>> # simulate
-        >>> cell.simulate(rec_imem=True)
-        >>> # observation points in spherical coordinates (flattened)
-        >>> X, Z = np.mgrid[-500:501:10., 9500:10501:10.]
-        >>> Y = np.zeros(X.shape)
-        >>> r = np.array([np.sqrt(X**2 + Z**2).flatten(),
-        >>>               np.arccos(Z / np.sqrt(X**2 + Z**2)).flatten(),
-        >>>               np.arctan2(Y, X).flatten()])
-        >>> # set up class object and compute mapping between segment currents
-        >>> # and electric potential in space
-        >>> sphere = LFPy.OneSphereVolumeConductor(r=r, R=10000.,
-        >>>                                        sigma_i=0.3, sigma_o=0.03)
-        >>> mapping = sphere.calc_mapping(cell, n_max=1000)
-        >>> # pick out some time index for the potential and compute potential
-        >>> ind = cell.tvec==2.
-        >>> Phi = np.dot(mapping, cell.imem)[:, ind].reshape(X.shape)
-        >>> # plot potential
-        >>> fig, ax = plt.subplots(1,1)
-        >>> zips = []
-        >>> for x, z in cell.get_idx_polygons(projection=('x', 'z')):
-        >>>     zips.append(zip(x, z))
-        >>> polycol = PolyCollection(zips,
-        >>>                          edgecolors='none',
-        >>>                          facecolors='gray')
-        >>> vrange = 1E-3 # limits for color contour plot
-        >>> im=ax.contour(X, Z, Phi,
-        >>>              levels=np.linspace(-vrange, vrange, 41))
-        >>> circle = plt.Circle(xy=(0,0), radius=sphere.R, fc='none', ec='k')
-        >>> ax.add_collection(polycol)
-        >>> ax.add_patch(circle)
-        >>> ax.axis(ax.axis('equal'))
-        >>> ax.set_xlim(X.min(), X.max())
-        >>> ax.set_ylim(Z.min(), Z.max())
-        >>> fig.colorbar(im, ax=ax)
-        >>> plt.show()
-
-        Returns
-        -------
-        ndarray
-            Shape (n_points, n_compartments) mapping between individual
-            segments and extracellular potential in extracellular locations
-
-        Notes
-        -----
-        Each segment is treated as a point source in space. The minimum
-        source to measurement site distance will be set to the diameter of
-        each segment
-
-        """
-        # midpoint position of compartments in spherical coordinates
-        radius = np.sqrt(cell.xmid**2 + cell.ymid**2 + cell.zmid**2)
-        theta = np.arccos(cell.zmid/radius)
-        phi = np.arctan2(cell.ymid, cell.xmid)
-        diam = cell.diam
-
-        # since the sources must be located on the x-axis, we keep a copy
-        # of the unrotated coordinate system for the contact points:
-        r_orig = np.copy(self.r)
-
-        # unit current amplitude
-        I = 1.
-
-        # initialize mapping array
-        mapping = np.zeros((self.r.shape[1], radius.size))
-
-        # compute the mapping for each compartment
-        for i, (radius_i, theta_i, _, diam_i) in enumerate(zip(radius, theta, phi, diam)):
-            self.r = np.array([r_orig[0], # radius unchanged
-                               r_orig[1] - theta_i, # rotate relative to source location
-                               r_orig[2]]) # phi unchanged (don't enter equations)
-            mapping[:, i] = self.calc_potential(radius_i, I=I, min_distance=diam_i, n_max=n_max)
-
-        # reset measurement locations
-        self.r = r_orig
-
-        # return mapping between segment currents and contrib in each
-        # measurement location
-        return mapping
-
-
-class FourSphereVolumeConductor(object):
-    """
-    Main class for computing extracellular potentials in a four-sphere
-    volume conductor model that assumes homogeneous, isotropic, linear
-    (frequency independent) conductivity within the inner sphere and outer
-    shells. The conductance outside the outer shell is 0 (air).
-
-    Parameters
-    ----------
-    radii : list, dtype=float
-        Len 4 list with the outer radii in units of (µm) for the 4
-        concentric shells in the four-sphere model: brain, csf, skull and
-        scalp, respectively.
-    sigmas : list, dtype=float
-        Len 4 list with the electrical conductivity in units of (S/m) of
-        the four shells in the four-sphere model: brain, csf, skull and
-        scalp, respectively.
-    r_electrodes : ndarray, dtype=float
-        Shape (n_contacts, 3) array containing n_contacts electrode locations
-        in cartesian coordinates in units of (µm).
-        All ``r_el`` in ``r_electrodes`` must be less than or equal to scalp
-        radius and larger than the distance between dipole and sphere
-        center: ``|rz| < r_el <= radii[3]``.
-
-    Examples
-    --------
-    Compute extracellular potential from current dipole moment in four-sphere
-    head model:
-
-    >>> import LFPy
-    >>> import numpy as np
-    >>> radii = [79000., 80000., 85000., 90000.]
-    >>> sigmas = [0.3, 1.5, 0.015, 0.3]
-    >>> r = np.array([[0., 0., 90000.], [0., 85000., 0.]])
-    >>> rz = np.array([0., 0., 78000.])
-    >>> sphere_model = LFPy.FourSphereVolumeConductor(radii, sigmas, r)
-    >>> # current dipole moment
-    >>> p = np.array([[10., 10., 10.]]*10) # 10 timesteps
-    >>> # compute potential
-    >>> potential = sphere_model.calc_potential(p, rz)
-
-    """
-
-    def __init__(self, radii, sigmas, r_electrodes, iter_factor = 2./99.*1e-6):
-        """Initialize class FourSphereVolumeConductor"""
-        self.r1 = float(radii[0])
-        self.r2 = float(radii[1])
-        self.r3 = float(radii[2])
-        self.r4 = float(radii[3])
-
-        self.sigma1 = float(sigmas[0])
-        self.sigma2 = float(sigmas[1])
-        self.sigma3 = float(sigmas[2])
-        self.sigma4 = float(sigmas[3])
-
-        self.r12 = self.r1 / self.r2
-        self.r21 = self.r2 / self.r1
-        self.r23 = self.r2 / self.r3
-        self.r32 = self.r3 / self.r2
-        self.r34 = self.r3 / self.r4
-        self.r43 = self.r4 / self.r3
-
-        self.sigma12 = self.sigma1 / self.sigma2
-        self.sigma21 = self.sigma2 / self.sigma1
-        self.sigma23 = self.sigma2 / self.sigma3
-        self.sigma32 = self.sigma3 / self.sigma2
-        self.sigma34 = self.sigma3 / self.sigma4
-        self.sigma43 = self.sigma4 / self.sigma3
-
-        self.rxyz = r_electrodes
-        self.r = np.sqrt(np.sum(r_electrodes ** 2, axis=1))
-
-        self.iteration_stop_factor = iter_factor
-        self._check_params()
-
-    def _check_params(self):
-        """Check that radii, sigmas and r contain reasonable values"""
-        if (self.r1 < 0) or (self.r1 > self.r2) or (self.r2 > self.r3) or (self.r3 > self.r4):
-            raise RuntimeError('Radii of brain (radii[0]), CSF (radii[1]), '
-                               'skull (radii[2]) and scalp (radii[3]) '
-                               'must be positive ints or floats such that '
-                               '0 < radii[0] < radii[1] < radii[2] < radii[3].')
-
-        if (self.sigma1 < 0) or (self.sigma2 < 0) or (self.sigma3 < 0) or (self.sigma4 < 0):
-            raise RuntimeError('Conductivities (sigmas), must contain positive'
-                               ' ints or floats.')
-
-        if any(r > self.r4 for r in self.r):
-            raise ValueError('Electrode located outside head model.'
-                               'r > radii[3]. r = %s, r4 = %s',
-                               self.r, self.r4)
-
-    def _rz_params(self, rz):
-        """Define dipole location vector, and check that dipole is located in
-        the brain, closer to the center than any measurement location."""
-        self._rzloc = rz
-        self._rz = np.sqrt(np.sum(rz ** 2))
-        self._z = self._rzloc/self._rz
-        if self._rz == 0:
-            raise RuntimeError('Placing dipole in center of head model causes division by zero.')
-
-        self._rz1 = self._rz / self.r1
-
-        if self._rz1 >= 1:
-            raise RuntimeError('Dipole should be placed inside brain, i.e. |rz| < |r1|')
-
-        elif self._rz1 > 0.99999:
-            warn('Dipole should be placed minimum ~1µm away from brain surface, '
-                  'to avoid extremely slow convergence.')
-
-        elif self._rz1 > 0.9999:
-            warn('Computation time might be long due to slow convergence. '
-                 'Can be avoided by placing dipole further away from brain surface.')
-
-        if any(r < self._rz for r in self.r):
-            raise RuntimeError('Electrode must be farther away from '
-                               'brain center than dipole: r > rz.'
-                               'r = %s, rz = %s', self.r, self._rz)
-
-        # compute theta angle between rzloc and rxyz
-        self._theta = self.calc_theta()
-
-
-    def calc_potential(self, p, rz):
-        """
-        Return electric potential from current dipole moment p.
-
-        Parameters
-        ----------
-        p : ndarray, dtype=float
-            Shape (n_timesteps, 3) array containing the x,y,z components of the
-            current dipole moment in units of (nA*µm) for all timesteps.
-        rz : ndarray, dtype=float
-            Shape (3, ) array containing the position of the current dipole in
-            cartesian coordinates. Units of (µm).
-
-        Returns
-        -------
-        potential : ndarray, dtype=float
-            Shape (n_contacts, n_timesteps) array containing the electric
-            potential at contact point(s) FourSphereVolumeConductor.r in units
-            of (mV) for all timesteps of current dipole moment p.
-
-        """
-
-        self._rz_params(rz)
-        n_contacts = self.r.shape[0]
-        n_timesteps = p.shape[0]
-
-        if np.linalg.norm(p) != 0:
-            p_rad, p_tan = self._decompose_dipole(p)
-        else:
-            p_rad = np.zeros((n_timesteps, 3))
-            p_tan = np.zeros((n_timesteps, 3))
-        if np.linalg.norm(p_rad) != 0.:
-            pot_rad = self._calc_rad_potential(p_rad)
-        else:
-            pot_rad = np.zeros((n_contacts, n_timesteps))
-
-        if np.linalg.norm(p_tan) != 0.:
-            pot_tan = self._calc_tan_potential(p_tan)
-        else:
-            pot_tan = np.zeros((n_contacts, n_timesteps))
-
-        pot_tot = pot_rad + pot_tan
-        return pot_tot
-
-    def calc_potential_from_multi_dipoles(self, cell, timepoints=None):
-        """
-        Return electric potential from multiple current dipoles from cell.
-
-        By multiple current dipoles we mean the dipoles computed from all
-        axial currents in a neuron simulation, typically two
-        axial currents per compartment, except for the root compartment.
-
-        Parameters
-        ----------
-        cell : LFPy Cell object, LFPy.Cell
-        timepoints : ndarray, dtype=int
-            array of timepoints at which you want to compute
-            the electric potential. Defaults to None. If not given,
-            all simulation timesteps will be included.
-
-        Returns
-        -------
-        potential : ndarray, dtype=float
-            Shape (n_contacts, n_timesteps) array containing the electric
-            potential at contact point(s) electrode_locs in units
-            of (mV) for all timesteps of neuron simulation.
-
-        Examples
-        --------
-        Compute extracellular potential from neuron simulation in
-        four-sphere head model. Instead of simplifying the neural activity to
-        a single dipole, we compute the contribution from every multi dipole
-        from all axial currents in neuron simulation:
-
-        >>> import LFPy
-        >>> import numpy as np
-        >>> cell = LFPy.Cell('PATH/TO/MORPHOLOGY', extracellular=False)
-        >>> syn = LFPy.Synapse(cell, idx=cell.get_closest_idx(0,0,100),
-        >>>                   syntype='ExpSyn', e=0., tau=1., weight=0.001)
-        >>> syn.set_spike_times(np.mgrid[20:100:20])
-        >>> cell.simulate(rec_vmem=True, rec_imem=False)
-        >>> radii = [200., 300., 400., 500.]
-        >>> sigmas = [0.3, 1.5, 0.015, 0.3]
-        >>> electrode_locs = np.array([[50., -50., 250.]])
-        >>> timepoints = np.array([0,100])
-        >>> MD_4s = LFPy.FourSphereVolumeConductor(radii,
-        >>>                                        sigmas,
-        >>>                                        electrode_locs)
-        >>> phi = MD_4s.calc_potential_from_multi_dipoles(cell,
-        >>>                                               timepoints)
-        """
-        multi_p, multi_p_locs = cell.get_multi_current_dipole_moments(timepoints)
-        N_elec = self.rxyz.shape[0]
-        Ni, Nt, Nd = multi_p.shape
-        potential = np.zeros((N_elec, Nt))
-        for i in range(Ni):
-            pot = self.calc_potential(multi_p[i], multi_p_locs[i])
-            potential += pot
-        return potential
-
-    def _decompose_dipole(self, p):
-        """
-        Decompose current dipole moment vector in radial and tangential terms
-
-        Parameters
-        ----------
-        p : ndarray, dtype=float
-            Shape (n_timesteps, 3) array containing the x,y,z-components of the
-            current dipole moment in units of (nA*µm) for all timesteps
-
-        Returns:
-        -------
-        p_rad : ndarray, dtype=float
-            Shape (n_timesteps, 3) array, radial part of p, parallel to self._rz
-        p_tan : ndarray, dtype=float
-            Shape (n_timesteps, 3) array, tangential part of p,
-            orthogonal to self._rz
-        """
-        z_ = np.expand_dims(self._z, -1) # reshape z-axis vector
-        p_rad = np.dot(np.dot(p, z_), z_.T)
-        p_tan = p - p_rad
-        return p_rad, p_tan
-
-    def _calc_rad_potential(self, p_rad):
-        """
-        Return potential from radial dipole p_rad at location rz measured at r
-
-        Parameters
-        ----------
-        p_rad : ndarray, dtype=float
-            Shape (n_timesteps, 3) array, radial part of p
-            in units of (nA*µm), parallel to self._rz
-
-        Returns
-        -------
-        potential : ndarray, dtype=float
-            Shape (n_contacts, n_timesteps) array containing the extracecllular
-            potential at n_contacts contact point(s) FourSphereVolumeConductor.r
-            in units of (mV) for all timesteps of p_rad
-        """
-
-        p_tot = np.linalg.norm(p_rad, axis=1)
-        s_vector = self._sign_rad_dipole(p_rad)
-        phi_const = s_vector * p_tot / (4 * np.pi * self.sigma1 * self._rz ** 2)
-        n_terms = np.zeros((len(self.r), len(p_tot)))
-        for el_point in range(len(self.r)):
-            r_point = self.r[el_point]
-            theta_point = self._theta[el_point]
-            if r_point <= self.r1:
-                n_terms[el_point] = self._potential_brain_rad(r_point,
-                                                             theta_point)
-            elif r_point <= self.r2:
-                n_terms[el_point] = self._potential_csf_rad(r_point,
-                                                           theta_point)
-            elif r_point <= self.r3:
-                n_terms[el_point] = self._potential_skull_rad(r_point,
-                                                             theta_point)
-            else:
-                n_terms[el_point] = self._potential_scalp_rad(r_point,
-                                                             theta_point)
-        potential = phi_const * n_terms
-        return potential
-
-    def _calc_tan_potential(self, p_tan):
-        """
-        Return potential from tangential dipole P at location rz measured at r
-
-        Parameters
-        ----------
-        p_tan : ndarray, dtype=float
-            Shape (n_timesteps, 3) array, tangential part of p
-            in units of (nA*µm), orthogonal to self._rz
-
-        Returns
-        _______
-        potential : ndarray, dtype=float
-            Shape (n_contacts, n_timesteps) array containing the extracecllular
-            potential at n_contacts contact point(s) FourSphereVolumeConductor.r
-            in units of (mV) for all timesteps of p_tan
-        """
-        phi = self.calc_phi(p_tan)
-        p_tot = np.linalg.norm(p_tan, axis=1)
-        phi_hom = - p_tot / (4 * np.pi * self.sigma1 * self._rz ** 2) * np.sin(phi)
-        n_terms = np.zeros((len(self.r),1))
-        for el_point in range(len(self.r)):
-            r_point = self.r[el_point]
-            theta_point = self._theta[el_point]
-            # if r_electrode is orthogonal to p_tan, i.e. theta = 0 or theta = pi,
-            # there is no contribution to electric potential from p_tan
-            if (theta_point == 0.) or (theta_point == np.pi):
-                n_terms[el_point] = 0
-            elif r_point <= self.r1:
-                n_terms[el_point] = self._potential_brain_tan(r_point, theta_point)
-            elif r_point <= self.r2:
-                n_terms[el_point] = self._potential_csf_tan(r_point, theta_point)
-            elif r_point <= self.r3:
-                n_terms[el_point] = self._potential_skull_tan(r_point, theta_point)
-            else:
-                n_terms[el_point] = self._potential_scalp_tan(r_point, theta_point)
-        potential = n_terms * phi_hom
-
-        return potential
-
-    def calc_theta(self):
-        """
-        Return polar angle(s) between rzloc and contact point location(s)
-
-        Returns
-        -------
-        theta : ndarray, dtype=float
-            Shape (n_contacts, ) array containing polar angle
-            in units of (radians) between z-axis and n_contacts contact
-            point location vector(s) in FourSphereVolumeConductor.rxyz
-            z-axis is defined in the direction of rzloc and the radial dipole.
-        """
-        cos_theta = np.dot(self.rxyz, self._rzloc) / (np.linalg.norm(self.rxyz, axis=1) * np.linalg.norm(self._rzloc))
-        theta = np.arccos(cos_theta)
-        return theta
-
-    def calc_phi(self, p_tan):
-        """
-        Return azimuthal angle between x-axis and contact point locations(s)
-
-        Parameters
-        ----------
-        p_tan : ndarray, dtype=float
-            Shape (n_timesteps, 3) array containing
-            tangential component of current dipole moment in units of (nA*µm)
-
-        Returns
-        -------
-        phi : ndarray, dtype=float
-            Shape (n_contacts, n_timesteps) array containing azimuthal angle
-            in units of (radians) between x-axis vector(s) and projection of
-            contact point location vector(s) rxyz into xy-plane.
-            z-axis is defined in the direction of rzloc.
-            y-axis is defined in the direction of p_tan (orthogonal to rzloc).
-            x-axis is defined as cross product between p_tan and rzloc (x).
-        """
-
-        # project rxyz onto z-axis (rzloc)
-        proj_rxyz_rz = self.rxyz*self._z
-        # find projection of rxyz in xy-plane
-        rxy = self.rxyz - proj_rxyz_rz
-        # define x-axis
-        x = np.cross(p_tan, self._z)
-
-        phi = np.zeros((len(self.rxyz), len(p_tan)))
-        # create masks to avoid computing phi when phi is not defined
-        mask = np.ones(phi.shape, dtype=bool)
-        # phi is not defined when theta= 0,pi or |p_tan| = 0
-        mask[(self._theta == 0) | (self._theta == np.pi)] = np.zeros(len(p_tan))
-        mask[:,np.abs(np.linalg.norm(p_tan, axis=1)) == 0] = 0
-
-        cos_phi = np.zeros(phi.shape)
-        # compute cos_phi using mask to avoid zerodivision
-        cos_phi[mask] = np.dot(rxy, x.T)[mask] / np.outer(np.linalg.norm(rxy,
-                  axis=1), np.linalg.norm(x, axis=1))[mask]
-
-        # compute phi in [0, pi]
-        phi[mask] = np.arccos(cos_phi[mask])
-
-        # nb: phi in [-pi, pi]. since p_tan defines direction of y-axis,
-        # phi < 0 when rxy*p_tan < 0
-        phi[np.dot(rxy, p_tan.T) < 0] *= -1
-
-        return phi
-
-    def _sign_rad_dipole(self, p):
-        """
-        Determine whether radial dipoles are pointing inwards or outwards
-
-        Parameters
-        ----------
-        p : ndarray, dtype=float
-            Shape (n_timesteps, 3) array containing the current dipole moment
-             in cartesian coordinates for all n_timesteps in units of (nA*µm)
-
-        Returns
-        -------
-        sign_vector : ndarray
-            Shape (n_timesteps, ) array containing +/-1 for all
-            current dipole moments in p.
-            If radial part of p[i] points outwards, sign_vector[i] = 1.
-            If radial part of p[i] points inwards, sign_vector[i] = -1.
-
-        """
-        sign_vector = np.sign(np.dot(p, self._rzloc))
-        return sign_vector
-
-    def _potential_brain_rad(self, r, theta):
-        """
-        Return factor for calculation of potential in brain from rad. dipole
-
-        Parameters
-        ----------
-        r : float
-            Distance from origin to brain electrode location in units of (µm)
-        theta : float
-            Polar angle between brain electrode location and
-            dipole location vector rzloc in units of (radians)
-
-        Returns
-        -------
-        pot_sum : float
-            Summationfactor for calculation of electrical potential in brain
-            from radial current dipole moment. (unitless)
-        """
-        n = 1
-        const = 1.
-        coeff_sum = 0.
-        consts = []
-        # while const > self.iteration_stop_factor*coeff_sum:
-        while const > 2./99.*1e-12*coeff_sum:
-            c1n = self._calc_c1n(n)
-            const = n*(c1n * (r / self.r1) ** n + (self._rz / r) ** (n + 1))
-            coeff_sum += const
-            consts.append(const)
-            n += 1
-        consts = np.insert(consts, 0, 0) # since the legendre function starts with P0
-        leg_consts = np.polynomial.legendre.Legendre(consts)
-        pot_sum = leg_consts(np.cos(theta))
-        return pot_sum
-
-    def _potential_csf_rad(self, r, theta):
-        """
-        Return factor for calculation of potential in CSF from rad. dipole
-
-        Parameters
-        ----------
-        r : float
-            Distance from origin to CSF electrode location in units of (µm)
-        theta : float
-            Polar angle between CSF electrode location and
-            dipole location vector rzloc in units of (radians)
-
-        Returns
-        -------
-        pot_sum : float
-            Summation factor for calculation of electrical potential in CSF
-            from radial current dipole moment. (unitless)
-        """
-        n = 1
-        const = 1.
-        coeff_sum = 0.
-        consts = []
-        # while const > self.iteration_stop_factor*coeff_sum:
-        while const > 2./99.*1e-6*coeff_sum:
-            term1 = self._calc_csf_term1(n,r)
-            term2 = self._calc_csf_term2(n,r)
-            const = n*(term1 + term2)
-            coeff_sum += const
-            consts.append(const)
-            n += 1
-        consts = np.insert(consts, 0, 0) # since the legendre function starts with P0
-        leg_consts = np.polynomial.legendre.Legendre(consts)
-        pot_sum = leg_consts(np.cos(theta))
-        return pot_sum
-
-    def _potential_skull_rad(self, r, theta):
-        """
-        Return factor for calculation of potential in skull from rad. dipole
-
-        Parameters
-        ----------
-        r : float
-            Distance from origin to skull electrode location in units of (µm)
-        theta : float
-            Polar angle between skull electrode location and
-            dipole location vector rzloc in units of (radians)
-
-        Returns
-        -------
-        pot_sum : float
-            Summation factor for calculation of electrical potential in skull
-            from radial current dipole moment. (unitless)
-        """
-        n = 1
-        const = 1.
-        coeff_sum = 0.
-        consts = []
-        # while const > self.iteration_stop_factor*coeff_sum:
-        while const > 2./99.*1e-6*coeff_sum:
-            c3n = self._calc_c3n(n)
-            d3n = self._calc_d3n(n, c3n)
-            const = n*(c3n * (r / self.r3) ** n + d3n * (self.r3 / r) ** (n + 1))
-            coeff_sum += const
-            consts.append(const)
-            n += 1
-        consts = np.insert(consts, 0, 0) # since the legendre function starts with P0
-        leg_consts = np.polynomial.legendre.Legendre(consts)
-        pot_sum = leg_consts(np.cos(theta))
-        return pot_sum
-
-    def _potential_scalp_rad(self, r, theta):
-        """
-        Return factor for calculation of potential in scalp from radial dipole
-
-        Parameters
-        ----------
-        r : float
-            Distance from origin to scalp electrode location in units of (µm)
-        theta : float
-            Polar angle between scalp electrode location and
-            dipole location vector rzloc in units of (radians)
-
-        Returns
-        -------
-        pot_sum : float
-            Summation factor for calculation of electrical potential in scalp
-            from radial current dipole moment. (unitless)
-        """
-        n = 1
-        const = 1.
-        coeff_sum = 0.
-        consts = []
-        # while const > self.iteration_stop_factor*coeff_sum:
-        while const > 2./99.*1e-6*coeff_sum:
-            c4n = self._calc_c4n(n)
-            d4n = self._calc_d4n(n, c4n)
-            const = n*(c4n * (r / self.r4) ** n + d4n * (self.r4 / r) ** (n + 1))
-            coeff_sum += const
-            consts.append(const)
-            n += 1
-        consts = np.insert(consts, 0, 0) # since the legendre function starts with P0
-        leg_consts = np.polynomial.legendre.Legendre(consts)
-        pot_sum = leg_consts(np.cos(theta))
-        return pot_sum
-
-    def _potential_brain_tan(self, r, theta):
-        """
-        Return factor for calculation of potential in brain from tan. dipole
-
-        Parameters
-        ----------
-        r : float
-            Distance from origin to brain electrode location in units of (µm)
-        theta : float
-            Polar angle between brain electrode location and
-            dipole location vector rzloc in units of (radians)
-
-        Returns
-        -------
-        pot_sum : float
-            Summation factor for calculation of electrical potential in brain
-            from tangential current dipole moment. (unitless)
-        """
-        n = 1
-        const = 1.
-        coeff_sum = 0.
-        consts = []
-        while const > self.iteration_stop_factor*coeff_sum:
-            c1n = self._calc_c1n(n)
-            const = (c1n * (r / self.r1) ** n + (self._rz / r) ** (n + 1))
-            coeff_sum += const
-            consts.append(const)
-            n += 1
-        pot_sum = np.sum([c*lpmv(1, i, np.cos(theta)) for c,i in zip(consts,np.arange(1,n))])
-        return pot_sum
-
-    def _potential_csf_tan(self, r, theta):
-        """
-        Return factor for calculation of potential in CSF from tan. dipole
-
-        Parameters
-        ----------
-        r : float
-            Distance from origin to CSF electrode location in units of (µm)
-        theta : float
-            Polar angle between CSF electrode location and
-            dipole location vector rzloc in units of (radians)
-
-        Returns
-        -------
-        pot_sum : float
-            Summation factor for calculation of electrical potential in CSF
-            from tangential current dipole moment. (unitless)
-        """
-        n = 1
-        const = 1.
-        coeff_sum = 0.
-        consts = []
-        while const > self.iteration_stop_factor*coeff_sum:
-            term1 = self._calc_csf_term1(n,r)
-            term2 = self._calc_csf_term2(n,r)
-            const = term1 + term2
-            coeff_sum += const
-            consts.append(const)
-            n += 1
-        pot_sum = np.sum([c*lpmv(1, i, np.cos(theta)) for c,i in zip(consts,np.arange(1,n))])
-        return pot_sum
-
-    def _potential_skull_tan(self, r, theta):
-        """
-        Return factor for calculation of potential in skull from tan. dipole
-
-        Parameters
-        ----------
-        r : float
-            Distance from origin to skull electrode location in units of (µm)
-        theta : float
-            Polar angle between skull electrode location and
-            dipole location vector rzloc in units of (radians)
-
-        Returns
-        -------
-        pot_sum : float
-            Summation factor for calculation of electrical potential in skull
-            from tangential current dipole moment. (unitless)
-        """
-        n = 1
-        const = 1.
-        coeff_sum = 0.
-        consts = []
-        while const > self.iteration_stop_factor*coeff_sum:
-            c3n = self._calc_c3n(n)
-            d3n = self._calc_d3n(n, c3n)
-            const = c3n * (r / self.r3) ** n + d3n * (self.r3 / r) ** (n + 1)
-            coeff_sum += const
-            consts.append(const)
-            n += 1
-        pot_sum = np.sum([c*lpmv(1, i, np.cos(theta)) for c,i in zip(consts,np.arange(1,n))])
-        return pot_sum
-
-    def _potential_scalp_tan(self, r, theta):
-        """
-        Return factor for calculation of potential in scalp from tan. dipole
-
-        Parameters
-        ----------
-        r : float
-            Distance from origin to scalp electrode location in units of (µm)
-        theta : float
-            Polar angle between scalp electrode location and
-            dipole location vector rzloc in units of (radians)
-
-        Returns
-        -------
-        pot_sum : float
-            Summation factor for calculation of electrical potential in scalp
-            from tangential current dipole moment. (unitless)
-        """
-        n = 1
-        const = 1.
-        coeff_sum = 0.
-        consts = []
-        while const > self.iteration_stop_factor*coeff_sum:
-            c4n = self._calc_c4n(n)
-            d4n = self._calc_d4n(n, c4n)
-            const = c4n * (r / self.r4) ** n + d4n * (self.r4 / r) ** (n + 1)
-            coeff_sum += const
-            consts.append(const)
-            n += 1
-        pot_sum = np.sum([c*lpmv(1, i, np.cos(theta)) for c,i in zip(consts,np.arange(1,n))])
-        return pot_sum
-
-    def _calc_vn(self, n):
-        r_const = ((self.r34 ** (2*n + 1) - 1) /
-                  ((n + 1) / n * self.r34 ** (2*n + 1) + 1))
-        if self.sigma23 + r_const == 0.0:
-            v = 1e12
-        else:
-            v = (n / (n + 1) * self.sigma34 - r_const) / (self.sigma34 + r_const)
-        return v
-
-    def _calc_yn(self, n):
-        vn = self._calc_vn(n)
-        r_const = ((n / (n + 1) * self.r23 ** (2*n + 1) - vn) /
-                  (self.r23 ** (2*n + 1) + vn))
-        if self.sigma23 + r_const == 0.0:
-            y = 1e12
-        else:
-            y = (n / (n + 1) * self.sigma23 - r_const) / (self.sigma23 + r_const)
-        return y
-
-    def _calc_zn(self, n):
-        yn = self._calc_yn(n)
-        z = (self.r12 ** (2*n+1) - (n + 1) / n * yn) / (self.r12 ** (2*n+1) + yn)
-        return z
-
-    def _calc_c1n(self, n):
-        zn = self._calc_zn(n)
-        c1 = (((n + 1) / n * self.sigma12 + zn) / (self.sigma12 - zn) * self._rz1**(n+1))
-        return c1
-
-    def _calc_c2n(self, n):
-        yn = self._calc_yn(n)
-        c1 = self._calc_c1n(n)
-        c2 = ((c1 + self._rz1**(n+1)) * self.r12 ** (n + 1) /
-             (self.r12 ** (2 * n + 1) + yn))
-        return c2
-
-    def _calc_d2n(self, n, c2):
-        yn = self._calc_yn(n)
-        d2 = yn * c2
-        return d2
-
-    def _calc_c3n(self, n):
-        vn = self._calc_vn(n)
-        c2 = self._calc_c2n(n)
-        d2 = self._calc_d2n(n, c2)
-        c3 = (c2 + d2) * self.r23 ** (n + 1) / (self.r23 ** (2*n + 1) + vn)
-        return c3
-
-    def _calc_d3n(self, n, c3):
-        vn = self._calc_vn(n)
-        d3 = vn * c3
-        return d3
-
-    def _calc_c4n(self, n):
-        c3 = self._calc_c3n(n)
-        d3 = self._calc_d3n(n, c3)
-        c4 = ((n + 1) / n * self.r34 ** (n + 1) * (c3 + d3) /
-             ((n + 1) / n * self.r34 ** (2*n + 1) + 1))
-        return c4
-
-    def _calc_d4n(self, n, c4):
-        d4 = n / (n + 1) * c4
-        return d4
-
-    def _calc_csf_term1(self, n, r):
-        yn = self._calc_yn(n)
-        c1 = self._calc_c1n(n)
-        term1 = ((c1 + self._rz1 ** (n + 1)) * self.r12*((self.r1*r)/
-                (self.r2 ** 2)) **n / (self.r12**(2*n+1) + yn))
-        return term1
-
-    def _calc_csf_term2(self, n, r):
-        yn = self._calc_yn(n)
-        c1 = self._calc_c1n(n)
-        term2 = (yn*(c1 + self._rz1 ** (n + 1))/
-                (r/self.r2*((self.r1 * r) / self.r2**2) ** n +
-                (r / self.r1) ** (n+1)*yn))
-        return term2
-
-
-class InfiniteVolumeConductor(object):
-    """
-    Main class for computing extracellular potentials with current dipole
-    approximation in an infinite 3D volume conductor model that assumes
-    homogeneous, isotropic, linear (frequency independent) conductivity
-
-    Parameters
-    ----------
-    sigma : float
-        Electrical conductivity in extracellular space in units of (S/cm)
-
-    Examples
-    --------
-    Computing the potential from dipole moment valid in the far field limit.
-    Theta correspond to the dipole alignment angle from the vertical z-axis:
-
-    >>> import LFPy
-    >>> import numpy as np
-    >>> inf_model = LFPy.InfiniteVolumeConductor(sigma=0.3)
-    >>> p = np.array([[10., 10., 10.]])
-    >>> r = np.array([[1000., 0., 5000.]])
-    >>> phi_p = inf_model.get_dipole_potential(p, r)
-
-    """
-
-    def __init__(self, sigma=0.3):
-        "Initialize class InfiniteVolumeConductor"
-        self.sigma = sigma
-
-    def get_dipole_potential(self, p, r):
-        """
-        Return electric potential from current dipole with current dipole
-        approximation
-
-        p : ndarray, dtype=float
-            Shape (n_timesteps, 3) array containing the x,y,z components of the
-            current dipole moment in units of (nA*µm) for all timesteps
-        r : ndarray, dtype=float
-            Shape (n_contacts, 3) array contaning the displacement vectors
-            from dipole location to measurement location
-
-        Returns
-        -------
-        potential : ndarray, dtype=float
-            Shape (n_contacts, n_timesteps) array containing the electric
-            potential at contact point(s) FourSphereVolumeConductor.r in units
-            of (mV) for all timesteps of current dipole moment p
-
-        """
-        dotprod = np.dot(r, p.T)
-        r_factor = np.linalg.norm(r, axis=1)**3
-        phi = 1./(4*np.pi*self.sigma)*(dotprod.T/ r_factor).T
-        return phi
-
-    def get_multi_dipole_potential(self, cell, electrode_locs, timepoints=None):
-        """
-        Return electric potential from multiple current dipoles from cell
-
-        By multiple current dipoles we mean the dipoles computed from all
-        axial currents in a neuron simulation, typically two
-        axial currents per compartment, except for the root compartment.
-
-        Parameters
-        ----------
-        cell : Cell object from LFPy
-        electrode_locs : ndarray, dtype=float
-            Shape (n_contacts, 3) array containing n_contacts electrode
-            locations in cartesian coordinates in units of (µm).
-            All ``r_el`` in electrode_locs must be placed so that ``|r_el|`` is
-            less than or equal to scalp radius and larger than
-            the distance between dipole and sphere
-            center: ``|rz| < |r_el| <= radii[3]``.
-        timepoints : ndarray, dtype=int
-            array of timepoints at which you want to compute
-            the electric potential. Defaults to None. If not given,
-            all simulation timesteps will be included.
-
-        Returns
-        -------
-        potential : ndarray, dtype=float
-            Shape (n_contacts, n_timesteps) array containing the electric
-            potential at contact point(s) electrode_locs in units
-            of (mV) for all timesteps of neuron simulation
-
-        Examples
-        --------
-        Compute extracellular potential from neuron simulation in
-        four-sphere head model. Instead of simplifying the neural activity to
-        a single dipole, we compute the contribution from every multi dipole
-        from all axial currents in neuron simulation:
-
-        >>> import LFPy
-        >>> import numpy as np
-        >>> cell = LFPy.Cell('PATH/TO/MORPHOLOGY', extracellular=False)
-        >>> syn = LFPy.Synapse(cell, idx=cell.get_closest_idx(0,0,100),
-        >>>                   syntype='ExpSyn', e=0., tau=1., weight=0.001)
-        >>> syn.set_spike_times(np.mgrid[20:100:20])
-        >>> cell.simulate(rec_vmem=True, rec_imem=False)
-        >>> sigma = 0.3
-        >>> timepoints = np.array([10, 20, 50, 100])
-        >>> electrode_locs = np.array([[50., -50., 250.]])
-        >>> MD_INF = LFPy.InfiniteVolumeConductor(sigma)
-        >>> phi = MD_INF.get_multi_dipole_potential(cell, electrode_locs,
-        >>>                                         timepoints = timepoints)
-        """
-
-        multi_p, multi_p_locs = cell.get_multi_current_dipole_moments(timepoints=timepoints)
-        N_elec = electrode_locs.shape[0]
-        Ni, Nt, Nd = multi_p.shape
-        potentials = np.zeros((N_elec, Nt))
-        for i in range(Ni):
-            p = multi_p[i]
-            r = electrode_locs - multi_p_locs[i]
-            pot = self.get_dipole_potential(p, r)
-            potentials += pot
-        return potentials
-
-def get_current_dipole_moment(dist, current):
-    """
-    Return current dipole moment vector P and P_tot of cell.
-
-    Parameters
-    ----------
-    current : ndarray, dtype=float
-        Either an array containing all transmembrane currents
-        from all compartments of the cell, or an array of all
-        axial currents between compartments in cell in units of nA
-    dist : ndarray, dtype=float
-        When input current is an array of axial currents,
-        dist is the length of each axial current.
-        When current is an array of transmembrane
-        currents, dist is the position vector of each
-        compartment middle. Unit is (µm).
-
-    Returns
-    -------
-    P : ndarray, dtype=float
-        Array containing the current dipole moment for all
-        timesteps in the x-, y- and z-direction in units of (nA*µm)
-    P_tot : ndarray, dtype=float
-        Array containing the magnitude of the
-        current dipole moment vector for all timesteps in units of (nA*µm)
-
-    Examples
-    --------
-    Get current dipole moment vector and scalar moment from axial currents
-    computed from membrane potentials:
-
-    >>> import LFPy
-    >>> import numpy as np
-    >>> cell = LFPy.Cell('PATH/TO/MORPHOLOGY', extracellular=False)
-    >>> syn = LFPy.Synapse(cell, idx=cell.get_closest_idx(0,0,1000),
-    >>>                   syntype='ExpSyn', e=0., tau=1., weight=0.001)
-    >>> syn.set_spike_times(np.mgrid[20:100:20])
-    >>> cell.simulate(rec_vmem=True, rec_imem=False)
-    >>> d_list, i_axial = cell.get_axial_currents()
-    >>> P_ax, P_ax_tot = LFPy.get_current_dipole_moment(d_list, i_axial)
-
-    Get current dipole moment vector and scalar moment from transmembrane
-    currents using the extracellular mechanism in NEURON:
-
-    >>> import LFPy
-    >>> import numpy as np
-    >>> cell = LFPy.Cell('PATH/TO/MORPHOLOGY', extracellular=True)
-    >>> syn = LFPy.Synapse(cell, idx=cell.get_closest_idx(0,0,1000),
-    >>>                   syntype='ExpSyn', e=0., tau=1., weight=0.001)
-    >>> syn.set_spike_times(np.mgrid[20:100:20])
-    >>> cell.simulate(rec_vmem=False, rec_imem=True)
-    >>> P_imem, P_imem_tot = LFPy.get_current_dipole_moment(np.c_[cell.xmid,
-    >>>                                                          cell.ymid,
-    >>>                                                          cell.zmid],
-    >>>                                                    cell.imem)
-
-    """
-    P = np.dot(current.T, dist)
-    P_tot = np.sqrt(np.sum(P**2, axis=1))
-    return P, P_tot
-
-class MEG(object):
-    """
-    Basic class for computing magnetic field from current dipole moment.
-    For this purpose we use the Biot-Savart law derived from Maxwell's equations
-    under the assumption of negligible magnetic induction effects (Nunez and
-    Srinivasan, Oxford University Press, 2006):
-
-    .. math:: \mathbf{H} = \\frac{\\mathbf{p} \\times \\mathbf{R}}{4 \pi R^3}
-
-    where :math:`\mathbf{p}` is the current dipole moment, :math:`\mathbf{R}`
-    the vector between dipole source location and measurement location, and
-    :math:`R=|\mathbf{R}|`
-
-    Note that the magnetic field :math:`\mathbf{H}` is related to the magnetic
-    field :math:`\mathbf{B}` as :math:`\mu_0 \mathbf{H} = \mathbf{B}-\mathbf{M}`
-    where :math:`\mu_0` is the permeability of free space (very close to
-    permebility of biological tissues). :math:`\mathbf{M}` denotes material
-    magnetization (also ignored)
-
-
-    Parameters
-    ----------
-    sensor_locations : ndarray, dtype=float
-        shape (n_locations x 3) array with x,y,z-locations of measurement
-        devices where magnetic field of current dipole moments is calculated.
-        In unit of (µm)
-    mu : float
-        Permeability. Default is permeability of vacuum (mu_0 = 4*pi*1E-7 T*m/A)
-
-
-    Examples
-    --------
-    Define cell object, create synapse, compute current dipole moment:
-
-    >>> import LFPy, os, numpy as np, matplotlib.pyplot as plt
-    >>> cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc'),
-    >>>                  passive=True)
-    >>> cell.set_pos(0., 0., 0.)
-    >>> syn = LFPy.Synapse(cell, idx=0, syntype='ExpSyn', weight=0.01, record_current=True)
-    >>> syn.set_spike_times_w_netstim()
-    >>> cell.simulate(rec_current_dipole_moment=True)
-
-    Compute the dipole location as an average of segment locations weighted by membrane area:
-
-    >>> dipole_location = (cell.area * np.c_[cell.xmid, cell.ymid, cell.zmid].T / cell.area.sum()).sum(axis=1)
-
-    Instantiate the LFPy.MEG object, compute and plot the magnetic signal in a sensor location:
-
-    >>> sensor_locations = np.array([[1E4, 0, 0]])
-    >>> meg = LFPy.MEG(sensor_locations)
-    >>> H = meg.calculate_H(cell.current_dipole_moment, dipole_location)
-    >>> plt.subplot(311)
-    >>> plt.plot(cell.tvec, cell.somav)
-    >>> plt.subplot(312)
-    >>> plt.plot(cell.tvec, syn.i)
-    >>> plt.subplot(313)
-    >>> plt.plot(cell.tvec, H[0])
-
-    Raises
-    ------
-    AssertionError
-        If dimensionality of sensor_locations is wrong
-    """
-    def __init__(self, sensor_locations, mu=4*np.pi*1E-7):
-        """
-        Initialize class MEG
-        """
-        try:
-            assert(sensor_locations.ndim == 2)
-        except AssertionError:
-            raise AssertionError('sensor_locations.ndim != 2')
-        try:
-            assert(sensor_locations.shape[1] == 3)
-        except AssertionError:
-            raise AssertionError('sensor_locations.shape[1] != 3')
-
-        # set attributes
-        self.sensor_locations = sensor_locations
-        self.mu = mu
-
-
-    def calculate_H(self, current_dipole_moment, dipole_location):
-        """
-        Compute magnetic field H from single current-dipole moment localized
-        somewhere in space
-
-        Parameters
-        ----------
-        current_dipole_moment : ndarray, dtype=float
-            shape (n_timesteps x 3) array with x,y,z-components of current-
-            dipole moment time series data in units of (nA µm)
-        dipole_location : ndarray, dtype=float
-            shape (3, ) array with x,y,z-location of dipole in units of (µm)
-
-        Returns
-        -------
-        ndarray, dtype=float
-            shape (n_locations x n_timesteps x 3) array with x,y,z-components
-            of the magnetic field :math:`\\mathbf{H}` in units of (nA/µm)
-
-        Raises
-        ------
-        AssertionError
-            If dimensionality of current_dipole_moment and/or dipole_location
-            is wrong
-        """
-        try:
-            assert(current_dipole_moment.ndim == 2)
-        except AssertionError:
-            raise AssertionError('current_dipole_moment.ndim != 2')
-        try:
-            assert(current_dipole_moment.shape[1] == 3)
-        except AssertionError:
-            raise AssertionError('current_dipole_moment.shape[1] != 3')
-        try:
-            assert(dipole_location.shape == (3, ))
-        except AssertionError:
-            raise AssertionError('dipole_location.shape != (3, )')
-
-
-        # container
-        H = np.empty((self.sensor_locations.shape[0],
-                      current_dipole_moment.shape[0],
-                      3))
-        # iterate over sensor locations
-        for i, r in enumerate(self.sensor_locations):
-            R = r - dipole_location
-            assert(R.ndim==1 and R.size == 3)
-            try:
-                assert(np.allclose(R, np.zeros(3)) == False)
-            except AssertionError:
-                raise AssertionError('Identical dipole and sensor location.')
-            H[i, ] = np.cross(current_dipole_moment,
-                              R) / (4 * np.pi * np.sqrt((R**2).sum())**3)
-
-        return H
-
-
-    def calculate_H_from_iaxial(self, cell):
-        """
-        Computes the magnetic field in space from axial currents computed from
-        membrane potential values and axial resistances of multicompartment
-        cells.
-
-        See:
-        Blagoev et al. (2007) Modelling the magnetic signature of neuronal
-        tissue. NeuroImage 37 (2007) 137–148
-        DOI: 10.1016/j.neuroimage.2007.04.033
-
-        for details on the biophysics governing magnetic fields from axial
-        currents.
-
-        Parameters
-        ----------
-        cell : object
-            LFPy.Cell-like object. Must have attribute vmem containing recorded
-            membrane potentials in units of mV
-
-        Examples
-        --------
-        Define cell object, create synapse, compute current dipole moment:
-
-        >>> import LFPy, os, numpy as np, matplotlib.pyplot as plt
-        >>> cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc'),
-        >>>                  passive=True)
-        >>> cell.set_pos(0., 0., 0.)
-        >>> syn = LFPy.Synapse(cell, idx=0, syntype='ExpSyn', weight=0.01, record_current=True)
-        >>> syn.set_spike_times_w_netstim()
-        >>> cell.simulate(rec_vmem=True)
-
-        Instantiate the LFPy.MEG object, compute and plot the magnetic signal in a sensor location:
-
-        >>> sensor_locations = np.array([[1E4, 0, 0]])
-        >>> meg = LFPy.MEG(sensor_locations)
-        >>> H = meg.calculate_H_from_iaxial(cell)
-        >>> plt.subplot(311)
-        >>> plt.plot(cell.tvec, cell.somav)
-        >>> plt.subplot(312)
-        >>> plt.plot(cell.tvec, syn.i)
-        >>> plt.subplot(313)
-        >>> plt.plot(cell.tvec, H[0])
-
-        Returns
-        -------
-        H : ndarray, dtype=float
-            shape (n_locations x n_timesteps x 3) array with x,y,z-components
-            of the magnetic field :math:`\\mathbf{H}` in units of (nA/µm)
-        """
-        i_axial, d_vectors, pos_vectors = cell.get_axial_currents_from_vmem()
-        R = self.sensor_locations
-        H = np.zeros((R.shape[0], cell.tvec.size, 3))
-
-        for i, R_ in enumerate(R):
-            for i_, d_, r_ in zip(i_axial, d_vectors, pos_vectors):
-                r_rel = R_ - r_
-                H[i, :, :] += np.dot(i_.reshape((-1, 1)),
-                                     np.cross(d_, r_rel).reshape((1, -1))
-                                     ) / (4*np.pi*np.sqrt((r_rel**2).sum())**3)
-        return H
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/inputgenerators.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/inputgenerators.py
deleted file mode 100644
index 042f8f9..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/inputgenerators.py
+++ /dev/null
@@ -1,106 +0,0 @@
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import numpy as np
-import scipy.stats
-import warnings
-
-def get_activation_times_from_distribution(n, tstart=0., tstop=1.E6,
-                                          distribution=scipy.stats.expon,
-                                          rvs_args=dict(loc=0, scale=1),
-                                          maxiter=1E6):
-    """
-    Construct a length n list of ndarrays containing continously increasing
-    random numbers on the interval [tstart, tstop], with intervals drawn from
-    a chosen continuous random variable distribution subclassed from
-    scipy.stats.rv_continous, e.g., scipy.stats.expon or scipy.stats.gamma.
-    
-    The most likely initial first entry is
-    ``tstart + method.rvs(size=inf, **rvs_args).mean()``
-    
-    Parameters
-    ----------
-    n : int
-        number of ndarrays in list
-    tstart : float
-        minimum allowed value in ndarrays
-    tstop : float
-        maximum allowed value in ndarrays
-    distribution : object
-        subclass of scipy.stats.rv_continous. Distributions
-        producing negative values should be avoided if continously increasing
-        values should be obtained, i.e., the probability density function
-        ``(distribution.pdf(**rvs_args))`` should be ``0`` for ``x < 0``, but this is not
-        explicitly tested for.
-    rvs_args : dict
-        parameters for method.rvs method. If "size" is in dict, then tstop will
-        be ignored, and each ndarray in output list will be
-        ``distribution.rvs(**rvs_args).cumsum() + tstart``. If size is not given in dict,
-        then values up to tstop will be included
-    maxiter : int
-        maximum number of iterations
-        
-        
-    Returns
-    -------
-    list of ndarrays
-        length n list of arrays containing data
-    
-    Raises
-    ------
-    AssertionError
-        if distribution does not have the 'rvs' attribute
-    StopIteration
-        if number of while-loop iterations reaches maxiter
-    
-    
-    Examples
-    --------
-    Create n sets of activation times with intervals drawn from the exponential
-    distribution, with rate expectation lambda 10 s^-1 (thus
-    scale=1000 / lambda). Here we assume output in units of ms
-    
-    >>> from LFPy.inputgenerators import get_activation_times_from_distribution
-    >>> import scipy.stats as st
-    >>> import matplotlib.pyplot as plt
-    >>> times = get_activation_times_from_distribution(n=10, tstart=0., tstop=1000.,
-    >>>                                             distribution=st.expon,
-    >>>                                             rvs_args=dict(loc=0.,
-    >>>                                                           scale=100.))
-    """
-    try:
-        assert hasattr(distribution, 'rvs')
-    except AssertionError:
-        raise AssertionError('distribution={} must have the attribute "rvs"'.format(distribution))
-    
-    times = []
-    if 'size' in rvs_args.keys():
-        for i in range(n):
-            times += [distribution.rvs(**rvs_args).cumsum() + tstart]
-    else:
-        for i in range(n):
-            values = distribution.rvs(size=1000, **rvs_args).cumsum() + tstart
-            iter = 0
-            while values[-1] < tstop and iter < maxiter:
-                values = np.r_[values, distribution.rvs(size=1000, **rvs_args).cumsum() + values[-1]]
-                iter += 1
-            
-            if iter == maxiter:
-                raise StopIteration('maximum number of iterations reach. Con')            
-            
-            times += [values[values < tstop]]
-    
-    return times
-
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/lfpcalc.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/lfpcalc.py
deleted file mode 100644
index 716088f..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/lfpcalc.py
+++ /dev/null
@@ -1,847 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import numpy as np
-
-
-def return_dist_from_segments(xstart, ystart, zstart, xend, yend, zend, p):
-    """
-    Returns distance and closest point on line segments from point p
-    """
-    px = xend-xstart
-    py = yend-ystart
-    pz = zend-zstart
-
-    delta = px*px + py*py + pz*pz
-    u = ((p[0] - xstart) * px + (p[1] - ystart) * py + (p[2] - zstart) * pz) / delta
-    u[u > 1] = 1.0
-    u[u < 0] = 0.0
-
-    closest_point = np.array([xstart + u * px,
-                              ystart + u * py,
-                              zstart + u * pz])
-    dist = np.sqrt(np.sum((closest_point.T - p)**2, axis=1))
-    return dist, closest_point
-
-
-def calc_lfp_linesource_anisotropic(cell, x, y, z, sigma, r_limit):
-    """Calculate electric field potential using the line-source method, all
-    compartments treated as line sources, even soma.
-
-    Parameters
-    ----------
-    cell: obj
-        LFPy.Cell or LFPy.TemplateCell instance
-    x : float
-        extracellular position, x-axis
-    y : float
-        extracellular position, y-axis
-    z : float
-        extracellular position, z-axis
-    sigma : array
-        extracellular conductivity [sigma_x, sigma_y, sigma_z]
-    r_limit : np.ndarray
-        minimum distance to source current for each compartment
-    """
-
-    #some variables for h, r2, r_soma calculations
-    xstart = cell.xstart
-    xend = cell.xend
-    ystart = cell.ystart
-    yend = cell.yend
-    zstart = cell.zstart
-    zend = cell.zend
-    l_vecs = np.array([xend - xstart,
-                      yend - ystart,
-                      zend - zstart])
-
-    pos = np.array([x, y, z])
-
-    rs, closest_points = return_dist_from_segments(xstart, ystart, zstart,
-                                                   xend, yend, zend, pos)
-
-    dx2 = (xend - xstart)**2
-    dy2 = (yend - ystart)**2
-    dz2 = (zend - zstart)**2
-    a = (sigma[1] * sigma[2] * dx2 +
-         sigma[0] * sigma[2] * dy2 +
-         sigma[0] * sigma[1] * dz2)
-
-    b = -2 * (sigma[1] * sigma[2] * (x - xstart) * (xend - xstart) +
-              sigma[0] * sigma[2] * (y - ystart) * (yend - ystart) +
-              sigma[0] * sigma[1] * (z - zstart) * (zend - zstart))
-    c = (sigma[1] * sigma[2] * (x - xstart)**2 +
-         sigma[0] * sigma[2] * (y - ystart)**2 +
-         sigma[0] * sigma[1] * (z - zstart)**2)
-
-    for idx in np.where(rs < r_limit)[0]:
-        r, closest_point, l_vec = rs[idx], closest_points[:, idx], l_vecs[:, idx]
-
-        p_ = pos.copy()
-        if np.abs(r) < 1e-12:
-            if np.abs(l_vec[0]) < 1e-12:
-                p_[0] += r_limit[idx]
-            elif np.abs(l_vec[1]) < 1e-12:
-                p_[1] += r_limit[idx]
-            elif np.abs(l_vec[2]) < 1e-12:
-                p_[2] += r_limit[idx]
-            else:
-                displace_vec = np.array([-l_vec[1], l_vec[0], 0])
-                displace_vec = displace_vec / np.sqrt(np.sum(displace_vec**2)) * r_limit[idx]
-                p_[:] += displace_vec
-        else:
-            p_[:] = pos + (pos - closest_point) * (r_limit[idx] - r) / r
-
-        if np.sqrt(np.sum((p_ - closest_point)**2)) - r_limit[idx] > 1e-9:
-            print(p_, closest_point)
-
-            raise RuntimeError("Segment adjustment not working")
-
-        b[idx] = -2 * (sigma[1] * sigma[2] * (p_[0] - xstart[idx]) * (xend[idx] - xstart[idx]) +
-                   sigma[0] * sigma[2] * (p_[1] - ystart[idx]) * (yend[idx] - ystart[idx]) +
-                   sigma[0] * sigma[1] * (p_[2] - zstart[idx]) * (zend[idx] - zstart[idx]))
-        c[idx] = (sigma[1] * sigma[2] * (p_[0] - xstart[idx])**2 +
-              sigma[0] * sigma[2] * (p_[1] - ystart[idx])**2 +
-              sigma[0] * sigma[1] * (p_[2] - zstart[idx])**2)
-
-    [i] = np.where(np.abs(b) <= 1e-6)
-    [iia] = np.where(np.bitwise_and(np.abs(4 * a * c - b*b) < 1e-6, np.abs(a - c) < 1e-6))
-    [iib] = np.where(np.bitwise_and(np.abs(4 * a * c - b*b) < 1e-6, np.abs(a - c) >= 1e-6))
-    [iii] = np.where(np.bitwise_and(4 * a * c - b*b < -1e-6, np.abs(b) > 1e-6))
-    [iiii] = np.where(np.bitwise_and(4 * a * c - b*b > 1e-6, np.abs(b) > 1e-6))
-
-    if len(i) + len(iia) + len(iib) + len(iii) + len(iiii) != cell.totnsegs:
-        print(a, b, c)
-        print(i, iia, iib, iii, iiii)
-        raise RuntimeError
-
-    mapping = np.zeros(cell.totnsegs)
-    mapping[i] = _anisotropic_line_source_case_i(a[i], c[i])
-    mapping[iia] = _anisotropic_line_source_case_iia(a[iia], c[iia])
-    mapping[iib] = _anisotropic_line_source_case_iib(a[iib], b[iib], c[iib])
-    mapping[iii] = _anisotropic_line_source_case_iii(a[iii], b[iii], c[iii])
-    mapping[iiii] = _anisotropic_line_source_case_iiii(a[iiii], b[iiii], c[iiii])
-
-    if np.isnan(mapping).any():
-        raise RuntimeError("NaN")
-
-    return 1 / (4 * np.pi) * mapping / np.sqrt(a)
-
-
-def calc_lfp_soma_as_point_anisotropic(cell, x, y, z, sigma, r_limit):
-    """Calculate electric field potential, soma is treated as point source, all
-    compartments except soma are treated as line sources.
-
-    Parameters
-    ----------
-    cell: obj
-        LFPy.Cell or LFPy.TemplateCell instance
-    x : float
-        extracellular position, x-axis
-    y : float
-        extracellular position, y-axis
-    z : float
-        extracellular position, z-axis
-    sigma : array
-        extracellular conductivity [sigma_x, sigma_y, sigma_z]
-    r_limit : np.ndarray
-        minimum distance to source current for each compartment
-    """
-
-    xstart = cell.xstart
-    xend = cell.xend
-    ystart = cell.ystart
-    yend = cell.yend
-    zstart = cell.zstart
-    zend = cell.zend
-    l_vecs = np.array([xend - xstart, yend - ystart, zend - zstart])
-
-    pos = np.array([x, y, z])
-
-    rs, closest_points = return_dist_from_segments(xstart, ystart, zstart, xend, yend, zend, pos)
-
-    dx2 = (xend - xstart)**2
-    dy2 = (yend - ystart)**2
-    dz2 = (zend - zstart)**2
-    a = (sigma[1] * sigma[2] * dx2 +
-         sigma[0] * sigma[2] * dy2 +
-         sigma[0] * sigma[1] * dz2)
-
-    b = -2 * (sigma[1] * sigma[2] * (x - xstart) * (xend - xstart) +
-              sigma[0] * sigma[2] * (y - ystart) * (yend - ystart) +
-              sigma[0] * sigma[1] * (z - zstart) * (zend - zstart))
-    c = (sigma[1] * sigma[2] * (x - xstart)**2 +
-         sigma[0] * sigma[2] * (y - ystart)**2 +
-         sigma[0] * sigma[1] * (z - zstart)**2)
-
-    for idx in np.where(rs < r_limit)[0]:
-        r, closest_point, l_vec = rs[idx], closest_points[:, idx], l_vecs[:, idx]
-
-        p_ = pos.copy()
-        if np.abs(r) < 1e-12:
-            if np.abs(l_vec[0]) < 1e-12:
-                p_[0] += r_limit[idx]
-            elif np.abs(l_vec[1]) < 1e-12:
-                p_[1] += r_limit[idx]
-            elif np.abs(l_vec[2]) < 1e-12:
-                p_[2] += r_limit[idx]
-            else:
-                displace_vec = np.array([-l_vec[1], l_vec[0], 0])
-                displace_vec = displace_vec / np.sqrt(np.sum(displace_vec**2)) * r_limit[idx]
-                p_[:] += displace_vec
-        else:
-            p_[:] = pos + (pos - closest_point) * (r_limit[idx] - r) / r
-
-        if np.sqrt(np.sum((p_ - closest_point)**2)) - r_limit[idx] > 1e-9:
-            print(p_, closest_point)
-
-            raise RuntimeError("Segment adjustment not working")
-
-        b[idx] = -2 * (sigma[1] * sigma[2] * (p_[0] - xstart[idx]) * (xend[idx] - xstart[idx]) +
-                   sigma[0] * sigma[2] * (p_[1] - ystart[idx]) * (yend[idx] - ystart[idx]) +
-                   sigma[0] * sigma[1] * (p_[2] - zstart[idx]) * (zend[idx] - zstart[idx]))
-        c[idx] = (sigma[1] * sigma[2] * (p_[0] - xstart[idx])**2 +
-              sigma[0] * sigma[2] * (p_[1] - ystart[idx])**2 +
-              sigma[0] * sigma[1] * (p_[2] - zstart[idx])**2)
-
-    [i] = np.where(np.abs(b) <= 1e-6)
-    [iia] = np.where(np.bitwise_and(np.abs(4 * a * c - b*b) < 1e-6, np.abs(a - c) < 1e-6))
-    [iib] = np.where(np.bitwise_and(np.abs(4 * a * c - b*b) < 1e-6, np.abs(a - c) >= 1e-6))
-    [iii] = np.where(np.bitwise_and(4 * a * c - b*b < -1e-6, np.abs(b) > 1e-6))
-    [iiii] = np.where(np.bitwise_and(4 * a * c - b*b > 1e-6, np.abs(b) > 1e-6))
-
-    if len(i) + len(iia) + len(iib) + len(iii) + len(iiii) != cell.totnsegs:
-        print(a, b, c)
-        print(i, iia, iib, iii, iiii)
-        raise RuntimeError
-
-    mapping = np.zeros(cell.totnsegs)
-    mapping[i] = _anisotropic_line_source_case_i(a[i], c[i])
-    mapping[iia] = _anisotropic_line_source_case_iia(a[iia], c[iia])
-    mapping[iib] = _anisotropic_line_source_case_iib(a[iib], b[iib], c[iib])
-    mapping[iii] = _anisotropic_line_source_case_iii(a[iii], b[iii], c[iii])
-    mapping[iiii] = _anisotropic_line_source_case_iiii(a[iiii], b[iiii], c[iiii])
-
-    if np.isnan(mapping).any():
-        raise RuntimeError("NaN")
-
-    mapping /= np.sqrt(a)
-
-    # Get compartment indices for somatic compartments (to be treated as point
-    # sources)
-    try:
-        somainds = cell.get_idx("soma")
-    except Exception:
-        raise Exception('Call {}.get_idx("soma") failed in method LFPy.lfpcalc.calc_lfp_soma_as_point'.format(cell))
-    
-    dx2_soma = (cell.xmid[somainds] - x)**2
-    dy2_soma = (cell.ymid[somainds] - y)**2
-    dz2_soma = (cell.zmid[somainds] - z)**2
-
-    r2_soma = dx2_soma + dy2_soma + dz2_soma
-
-    # Go through and correct all (if any) somatic idxs that are too close
-    for close_idx in np.where(np.abs(r2_soma) < 1e-6)[0]:
-        dx2_soma[close_idx] += 0.001
-        r2_soma[close_idx] += 0.001
-
-    for close_idx in np.where(r2_soma < r_limit[somainds]**2)[0]:
-        # For anisotropic media, the direction in which to move points matter.
-        # Radial distance between point source and electrode is scaled to r_limit
-        r2_scale_factor = r_limit[somainds[close_idx]]*r_limit[somainds[close_idx]] / r2_soma[close_idx]
-        dx2_soma[close_idx] *= r2_scale_factor
-        dy2_soma[close_idx] *= r2_scale_factor
-        dz2_soma[close_idx] *= r2_scale_factor
-
-    mapping[somainds] = 1/np.sqrt(sigma[1] * sigma[2] * dx2_soma
-                    + sigma[0] * sigma[2] * dy2_soma
-                    + sigma[0] * sigma[1] * dz2_soma)
-
-    return 1. / (4 * np.pi) * mapping
-
-
-def _anisotropic_line_source_case_i(a, c):
-    return np.log(np.sqrt(a / c) + np.sqrt(a / c + 1))
-
-
-def _anisotropic_line_source_case_iia(a, c):
-    return np.log(np.abs(1 + np.sqrt(a / c)))
-
-
-def _anisotropic_line_source_case_iib(a, b, c):
-    return np.abs(np.log(np.abs(np.sign(b) * np.sqrt(a/c) + 1)))
-
-
-def _anisotropic_line_source_case_iii(a, b, c):
-    return np.log(np.abs((2 * a + b + 2 * np.sqrt(a * (a + b + c)))
-                        / (b + 2 * np.sqrt(a * c))))
-
-
-def _anisotropic_line_source_case_iiii(a, b, c):
-    return (np.arcsinh((2 * a + b) / np.sqrt(4 * a * c - b*b)) -
-                        np.arcsinh(b / np.sqrt(4 * a * c - b*b)))
-
-
-def calc_lfp_linesource(cell, x, y, z, sigma, r_limit):
-
-    """Calculate electric field potential using the line-source method, all
-    compartments treated as line sources, including soma.
-    
-    Parameters
-    ----------        
-    cell: obj
-        LFPy.Cell or LFPy.TemplateCell like instance
-    x : float
-        extracellular position, x-axis
-    y : float
-        extracellular position, y-axis
-    z : float
-        extracellular position, z-axis
-    sigma : float
-        extracellular conductivity
-    r_limit : np.ndarray
-        minimum distance to source current for each compartment
-    """
-
-    #some variables for h, r2, r_soma calculations
-    xstart = cell.xstart
-    xend = cell.xend
-    ystart = cell.ystart
-    yend = cell.yend
-    zstart = cell.zstart
-    zend = cell.zend
-    
-    deltaS = _deltaS_calc(xstart, xend, ystart, yend, zstart, zend)
-    h = _h_calc(xstart, xend, ystart, yend, zstart, zend, deltaS, x, y, z)
-    r2 = _r2_calc(xend, yend, zend, x, y, z, h)
-
-    too_close_idxs = np.where(r2 < r_limit*r_limit)[0]
-    r2[too_close_idxs] = r_limit[too_close_idxs]**2
-    l = h + deltaS
-    hnegi = h < 0
-    hposi = h >= 0
-    lnegi = l < 0
-    lposi = l >= 0
-
-    mapping = np.zeros(len(cell.xstart))
-
-    #case i, h < 0, l < 0
-    [i] = np.where(hnegi & lnegi)
-    #case ii, h < 0, l >= 0
-    [ii] = np.where(hnegi & lposi)
-    #case iii, h >= 0, l >= 0
-    [iii] = np.where(hposi & lposi)
-
-
-    mapping[i] = _linesource_calc_case1(l[i], r2[i], h[i])
-    mapping[ii] = _linesource_calc_case2(l[ii], r2[ii], h[ii])
-    mapping[iii] = _linesource_calc_case3(l[iii], r2[iii], h[iii])
-    return 1 / (4 * np.pi * sigma * deltaS) * mapping
-
-
-def calc_lfp_soma_as_point(cell, x, y, z, sigma, r_limit):
-
-    """Calculate electric field potential using the line-source method,
-    soma is treated as point/sphere source
-    
-    Parameters
-    ----------
-    cell: obj
-        `LFPy.Cell` or `LFPy.TemplateCell` like instance
-    x : float
-        extracellular position, x-axis
-    y : float
-        extracellular position, y-axis
-    z : float
-        extracellular position, z-axis
-    sigma : float
-        extracellular conductivity in S/m
-    r_limit : np.ndarray
-        minimum distance to source current for each compartment.
-    """
-    # get compartment indices for somatic compartments (to be treated as point
-    # sources)
-    try:
-        somainds = cell.get_idx("soma")
-    except Exception:
-        raise Exception('Call {}.get_idx("soma") failed in method LFPy.lfpcalc.calc_lfp_soma_as_point'.format(cell))
-
-    #some variables for h, r2, r_soma calculations
-    xstart = cell.xstart
-    xmid = cell.xmid[somainds]
-    xend = cell.xend
-    ystart = cell.ystart
-    ymid = cell.ymid[somainds]
-    yend = cell.yend
-    zstart = cell.zstart
-    zmid = cell.zmid[somainds]
-    zend = cell.zend
-
-    deltaS = _deltaS_calc(xstart, xend, ystart, yend, zstart, zend)
-    h = _h_calc(xstart, xend, ystart, yend, zstart, zend, deltaS, x, y, z)
-    r2 = _r2_calc(xend, yend, zend, x, y, z, h)
-    r_soma = _r_soma_calc(xmid, ymid, zmid, x, y, z)
-    if np.any(r_soma < r_limit[somainds]):
-        print('Adjusting r-distance to soma segments')
-        r_soma[r_soma < r_limit[somainds]
-               ] = r_limit[somainds][r_soma < r_limit[somainds]]
-
-    too_close_idxs = np.where(r2 < r_limit*r_limit)[0]
-    r2[too_close_idxs] = r_limit[too_close_idxs]**2
-    l = h + deltaS
-
-    hnegi = h < 0
-    hposi = h >= 0
-    lnegi = l < 0
-    lposi = l >= 0
-
-    # Ensuring that soma is not treated as line-source
-    hnegi[somainds] = hposi[somainds] = lnegi[somainds] = lposi[somainds] = False
-
-    #Line sources
-    #case i,  h < 0,  l < 0
-    i = np.where(hnegi & lnegi)
-    #case ii,  h < 0,  l >= 0
-    ii = np.where(hnegi & lposi)
-    #case iii,  h >= 0,  l >= 0
-    iii = np.where(hposi & lposi)
-
-    #Summarizing all potential contributions
-    mapping = np.zeros(cell.totnsegs)
-    mapping[somainds] = 1 / r_soma
-    deltaS[somainds] = 1.
-
-    mapping[i] = _linesource_calc_case1(l[i], r2[i], h[i])
-    mapping[ii] = _linesource_calc_case2(l[ii], r2[ii], h[ii])
-    mapping[iii] = _linesource_calc_case3(l[iii], r2[iii], h[iii])
-
-    return 1 / (4 * np.pi * sigma * deltaS) * mapping
-
-
-def _linesource_calc_case1(l_i, r2_i, h_i):
-    """Calculates linesource contribution for case i"""
-    bb = np.sqrt(h_i*h_i + r2_i) - h_i
-    cc = np.sqrt(l_i*l_i + r2_i) - l_i
-    dd = np.log(bb / cc)
-    return dd
-
-
-def _linesource_calc_case2(l_ii, r2_ii, h_ii):
-    """Calculates linesource contribution for case ii"""
-    bb = np.sqrt(h_ii*h_ii + r2_ii) - h_ii
-    cc = (l_ii + np.sqrt(l_ii*l_ii + r2_ii)) / r2_ii
-    dd = np.log(bb * cc)
-    return dd
-
-
-def _linesource_calc_case3(l_iii, r2_iii, h_iii):
-    """Calculates linesource contribution for case iii"""
-    bb = np.sqrt(l_iii*l_iii + r2_iii) + l_iii
-    cc = np.sqrt(h_iii*h_iii + r2_iii) + h_iii
-    dd = np.log(bb / cc)
-    return dd
-
-
-def _deltaS_calc(xstart, xend, ystart, yend, zstart, zend):
-    """Returns length of each segment"""
-    deltaS = np.sqrt((xstart - xend)**2 + (ystart - yend)**2 +
-                     (zstart-zend)**2)
-    return deltaS
-
-
-def _h_calc(xstart, xend, ystart, yend, zstart, zend, deltaS, x, y, z):
-    """Subroutine used by calc_lfp_*()"""
-    aa = np.array([x - xend, y - yend, z-zend])
-    bb = np.array([xend - xstart, yend - ystart, zend - zstart])
-    cc = np.sum(aa*bb, axis=0)
-    hh = cc / deltaS
-    return hh
-
-
-def _r2_calc(xend, yend, zend, x, y, z, h):
-    """Subroutine used by calc_lfp_*()"""
-    r2 = (x-xend)**2 + (y-yend)**2 + (z-zend)**2 - h**2
-    return abs(r2)
-
-
-def _r_soma_calc(xmid, ymid, zmid, x, y, z):
-    """calculate the distance to soma midpoint"""
-    r_soma = np.sqrt((x - xmid)**2 + (y - ymid)**2 + (z - zmid)**2)
-    return r_soma
-
-
-def calc_lfp_pointsource(cell, x, y, z, sigma, r_limit):
-    """Calculate extracellular potentials using the point-source
-    equation on all compartments
-
-    Parameters
-    ----------
-    cell: obj
-        LFPy.Cell or LFPy.TemplateCell like instance
-    x : float
-        extracellular position, x-axis
-    y : float
-        extracellular position, y-axis
-    z : float
-        extracellular position, z-axis
-    sigma : float
-        extracellular conductivity
-    r_limit : np.ndarray
-        minimum distance to source current for each compartment
-    """
-
-    r2 = (cell.xmid - x)**2 + (cell.ymid - y)**2 + (cell.zmid - z)**2
-    r2 = _check_rlimit_point(r2, r_limit)
-    mapping = 1 / (4 * np.pi * sigma * np.sqrt(r2))
-    return mapping
-
-
-def calc_lfp_pointsource_anisotropic(cell, x, y, z, sigma, r_limit):
-    """Calculate extracellular potentials using the anisotropic point-source
-    equation on all compartments
-
-    Parameters
-    ----------
-    cell: obj
-        LFPy.Cell or LFPy.TemplateCell instance
-    x : float
-        extracellular position, x-axis
-    y : float
-        extracellular position, y-axis
-    z : float
-        extracellular position, z-axis
-    sigma : array
-        extracellular conductivity in [x,y,z]-direction
-    r_limit : np.ndarray
-        minimum distance to source current for each compartment
-    """
-
-    dx2 = (cell.xmid - x)**2
-    dy2 = (cell.ymid - y)**2
-    dz2 = (cell.zmid - z)**2
-
-    r2 = dx2 + dy2 + dz2
-    if (np.abs(r2) < 1e-6).any():
-        dx2[np.abs(r2) < 1e-6] += 0.001
-        r2[np.abs(r2) < 1e-6] += 0.001
-
-    close_idxs = r2 < r_limit*r_limit
-
-    # For anisotropic media, the direction in which to move points matter.
-    # Radial distance between point source and electrode is scaled to r_limit
-    r2_scale_factor = r_limit[close_idxs]*r_limit[close_idxs] / r2[close_idxs]
-    dx2[close_idxs] *= r2_scale_factor
-    dy2[close_idxs] *= r2_scale_factor
-    dz2[close_idxs] *= r2_scale_factor
-
-    sigma_r = np.sqrt(sigma[1] * sigma[2] * dx2
-                    + sigma[0] * sigma[2] * dy2
-                    + sigma[0] * sigma[1] * dz2)
-
-    mapping = 1 / (4 * np.pi * sigma_r)
-    return mapping
-
-
-def _check_rlimit_point(r2, r_limit):
-    """Correct r2 so that r2 >= r_limit**2 for all values"""
-    inds = r2 < r_limit*r_limit
-    r2[inds] = r_limit[inds]*r_limit[inds]
-    return r2
-
-
-def calc_lfp_pointsource_moi(cell, x, y, z, sigma_T, sigma_S, sigma_G,
-                             steps, h, r_limit, **kwargs):
-    """Calculate extracellular potentials using the point-source
-    equation on all compartments for in vitro Microelectrode Array (MEA) slices
-
-    Parameters
-    ----------
-    cell: obj
-        LFPy.Cell or LFPy.TemplateCell like instance
-    x : float
-        extracellular position, x-axis
-    y : float
-        extracellular position, y-axis
-    z : float
-        extracellular position, z-axis
-    sigma_T : float
-        extracellular conductivity in tissue slice
-    sigma_G : float
-        Conductivity of MEA glass electrode plane.
-        Should normally be zero for MEA set up.
-    sigma_S : float
-        Conductivity of saline bath that tissue slice is immersed in
-    steps : int
-        Number of steps to average over the in technically infinite sum
-    h : float
-        Slice thickness in um.
-    r_limit : np.ndarray
-        minimum distance to source current for each compartment
-    """
-
-    dx2 = (x - cell.xmid)**2
-    dy2 = (y - cell.ymid)**2
-    dz2 = (z - cell.zmid)**2
-
-    dL2 = dx2 + dy2
-    inds = np.where(dL2 + dz2 < r_limit*r_limit)[0]
-    dL2[inds] = r_limit[inds]*r_limit[inds] - dz2[inds]
-
-    def _omega(dz):
-        return 1/np.sqrt(dL2 + dz*dz)
-
-    WTS = (sigma_T - sigma_S)/(sigma_T + sigma_S)
-    WTG = (sigma_T - sigma_G)/(sigma_T + sigma_G)
-
-    mapping = _omega(z - cell.zmid)
-    mapping += (WTS * _omega(z + cell.zmid - 2*h) +
-                WTG * _omega(z + cell.zmid))
-
-    n = np.arange(1, steps)
-    a = (WTS*WTG)**n[:, None] * (WTS * _omega(z + cell.zmid - 2*(n[:, None] + 1)*h) +
-                                 WTG * _omega(z + cell.zmid + 2*n[:, None]*h) +
-                                 _omega(z - cell.zmid + 2*n[:, None]*h) +
-                                 _omega(z - cell.zmid - 2*n[:, None]*h))
-    mapping += np.sum(a, axis=0)
-    mapping *= 1/(4*np.pi*sigma_T)
-
-    return mapping
-
-
-def calc_lfp_linesource_moi(cell, x, y, z, sigma_T, sigma_S, sigma_G,
-                             steps, h, r_limit, **kwargs):
-    """Calculate extracellular potentials using the line-source
-    equation on all compartments for in vitro Microelectrode Array (MEA) slices
-
-    Parameters
-    ----------
-    cell: obj
-        LFPy.Cell or LFPy.TemplateCell like instance
-    x : float
-        extracellular position, x-axis
-    y : float
-        extracellular position, y-axis
-    z : float
-        extracellular position, z-axis
-    sigma_T : float
-        extracellular conductivity in tissue slice
-    sigma_G : float
-        Conductivity of MEA glass electrode plane.
-        Should normally be zero for MEA set up, and for this method,
-        only zero valued sigma_G is supported.
-    sigma_S : float
-        Conductivity of saline bath that tissue slice is immersed in
-    steps : int
-        Number of steps to average over the in technically infinite sum
-    h : float
-        Slice thickness in um.
-    r_limit : np.ndarray
-        minimum distance to source current for each compartment
-    """
-
-    if np.abs(z) > 1e-9:
-        raise RuntimeError("This method can only handle electrodes "
-                           "at the MEA plane z=0")
-    if np.abs(sigma_G) > 1e-9:
-        raise RuntimeError("This method can only handle sigma_G=0, i.e.,"
-                           "a non-conducting MEA glass electrode plane.")
-
-    xstart = cell.xstart
-    xend = cell.xend
-    ystart = cell.ystart
-    yend = cell.yend
-    zstart = cell.zstart
-    zend = cell.zend
-    x0, y0, z0 = cell.xstart, cell.ystart, cell.zstart
-    x1, y1, z1 = cell.xend, cell.yend, cell.zend
-
-    pos = np.array([x, y, z])
-    rs, closest_points = return_dist_from_segments(xstart, ystart, zstart,
-                                                   xend, yend, zend, pos)
-    z0_ = z0.copy()
-    z0_[np.where(rs < r_limit)] = r_limit[np.where(rs < r_limit)]
-
-    ds = _deltaS_calc(xstart, xend, ystart, yend, zstart, zend)
-    factor_a = ds*ds
-    dx = x1 - x0
-    dy = y1 - y0
-    dz = z1 - z0
-    a_x = x - x0
-    a_y = y - y0
-    W = (sigma_T - sigma_S)/(sigma_T + sigma_S)
-    num = np.zeros(factor_a.shape)
-    den = np.zeros(factor_a.shape)
-
-    def _omega(a_z):
-        #See Rottman integration formula 46) page 137 for explanation
-
-        factor_b = - a_x*dx - a_y*dy - a_z*dz
-        factor_c = a_x*a_x + a_y*a_y + a_z*a_z
-        b_2_ac = factor_b*factor_b - factor_a * factor_c
-
-        case1_idxs = np.where(np.abs(b_2_ac) <= 1e-12)
-        case2_idxs = np.where(np.abs(b_2_ac) > 1e-12)
-
-        if not len(case1_idxs) == 0:
-            num[case1_idxs] = factor_a[case1_idxs] + factor_b[case1_idxs]
-            den[case1_idxs] = factor_b[case1_idxs]
-        if not len(case2_idxs) == 0:
-            num[case2_idxs] = (factor_a[case2_idxs] + factor_b[case2_idxs] +
-                               ds[case2_idxs]*np.sqrt(factor_a[case2_idxs] +
-                               2*factor_b[case2_idxs] + factor_c[case2_idxs]))
-            den[case2_idxs] = (factor_b[case2_idxs] +
-                               ds[case2_idxs]*np.sqrt(factor_c[case2_idxs]))
-        return np.log(num/den)
-
-    mapping = _omega(-z0_)
-    n = 1
-    while n < steps:
-        mapping += W**n * (_omega(2*n*h - z0_) + _omega(-2*n*h - z0_))
-        n += 1
-
-    mapping *= 2/(4*np.pi*sigma_T * ds)
-
-    return mapping
-
-
-def calc_lfp_soma_as_point_moi(cell, x, y, z, sigma_T, sigma_S, sigma_G,
-                             steps, h, r_limit, **kwargs):
-    """Calculate extracellular potentials for in vitro
-    Microelectrode Array (MEA) slices, where soma (compartment zero) is
-    treated as a point source, and all other compartments as line sources.
-
-    Parameters
-    ----------
-    cell: obj
-        LFPy.Cell or LFPy.TemplateCell like instance
-    x : float
-        extracellular position, x-axis
-    y : float
-        extracellular position, y-axis
-    z : float
-        extracellular position, z-axis
-    sigma_T : float
-        extracellular conductivity in tissue slice
-    sigma_G : float
-        Conductivity of MEA glass electrode plane.
-        Should normally be zero for MEA set up, and for this method,
-        only zero valued sigma_G is supported.
-    sigma_S : float
-        Conductivity of saline bath that tissue slice is immersed in
-    steps : int
-        Number of steps to average over the in technically infinite sum
-    h : float
-        Slice thickness in um.
-    r_limit : np.ndarray
-        minimum distance to source current for each compartment
-    """
-
-    if np.abs(z) > 1e-9:
-        raise RuntimeError("This method can only handle electrodes "
-                           "at the MEA plane z=0")
-    if np.abs(sigma_G) > 1e-9:
-        raise RuntimeError("This method can only handle sigma_G=0, i.e.,"
-                           "a non-conducting MEA glass electrode plane.")
-
-    xstart = cell.xstart
-    xend = cell.xend
-    ystart = cell.ystart
-    yend = cell.yend
-    zstart = cell.zstart
-    zend = cell.zend
-    x0, y0, z0 = cell.xstart, cell.ystart, cell.zstart
-    x1, y1, z1 = cell.xend, cell.yend, cell.zend
-
-    pos = np.array([x, y, z])
-    rs, closest_points = return_dist_from_segments(xstart, ystart, zstart,
-                                                   xend, yend, zend, pos)
-    z0_ = np.array(z0)
-    if np.any(rs < r_limit):
-        z0_[rs < r_limit] = r_limit
-
-
-    ds = _deltaS_calc(xstart, xend, ystart, yend, zstart, zend)
-    factor_a = ds*ds
-    dx = x1 - x0
-    dy = y1 - y0
-    dz = z1 - z0
-    a_x = x - x0
-    a_y = y - y0
-    W = (sigma_T - sigma_S)/(sigma_T + sigma_S)
-    num = np.zeros(factor_a.shape)
-    den = np.zeros(factor_a.shape)
-
-    def _omega(a_z):
-        #See Rottman integration formula 46) page 137 for explanation
-
-        factor_b = - a_x*dx - a_y*dy - a_z*dz
-        factor_c = a_x*a_x + a_y*a_y + a_z*a_z
-        b_2_ac = factor_b*factor_b - factor_a * factor_c
-
-        case1_idxs = np.where(np.abs(b_2_ac) <= 1e-12)
-        case2_idxs = np.where(np.abs(b_2_ac) > 1e-12)
-
-        if not len(case1_idxs) == 0:
-            num[case1_idxs] = factor_a[case1_idxs] + factor_b[case1_idxs]
-            den[case1_idxs] = factor_b[case1_idxs]
-        if not len(case2_idxs) == 0:
-            num[case2_idxs] = (factor_a[case2_idxs] + factor_b[case2_idxs] +
-                               ds[case2_idxs]*np.sqrt(factor_a[case2_idxs] +
-                               2*factor_b[case2_idxs] + factor_c[case2_idxs]))
-            den[case2_idxs] = (factor_b[case2_idxs] +
-                               ds[case2_idxs]*np.sqrt(factor_c[case2_idxs]))
-        return np.log(num/den)
-
-    mapping = _omega(-z0_)
-    n = 1
-    while n < steps:
-        mapping += W**n * (_omega(2*n*h - z0) + _omega(-2*n*h - z0))
-        n += 1
-
-    mapping *= 2/(4*np.pi*sigma_T * ds)
-
-    # NOW DOING SOMA
-
-    # get compartment indices for somatic compartments (to be treated as point
-    # sources)
-    try:
-        somainds = cell.get_idx("soma")
-    except Exception:
-        raise Exception('Call {}.get_idx("soma") failed in method LFPy.lfpcalc.calc_lfp_soma_as_point'.format(cell))
-
-    dx2 = (x - cell.xmid[somainds])**2
-    dy2 = (y - cell.ymid[somainds])**2
-    dz2 = (z - cell.zmid[somainds])**2
-
-    dL2 = dx2 + dy2
-    inds = np.where(dL2 + dz2 < r_limit[somainds]*r_limit[somainds])[0]
-    dL2[inds] = r_limit[inds]*r_limit[inds] - dz2[inds]
-
-    def _omega(dz):
-        return 1/np.sqrt(dL2 + dz*dz)
-
-    mapping[somainds] = _omega(z - cell.zmid[somainds])
-    mapping[somainds] += (W * _omega(cell.zmid[somainds] - 2*h) +
-                       _omega(cell.zmid[somainds]))
-
-    n = np.arange(1, steps)
-    a = (W)**n[:, None] * (W * _omega(+ cell.zmid[somainds] - 2*(n[:, None] + 1)*h) +
-                           2 * _omega(+ cell.zmid[somainds] + 2*n[:, None]*h) +
-                               _omega(+ cell.zmid[somainds] - 2*n[:, None]*h))
-    mapping[somainds] += np.sum(a, axis=0)
-    mapping[somainds] *= 1/(4*np.pi*sigma_T)
-
-    return mapping
\ No newline at end of file
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/network.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/network.py
deleted file mode 100644
index 661705b..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/network.py
+++ /dev/null
@@ -1,1626 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Defines classes and methods used by example_parallel_network.py script
-
-Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-from __future__ import division
-import numpy as np
-import os
-import scipy.stats as stats
-import h5py
-from mpi4py import MPI
-import neuron
-from .templatecell import TemplateCell
-import scipy.sparse as ss
-
-# set up MPI environment
-COMM = MPI.COMM_WORLD
-SIZE = COMM.Get_size()
-RANK = COMM.Get_rank()
-
-
-flattenlist = lambda lst: [item for sublist in lst for item in sublist]
-
-
-################################################################################
-# NetworkCell class that has a create_synapse method that
-# creates a synapse on the target cell, and a create_spike_detector method that
-# allows for connecting to a synapse on a target cell. All other methods and
-# attributes are inherited from the standard LFPy.TemplateCell class
-################################################################################
-class NetworkCell(TemplateCell):
-    """
-    class NetworkCell
-
-    Similar to `LFPy.TemplateCell` with the addition of some attributes and
-    methods allowing for spike communication between parallel RANKs.
-
-    This class allow using NEURON templates with some limitations.
-
-    This takes all the same parameters as the Cell class, but requires three
-    more template related parameters
-
-    Parameters
-    ----------
-    morphology : str
-        path to morphology file
-    templatefile : str
-        File with cell template definition(s)
-    templatename : str
-        Cell template-name used for this cell object
-    templateargs : str
-        Parameters provided to template-definition
-    v_init : float
-        Initial membrane potential. Default to -65.
-    Ra : float
-        axial resistance. Defaults to 150.
-    cm : float
-        membrane capacitance. Defaults to 1.0
-    passive : bool
-        Passive mechanisms are initialized if True. Defaults to True
-    passive_parameters : dict
-        parameter dictionary with values for the passive membrane mechanism in
-        NEURON ('pas'). The dictionary must contain keys 'g_pas' and 'e_pas',
-        like the default: passive_parameters=dict(g_pas=0.001, e_pas=-70)
-    extracellular : bool
-        switch for NEURON's extracellular mechanism. Defaults to False
-    dt: float
-        Simulation time step. Defaults to 2**-4
-    tstart : float
-        initialization time for simulation <= 0 ms. Defaults to 0.
-    tstop : float
-        stop time for simulation > 0 ms. Defaults to 100.
-    nsegs_method : 'lambda100' or 'lambda_f' or 'fixed_length' or None
-        nseg rule, used by NEURON to determine number of compartments.
-        Defaults to 'lambda100'
-    max_nsegs_length : float or None
-        max segment length for method 'fixed_length'. Defaults to None
-    lambda_f : int
-        AC frequency for method 'lambda_f'. Defaults to 100
-    d_lambda : float
-        parameter for d_lambda rule. Defaults to 0.1
-    delete_sections : bool
-        delete pre-existing section-references. Defaults to True
-    custom_code : list or None
-        list of model-specific code files ([.py/.hoc]). Defaults to None
-    custom_fun : list or None
-        list of model-specific functions with args. Defaults to None
-    custom_fun_args : list or None
-        list of args passed to custom_fun functions. Defaults to None
-    pt3d : bool
-        use pt3d-info of the cell geometries switch. Defaults to False
-    celsius : float or None
-        Temperature in celsius. If nothing is specified here
-        or in custom code it is 6.3 celcius
-    verbose : bool
-        verbose output switch. Defaults to False
-
-    Examples
-    --------
-
-    >>> import LFPy
-    >>> cellParameters = {
-    >>>     'morphology' : '',
-    >>>     'templatefile' :  ''
-    >>>     'templatename' :  'templatename'
-    >>>     'templateargs' :  None
-    >>>     'v_init' : -65,
-    >>>     'cm' : 1.0,
-    >>>     'Ra' : 150,
-    >>>     'passive' : True,
-    >>>     'passive_parameters' : {'g_pas' : 0.001, 'e_pas' : -65.},
-    >>>     'dt' : 2**-3,
-    >>>     'tstart' : 0,
-    >>>     'tstop' : 50,
-    >>> }
-    >>> cell = LFPy.NetworkCell(**cellParameters)
-    >>> cell.simulate()
-
-
-    """
-    def __init__(self, **args):
-        """
-        Initialization of class LFPy.NetworkCell.
-
-        """
-        TemplateCell.__init__(self, **args)
-
-        # create list netconlist for spike detecting NetCon object(s)
-        self.sd_netconlist = neuron.h.List()
-        # create list of recording device for action potentials
-        self.spikes = []
-        # create list of random number generators used with synapse model
-        self.rng_list = []
-
-        # create separate list for networked synapses
-        self.netconsynapses = []
-
-        # create recording device for membrane voltage
-        self.somav = neuron.h.Vector()
-        for sec in self.somalist:
-            self.somav.record(sec(0.5)._ref_v)
-
-
-    def create_synapse(self, cell, sec, x=0.5, syntype=neuron.h.ExpSyn,
-                       synparams=dict(tau=2., e=0.),
-                       assert_syn_values=False):
-        """
-        Create synapse object of type syntype on sec(x) of cell and
-        append to list cell.netconsynapses
-
-        TODO: Use LFPy.Synapse class if possible.
-
-        Parameters
-        ----------
-        cell : object
-            instantiation of class NetworkCell or similar
-        sec : neuron.h.Section object,
-            section reference on cell
-        x : float in [0, 1],
-            relative position along section
-        syntype : hoc.HocObject
-            NEURON synapse model reference, e.g., neuron.h.ExpSyn
-        synparams : dict
-            parameters for syntype, e.g., for neuron.h.ExpSyn we have:
-                tau : float, synapse time constant
-                e : float, synapse reversal potential
-        assert_syn_values : bool
-            if True, raise AssertionError if synapse attribute values do not
-            match the values in the synparams dictionary
-
-        Raises
-        ------
-        AssertionError
-        """
-        # create a synapse object on the target cell
-        syn = syntype(x, sec=sec)
-        if hasattr(syn, 'setRNG'):
-            # Create the random number generator for the synapse
-            rng = neuron.h.Random()
-            # not sure if this is how it is supposed to be set up...
-            rng.MCellRan4(np.random.randint(0, 2**32-1), np.random.randint(0, 2**32-1))
-            rng.uniform(0, 1)
-            syn.setRNG(rng) # used for e.g., stochastic synapse mechanisms (cf. BBP microcircuit portal files)
-            cell.rng_list.append(rng) # must store ref to rng object
-        cell.netconsynapses.append(syntype(x, sec=sec))
-
-        for key, value in synparams.items():
-            exec("cell.netconsynapses[-1].{} = {}".format(key, value))
-            # check that synapses are parameterized correctly
-            if assert_syn_values:
-                try:
-                    np.testing.assert_almost_equal(getattr(cell.netconsynapses[-1], key), value)
-                except AssertionError:
-                    raise AssertionError('{} = {} != {}'.format(key,
-                                                                getattr(cell.netconsynapses[-1], key),
-                                                                value))
-
-
-    def create_spike_detector(self, target=None, threshold=-10.,
-                     weight=0.0, delay=0.0):
-        """
-        Create spike-detecting NetCon object attached to the cell's soma
-        midpoint, but this could be extended to having multiple spike-detection
-        sites. The NetCon object created is attached to the cell's sd_netconlist
-        attribute, and will be used by the Network class when creating
-        connections between all presynaptic cells and postsynaptic cells on
-        each local RANK.
-
-        Parameters
-        ----------
-        target : None (default) or a NEURON point process
-        threshold : float
-            spike detection threshold
-        weight : float
-            connection weight (not used unless target is a point process)
-        delay : float
-            connection delay (not used unless target is a point process)
-        """
-        # create new NetCon objects for the connections. Activation times will
-        # be triggered on the somatic voltage with a given threshold.
-        for sec in self.somalist:
-            self.sd_netconlist.append(neuron.h.NetCon(sec(0.5)._ref_v,
-                                                target,
-                                                sec=sec))
-            self.sd_netconlist[-1].threshold = threshold
-            self.sd_netconlist[-1].weight[0] = weight
-            self.sd_netconlist[-1].delay = delay
-
-
-class DummyCell(object):
-    def __init__(self, totnsegs=0,
-                 imem=np.array([[]]),
-                 xstart=np.array([]), xmid=np.array([]), xend=np.array([]),
-                 ystart=np.array([]), ymid=np.array([]), yend=np.array([]),
-                 zstart=np.array([]), zmid=np.array([]), zend=np.array([]),
-                 diam=np.array([]), area=np.array([]), somainds=np.array([])):
-        """
-        Dummy Cell object initialized with all attributes needed for LFP
-        calculations using the LFPy.RecExtElectrode class and methods. This cell
-        can be imagined as one "super" cell containing transmembrane currents
-        generated by all NetworkCell segments on this RANK at once.
-
-
-        Parameters
-        ----------
-        totnsegs : int
-            total number of segments
-        imem : ndarray
-            totnsegs x ntimesteps array with transmembrane currents in nA
-        xstart, ystart, zstart : ndarray
-            arrays of length totnsegs with start (x,y,z) coordinate of segments
-            in units of um
-        xmid, ymid, zmid : ndarray
-            midpoint coordinates of segments
-        xend, yend, zend : ndarray
-            endpoint coordinateso of segments
-        diam : ndarray
-            array of length totnsegs with segment diameters
-        area : ndarray
-            array of segment surface areas
-        """
-        # set attributes
-        self.totnsegs = totnsegs
-        self.imem = imem
-        self.xstart = xstart
-        self.xmid = xmid
-        self.xend = xend
-        self.ystart = ystart
-        self.ymid = ymid
-        self.yend = yend
-        self.zstart = zstart
-        self.zmid = zmid
-        self.zend = zend
-        self.diam = diam
-        self.area = area
-        self.somainds = somainds
-
-    def get_idx(self, section="soma"):
-        if section=="soma":
-            return self.somainds
-        else:
-            raise ValueError('section argument must be "soma"')
-
-
-class NetworkPopulation(object):
-    def __init__(self, CWD=None, CELLPATH=None, first_gid=0, Cell=NetworkCell,
-                 POP_SIZE=4, name='L5PC',
-                 cell_args=dict(), pop_args=dict(),
-                 rotation_args=dict(),
-                 OUTPUTPATH='example_parallel_network'):
-        """
-        NetworkPopulation class representing a group of Cell objects distributed
-        across RANKs.
-
-        Parameters
-        ----------
-        CWD : path or None
-            Current working directory
-        CELLPATH: path or None
-            Relative path from CWD to source files for cell model (morphology, hoc routines etc.)
-        first_gid : int
-            The global identifier of the first cell created in this population
-            instance. The first_gid in the first population created should be 0
-            and cannot exist in previously created NetworkPopulation instances
-        Cell : class
-            class defining a Cell object, see class NetworkCell above
-        POP_SIZE : int
-            number of cells in population
-        name : str
-            population name reference
-        cell_args : dict
-            keys and values for Cell object
-        pop_args : dict
-            keys and values for Network.draw_rand_pos assigning cell positions
-        rotation_arg : dict
-            default cell rotations around x and y axis on the form
-            { 'x' : np.pi/2, 'y' : 0 }. Can only have the keys 'x' and 'y'.
-            Cells are randomly rotated around z-axis using the Cell.set_rotation
-            method.
-        OUTPUTPATH : str
-            path to output file destination
-        """
-        # set class attributes
-        self.CWD = CWD
-        self.CELLPATH = CELLPATH
-        self.first_gid = first_gid
-        self.Cell = Cell
-        self.POP_SIZE = POP_SIZE
-        self.name = name
-        self.cell_args = cell_args
-        self.pop_args = pop_args
-        self.rotation_args = rotation_args
-        self.OUTPUTPATH = OUTPUTPATH
-
-        # create folder for output if it does not exist
-        if RANK == 0:
-            if not os.path.isdir(OUTPUTPATH):
-                os.mkdir(OUTPUTPATH)
-        COMM.Barrier()
-
-        # container of Vector objects used to record times of action potentials
-        self.spike_vectors = []
-
-        # set up population of cells on this RANK
-        self.gids = [(i+first_gid) for i in range(POP_SIZE) if (i+first_gid) % SIZE == RANK]
-
-        # we have to enter the cell's corresponding file directory to
-        # create cell because how EPFL set their code up
-        if CWD is not None:
-            os.chdir(os.path.join(CWD, CELLPATH, self.name))
-            self.cells = [Cell(**cell_args) for gid in self.gids]
-            os.chdir(CWD)
-        else:
-            self.cells = [Cell(**cell_args) for gid in self.gids]
-        # position each cell's soma in space
-        self.soma_pos = self.draw_rand_pos(POP_SIZE=len(self.gids), **pop_args)
-        for i, cell in enumerate(self.cells):
-            cell.set_pos(**self.soma_pos[i])
-
-        # assign a random rotation around the z-axis of each cell
-        self.rotations = np.random.uniform(0, np.pi*2, len(self.gids))
-        assert('z' not in self.rotation_args.keys())
-        for i, cell in enumerate(self.cells):
-            cell.set_rotation(z=self.rotations[i], **self.rotation_args)
-
-        # assign gid to each cell
-        for gid, cell in zip(self.gids, self.cells):
-            cell.gid = gid
-
-
-        # gather gids, soma positions and cell rotations to RANK 0, and write
-        # as structured array.
-        if RANK == 0:
-            populationData = flattenlist(COMM.gather(zip(self.gids, self.soma_pos, self.rotations)))
-
-            # create structured array for storing data
-            dtype = [('gid', 'i8'), ('x', float), ('y', float), ('z', float),
-                     ('x_rot', float), ('y_rot', float), ('z_rot', float)]
-            popDataArray = np.empty((len(populationData, )), dtype=dtype)
-            for i, (gid, pos, z_rot) in enumerate(populationData):
-                popDataArray[i]['gid'] = gid
-                popDataArray[i]['x'] = pos['x']
-                popDataArray[i]['y'] = pos['y']
-                popDataArray[i]['z'] = pos['z']
-                popDataArray[i]['x_rot'] = np.pi/2
-                popDataArray[i]['y_rot'] = 0.
-                popDataArray[i]['z_rot'] = z_rot
-
-            # Dump to hdf5 file, append to file if it exists
-            f = h5py.File(os.path.join(self.OUTPUTPATH,
-                                       'cell_positions_and_rotations.h5'), 'a')
-            # delete old entry if it exist
-            if self.name in f.keys():
-                del f[self.name]
-                try:
-                    assert self.name not in f.keys()
-                except AssertionError:
-                    raise AssertionError
-            f[self.name] = popDataArray
-            f.close()
-        else:
-            COMM.gather(zip(self.gids, self.soma_pos, self.rotations))
-
-        # sync
-        COMM.Barrier()
-
-
-    def draw_rand_pos(self, POP_SIZE, radius, loc, scale, cap=None):
-        """
-        Draw some random location for POP_SIZE cells within radius radius,
-        at mean depth loc and standard deviation scale.
-
-        Returned argument is a list of dicts [{'x', 'y', 'z'},].
-
-
-        Parameters
-        ----------
-        POP_SIZE : int
-            Population size
-        radius : float
-            Radius of population.
-        loc : float
-            expected mean depth of somas of population.
-        scale : float
-            expected standard deviation of depth of somas of population.
-        cap : None, float or length to list of floats
-            if float, cap distribution between [loc-cap, loc+cap),
-            if list, cap distribution between [loc-cap[0], loc+cap[1]]
-
-
-        Returns
-        -------
-        soma_pos : list
-            List of dicts of len POP_SIZE
-            where dict have keys x, y, z specifying
-            xyz-coordinates of cell at list entry `i`.
-
-
-        """
-
-        x = np.empty(POP_SIZE)
-        y = np.empty(POP_SIZE)
-        z = np.empty(POP_SIZE)
-        for i in range(POP_SIZE):
-            x[i] = (np.random.rand()-0.5) * radius*2
-            y[i] = (np.random.rand()-0.5) * radius*2
-            while np.sqrt(x[i]**2 + y[i]**2) >= radius:
-                x[i] = (np.random.rand()-0.5)*radius*2
-                y[i] = (np.random.rand()-0.5)*radius*2
-        z = np.random.normal(loc=loc, scale=scale, size=POP_SIZE)
-        if cap is not None:
-            if type(cap) in [float, np.float, np.float32, np.float64]:
-                while not np.all((z >= loc-cap) & (z < loc+cap)):
-                    inds = (z < loc-cap) ^ (z > loc+cap)
-                    z[inds] = np.random.normal(loc=loc, scale=scale,
-                                               size=inds.sum())
-            elif type(cap) is list:
-                try:
-                    assert(len(cap) == 2)
-                except AssertionError:
-                    raise AssertionError('cap = {} is not a length 2 list'.format(float))
-                while not np.all((z >= loc-cap[0]) & (z < loc+cap[1])):
-                    inds = (z < loc-cap[0]) ^ (z > loc+cap[1])
-                    z[inds] = np.random.normal(loc=loc, scale=scale,
-                                               size=inds.sum())
-            else:
-                raise Exception('cap = {} is not None, a float or length 2 list of floats'.format(float))
-
-        soma_pos = []
-        for i in range(POP_SIZE):
-            soma_pos.append({'x' : x[i], 'y' : y[i], 'z' : z[i]})
-
-        return soma_pos
-
-
-class Network(object):
-    def __init__(self, dt=0.1, tstart=0., tstop=1000., v_init=-65., celsius=6.3,
-                 OUTPUTPATH='example_parallel_network',
-                 verbose=False):
-        """
-        Network class, creating distributed populations of cells of
-        type Cell and handling connections between cells in the respective
-        populations.
-
-        Parameters
-        ----------
-        dt : float
-            Simulation timestep size
-        tstart : float
-            Start time of simulation
-        tstop : float
-            End time of simulation
-        v_init : float
-            Membrane potential set at first timestep across all cells
-        celsius : float
-            Global control of temperature, affect channel kinetics.
-            It will also be forced when creating the different Cell objects, as
-            LFPy.Cell and LFPy.TemplateCell also accept the same keyword
-            argument.
-        verbose : bool
-            if True, print out misc. messages
-
-
-        """
-        # set attributes
-        self.dt = dt
-        self.tstart = tstart
-        self.tstop = tstop
-        self.v_init = v_init
-        self.celsius = celsius
-        self.OUTPUTPATH = OUTPUTPATH
-        self.verbose = verbose
-
-        # we need NEURON's ParallelContext for communicating NetCon events
-        self.pc = neuron.h.ParallelContext()
-
-        # create empty list for connections between cells (not to be confused
-        # with each cell's list of netcons)
-        self.netconlist = neuron.h.List()
-
-
-        # The different populations in the Network will be collected in
-        # a dictionary of NetworkPopulation object, where the keys represent the
-        # population name. The names are also put in a list ordered according to
-        # order populations are created in (as some operations rely on this)
-        self.populations = dict()
-        self.population_names = []
-
-
-
-    def create_population(self, CWD=None, CELLPATH=None, Cell=NetworkCell,
-                          POP_SIZE=4, name='L5PC',
-                          cell_args=dict(), pop_args=dict(),
-                          rotation_args=dict()):
-        """
-        Create and append a distributed POP_SIZE-sized population of cells of
-        type Cell with the corresponding name. Cell-object references, gids on
-        this RANK, population size POP_SIZE and names will be added to the lists
-        Network.gids, Network.cells, Network.sizes and Network.names,
-        respectively
-
-        Parameters
-        ----------
-        CWD : path
-            Current working directory
-        CELLPATH: path
-            Relative path from CWD to source files for cell model (morphology, hoc routines etc.)
-        Cell : class
-            class defining a Cell-like object, see class NetworkCell
-        POP_SIZE : int
-            number of cells in population
-        name : str
-            population name reference
-        cell_args : dict
-            keys and values for Cell object
-        pop_args : dict
-            keys and values for Network.draw_rand_pos assigning cell positions
-        rotation_arg : dict
-            default cell rotations around x and y axis on the form
-            { 'x' : np.pi/2, 'y' : 0 }. Can only have the keys 'x' and 'y'.
-            Cells are randomly rotated around z-axis using the Cell.set_rotation
-            method.
-
-        """
-        try:
-            assert name not in self.populations.keys()
-        except AssertionError:
-            raise AssertionError('population name {} already taken'.format(name))
-
-        # compute the first global id of this new population, based
-        # on population sizes of existing populations
-        first_gid = 0
-        for p in self.populations.values():
-            first_gid += p.POP_SIZE
-
-        # create NetworkPopulation object
-        population = NetworkPopulation(CWD=CWD, CELLPATH=CELLPATH, first_gid=first_gid,
-                                Cell=Cell,
-                                POP_SIZE=POP_SIZE, name=name,
-                                cell_args=cell_args, pop_args=pop_args,
-                                rotation_args=rotation_args,
-                                OUTPUTPATH=self.OUTPUTPATH)
-
-        # associate gids of cells on this RANK such that NEURON can look up
-        # at which RANK different cells are created when connecting the network
-        for gid in population.gids:
-            self.pc.set_gid2node(gid, RANK)
-
-        # Prepare connection targets by iterating over local neurons in pop.
-        for gid, cell in zip(population.gids, population.cells):
-            # attach NetCon source (spike detektor) to each cell's soma with no
-            # target to cell gid
-            cell.create_spike_detector(None)
-            # assosiate cell gid with the NetCon source
-            self.pc.cell(gid, cell.sd_netconlist[-1])
-
-            # record spike events
-            population.spike_vectors.append(neuron.h.Vector())
-            cell.sd_netconlist[-1].record(population.spike_vectors[-1])
-
-        # add population object to dictionary of populations
-        self.populations[name] = population
-
-        # append population name to list (Network.populations.keys() not unique)
-        self.population_names.append(name)
-
-
-    def get_connectivity_rand(self, pre='L5PC', post='L5PC', connprob = 0.2):
-        """
-        Dummy function creating a (boolean) cell to cell connectivity matrix
-        between pre and postsynaptic populations.
-
-        Connections are drawn randomly between presynaptic cell gids in
-        population 'pre' and postsynaptic cell gids in 'post' on this RANK with
-        a fixed connection probability. self-connections are disabled if
-        presynaptic and postsynaptic populations are the same.
-
-        Parameters
-        ----------
-        pre : str
-            presynaptic population name
-        post : str
-            postsynaptic population name
-        connprob : float in [0, 1]
-            connection probability, connections are drawn on random
-
-        Returns
-        -------
-        ndarray, dtype bool
-            n_pre x n_post array of connections between n_pre presynaptic
-            neurons and n_post postsynaptic neurons on this RANK. Entries
-            with True denotes a connection.
-        """
-        n_pre = self.populations[pre].POP_SIZE
-        gids = np.array(self.populations[post].gids).astype(int)
-
-        # first check if there are any postsyn cells on this RANK
-        if gids.size > 0:
-            # define incoming connections for cells on this RANK
-            C = np.random.rand(n_pre, gids.size) < connprob
-            if pre == post:
-                # avoid self connections.
-                gids_pre, gids_post = np.where(C)
-                gids_pre += self.populations[pre].first_gid
-                gids_post *= SIZE # asssume round-robin distribution of gids
-                gids_post += self.populations[post].gids[0]
-                inds = gids_pre == gids_post
-                gids_pre = gids_pre[inds == False]
-                gids_pre -= self.populations[pre].first_gid
-                gids_post = gids_post[inds == False]
-                gids_post -= self.populations[post].gids[0]
-                gids_post //= SIZE
-                c = np.c_[gids_pre, gids_post]
-                # create boolean matrix
-                C = ss.csr_matrix((np.ones(gids_pre.shape[0], dtype=bool),
-                                   (c[:, 0], c[:, 1])),
-                                  shape=(n_pre, gids.size), dtype=bool)
-                return C.toarray()
-            else:
-                return C
-        else:
-            return np.zeros((n_pre, 0), dtype=bool)
-
-
-    def connect(self, pre, post, connectivity,
-                syntype=neuron.h.ExpSyn,
-                synparams=dict(tau=2., e=0.),
-                weightfun=np.random.normal,
-                weightargs=dict(loc=0.1, scale=0.01),
-                minweight=0,
-                delayfun=np.random.normal,
-                delayargs=dict(loc=2, scale=0.2),
-                mindelay=0.3,
-                multapsefun=np.random.normal,
-                multapseargs=dict(loc=4, scale=1),
-                syn_pos_args=dict(section=['soma', 'dend', 'apic'],
-                                  fun=[stats.norm]*2,
-                                  funargs=[dict(loc=0, scale=100)]*2,
-                                  funweights=[0.5]*2,
-                                  z_min=-1E6, z_max=1E6,
-                                  ),
-                save_connections=False,
-                ):
-        """
-        Connect presynaptic cells to postsynaptic cells. Connections are
-        drawn from presynaptic cells to postsynaptic cells, hence connectivity
-        array must only be specified for postsynaptic units existing on this
-        RANK.
-
-        Parameters
-        ----------
-        pre : str
-            presynaptic population name
-        post : str
-            postsynaptic population name
-        connectivity : ndarray / (scipy.sparse array)
-            boolean connectivity matrix between pre and post.
-        syntype : hoc.HocObject
-            reference to NEURON synapse mechanism, e.g., neuron.h.ExpSyn
-        synparams : dict
-            dictionary of parameters for synapse mechanism, keys 'e', 'tau' etc.
-        weightfun : function
-            function used to draw weights from a numpy.random distribution
-        weightargs : dict
-            parameters passed to weightfun
-        minweight : float,
-            minimum weight in units of nS
-        delayfun : function
-            function used to draw delays from a numpy.random distribution
-        delayargs : dict
-            parameters passed to delayfun
-        mindelay : float,
-            minimum delay in multiples of dt
-        multapsefun : function or None
-            function reference, e.g., numpy.random.normal used to draw a number
-            of synapses for a cell-to-cell connection. If None, draw only one
-            connection
-        multapseargs : dict
-            arguments passed to multapsefun
-        syn_pos_args : dict
-            arguments passed to inherited LFPy.Cell method
-            NetworkCell.get_rand_idx_area_and_distribution_norm to find
-            synapse locations.
-        save_connections : bool
-            if True (default False), save instantiated connections to HDF5 file
-            "Network.OUTPUTPATH/synapse_positions.h5" as dataset "
:"
-            using a structured ndarray with dtype
-            [('gid', 'i8'), ('x', float), ('y', float), ('z', float)]
-            where gid is postsynaptic cell id, and x,y,z the corresponding
-            midpoint coordinates of the target compartment.
-        """
-        # set up connections from all cells in presynaptic to post across RANKs
-        n0 = self.populations[pre].first_gid
-        # gids of presynaptic neurons:
-        pre_gids = np.arange(n0, n0 + self.populations[pre].POP_SIZE)
-
-        # count connections and synapses made on this RANK
-        conncount = connectivity.astype(int).sum()
-        syncount = 0
-
-        # keep track of synapse positions for this connect
-        # call on this rank such that these can be communicated and stored
-        syn_idx_pos = []
-
-        # iterate over gids on this RANK and create connections
-        for i, (post_gid, cell) in enumerate(zip(self.populations[post].gids, self.populations[post].cells)):
-            # do NOT iterate over all possible presynaptic neurons
-            for pre_gid in pre_gids[connectivity[:, i]]:
-                # throw a warning if sender neuron is identical to receiving neuron
-                if post_gid == pre_gid:
-                    print('connecting cell w. gid {} to itself (RANK {})'.format(post_gid, RANK))
-
-                # assess number of synapses
-                if multapsefun is None:
-                    nidx = 1
-                else:
-                    nidx = 0
-                    j = 0
-                    while nidx <= 0 and j < 1000:
-                        nidx = int(multapsefun(**multapseargs))
-                        j += 1
-                    if j == 1000:
-                        raise Exception('change multapseargs as no positive synapse count was found in 1000 trials')
-
-                # find synapse locations and corresponding section names
-                idxs = cell.get_rand_idx_area_and_distribution_norm(nidx=nidx, **syn_pos_args)
-                secs = cell.get_idx_name(idxs)
-
-                # draw weights
-                weights = weightfun(size=nidx, **weightargs)
-                # redraw weights less that minweight
-                while np.any(weights < minweight):
-                    j = weights < minweight
-                    weights[j] = weightfun(size=j.sum(), **weightargs)
-
-                # draw delays
-                delays = delayfun(size=nidx, **delayargs)
-                # redraw delays shorter than mindelay
-                while np.any(delays < mindelay):
-                    j = delays < mindelay
-                    delays[j] = delayfun(size=j.sum(), **delayargs)
-
-                for i, ((idx, secname, x), weight, delay) in enumerate(zip(secs, weights, delays)):
-                    cell.create_synapse(cell,
-                                        # TODO: Find neater way of accessing Section reference, this seems slow
-                                        sec=list(cell.allseclist)[np.where(np.array(cell.allsecnames)==secname)[0][0]],
-                                        x=x, syntype=syntype,
-                                        synparams=synparams)
-                    # connect up NetCon object
-                    nc = self.pc.gid_connect(pre_gid, cell.netconsynapses[-1])
-                    nc.weight[0] = weight
-                    nc.delay = delays[i]
-                    self.netconlist.append(nc)
-
-                    # store also synapse indices allowing for computing LFPs from syn.i
-                    cell.synidx.append(idx)
-
-                    # store gid and xyz-coordinate of synapse positions
-                    syn_idx_pos.append((cell.gid, cell.xmid[idx], cell.ymid[idx], cell.zmid[idx]))
-
-                syncount += nidx
-
-        conncount = COMM.reduce(conncount, op=MPI.SUM, root=0)
-        syncount = COMM.reduce(syncount, op=MPI.SUM, root=0)
-
-        if RANK == 0:
-            print('Connected population {} to {} by {} connections and {} synapses'.format(pre, post, conncount, syncount))
-
-        else:
-            conncount = None
-            syncount = None
-
-
-        # gather and write syn_idx_pos data
-        if save_connections:
-            if RANK == 0:
-                synData = flattenlist(COMM.gather(syn_idx_pos))
-
-                # convert to structured array
-                dtype = [('gid', 'i8'), ('x', float), ('y', float), ('z', float)]
-                synDataArray = np.empty((len(synData), ), dtype=dtype)
-                for i, (gid, x, y, z) in enumerate(synData):
-                    synDataArray[i]['gid'] = gid
-                    synDataArray[i]['x'] = x
-                    synDataArray[i]['y'] = y
-                    synDataArray[i]['z'] = z
-                # Dump to hdf5 file, append to file if entry exists
-                f = h5py.File(os.path.join(self.OUTPUTPATH,
-                                           'synapse_positions.h5'), 'a')
-                key = '{}:{}'.format(pre, post)
-                if key in f.keys():
-                    del f[key]
-                    try:
-                        assert key not in f.keys()
-                    except AssertionError:
-                        raise AssertionError
-                f[key] = synDataArray
-                f.close()
-            else:
-                COMM.gather(syn_idx_pos)
-
-        return COMM.bcast([conncount, syncount])
-
-
-    def simulate(self, electrode=None, rec_imem=False, rec_vmem=False,
-                 rec_ipas=False, rec_icap=False,
-                 rec_isyn=False, rec_vmemsyn=False, rec_istim=False,
-                 rec_current_dipole_moment=False,
-                 rec_pop_contributions=False,
-                 rec_variables=[], variable_dt=False, atol=0.001,
-                 to_memory=True, to_file=False,
-                 file_name='OUTPUT.h5',
-                 dotprodcoeffs=None, **kwargs):
-        """
-        This is the main function running the simulation of the network model.
-
-        Parameters
-        ----------
-        electrode:
-            Either an LFPy.RecExtElectrode object or a list of such.
-                    If supplied, LFPs will be calculated at every time step
-                    and accessible as electrode.LFP. If a list of objects
-                    is given, accessible as electrode[0].LFP etc.
-        rec_imem:   If true, segment membrane currents will be recorded
-                    If no electrode argument is given, it is necessary to
-                    set rec_imem=True in order to calculate LFP later on.
-                    Units of (nA).
-        rec_vmem:   record segment membrane voltages (mV)
-        rec_ipas:   record passive segment membrane currents (nA)
-        rec_icap:   record capacitive segment membrane currents (nA)
-        rec_isyn:   record synaptic currents of from Synapse class (nA)
-        rec_vmemsyn:    record membrane voltage of segments with Synapse(mV)
-        rec_istim:  record currents of StimIntraElectrode (nA)
-        rec_current_dipole_moment : bool
-            If True, compute and record current-dipole moment from
-            transmembrane currents as in Linden et al. (2010) J Comput Neurosci,
-            DOI: 10.1007/s10827-010-0245-4. Will set the `LFPy.Cell` attribute
-            `current_dipole_moment` as n_timesteps x 3 `ndarray` where the
-            last dimension contains the x,y,z components of the dipole moment.
-        rec_pop_contributions : bool
-            If True, compute and return single-population contributions to
-            the extracellular potential during simulation time
-        rec_variables: list of variables to record, i.e arg=['cai', ]
-        variable_dt: boolean, using variable timestep in NEURON
-        atol:       absolute tolerance used with NEURON variable timestep
-        to_memory:  only valid with electrode, store lfp in -> electrode.LFP
-        to_file:    only valid with electrode, save LFPs in hdf5 file format
-        file_name : str
-            If to_file is True, file which extracellular potentials will be
-            written to. The file format is HDF5, default is "OUTPUT.h5", put
-            in folder Network.OUTPUTPATH
-        dotprodcoeffs :  list of N x Nseg ndarray. These arrays will at
-                    every timestep be multiplied by the membrane currents.
-                    Presumably useful for memory efficient csd or lfp calcs
-        **kwargs :  keyword argument dict values passed along to function
-                    _run_simulation_with_electrode(), containing some or all of
-                    the boolean flags: use_ipas, use_icap, use_isyn
-                    (defaulting to 'False').
-
-        Returns
-        -------
-        SPIKES : dict
-            the first returned argument is a dictionary with keys 'gids' and
-            'times'. Each item is a nested list of len(Npop) times N_X where N_X
-            is the corresponding population size. Each entry is a np.ndarray
-            containing the spike times of each cell in the nested list in item
-            'gids'
-        OUTPUT : list of ndarray
-            if parameters electrode is not None and/or dotprodcoeffs is not
-            None, contains the
-            [electrode.LFP, ...., (dotprodcoeffs[0] dot I)(t), ...]
-            The first output is a structured array, so OUTPUT[0]['imem']
-            corresponds to the total LFP and the other the per-population
-            contributions.
-        P : ndarray
-            if rec_current_dipole_moment==True, contains the x,y,z-components of
-            current-dipole moment from transmembrane currents summed up over
-            all populations
-
-        """
-        # set up integrator, use the CVode().fast_imem method by default
-        # as it doesn't hurt sim speeds much if at all.
-        cvode = neuron.h.CVode()
-        try:
-            cvode.use_fast_imem(1)
-        except AttributeError as ae:
-            raise Exception('neuron.h.CVode().use_fast_imem() not found. Please update NEURON to v.7.4 or newer')
-
-        # test some of the inputs
-        try:
-            if electrode is None:
-                assert(rec_pop_contributions is False)
-        except AssertionError:
-            raise AssertionError('rec_pop_contributions can not be True when electrode is None')
-
-        for name in self.population_names:
-            for cell in self.populations[name].cells:
-                cell._set_soma_volt_recorder()
-                if rec_imem:
-                    cell._set_imem_recorders()
-                if rec_vmem:
-                    cell._set_voltage_recorders()
-                if rec_ipas:
-                    cell._set_ipas_recorders()
-                if rec_icap:
-                    cell._set_icap_recorders()
-                # if rec_current_dipole_moment:
-                #     self._set_current_dipole_moment_array()
-                if len(rec_variables) > 0:
-                    cell._set_variable_recorders(rec_variables)
-
-        #run fadvance until t >= tstop, and calculate LFP if asked for
-        if electrode is None and dotprodcoeffs is None and not rec_current_dipole_moment and not rec_pop_contributions and not to_file:
-            if not rec_imem:
-                if self.verbose:
-                    print("rec_imem = {}, not recording membrane currents!".format(rec_imem))
-            _run_simulation(self, cvode, variable_dt, atol)
-        else:
-            if dotprodcoeffs is not None:
-                raise NotImplementedError
-            LFP, P = _run_simulation_with_electrode(self, cvode=cvode,
-                            electrode=electrode,
-                            variable_dt=variable_dt,
-                            atol=atol,
-                            to_memory=to_memory,
-                            to_file=to_file,
-                            file_name='tmp_output_RANK_{:03d}.h5',
-                            dotprodcoeffs=dotprodcoeffs,
-                            rec_current_dipole_moment=rec_current_dipole_moment,
-                            rec_pop_contributions=rec_pop_contributions,
-                            **kwargs)
-
-        for name in self.population_names:
-            for cell in self.populations[name].cells:
-                #somatic trace
-                cell.somav = np.array(cell.somav)
-                if rec_imem:
-                    cell._calc_imem()
-                if rec_ipas:
-                    cell._calc_ipas()
-                if rec_icap:
-                    cell._calc_icap()
-                if rec_vmem:
-                    cell._collect_vmem()
-                if rec_isyn:
-                    cell._collect_isyn()
-                if rec_vmemsyn:
-                    cell._collect_vsyn()
-                if rec_istim:
-                    cell._collect_istim()
-                if len(rec_variables) > 0:
-                    cell._collect_rec_variables(rec_variables)
-                if hasattr(cell, 'netstimlist'):
-                    del cell.netstimlist
-
-        # Collect spike trains across all RANKs to RANK 0
-        for name in self.population_names:
-            population = self.populations[name]
-            for i in range(len(population.spike_vectors)):
-                population.spike_vectors[i] = np.array(population.spike_vectors[i])
-        if RANK == 0:
-            times = []
-            gids = []
-            for i, name in enumerate(self.population_names):
-                times.append([])
-                gids.append([])
-                times[i] += [x for x in self.populations[name].spike_vectors]
-                gids[i] += [x for x in self.populations[name].gids]
-                for j in range(1, SIZE):
-                    times[i] += COMM.recv(source=j, tag=13)
-                    gids[i] += COMM.recv(source=j, tag=14)
-        else:
-            times = None
-            gids = None
-            for name in self.population_names:
-                COMM.send([x for x in self.populations[name].spike_vectors],
-                    dest=0, tag=13)
-                COMM.send([x for x in self.populations[name].gids],
-                    dest=0, tag=14)
-
-        # create final output file, summing up single RANK output from temp files
-        if to_file and electrode is not None:
-            op=MPI.SUM
-            fname = os.path.join(self.OUTPUTPATH, 'tmp_output_RANK_{:03d}.h5'.format(RANK))
-            f0 = h5py.File(fname, 'r')
-            if RANK == 0:
-                f1 = h5py.File(os.path.join(self.OUTPUTPATH, file_name), 'w')
-            dtype = []
-            for key, value in f0[list(f0.keys())[0]].items():
-                dtype.append((str(key), np.float))
-            shape = value.shape
-            for grp in f0.keys():
-                if RANK == 0:
-                    f1[grp] = np.zeros(shape, dtype=dtype)
-                for key, value in f0[grp].items():
-                    if RANK == 0:
-                        recvbuf = np.zeros(shape, dtype=np.float)
-                    else:
-                        recvbuf = None
-                    COMM.Reduce(value[()].astype(np.float), recvbuf, op=op, root=0)
-                    if RANK == 0:
-                        f1[grp][key] = recvbuf
-            f0.close()
-            if RANK == 0:
-                f1.close()
-            os.remove(fname)
-
-
-        if electrode is None and dotprodcoeffs is None and not rec_current_dipole_moment and not rec_pop_contributions:
-            return dict(times=times, gids=gids)
-        else:
-            # communicate and sum up LFPs and dipole moments:
-            if LFP is not None:
-                for i in range(len(LFP)):
-                    LFP[i] = ReduceStructArray(LFP[i])
-            if P is not None:
-                P = ReduceStructArray(P)
-            return dict(times=times, gids=gids), LFP, P
-
-
-    def _create_network_dummycell(self):
-        """
-        set up parameters for a DummyCell object, allowing for computing
-        the sum of all single-cell LFPs at each timestep, essentially
-        creating one supercell with all segments of all cell objects
-        present on this RANK.
-        """
-        # compute the total number of segments per population on this RANK
-        nsegs = [[cell.totnsegs for cell in self.populations[name].cells]
-            for name in self.population_names]
-        for i, nseg in enumerate(nsegs):
-            if nseg == []:
-                nsegs[i] = [0]
-        for i, y in enumerate(nsegs): nsegs[i] = np.sum(y)
-        nsegs = np.array(nsegs, dtype=int)
-
-        totnsegs = nsegs.sum()
-        imem = np.eye(totnsegs)
-        xstart = np.array([])
-        xmid = np.array([])
-        xend = np.array([])
-        ystart = np.array([])
-        ymid = np.array([])
-        yend = np.array([])
-        zstart = np.array([])
-        zmid = np.array([])
-        zend = np.array([])
-        diam = np.array([])
-        area = np.array([])
-
-        somainds = np.array([], dtype=int)
-        nseg = 0
-
-        for name in self.population_names:
-            for cell in self.populations[name].cells:
-                xstart = np.r_[xstart, cell.xstart]
-                ystart = np.r_[ystart, cell.ystart]
-                zstart = np.r_[zstart, cell.zstart]
-                xmid = np.r_[xmid, cell.xmid]
-                ymid = np.r_[ymid, cell.ymid]
-                zmid = np.r_[zmid, cell.zmid]
-                xend = np.r_[xend, cell.xend]
-                yend = np.r_[yend, cell.yend]
-                zend = np.r_[zend, cell.zend]
-                diam = np.r_[diam, cell.diam]
-                area = np.r_[area, cell.area]
-
-                somainds = np.r_[somainds, cell.get_idx("soma")+nseg]
-                nseg += cell.totnsegs
-
-
-        # return number of segments per population and DummyCell object
-        return nsegs, DummyCell(totnsegs,
-                         imem,
-                         xstart, xmid, xend,
-                         ystart, ymid, yend,
-                         zstart, zmid, zend,
-                         diam, area, somainds)
-
-
-def _run_simulation(network, cvode, variable_dt=False, atol=0.001):
-    """
-    Running the actual simulation in NEURON, simulations in NEURON
-    are now interruptable.
-
-    Parameters
-    ----------
-    network : LFPy.Network object
-        instantiation of class LFPy.Network
-    cvode : neuron.h.CVode() object
-    variable_dt : bool
-        switch for variable-timestep method
-    atol : float
-        absolute tolerance with CVode for variable time-step method
-    """
-    # set maximum integration step, it is necessary for communication of
-    # spikes across RANKs to occur.
-    network.pc.set_maxstep(10)
-
-    # time resolution
-    neuron.h.dt = network.dt
-
-    #don't know if this is the way to do, but needed for variable dt method
-    if variable_dt:
-        cvode.active(1)
-        cvode.atol(atol)
-    else:
-        cvode.active(0)
-
-    # initialize state
-    neuron.h.finitialize(network.v_init)
-
-    # initialize current- and record
-    if cvode.active():
-        cvode.re_init()
-    else:
-        neuron.h.fcurrent()
-    neuron.h.frecord_init()
-
-    # Starting simulation at tstart
-    neuron.h.t = network.tstart
-
-    # only needed if LFPy.Synapse classes are used.
-    for name in network.population_names:
-        for cell in network.populations[name].cells:
-            cell._loadspikes()
-
-    while neuron.h.t < network.tstop:
-        neuron.h.fadvance()
-        if neuron.h.t % 100 == 0:
-            if RANK == 0:
-                print('t = {} ms'.format(neuron.h.t))
-
-    return
-
-
-def _run_simulation_with_electrode(network, cvode,
-                                   electrode=None,
-                                   variable_dt=False,
-                                   atol=0.001,
-                                   to_memory=True,
-                                   to_file=False,
-                                   file_name=None,
-                                   dotprodcoeffs=None,
-                                   rec_current_dipole_moment=False,
-                                   use_ipas=False, use_icap=False,
-                                   use_isyn=False,
-                                   rec_pop_contributions=False
-                                   ):
-    """
-    Running the actual simulation in NEURON.
-    electrode argument used to determine coefficient
-    matrix, and calculate the LFP on every time step.
-
-    Parameters
-    ----------
-    network : LFPy.Network object
-        instantiation of class LFPy.Network
-    cvode : neuron.h.CVode() object
-    electrode : LFPy.RecExtElectrode object or None
-        instantiation of class LFPy.RecExtElectrode for which extracellular
-        potentials will be computed.
-    variable_dt : bool
-        switch for variable-timestep method
-    atol : float
-        absolute tolerance with CVode for variable time-step method
-    to_memory : bool
-        Boolean flag for computing extracellular potentials, default is True
-    to_file : bool or None
-        Boolean flag for computing extracellular potentials to file
-        , default is False
-    file_name : formattable str
-        If to_file is True, file which extracellular potentials will be
-        written to. The file format is HDF5, default is
-        "output_RANK_{:03d}.h5". The output is written per RANK, and the
-        RANK # will be inserted into the corresponding file name.
-    dotprodcoeffs : None or list of ndarrays
-        Each element in list is a mapping of transmembrane currents to a measure
-        on the form :math:`V = \\mathbf{C} \\cdot \\mathbf{I}`
-    rec_current_dipole_moment : bool
-        if True, compute and store the total current-dipole moment per time
-        step as the sum over each individual population
-    use_ipas : bool
-        if True, compute the contribution to extracellular potentials across
-        the passive leak channels embedded in the cells membranes summed over
-        populations
-    use_icap : bool
-        if True, compute the contribution to extracellular potentials across
-        the membrane capacitance embedded in the cells membranes summed over
-        populations
-    use_isyn : bool
-        if True, compute the contribution to extracellular potentials across
-        the excitatory and inhibitory synapses embedded in the cells membranes
-        summed over populations
-    rec_pop_contributions : bool
-        if True, compute and return single-population contributions to the
-        extracellular potential during each time step of the simulation
-
-    Returns
-    -------
-    RESULTS : list
-        ordered according to [dotprodcoeffs, ..., electrode, ...], each element
-        being the superimposed contribution to i.e., the extracellular potential
-        at each timestep from all cell objects on this particular RANK.
-        Thus, no single-cell contributions to the LFP
-        are returned.
-    DIPOLE_MOMENT : ndarray
-        Shape (n_timesteps, 3) array containing the x,y,z-components of the
-        current-dipole moment summed up over contributions from cells across
-        all populations on this MPI RANK.
-    """
-    # create a dummycell object lumping together needed attributes
-    # for calculation of extracellular potentials etc. The population_nsegs
-    # array is used to slice indices such that single-population
-    # contributions to the potential can be calculated.
-    population_nsegs, network_dummycell = network._create_network_dummycell()
-
-    # Use electrode object(s) to calculate coefficient matrices for LFP
-    # calculations. If electrode is a list, then
-    # put electrodecoeff in a list, if it isn't already
-    if dotprodcoeffs is not None:
-        if type(dotprodcoeffs) != list:
-            dotprodcoeffs = [dotprodcoeffs]
-    else:
-        #create empty list if no dotprodcoeffs are supplied
-        dotprodcoeffs = []
-
-    #access electrode object and append dotprodcoeffs
-    if electrode is not None:
-        #put electrode argument in list if needed
-        if type(electrode) == list:
-            electrodes = electrode
-        else:
-            electrodes = [electrode]
-
-        # At each timestep we will later construct a single vector I of all
-        # transmembrane currents. With that, and a corresponding matrix G
-        # mapping a current contribution to an electrode contact, we can here
-        # compute the extracellular potentials V_r in all contacts r at
-        # timestep t_i as
-        # V_r(r, t_i) = G x I(r, t_i)
-
-
-        # # create a dummycell object lumping together needed attributes
-        # # for calculation of extracellular potentials. The population_nsegs
-        # # array is used to slice indices such that single-population
-        # # contributions to the potential can be calculated.
-        # population_nsegs, network_dummycell = network._create_network_dummycell()
-
-        # We can have a number of separate electrode objects in a list, create
-        # mappings for each
-        for el in electrodes:
-            # el.calc_lfp(cell=network_dummycell)
-            el.calc_mapping(cell=network_dummycell)
-            dotprodcoeffs += [el.mapping]
-            # del el.LFP
-            del el.mapping
-
-    elif electrode is None:
-        electrodes = None
-        # if rec_current_dipole_moment:
-        #     population_nsegs, network_dummycell = network._create_network_dummycell()
-
-
-
-
-    # set maximum integration step, it is necessary for communication of
-    # spikes across RANKs to occur.
-    # NOTE: Should this depend on the minimum delay in the network?
-    network.pc.set_maxstep(10)
-
-    # Initialize NEURON simulations of cell object
-    neuron.h.dt = network.dt
-
-    #needed for variable dt method
-    if network.dt <= 1E-8:
-        cvode.active(1)
-        cvode.atol(atol)
-    else:
-        cvode.active(0)
-
-    #initialize state
-    neuron.h.finitialize(network.v_init)
-
-    # use fast calculation of transmembrane currents
-    cvode.use_fast_imem(1)
-
-    #initialize current- and record
-    if cvode.active():
-        cvode.re_init()
-    else:
-        neuron.h.fcurrent()
-    neuron.h.frecord_init()
-
-    #Starting simulation at tstart
-    neuron.h.t = network.tstart
-
-    # create list of cells across all populations to simplify loops
-    cells = []
-    for name in network.population_names:
-        cells += network.populations[name].cells
-
-    #load spike times from NetCon, only needed if LFPy.Synapse class is used
-    for cell in cells:
-        cell._loadspikes()
-
-
-    # define data type for structured arrays dependent on the boolean arguments
-    dtype = [('imem', np.float)]
-    if use_ipas: dtype += [('ipas', np.float)]
-    if use_icap: dtype += [('icap', np.float)]
-    if use_isyn: dtype += [('isyn_e', np.float), ('isyn_i', np.float)]
-    if rec_pop_contributions: dtype += list(zip(network.population_names,
-                                                [np.float]*len(network.population_names)))
-
-    # setup list of structured arrays for all extracellular potentials
-    # at each contact from different source terms and subpopulations
-    if to_memory:
-        RESULTS = []
-        for coeffs in dotprodcoeffs:
-            RESULTS.append(np.zeros((coeffs.shape[0],
-                                     int(network.tstop / network.dt) + 1),
-                                    dtype=dtype)
-                           )
-    else:
-        RESULTS = None
-
-    # container for electric current dipole moment for the individual
-    # populations captured inside the DummyCell instance
-    if rec_current_dipole_moment:
-        DIPOLE_MOMENT = np.zeros((int(network.tstop / network.dt) + 1, 3),
-            dtype=list(zip(network.population_names,
-                           [np.float]*len(network.population_names))))
-    else:
-        DIPOLE_MOMENT = None
-
-    #LFPs for each electrode will be put here during simulations
-    if to_file:
-        #ensure right ending:
-        if file_name.split('.')[-1] != 'h5':
-            file_name += '.h5'
-        outputfile = h5py.File(os.path.join(network.OUTPUTPATH,
-                                            file_name.format(RANK)), 'w')
-        for i, coeffs in enumerate(dotprodcoeffs):
-            # can't do it this way until h5py issue #770
-            # (https://github.com/h5py/h5py/issues/770) is fixed:
-            # outputfile['OUTPUT[{}]'.format(i)] = np.zeros((coeffs.shape[0],
-            #                     int(network.tstop / network.dt) + 1), dtype=dtype)
-            grp = outputfile.create_group('OUTPUT[{}]'.format(i))
-            for key, val in dtype:
-                grp[key] = np.zeros((coeffs.shape[0], int(network.tstop / network.dt) + 1), dtype=val)
-
-    # temp vector to store membrane currents at each timestep:
-    imem = np.zeros(network_dummycell.totnsegs, dtype=dtype)
-
-    # create a 2D array representation of segment midpoints for dot product
-    # with transmembrane currents when computing dipole moment
-    if rec_current_dipole_moment:
-        midpoints = np.c_[network_dummycell.xmid,
-                          network_dummycell.ymid,
-                          network_dummycell.zmid]
-
-    #run fadvance until time limit, and calculate LFPs for each timestep
-    tstep = 0
-    while neuron.h.t < network.tstop:
-        if neuron.h.t >= 0:
-            i = 0
-            totnsegs = 0
-            if use_isyn:
-                imem['isyn_e'] = 0. # need to reset these for every iteration
-                imem['isyn_i'] = 0. # because we sum over synapses
-            for cell in cells:
-                for sec in cell.allseclist:
-                    for seg in sec:
-                        imem['imem'][i] = seg.i_membrane_
-                        if use_ipas:
-                            imem['ipas'][i] = seg.i_pas
-                        if use_icap:
-                            imem['icap'][i] = seg.i_cap
-                        i += 1
-
-                if use_isyn:
-                    for idx, syn in zip(cell.synidx, cell.netconsynapses):
-                        if hasattr(syn, 'e') and syn.e > -50:
-                            imem['isyn_e'][idx+totnsegs] += syn.i
-                        else:
-                            imem['isyn_i'][idx+totnsegs] += syn.i
-
-                totnsegs += cell.totnsegs
-
-            if rec_current_dipole_moment:
-                k = 0 # counter
-                for nsegs, name in zip(population_nsegs, network.population_names):
-                    cellinds = np.arange(k, k+nsegs)
-                    DIPOLE_MOMENT[name][tstep, ] = np.dot(imem['imem'][cellinds, ],
-                                                          midpoints[cellinds, ])
-                    k += nsegs
-
-            if to_memory:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    RESULTS[j]['imem'][:, tstep] = np.dot(coeffs, imem['imem'])
-                    if use_ipas:
-                        RESULTS[j]['ipas'][:, tstep] = np.dot(coeffs, imem['ipas'] * network_dummycell.area * 1E-2)
-                    if use_icap:
-                        RESULTS[j]['icap'][:, tstep] = np.dot(coeffs, imem['icap'] * network_dummycell.area * 1E-2)
-                    if use_isyn:
-                        RESULTS[j]['isyn_e'][:, tstep] = np.dot(coeffs, imem['isyn_e'])
-                        RESULTS[j]['isyn_i'][:, tstep] = np.dot(coeffs, imem['isyn_i'])
-
-                if rec_pop_contributions:
-                    for j, coeffs in enumerate(dotprodcoeffs):
-                        k = 0 # counter
-                        for nsegs, name in zip(population_nsegs, network.population_names):
-                            cellinds = np.arange(k, k+nsegs)
-                            RESULTS[j][name][:, tstep] = np.dot(coeffs[:, cellinds],
-                                                                imem['imem'][cellinds, ])
-                            k += nsegs
-
-            if to_file:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    outputfile['OUTPUT[{}]'.format(j)
-                               ]['imem'][:, tstep] = np.dot(coeffs, imem['imem'])
-                    if use_ipas:
-                        outputfile['OUTPUT[{}]'.format(j)
-                                   ]['ipas'][:, tstep] = np.dot(coeffs, imem['ipas'] * network_dummycell.area * 1E-2)
-                    if use_icap:
-                        outputfile['OUTPUT[{}]'.format(j)
-                                   ]['icap'][:, tstep] = np.dot(coeffs, imem['icap'] * network_dummycell.area * 1E-2)
-                    if use_isyn:
-                        outputfile['OUTPUT[{}]'.format(j)
-                                   ]['isyn_e'][:, tstep] = np.dot(coeffs, imem['isyn_e'])
-                        outputfile['OUTPUT[{}]'.format(j)
-                                   ]['isyn_i'][:, tstep] = np.dot(coeffs, imem['isyn_i'])
-
-                if rec_pop_contributions:
-                    for j, coeffs in enumerate(dotprodcoeffs):
-                        k = 0 # counter
-                        for nsegs, name in zip(population_nsegs, network.population_names):
-                            cellinds = np.arange(k, k+nsegs)
-                            outputfile['OUTPUT[{}]'.format(j)
-                                       ][name][:, tstep] = np.dot(coeffs[:, cellinds], imem['imem'][cellinds, ])
-                            k += nsegs
-
-            tstep += 1
-        neuron.h.fadvance()
-        if neuron.h.t % 100. == 0.:
-            if RANK == 0:
-                print('t = {} ms'.format(neuron.h.t))
-
-
-    try:
-        #calculate LFP after final fadvance()
-        i = 0
-        totnsegs = 0
-        if use_isyn:
-            imem['isyn_e'] = 0. # need to reset these for every iteration because we sum over synapses
-            imem['isyn_i'] = 0.
-        for cell in cells:
-            for sec in cell.allseclist:
-                for seg in sec:
-                    imem['imem'][i] = seg.i_membrane_
-                    if use_ipas:
-                        imem['ipas'][i] = seg.i_pas
-                    if use_icap:
-                        imem['icap'][i] = seg.i_cap
-                    i += 1
-
-            if use_isyn:
-                for idx, syn in zip(cell.synidx, cell.netconsynapses):
-                    if hasattr(syn, 'e') and syn.e > -50:
-                        imem['isyn_e'][idx+totnsegs] += syn.i
-                    else:
-                        imem['isyn_i'][idx+totnsegs] += syn.i
-
-            totnsegs += cell.totnsegs
-
-        if rec_current_dipole_moment:
-            k = 0 # counter
-            for nsegs, name in zip(population_nsegs, network.population_names):
-                cellinds = np.arange(k, k+nsegs)
-                DIPOLE_MOMENT[name][tstep, ] = np.dot(imem['imem'][cellinds, ], midpoints[cellinds, ])
-                k += nsegs
-
-        if to_memory:
-            for j, coeffs in enumerate(dotprodcoeffs):
-                RESULTS[j]['imem'][:, tstep] = np.dot(coeffs, imem['imem'])
-                if use_ipas:
-                    RESULTS[j]['ipas'][:, tstep] = np.dot(coeffs, imem['ipas'] * network_dummycell.area * 1E-2)
-                if use_icap:
-                    RESULTS[j]['icap'][:, tstep] = np.dot(coeffs, imem['icap'] * network_dummycell.area * 1E-2)
-                if use_isyn:
-                    RESULTS[j]['isyn_e'][:, tstep] = np.dot(coeffs, imem['isyn_e'])
-                    RESULTS[j]['isyn_i'][:, tstep] = np.dot(coeffs, imem['isyn_i'])
-
-            if rec_pop_contributions:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    k = 0 # counter
-                    for nsegs, name in zip(population_nsegs, network.population_names):
-                        cellinds = np.arange(k, k+nsegs)
-                        RESULTS[j][name][:, tstep] = np.dot(coeffs[:, cellinds], imem['imem'][cellinds, ])
-                        k += nsegs
-
-
-        if to_file:
-            for j, coeffs in enumerate(dotprodcoeffs):
-                outputfile['OUTPUT[{}]'.format(j)
-                           ]['imem'][:, tstep] = np.dot(coeffs, imem['imem'])
-                if use_ipas:
-                    outputfile['OUTPUT[{}]'.format(j)
-                               ]['ipas'][:, tstep] = np.dot(coeffs, imem['ipas'] * network_dummycell.area * 1E-2)
-                if use_icap:
-                    outputfile['OUTPUT[{}]'.format(j)
-                               ]['icap'][:, tstep] = np.dot(coeffs, imem['icap'] * network_dummycell.area * 1E-2)
-                if use_isyn:
-                    outputfile['OUTPUT[{}]'.format(j)
-                               ]['isyn_e'][:, tstep] = np.dot(coeffs, imem['isyn_e'])
-                    outputfile['OUTPUT[{}]'.format(j)
-                               ]['isyn_i'][:, tstep] = np.dot(coeffs, imem['isyn_i'])
-
-            if rec_pop_contributions:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    k = 0 # counter
-                    for nsegs, name in zip(population_nsegs, network.population_names):
-                        cellinds = np.arange(k, k+nsegs)
-                        outputfile['OUTPUT[{}]'.format(j)
-                                   ][name][:, tstep] = np.dot(coeffs[:, cellinds],
-                                                              imem['imem'][cellinds, ])
-                        k += nsegs
-
-    except IndexError:
-        pass
-
-    if to_memory:
-        return RESULTS, DIPOLE_MOMENT
-
-    if to_file:
-        outputfile.close()
-        return RESULTS, DIPOLE_MOMENT
-
-
-def ReduceStructArray(sendbuf, op=MPI.SUM):
-    """
-    simplify MPI Reduce for structured ndarrays with floating point numbers
-
-    Parameters
-    ----------
-    sendbuf : structured ndarray
-        Array data to be reduced (default: summed)
-    op : mpi4py.MPI.Op object
-        MPI_Reduce function. Default is mpi4py.MPI.SUM
-    """
-    if RANK == 0:
-        shape = sendbuf.shape
-        dtype_names = sendbuf.dtype.names
-    else:
-        shape = None
-        dtype_names = None
-    shape = COMM.bcast(shape)
-    dtype_names = COMM.bcast(dtype_names)
-
-    if RANK == 0:
-        reduced = np.zeros(shape,
-                           dtype=list(zip(dtype_names,
-                                     ['f8' for i in range(len(dtype_names))])))
-    else:
-        reduced = None
-    for name in dtype_names:
-        if RANK == 0:
-            recvbuf = np.zeros(shape)
-        else:
-            recvbuf = None
-        COMM.Reduce(np.array(sendbuf[name]), recvbuf, op=op, root=0)
-        if RANK == 0:
-            reduced[name] = recvbuf
-    return reduced
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/pointprocess.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/pointprocess.py
deleted file mode 100644
index 31c7726..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/pointprocess.py
+++ /dev/null
@@ -1,295 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import numpy as np
-import neuron
-
-class PointProcess(object):
-    """
-    Superclass on top of Synapse, StimIntElectrode, just to import and set
-    some shared variables and extracts Cartesian coordinates of a segment
-    
-    Parameters
-    ----------
-    cell : obj
-        LFPy.Cell object
-    idx : int
-        index of segment
-    record_current : bool
-        Must be set to True for recording of pointprocess currents
-    record_potential : bool
-        Must be set to True for recording potential of pointprocess target idx
-    kwargs : pointprocess specific variables passed on to cell/neuron
-
-    """
-    def __init__(self, cell, idx, record_current=False, record_potential=False, **kwargs):
-        """
-        Initializes the PointProcess class
-        """
-        for key in ['color', 'marker']:
-            if key in kwargs.keys():
-                raise DeprecationWarning('Parameter {} has been deprecated'.format(key))
-        self.idx = idx
-        self.record_current = record_current
-        self.record_potential = record_potential
-        self.kwargs = kwargs
-        self.update_pos(cell)
-
-    def update_pos(self, cell):
-        """
-        Extract coordinates of point-process 
-        """
-        self.x = cell.xmid[self.idx]
-        self.y = cell.ymid[self.idx]
-        self.z = cell.zmid[self.idx]
-
-
-class Synapse(PointProcess):
-    """
-    The synapse class, pointprocesses that spawn membrane currents.
-    See http://www.neuron.yale.edu/neuron/static/docs/help/neuron/neuron/mech.html#pointprocesses
-    for details, or corresponding mod-files.
-    
-    This class is meant to be used with synaptic mechanisms, giving rise to
-    currents that will be part of the membrane currents. 
-
-    Parameters
-    ----------
-    cell : obj
-        `LFPy.Cell` or `LFPy.TemplateCell` instance to receive synapptic
-        input
-    idx : int
-        Cell index where the synaptic input arrives
-    syntype : str
-        Type of synapse. Built-in examples: ExpSyn, Exp2Syn
-    record_current : bool
-        Decides if current is recorded
-    **kwargs
-        Additional arguments to be passed on to
-        NEURON in `cell.set_synapse`
-
-    Examples
-    --------
-    >>> import pylab as pl
-    >>> pl.interactive(1)
-    >>> import LFPy
-    >>> import os
-    >>> cellParameters = {
-    >>>     'morphology' :  os.path.join('examples', 'morphologies', 'L5_Mainen96_LFPy.hoc'),
-    >>>     'passive' : True,
-    >>>     'tstop' :     50,
-    >>> }
-    >>> cell = LFPy.Cell(**cellParameters)
-
-    >>> synapseParameters = {
-    >>>     'idx' : cell.get_closest_idx(x=0, y=0, z=800),
-    >>>     'e' : 0,                                # reversal potential
-    >>>     'syntype' : 'ExpSyn',                   # synapse type
-    >>>     'tau' : 2,                              # syn. time constant
-    >>>     'weight' : 0.01,                        # syn. weight
-    >>>     'record_current' : True                 # syn. current record
-    >>> }
-    >>> synapse = LFPy.Synapse(cell, **synapseParameters)
-    >>> synapse.set_spike_times(pl.array([10, 15, 20, 25]))
-    >>> cell.simulate()
-
-    >>> pl.subplot(211)
-    >>> pl.plot(cell.tvec, synapse.i)
-    >>> pl.title('Synapse current (nA)')
-    >>> pl.subplot(212)
-    >>> pl.plot(cell.tvec, cell.somav)
-    >>> pl.title('Somatic potential (mV)')
-
-    """
-    def __init__(self, cell, idx, syntype, record_current=False, record_potential=False, **kwargs):
-        """
-        Initialization of class Synapse
-        """
-        PointProcess.__init__(self, cell, idx, record_current, record_potential, **kwargs)
-            
-        self.syntype = syntype
-        self.cell = cell
-        self.hocidx = int(cell.set_synapse(idx=idx, syntype=syntype,
-                                           record_current=record_current,
-                                           record_potential=record_potential,
-                                           **kwargs))
-        self._ns_index = int(cell.netstimlist.count()) - 1
-        cell.synapses.append(self)
-        cell.synidx.append(idx)
-        self.cell.sptimeslist.append(np.array([]))
-
-    def set_spike_times(self, sptimes=np.zeros(0)):
-        """Set the spike times explicitly using numpy arrays"""
-        try:
-            assert type(sptimes) is np.ndarray
-        except AssertionError:
-            raise AssertionError('synapse activation times must be a np.ndarray, not type({})'.format(type(sptimes)))
-        self.cell.sptimeslist.insrt(self._ns_index, sptimes)
-        self.cell.sptimeslist.remove(self._ns_index + 1)
-    
-    def set_spike_times_w_netstim(self, noise=1., start=0., number=1E3,
-                                  interval=10., seed=1234.):
-        """
-        Generate a train of pre-synaptic stimulus times by setting up the
-        neuron NetStim object associated with this synapse
-        
-        Parameters
-        ----------
-        noise : float in range [0, 1]
-            Fractional randomness, from deterministic to intervals that drawn
-            from negexp distribution (Poisson spiketimes).
-        start : float
-            ms, (most likely) start time of first spike
-        number : int
-            (average) number of spikes
-        interval : float
-            ms, (mean) time between spikes
-        seed : float
-            Random seed value
-        """
-        self.cell.netstimlist[self._ns_index].noise = noise
-        self.cell.netstimlist[self._ns_index].start = start
-        self.cell.netstimlist[self._ns_index].number = number
-        self.cell.netstimlist[self._ns_index].interval = interval        
-        self.cell.netstimlist[self._ns_index].seed(seed)
-
-    def collect_current(self, cell):
-        """Collect synapse current"""
-        try:
-            self.i = np.array(cell.synireclist.o(self.hocidx))
-        except:
-            raise Exception('cell.synireclist deleted from consequtive runs')
-    
-    def collect_potential(self, cell):
-        """Collect membrane potential of segment with synapse"""
-        try:
-            self.v = np.array(cell.synvreclist.o(self.hocidx))
-        except:
-            raise Exception('cell.synvreclist deleted from consequtive runs')
-
-
-class StimIntElectrode(PointProcess):
-    """Class for NEURON point processes representing electrode currents,
-    such as VClamp, SEClamp and ICLamp.
-    
-    Membrane currents will no longer sum to zero if these mechanisms are used,
-    as the equivalent circuit is akin to a current input to the compartment
-    from a far away extracellular location ("ground"), not immediately from
-    the surface to the inside of the compartment as with transmembrane currents.
-    
-    Refer to NEURON documentation @ neuron.yale.edu for keyword arguments or 
-    class documentation in Python issuing e.g.
-        
-        help(neuron.h.VClamp)
-    
-    Will insert pptype on cell-instance, pass the corresponding kwargs onto
-    cell.set_point_process.
-
-    Parameters
-    ----------
-    cell : obj
-        `LFPy.Cell` or `LFPy.TemplateCell` instance to receive Stimulation
-         electrode input
-    idx : int
-        Cell segment index where the stimulation electrode is placed
-    pptype : str
-        Type of point process. Built-in examples: VClamp, SEClamp and ICLamp.
-        Defaults to 'SEClamp'.
-    record_current : bool
-        Decides if current is recorded
-    record_potential : bool
-        switch for recording the potential on postsynaptic segment index
-    **kwargs
-        Additional arguments to be passed on to
-        NEURON in `cell.set_point_process`
-
-    Examples
-    --------
-    >>> import pylab as pl
-    >>> pl.ion()
-    >>> import os
-    >>> import LFPy
-    >>> #define a list of different electrode implementations from NEURON
-    >>> pointprocesses = [
-    >>>     {
-    >>>         'idx' : 0,
-    >>>         'record_current' : True,
-    >>>         'pptype' : 'IClamp',
-    >>>         'amp' : 1,
-    >>>         'dur' : 20,
-    >>>         'delay' : 10,
-    >>>     },
-    >>>     {
-    >>>         'idx' : 0,
-    >>>         'record_current' : True,
-    >>>         'pptype' : 'VClamp',
-    >>>         'amp[0]' : -70,
-    >>>         'dur[0]' : 10,
-    >>>         'amp[1]' : 0,
-    >>>         'dur[1]' : 20,
-    >>>         'amp[2]' : -70,
-    >>>         'dur[2]' : 10,
-    >>>    },
-    >>>    {
-    >>>        'idx' : 0,
-    >>>        'record_current' : True,
-    >>>        'pptype' : 'SEClamp',
-    >>>        'dur1' : 10,
-    >>>        'amp1' : -70,
-    >>>        'dur2' : 20,
-    >>>        'amp2' : 0,
-    >>>        'dur3' : 10,
-    >>>        'amp3' : -70,
-    >>>     },
-    >>>  ]
-    >>>  #create a cell instance for each electrode
-    >>> for pointprocess in pointprocesses:
-    >>>      cell = LFPy.Cell(morphology=os.path.join('examples', 'morphologies', 'L5_Mainen96_LFPy.hoc'),
-    >>>                      passive=True)
-    >>>      stimulus = LFPy.StimIntElectrode(cell, **pointprocess)
-    >>>      cell.simulate()
-    >>>      pl.subplot(211)
-    >>>      pl.plot(cell.tvec, stimulus.i, label=pointprocess['pptype'])
-    >>>      pl.legend(loc='best')
-    >>>      pl.title('Stimulus currents (nA)')
-    >>>      pl.subplot(212)
-    >>>      pl.plot(cell.tvec, cell.somav, label=pointprocess['pptype'])
-    >>>      pl.legend(loc='best')
-    >>>      pl.title('Somatic potential (mV)')
-
-    """    
-    def __init__(self, cell, idx, pptype='SEClamp',
-                 record_current=False,
-                 record_potential=False, **kwargs):
-        """Initialize StimIntElectrode class"""
-        PointProcess.__init__(self, cell=cell, idx=idx,
-                              record_current=record_current,
-                              record_potential=record_potential)
-        self.pptype = pptype
-        self.hocidx = int(cell.set_point_process(idx, pptype,
-                                                 record_current=record_current,
-                                                 record_potential=record_potential,
-                                                 **kwargs))
-        cell.pointprocesses.append(self)
-        cell.pointprocess_idx.append(idx)
-
-    def collect_current(self, cell):
-        """Fetch electrode current from recorder list"""
-        self.i = np.array(cell.stimireclist.o(self.hocidx))
-    
-    def collect_potential(self, cell):
-        """Collect membrane potential of segment with PointProcess"""
-        self.v = np.array(cell.stimvreclist.o(self.hocidx))
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/recextelectrode.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/recextelectrode.py
deleted file mode 100644
index 35ef6c1..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/recextelectrode.py
+++ /dev/null
@@ -1,900 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import sys
-import warnings
-import numpy as np
-from . import lfpcalc, tools
-
-class RecExtElectrode(object):
-    """class RecExtElectrode
-
-    Main class that represents an extracellular electric recording devices such
-    as a laminar probe.
-
-    Parameters
-    ----------
-    cell : None or object
-        If not None, instantiation of LFPy.Cell, LFPy.TemplateCell or similar.
-    sigma : float or list/ndarray of floats
-        extracellular conductivity in units of (S/m). A scalar value implies an
-        isotropic extracellular conductivity. If a length 3 list or array of
-        floats is provided, these values corresponds to an anisotropic
-        conductor with conductivities [sigma_x, sigma_y, sigma_z] accordingly.
-    x, y, z : np.ndarray
-        coordinates or arrays of coordinates in units of (um). Must be same length
-    N : None or list of lists
-        Normal vectors [x, y, z] of each circular electrode contact surface,
-        default None
-    r : float
-        radius of each contact surface, default None
-    n : int
-        if N is not None and r > 0, the number of discrete points used to
-        compute the n-point average potential on each circular contact point.
-    contact_shape : str
-        'circle'/'square' (default 'circle') defines the contact point shape
-        If 'circle' r is the radius, if 'square' r is the side length
-    method : str
-        switch between the assumption of 'linesource', 'pointsource',
-        'soma_as_point' to represent each compartment when computing
-        extracellular potentials
-    from_file : bool
-        if True, load cell object from file
-    cellfile : str
-        path to cell pickle
-    verbose : bool
-        Flag for verbose output, i.e., print more information
-    seedvalue : int
-        random seed when finding random position on contact with r > 0
-
-    Examples
-    --------
-    Compute extracellular potentials after simulating and storage of
-    transmembrane currents with the LFPy.Cell class:
-
-    >>> import numpy as np
-    >>> import matplotlib.pyplot as plt
-    >>> import LFPy
-    >>>
-    >>> cellParameters = {
-    >>>     'morphology' : 'examples/morphologies/L5_Mainen96_LFPy.hoc',  # morphology file
-    >>>     'v_init' : -65,                          # initial voltage
-    >>>     'cm' : 1.0,                             # membrane capacitance
-    >>>     'Ra' : 150,                             # axial resistivity
-    >>>     'passive' : True,                        # insert passive channels
-    >>>     'passive_parameters' : {"g_pas":1./3E4, "e_pas":-65}, # passive params
-    >>>     'dt' : 2**-4,                           # simulation time res
-    >>>     'tstart' : 0.,                        # start t of simulation
-    >>>     'tstop' : 50.,                        # end t of simulation
-    >>> }
-    >>> cell = LFPy.Cell(**cellParameters)
-    >>>
-    >>> synapseParameters = {
-    >>>     'idx' : cell.get_closest_idx(x=0, y=0, z=800), # compartment
-    >>>     'e' : 0,                                # reversal potential
-    >>>     'syntype' : 'ExpSyn',                   # synapse type
-    >>>     'tau' : 2,                              # syn. time constant
-    >>>     'weight' : 0.01,                       # syn. weight
-    >>>     'record_current' : True                 # syn. current record
-    >>> }
-    >>> synapse = LFPy.Synapse(cell, **synapseParameters)
-    >>> synapse.set_spike_times(np.array([10., 15., 20., 25.]))
-    >>>
-    >>> cell.simulate(rec_imem=True)
-    >>>
-    >>> N = np.empty((16, 3))
-    >>> for i in xrange(N.shape[0]): N[i,] = [1, 0, 0] #normal vec. of contacts
-    >>> electrodeParameters = {         #parameters for RecExtElectrode class
-    >>>     'sigma' : 0.3,              #Extracellular potential
-    >>>     'x' : np.zeros(16)+25,      #Coordinates of electrode contacts
-    >>>     'y' : np.zeros(16),
-    >>>     'z' : np.linspace(-500,1000,16),
-    >>>     'n' : 20,
-    >>>     'r' : 10,
-    >>>     'N' : N,
-    >>> }
-    >>> electrode = LFPy.RecExtElectrode(cell, **electrodeParameters)
-    >>> electrode.calc_lfp()
-    >>> plt.matshow(electrode.LFP)
-    >>> plt.colorbar()
-    >>> plt.axis('tight')
-    >>> plt.show()
-
-
-    Compute extracellular potentials during simulation (recommended):
-
-    >>> import numpy as np
-    >>> import matplotlib.pyplot as plt
-    >>> import LFPy
-    >>>
-    >>> cellParameters = {
-    >>>     'morphology' : 'examples/morphologies/L5_Mainen96_LFPy.hoc',  # morphology file
-    >>>     'v_init' : -65,                          # initial voltage
-    >>>     'cm' : 1.0,                             # membrane capacitance
-    >>>     'Ra' : 150,                             # axial resistivity
-    >>>     'passive' : True,                        # insert passive channels
-    >>>     'passive_parameters' : {"g_pas":1./3E4, "e_pas":-65}, # passive params
-    >>>     'dt' : 2**-4,                           # simulation time res
-    >>>     'tstart' : 0.,                        # start t of simulation
-    >>>     'tstop' : 50.,                        # end t of simulation
-    >>> }
-    >>> cell = LFPy.Cell(**cellParameters)
-    >>>
-    >>> synapseParameters = {
-    >>>     'idx' : cell.get_closest_idx(x=0, y=0, z=800), # compartment
-    >>>     'e' : 0,                                # reversal potential
-    >>>     'syntype' : 'ExpSyn',                   # synapse type
-    >>>     'tau' : 2,                              # syn. time constant
-    >>>     'weight' : 0.01,                       # syn. weight
-    >>>     'record_current' : True                 # syn. current record
-    >>> }
-    >>> synapse = LFPy.Synapse(cell, **synapseParameters)
-    >>> synapse.set_spike_times(np.array([10., 15., 20., 25.]))
-    >>>
-    >>> N = np.empty((16, 3))
-    >>> for i in xrange(N.shape[0]): N[i,] = [1, 0, 0] #normal vec. of contacts
-    >>> electrodeParameters = {         #parameters for RecExtElectrode class
-    >>>     'sigma' : 0.3,              #Extracellular potential
-    >>>     'x' : np.zeros(16)+25,      #Coordinates of electrode contacts
-    >>>     'y' : np.zeros(16),
-    >>>     'z' : np.linspace(-500,1000,16),
-    >>>     'n' : 20,
-    >>>     'r' : 10,
-    >>>     'N' : N,
-    >>> }
-    >>> electrode = LFPy.RecExtElectrode(**electrodeParameters)
-    >>>
-    >>> cell.simulate(electrode=electrode)
-    >>>
-    >>> plt.matshow(electrode.LFP)
-    >>> plt.colorbar()
-    >>> plt.axis('tight')
-    >>> plt.show()
-
-    """
-
-    def __init__(self, cell=None, sigma=0.3,
-                 x=np.array([0]), y=np.array([0]), z=np.array([0]),
-                 N=None, r=None, n=None, contact_shape='circle',
-                 perCellLFP=False, method='linesource',
-                 from_file=False, cellfile=None, verbose=False,
-                 seedvalue=None, **kwargs):
-        """Initialize RecExtElectrode class"""
-
-        self.sigma = sigma
-        if type(sigma) in [list, np.ndarray]:
-            self.sigma = np.array(sigma)
-            if not self.sigma.shape == (3,):
-                raise ValueError("Conductivity, sigma, should be float "
-                                 "or array of length 3: "
-                                 "[sigma_x, sigma_y, sigma_z]")
-
-            self.anisotropic = True
-        else:
-            self.sigma = sigma
-            self.anisotropic = False
-
-        if type(x) in [float, int]:
-            self.x = np.array([x])
-        else:
-            self.x = np.array(x).flatten()
-        if type(y) in [float, int]:
-            self.y = np.array([y])
-        else:
-            self.y = np.array(y).flatten()
-        if type(z) in [float, int]:
-            self.z = np.array([z])
-        else:
-            self.z = np.array(z).flatten()
-        try:
-            assert((self.x.size==self.y.size) and (self.x.size==self.z.size))
-        except AssertionError:
-            raise AssertionError("The number of elements in [x, y, z] must be identical")
-
-        if N is not None:
-            if type(N) != np.array:
-                try:
-                    N = np.array(N)
-                except:
-                    print('Keyword argument N could not be converted to a '
-                          'numpy.ndarray of shape (n_contacts, 3)')
-                    print(sys.exc_info()[0])
-                    raise
-            if N.shape[-1] == 3:
-                self.N = N
-            else:
-                self.N = N.T
-                if N.shape[-1] != 3:
-                    raise Exception('N.shape must be (n_contacts, 1, 3)!')
-        else:
-            self.N = N
-
-        self.r = r
-        self.n = n
-
-        if contact_shape is None:
-            self.contact_shape = 'circle'
-        elif contact_shape in ['circle', 'square']:
-            self.contact_shape = contact_shape
-        else:
-            raise ValueError('The contact_shape argument must be either: '
-                             'None, \'circle\', \'square\'')
-
-        self.perCellLFP = perCellLFP
-
-        self.method = method
-        self.verbose = verbose
-        self.seedvalue = seedvalue
-
-        self.kwargs = kwargs
-
-        #None-type some attributes created by the Cell class
-        self.electrodecoeff = None
-        self.circle = None
-        self.offsets = None
-
-        if from_file:
-            if type(cellfile) == type(str()):
-                cell = tools.load(cellfile)
-            elif type(cellfile) == type([]):
-                cell = []
-                for fil in cellfile:
-                    cell.append(tools.load(fil))
-            else:
-                raise ValueError('cell either string or list of strings')
-
-        if cell is not None:
-            self.set_cell(cell)
-
-        if method == 'soma_as_point':
-            if self.anisotropic:
-                self.lfp_method = lfpcalc.calc_lfp_soma_as_point_anisotropic
-            else:
-                self.lfp_method = lfpcalc.calc_lfp_soma_as_point
-        elif method == 'som_as_point':
-            raise RuntimeError('The method "som_as_point" is deprecated.'
-                                     'Use "soma_as_point" instead')
-        elif method == 'linesource':
-            if self.anisotropic:
-                self.lfp_method = lfpcalc.calc_lfp_linesource_anisotropic
-            else:
-                self.lfp_method = lfpcalc.calc_lfp_linesource
-        elif method == 'pointsource':
-            if self.anisotropic:
-                self.lfp_method = lfpcalc.calc_lfp_pointsource_anisotropic
-            else:
-                self.lfp_method = lfpcalc.calc_lfp_pointsource
-        else:
-            raise ValueError("LFP method not recognized. "
-                             "Should be 'soma_as_point', 'linesource' "
-                             "or 'pointsource'")
-
-    def set_cell(self, cell):
-        """Set the supplied cell object as attribute "cell" of the
-        RecExtElectrode object
-
-        Parameters
-        ----------
-        cell : obj
-            `LFPy.Cell` or `LFPy.TemplateCell` instance.
-
-        Returns
-        -------
-        None
-        """
-        self.cell = cell
-        if self.cell is not None:
-            self.r_limit = self.cell.diam/2
-            self.mapping = np.zeros((self.x.size, len(cell.xmid)))
-
-
-    def _test_imem_sum(self, tolerance=1E-8):
-        """Test that the membrane currents sum to zero"""
-        if type(self.cell) == dict or type(self.cell) == list:
-            raise DeprecationWarning('no support for more than one cell-object')
-
-        sum_imem = self.cell.imem.sum(axis=0)
-        #check if eye matrix is supplied:
-        if ((self.cell.imem.shape == (self.cell.totnsegs, self.cell.totnsegs))
-            and (np.all(self.cell.imem == np.eye(self.cell.totnsegs)))):
-            pass
-        else:
-            if abs(sum_imem).max() >= tolerance:
-                warnings.warn('Membrane currents do not sum to zero')
-                [inds] = np.where((abs(sum_imem) >= tolerance))
-                if self.cell.verbose:
-                    for i in inds:
-                        print('membrane current sum of celltimestep %i: %.3e'
-                            % (i, sum_imem[i]))
-            else:
-                pass
-
-
-    def calc_mapping(self, cell):
-        """Creates a linear mapping of transmembrane currents of each segment
-        of the supplied cell object to contribution to extracellular potential
-        at each electrode contact point of the RexExtElectrode object. Sets
-        the class attribute "mapping", which is a shape (n_contact, n_segs)
-        ndarray, such that the extracellular potential at the contacts
-        phi = np.dot(mapping, I_mem)
-        where I_mem is a shape (n_segs, n_tsteps) ndarray with transmembrane
-        currents for each time step of the simulation.
-
-        Parameters
-        ----------
-        cell : obj
-            `LFPy.Cell` or `LFPy.TemplateCell` instance.
-
-        Returns
-        -------
-        mapping : ndarray
-            The attribute RecExtElectrode.mapping is returned (optional)
-        """
-        if cell is not None:
-            self.set_cell(cell)
-
-        if self.n is not None and self.N is not None and self.r is not None:
-            if self.n <= 1:
-                raise ValueError("n = %i must be larger that 1" % self.n)
-            else:
-                pass
-
-            self._lfp_el_pos_calc_dist()
-
-            if self.verbose:
-                print('calculations finished, %s, %s' % (str(self),
-                                                         str(self.cell)))
-        else:
-            self._loop_over_contacts()
-            if self.verbose:
-                print('calculations finished, %s, %s' % (str(self),
-                                                         str(self.cell)))
-        # return mapping
-        return self.mapping
-
-
-    def calc_lfp(self, t_indices=None, cell=None):
-        """Calculate LFP on electrode geometry from all cell instances.
-        Will chose distributed calculated if electrode contain 'n', 'N', and 'r'
-
-        Parameters
-        ----------
-        cell : obj, optional
-            `LFPy.Cell` or `LFPy.TemplateCell` instance. Must be specified here
-            if it was not specified at the initiation of the `RecExtElectrode`
-            class
-        t_indices : np.ndarray
-            Array of timestep indexes where extracellular potential should
-            be calculated.
-        """
-
-        self.calc_mapping(cell)
-
-        if t_indices is not None:
-            currmem = self.cell.imem[:, t_indices]
-        else:
-            currmem = self.cell.imem
-
-        self._test_imem_sum()
-        self.LFP = np.dot(self.mapping, currmem)
-        # del self.mapping
-
-
-    def _loop_over_contacts(self, **kwargs):
-        """Loop over electrode contacts, and return LFPs across channels"""
-
-        for i in range(self.x.size):
-            self.mapping[i, :] = self.lfp_method(self.cell,
-                                             x = self.x[i],
-                                             y = self.y[i],
-                                             z = self.z[i],
-                                             sigma = self.sigma,
-                                             r_limit = self.r_limit,
-                                             **kwargs)
-
-
-    def _lfp_el_pos_calc_dist(self, **kwargs):
-
-        """
-        Calc. of LFP over an n-point integral approximation over flat
-        electrode surface: circle of radius r or square of side r. The
-        locations of these n points on the electrode surface are random,
-        within the given surface. """
-        # lfp_el_pos = np.zeros(self.LFP.shape)
-        self.offsets = {}
-        self.circle_circ = {}
-
-        def create_crcl(i):
-            """make circumsize of contact point"""
-            crcl = np.zeros((self.n, 3))
-            for j in range(self.n):
-                B = [(np.random.rand()-0.5),
-                    (np.random.rand()-0.5),
-                    (np.random.rand()-0.5)]
-                crcl[j, ] = np.cross(self.N[i, ], B)
-                crcl[j, ] = crcl[j, ]/np.sqrt(crcl[j, 0]**2 +
-                                           crcl[j, 1]**2 +
-                                           crcl[j, 2]**2)*self.r
-
-            crclx = crcl[:, 0] + self.x[i]
-            crcly = crcl[:, 1] + self.y[i]
-            crclz = crcl[:, 2] + self.z[i]
-
-            return crclx, crcly, crclz
-
-        def create_sqr(i):
-            """make circle in which square contact is circumscribed"""
-            sqr = np.zeros((self.n, 3))
-            for j in range(self.n):
-                B = [(np.random.rand() - 0.5),
-                     (np.random.rand() - 0.5),
-                     (np.random.rand() - 0.5)]
-                sqr[j,] = np.cross(self.N[i,], B)/np.linalg.norm(np.cross(self.N[i,], B)) * self.r * np.sqrt(2)/2
-
-            sqrx = sqr[:, 0] + self.x[i]
-            sqry = sqr[:, 1] + self.y[i]
-            sqrz = sqr[:, 2] + self.z[i]
-
-            return sqrx, sqry, sqrz
-
-        def calc_xyz_n(i):
-            """calculate some offsets"""
-            #offsets and radii init
-            offs = np.zeros((self.n, 3))
-            r2 = np.zeros(self.n)
-
-            #assert the same random numbers are drawn every time
-            if self.seedvalue is not None:
-                np.random.seed(self.seedvalue)
-
-            if self.contact_shape is 'circle':
-                for j in range(self.n):
-                    A = [(np.random.rand()-0.5)*self.r*2,
-                        (np.random.rand()-0.5)*self.r*2,
-                        (np.random.rand()-0.5)*self.r*2]
-                    offs[j, ] = np.cross(self.N[i, ], A)
-                    r2[j] = offs[j, 0]**2 + offs[j, 1]**2 + offs[j, 2]**2
-                    while r2[j] > self.r**2:
-                        A = [(np.random.rand()-0.5)*self.r*2,
-                            (np.random.rand()-0.5)*self.r*2,
-                            (np.random.rand()-0.5)*self.r*2]
-                        offs[j, ] = np.cross(self.N[i, ], A)
-                        r2[j] = offs[j, 0]**2 + offs[j, 1]**2 + offs[j, 2]**2
-            elif self.contact_shape is 'square':
-                for j in range(self.n):
-                    A = [(np.random.rand()-0.5),
-                        (np.random.rand()-0.5),
-                        (np.random.rand()-0.5)]
-                    offs[j, ] = np.cross(self.N[i, ], A)*self.r
-                    r2[j] = offs[j, 0]**2 + offs[j, 1]**2 + offs[j, 2]**2
-
-            x_n = offs[:, 0] + self.x[i]
-            y_n = offs[:, 1] + self.y[i]
-            z_n = offs[:, 2] + self.z[i]
-
-            return x_n, y_n, z_n
-
-        def loop_over_points(x_n, y_n, z_n):
-
-            #loop over points on contact
-            for j in range(self.n):
-                tmp = self.lfp_method(self.cell,
-                                              x = x_n[j],
-                                              y = y_n[j],
-                                              z = z_n[j],
-                                              r_limit = self.r_limit,
-                                              sigma = self.sigma,
-                                              **kwargs
-                                              )
-
-                if j == 0:
-                    lfp_e = tmp
-                else:
-                    lfp_e += tmp
-
-                #no longer needed
-                del tmp
-
-            return lfp_e / self.n
-
-        #loop over contacts
-        for i in range(len(self.x)):
-            if self.n > 1:
-
-                #fetch offsets:
-                x_n, y_n, z_n = calc_xyz_n(i)
-
-                #fill in with contact average
-                self.mapping[i] = loop_over_points(x_n, y_n, z_n) #lfp_e.mean(axis=0)
-
-            else:
-                self.mapping[i] = self.lfp_method(self.cell,
-                                              x=self.x[i],
-                                              y=self.y[i],
-                                              z=self.z[i],
-                                              r_limit = self.r_limit,
-                                              sigma=self.sigma,
-                                              **kwargs)
-
-            self.offsets[i] = {'x_n' : x_n,
-                               'y_n' : y_n,
-                               'z_n' : z_n}
-
-            #fetch circumscribed circle around contact
-            if self.contact_shape is 'circle':
-                crcl = create_crcl(i)
-                self.circle_circ[i] = {
-                    'x' : crcl[0],
-                    'y' : crcl[1],
-                    'z' : crcl[2],
-                }
-            elif self.contact_shape is 'square':
-                sqr = create_sqr(i)
-                self.circle_circ[i] = {
-                    'x': sqr[0],
-                    'y': sqr[1],
-                    'z': sqr[2],
-                }
-
-
-class RecMEAElectrode(RecExtElectrode):
-    """class RecMEAElectrode
-
-    Electrode class that represents an extracellular in vitro slice recording
-    as a Microelectrode Array (MEA). Inherits RecExtElectrode class
-
-    Set-up:
-
-              Above neural tissue (Saline) -> sigma_S
-    <----------------------------------------------------> z = z_shift + h
-
-              Neural Tissue -> sigma_T
-
-                   o -> source_pos = [x',y',z']
-
-    <-----------*----------------------------------------> z = z_shift + 0
-                 \-> elec_pos = [x,y,z]
-
-              Below neural tissue (MEA Glass plate) -> sigma_G
-
-    Parameters
-    ----------
-    cell : None or object
-        If not None, instantiation of LFPy.Cell, LFPy.TemplateCell or similar.
-    sigma_T : float
-        extracellular conductivity of neural tissue in unit (S/m)
-    sigma_S : float
-        conductivity of saline bath that the neural slice is
-        immersed in [1.5] (S/m)
-    sigma_G : float
-        conductivity of MEA glass electrode plate. Most commonly
-        assumed non-conducting [0.0] (S/m)
-    h : float, int
-        Thickness in um of neural tissue layer containing current
-        the current sources (i.e., in vitro slice or cortex)
-    z_shift : float, int
-        Height in um of neural tissue layer bottom. If e.g., top of neural tissue
-        layer should be z=0, use z_shift=-h. Defaults to z_shift = 0, so
-        that the neural tissue layer extends from z=0 to z=h.
-    squeeze_cell_factor : float or None
-        Factor to squeeze the cell in the z-direction. This is
-        needed for large cells that are thicker than the slice, since no part
-        of the cell is allowed to be outside the slice. The squeeze is done
-        after the neural simulation, and therefore does not affect neuronal
-        simulation, only calculation of extracellular potentials.
-    x, y, z : np.ndarray
-        coordinates or arrays of coordinates in units of (um).
-        Must be same length
-    N : None or list of lists
-        Normal vectors [x, y, z] of each circular electrode contact surface,
-        default None
-    r : float
-        radius of each contact surface, default None
-    n : int
-        if N is not None and r > 0, the number of discrete points used to
-        compute the n-point average potential on each circular contact point.
-    contact_shape : str
-        'circle'/'square' (default 'circle') defines the contact point shape
-        If 'circle' r is the radius, if 'square' r is the side length
-    method : str
-        switch between the assumption of 'linesource', 'pointsource',
-        'soma_as_point' to represent each compartment when computing
-        extracellular potentials
-    from_file : bool
-        if True, load cell object from file
-    cellfile : str
-        path to cell pickle
-    verbose : bool
-        Flag for verbose output, i.e., print more information
-    seedvalue : int
-        random seed when finding random position on contact with r > 0
-
-    Examples
-    See also examples/example_MEA.py
-
-    >>> import numpy as np
-    >>> import matplotlib.pyplot as plt
-    >>> import LFPy
-    >>>
-    >>> cellParameters = {
-    >>>     'morphology' : 'examples/morphologies/L5_Mainen96_LFPy.hoc',  # morphology file
-    >>>     'v_init' : -65,                          # initial voltage
-    >>>     'cm' : 1.0,                             # membrane capacitance
-    >>>     'Ra' : 150,                             # axial resistivity
-    >>>     'passive' : True,                        # insert passive channels
-    >>>     'passive_parameters' : {"g_pas":1./3E4, "e_pas":-65}, # passive params
-    >>>     'dt' : 2**-4,                           # simulation time res
-    >>>     'tstart' : 0.,                        # start t of simulation
-    >>>     'tstop' : 50.,                        # end t of simulation
-    >>> }
-    >>> cell = LFPy.Cell(**cellParameters)
-    >>> cell.set_rotation(x=np.pi/2, z=np.pi/2)
-    >>> cell.set_pos(z=100)
-    >>> synapseParameters = {
-    >>>     'idx' : cell.get_closest_idx(x=800, y=0, z=100), # compartment
-    >>>     'e' : 0,                                # reversal potential
-    >>>     'syntype' : 'ExpSyn',                   # synapse type
-    >>>     'tau' : 2,                              # syn. time constant
-    >>>     'weight' : 0.01,                       # syn. weight
-    >>>     'record_current' : True                 # syn. current record
-    >>> }
-    >>> synapse = LFPy.Synapse(cell, **synapseParameters)
-    >>> synapse.set_spike_times(np.array([10., 15., 20., 25.]))
-    >>>
-    >>> MEA_electrode_parameters = {
-    >>>     'sigma_T' : 0.3,      # extracellular conductivity
-    >>>     'sigma_G' : 0.0,      # MEA glass electrode plate conductivity
-    >>>     'sigma_S' : 1.5,      # Saline bath conductivity
-    >>>     'x' : np.linspace(0, 1200, 16),  # electrode requires 1d vector of positions
-    >>>     'y' : np.zeros(16),
-    >>>     'z' : np.zeros(16),
-    >>>     "method": "pointsource",
-    >>>     "h": 300,
-    >>>     "squeeze_cell_factor": 0.3,
-    >>> }
-    >>> MEA = LFPy.RecMEAElectrode(cell, **MEA_electrode_parameters)
-    >>>
-    >>> cell.simulate(electrode=MEA)
-    >>>
-    >>> plt.matshow(MEA.LFP)
-    >>> plt.colorbar()
-    >>> plt.axis('tight')
-    >>> plt.show()
-    """
-    def __init__(self, cell=None, sigma_T=0.3, sigma_S=1.5, sigma_G=0.0,
-                 h=300., z_shift=0., steps=20,
-                 x=np.array([0]), y=np.array([0]), z=np.array([0]),
-                 N=None, r=None, n=None,
-                 perCellLFP=False, method='linesource',
-                 from_file=False, cellfile=None, verbose=False,
-                 seedvalue=None, squeeze_cell_factor=None, **kwargs):
-
-        RecExtElectrode.__init__(self, cell=cell,
-                     x=x, y=y, z=z,
-                     N=N, r=r, n=n,
-                     perCellLFP=perCellLFP, method=method,
-                     from_file=from_file, cellfile=cellfile, verbose=verbose,
-                     seedvalue=seedvalue, **kwargs)
-
-        self.sigma_G = sigma_G
-        self.sigma_T = sigma_T
-        self.sigma_S = sigma_S
-        self.sigma = None
-        self.h = h
-        self.z_shift = z_shift
-        self.steps = steps
-        self.squeeze_cell_factor = squeeze_cell_factor
-        self.moi_param_kwargs = {"h": self.h,
-                                 "steps": self.steps,
-                                 "sigma_G": self.sigma_G,
-                                 "sigma_T": self.sigma_T,
-                                 "sigma_S": self.sigma_S,
-                                 }
-
-        if cell is not None:
-            self.set_cell(cell)
-
-        if method == 'pointsource':
-            self.lfp_method = lfpcalc.calc_lfp_pointsource_moi
-        elif method == "linesource":
-            if (np.abs(z - self.z_shift) > 1e-9).any():
-                raise NotImplementedError("The method 'linesource' is only "
-                                          "supported for electrodes at the "
-                                          "z=0 plane. Use z=0 or method "
-                                          "'pointsource'.")
-            if np.abs(self.sigma_G) > 1e-9:
-                raise NotImplementedError("The method 'linesource' is only "
-                                          "supported for sigma_G=0. Use "
-                                          "sigma_G=0 or method "
-                                          "'pointsource'.")
-            self.lfp_method = lfpcalc.calc_lfp_linesource_moi
-        elif method == "soma_as_point":
-            if (np.abs(z - self.z_shift) > 1e-9).any():
-                raise NotImplementedError("The method 'soma_as_point' is only "
-                                          "supported for electrodes at the "
-                                          "z=0 plane. Use z=0 or method "
-                                          "'pointsource'.")
-            if np.abs(self.sigma_G) > 1e-9:
-                raise NotImplementedError("The method 'soma_as_point' is only "
-                                          "supported for sigma_G=0. Use "
-                                          "sigma_G=0 or method "
-                                          "'pointsource'.")
-            self.lfp_method = lfpcalc.calc_lfp_soma_as_point_moi
-        else:
-            raise ValueError("LFP method not recognized. "
-                             "Should be 'soma_as_point', 'linesource' "
-                             "or 'pointsource'")
-
-    def _squeeze_cell_in_depth_direction(self):
-        """Will squeeze self.cell centered around the soma by a scaling factor,
-        so that it fits inside the slice. If scaling factor is not big enough,
-        a RuntimeError is raised. """
-
-        self.cell.distort_geometry(factor=self.squeeze_cell_factor)
-
-        if (np.max([self.cell.zstart, self.cell.zend]) > self.h + self.z_shift or
-            np.min([self.cell.zstart, self.cell.zend]) < self.z_shift):
-            bad_comps, reason = self._return_comp_outside_slice()
-            msg = ("Compartments {} of cell ({}) has cell.{} slice. "
-                   "Increase squeeze_cell_factor, move or rotate cell."
-                   ).format(bad_comps, self.cell.morphology, reason)
-
-            raise RuntimeError(msg)
-
-    def _return_comp_outside_slice(self):
-        """
-        Assuming part of the cell is outside the valid region,
-        i.e, not in the slice (self.z_shift < z < self.z_shift + self.h)
-        this function check what array (cell.zstart or cell.zend) that is
-        outside, and if it is above or below the valid region.
-
-        Raises: RuntimeError
-            If no compartment is outside valid region.
-
-        Returns: array, str
-            Numpy array with the compartments that are outside the slice,
-            and a string with additional information on the problem.
-        """
-        zstart_above = np.where(self.cell.zstart > self.z_shift + self.h)[0]
-        zend_above = np.where(self.cell.zend > self.z_shift + self.h)[0]
-        zend_below = np.where(self.cell.zend < self.z_shift)[0]
-        zstart_below = np.where(self.cell.zstart < self.z_shift)[0]
-
-        if len(zstart_above) > 0:
-            return zstart_above, "zstart above"
-        if len(zstart_below) > 0:
-            return zstart_below, "zstart below"
-        if len(zend_above) > 0:
-            return zend_above, "zend above"
-        if len(zend_below) > 0:
-            return zend_below, "zend below"
-        raise RuntimeError("This function should only be called if cell"
-                           "extends outside slice")
-
-    def test_cell_extent(self):
-        """
-        Test if the cell is confined within the slice.
-        If class argument "squeeze_cell" is True, cell is squeezed to to
-        fit inside slice.
-
-        """
-        if self.cell is None:
-            raise RuntimeError("Does not have cell instance.")
-
-        if (np.max([self.cell.zstart, self.cell.zend]) > self.z_shift + self.h or
-                np.min([self.cell.zstart, self.cell.zend]) < self.z_shift):
-
-            if self.verbose:
-                print("Cell extends outside slice.")
-
-            if self.squeeze_cell_factor is not None:
-                if not self.z_shift < self.cell.zmid[0] < self.z_shift + self.h:
-                    raise RuntimeError("Soma position is not in slice.")
-                self._squeeze_cell_in_depth_direction()
-            else:
-                bad_comps, reason = self._return_comp_outside_slice()
-                msg = ("Compartments {} of cell ({}) has cell.{} slice "
-                       "and argument squeeze_cell_factor is None."
-                       ).format(bad_comps, self.cell.morphology, reason)
-                raise RuntimeError(msg)
-        else:
-            if self.verbose:
-                print("Cell position is good.")
-            if self.squeeze_cell_factor is not None:
-                if self.verbose:
-                    print("Squeezing cell anyway.")
-                self._squeeze_cell_in_depth_direction()
-
-    def calc_mapping(self, cell):
-        """Creates a linear mapping of transmembrane currents of each segment
-        of the supplied cell object to contribution to extracellular potential
-        at each electrode contact point of the RexExtElectrode object. Sets
-        the class attribute "mapping", which is a shape (n_contact, n_segs)
-        ndarray, such that the extracellular potential at the contacts
-        phi = np.dot(mapping, I_mem)
-        where I_mem is a shape (n_segs, n_tsteps) ndarray with transmembrane
-        currents for each time step of the simulation.
-
-        Parameters
-        ----------
-        cell : obj
-            `LFPy.Cell` or `LFPy.TemplateCell` instance.
-
-        Returns
-        -------
-        None
-        """
-        if cell is not None:
-            self.set_cell(cell)
-        self.test_cell_extent()
-
-        # Temporarily shift coordinate system so middle layer extends
-        # from z=0 to z=h
-        self.z = self.z - self.z_shift
-        self.cell.zstart = self.cell.zstart - self.z_shift
-        self.cell.zmid = self.cell.zmid - self.z_shift
-        self.cell.zend = self.cell.zend - self.z_shift
-
-        if self.n is not None and self.N is not None and self.r is not None:
-            if self.n <= 1:
-                raise ValueError("n = %i must be larger that 1" % self.n)
-            else:
-                pass
-
-            self._lfp_el_pos_calc_dist(**self.moi_param_kwargs)
-
-            if self.verbose:
-                print('calculations finished, %s, %s' % (str(self),
-                                                         str(self.cell)))
-        else:
-            self._loop_over_contacts(**self.moi_param_kwargs)
-            if self.verbose:
-                print('calculations finished, %s, %s' % (str(self),
-                                                         str(self.cell)))
-
-        # Shift coordinate system back so middle layer extends
-        # from z=z_shift to z=z_shift + h
-        self.z = self.z + self.z_shift
-        self.cell.zstart = self.cell.zstart + self.z_shift
-        self.cell.zmid = self.cell.zmid + self.z_shift
-        self.cell.zend = self.cell.zend + self.z_shift
-
-
-    def calc_lfp(self, t_indices=None, cell=None):
-        """Calculate LFP on electrode geometry from all cell instances.
-        Will chose distributed calculated if electrode contain 'n', 'N', and 'r'
-
-        Parameters
-        ----------
-        cell : obj, optional
-            `LFPy.Cell` or `LFPy.TemplateCell` instance. Must be specified here
-            if it was not specified at the initiation of the `RecExtElectrode`
-            class
-        t_indices : np.ndarray
-            Array of timestep indexes where extracellular potential should
-            be calculated.
-        """
-
-        self.calc_mapping(cell)
-
-        if t_indices is not None:
-            currmem = self.cell.imem[:, t_indices]
-        else:
-            currmem = self.cell.imem
-
-        self._test_imem_sum()
-        self.LFP = np.dot(self.mapping, currmem)
-        # del self.mapping
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/run_simulation.cpython-38-x86_64-linux-gnu.so b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/run_simulation.cpython-38-x86_64-linux-gnu.so
deleted file mode 100755
index 790accc..0000000
Binary files a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/run_simulation.cpython-38-x86_64-linux-gnu.so and /dev/null differ
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/run_simulation.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/run_simulation.py
deleted file mode 100644
index 1faf6bb..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/run_simulation.py
+++ /dev/null
@@ -1,333 +0,0 @@
-# -*- coding: utf-8 -*-
-'''Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-'''
-
-from __future__ import division
-from time import time
-import numpy as np
-import neuron
-
-
-def _run_simulation(cell, cvode, variable_dt=False, atol=0.001):
-    '''
-    Running the actual simulation in NEURON, simulations in NEURON
-    are now interruptable.
-    '''
-    neuron.h.dt = cell.dt
-        
-    # variable dt method
-    if variable_dt:
-        cvode.active(1)
-        cvode.atol(atol)
-    else:
-        cvode.active(0)    
-    
-    # re-initialize state
-    neuron.h.finitialize(cell.v_init)
-    
-    # initialize current- and record
-    if cvode.active():
-        cvode.re_init()
-    else:
-        neuron.h.fcurrent()
-    neuron.h.frecord_init()
-    
-    # Starting simulation at tstart
-    neuron.h.t = cell.tstart
-    
-    cell._loadspikes()
-    
-    #print sim.time and realtime factor at intervals
-    counter = 0.
-    t0 = time()
-    ti = neuron.h.t
-    if cell.tstop >= 10000:
-        interval = 1000. / cell.dt
-    else:
-        interval = 100. / cell.dt
-    
-    while neuron.h.t < cell.tstop:
-        neuron.h.fadvance()
-        counter += 1.
-        if counter % interval == 0:
-            rtfactor = (neuron.h.t - ti) * 1E-3 / (time() - t0)
-            if cell.verbose:
-                print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
-                                                                   rtfactor))
-            t0 = time()
-            ti = neuron.h.t
-
-def _run_simulation_with_electrode(cell, cvode, electrode=None,
-                                   variable_dt=False,
-                                   atol=0.001,
-                                   to_memory=True, to_file=False,
-                                   file_name=None, dotprodcoeffs=None,
-                                   rec_current_dipole_moment=False):
-    '''
-    Running the actual simulation in NEURON.
-    electrode argument used to determine coefficient
-    matrix, and calculate the LFP on every time step.
-    '''
-    try:
-        import h5py
-    except:
-        print('h5py not found, LFP to file not possible')
-        to_file = False
-        file_name = None
-
-    # Use electrode object(s) to calculate coefficient matrices for LFP
-    # calculations. If electrode is a list, then
-    if cell.verbose:
-        print('precalculating geometry - LFP mapping')
-        
-    #put electrodecoeff in a list, if it isn't already
-    if dotprodcoeffs is not None:
-        if type(dotprodcoeffs) != list:
-            dotprodcoeffs = [dotprodcoeffs]
-        electrodes = []
-    else:
-        #create empty list if no dotprodcoeffs are supplied
-        dotprodcoeffs = []
-    
-    #just for safekeeping
-    lendotprodcoeffs0 = len(dotprodcoeffs)
-    
-    #access electrode object and append mapping
-    if electrode is not None:
-        #put electrode argument in list if needed
-        if type(electrode) == list:
-            electrodes = electrode
-        else:
-            electrodes = [electrode]
-        
-        for el in electrodes:
-            el.calc_mapping(cell)
-            dotprodcoeffs.append(el.mapping)
-
-    elif electrode is None:
-        electrodes = None
-   
-
-    # Initialize NEURON simulations of cell object    
-    neuron.h.dt = cell.dt
-    
-    #don't know if this is the way to do, but needed for variable dt method
-    if cell.dt <= 1E-8:
-        cvode.active(1)
-        cvode.atol(atol)
-    
-    #re-initialize state
-    neuron.h.finitialize(cell.v_init)
-    neuron.h.frecord_init() # wrong voltages t=0 for tstart < 0 otherwise
-    neuron.h.fcurrent()
-    
-    #Starting simulation at tstart (which may be < 0)
-    neuron.h.t = cell.tstart
-    
-    #load spike times from NetCon
-    cell._loadspikes()
-    
-    #print sim.time at intervals
-    counter = 0.
-    tstep = 0
-    t0 = time()
-    ti = neuron.h.t
-    if cell.tstop >= 10000:
-        interval = 1000. / cell.dt
-    else:
-        interval = 100. / cell.dt
-    
-    #temp vector to store membrane currents at each timestep
-    imem = np.zeros(cell.totnsegs)
-    #LFPs for each electrode will be put here during simulation
-    if to_memory:
-        electrodesLFP = []
-        for coeffs in dotprodcoeffs:
-            electrodesLFP.append(np.zeros((coeffs.shape[0],
-                                int(cell.tstop / cell.dt) + 1)))
-    #LFPs for each electrode will be put here during simulations
-    if to_file:
-        #ensure right ending:
-        if file_name.split('.')[-1] != 'h5':
-            file_name += '.h5'
-        el_LFP_file = h5py.File(file_name, 'w')
-        i = 0
-        for coeffs in dotprodcoeffs:
-            el_LFP_file['electrode{:03d}'.format(i)] = np.zeros((coeffs.shape[0],
-                                    int(cell.tstop / cell.dt + 1)))
-            i += 1
-
-    # create a 2D array representation of segment midpoints for dot product
-    # with transmembrane currents when computing dipole moment
-    if rec_current_dipole_moment:
-        midpoints = np.c_[cell.xmid, cell.ymid, cell.zmid]
-
-    
-    #run fadvance until time limit, and calculate LFPs for each timestep
-    while neuron.h.t < cell.tstop:
-        if neuron.h.t >= 0:
-            i = 0
-            for sec in cell.allseclist:
-                for seg in sec:
-                    imem[i] = seg.i_membrane_
-                    i += 1
-
-            if rec_current_dipole_moment:
-                cell.current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
-            
-            if to_memory:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
-                    
-            if to_file:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    el_LFP_file['electrode{:03d}'.format(j)
-                                ][:, tstep] = np.dot(coeffs, imem)
-            
-            tstep += 1
-
-        neuron.h.fadvance()
-        counter += 1.
-        if counter % interval == 0.:
-            rtfactor = (neuron.h.t - ti) * 1E-3 / (time() - t0)
-            if cell.verbose:
-                print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
-                                                                   rtfactor))
-            t0 = time()
-            ti = neuron.h.t
-    
-    try:
-        #calculate LFP after final fadvance()
-        i = 0
-        for sec in cell.allseclist:
-            for seg in sec:
-                imem[i] = seg.i_membrane_
-                i += 1
-
-        if rec_current_dipole_moment:
-            cell.current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
-            
-        if to_memory:
-            for j, coeffs in enumerate(dotprodcoeffs):
-                electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
-        if to_file:
-            for j, coeffs in enumerate(dotprodcoeffs):
-                el_LFP_file['electrode{:03d}'.format(j)
-                            ][:, tstep] = np.dot(coeffs, imem)
-
-    except:
-        pass
-    
-    # Final step, put LFPs in the electrode object, superimpose if necessary
-    # If electrode.perCellLFP, store individual LFPs
-    if to_memory:
-        #the first few belong to input dotprodcoeffs
-        cell.dotprodresults = electrodesLFP[:lendotprodcoeffs0]
-        #the remaining belong to input electrode arguments
-        if electrodes is not None:
-            for j, LFP in enumerate(electrodesLFP):
-                if not j < lendotprodcoeffs0:
-                    if hasattr(electrodes[j-lendotprodcoeffs0], 'LFP'):
-                        electrodes[j-lendotprodcoeffs0].LFP += LFP
-                    else:
-                        electrodes[j-lendotprodcoeffs0].LFP = LFP
-                    #will save each cell contribution separately
-                    if electrodes[j-lendotprodcoeffs0].perCellLFP:
-                        if not hasattr(electrodes[j], 'CellLFP'):
-                            electrodes[j-lendotprodcoeffs0].CellLFP = []
-                        electrodes[j-lendotprodcoeffs0].CellLFP.append(LFP)
-                    electrodes[j-lendotprodcoeffs0].electrodecoeff = dotprodcoeffs[j]
-
-    if to_file:
-        el_LFP_file.close()
-
-
-def _collect_geometry_neuron(cell):
-    '''Loop over allseclist to determine area, diam, xyz-start- and
-    endpoints, embed geometry to cell object'''
-    
-    
-    areavec = np.zeros(cell.totnsegs)
-    diamvec = np.zeros(cell.totnsegs)
-    lengthvec = np.zeros(cell.totnsegs)
-    
-    xstartvec = np.zeros(cell.totnsegs)
-    xendvec = np.zeros(cell.totnsegs)
-    ystartvec = np.zeros(cell.totnsegs)
-    yendvec = np.zeros(cell.totnsegs)
-    zstartvec = np.zeros(cell.totnsegs)
-    zendvec = np.zeros(cell.totnsegs)
-    
-    counter = 0
-    
-    #loop over all segments
-    for sec in cell.allseclist:
-        n3d = int(neuron.h.n3d())
-        nseg = sec.nseg
-        gsen2 = 1./2/nseg
-        if n3d > 0:
-            #create interpolation objects for the xyz pt3d info:
-            L = np.zeros(n3d)
-            x = np.zeros(n3d)
-            y = np.zeros(n3d)
-            z = np.zeros(n3d)
-            for i in range(n3d):
-                L[i] = neuron.h.arc3d(i)
-                x[i] = neuron.h.x3d(i)
-                y[i] = neuron.h.y3d(i)
-                z[i] = neuron.h.z3d(i)
-            
-            #normalize as seg.x [0, 1]
-            L /= sec.L
-                        
-            #temporary store position of segment midpoints
-            segx = np.zeros(nseg)
-            for i, seg in enumerate(sec):
-                segx[i] = seg.x
-            
-            #can't be >0 which may happen due to NEURON->Python float transfer:
-            segx0 = (segx - gsen2).round(decimals=6)
-            segx1 = (segx + gsen2).round(decimals=6)
-            
-            #fill vectors with interpolated coordinates of start and end points
-            xstartvec[counter:counter+nseg] = np.interp(segx0, L, x)
-            xendvec[counter:counter+nseg] = np.interp(segx1, L, x)
-            
-            ystartvec[counter:counter+nseg] = np.interp(segx0, L, y)
-            yendvec[counter:counter+nseg] = np.interp(segx1, L, y)
-            
-            zstartvec[counter:counter+nseg] = np.interp(segx0, L, z)
-            zendvec[counter:counter+nseg] = np.interp(segx1, L, z)
-                        
-            #fill in values area, diam, length
-            for i, seg in enumerate(sec):
-                areavec[counter] = neuron.h.area(seg.x)
-                diamvec[counter] = seg.diam
-                lengthvec[counter] = sec.L/nseg
-
-                counter += 1
-    
-    #set cell attributes
-    cell.xstart = xstartvec
-    cell.ystart = ystartvec
-    cell.zstart = zstartvec
-    
-    cell.xend = xendvec
-    cell.yend = yendvec
-    cell.zend = zendvec
-    
-    cell.area = areavec
-    cell.diam = diamvec
-    cell.length = lengthvec
-
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/run_simulation.pyx b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/run_simulation.pyx
deleted file mode 100644
index 3900411..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/run_simulation.pyx
+++ /dev/null
@@ -1,376 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# cython: language_level=2
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-from time import time
-import numpy as np
-cimport numpy as np
-import neuron
-
-DTYPE = np.float64
-ctypedef np.float64_t DTYPE_t
-ctypedef Py_ssize_t   LTYPE_t
-
-
-def _run_simulation(cell, cvode, variable_dt=False, atol=0.001):
-    """
-    Running the actual simulation in NEURON, simulations in NEURON
-    is now interruptable.
-    """
-    neuron.h.dt = cell.dt
-
-    # variable dt method
-    if variable_dt:
-        cvode.active(1)
-        cvode.atol(atol)
-    else:
-        cvode.active(0)
-
-    #re-initialize state
-    neuron.h.finitialize(cell.v_init)
-
-    #initialize current- and record
-    if cvode.active():
-        cvode.re_init()
-    else:
-        neuron.h.fcurrent()
-    neuron.h.frecord_init()
-
-    #Starting simulation at t != 0
-    neuron.h.t = cell.tstart
-
-    cell._loadspikes()
-
-    #print sim.time at intervals
-    cdef int counter = 0
-    cdef double interval
-    cdef double tstop = cell.tstop
-    cdef double t0 = time()
-    cdef double ti = neuron.h.t
-    cdef double rtfactor
-    if tstop >= 10000:
-        interval = 1000. / cell.dt
-    else:
-        interval = 100. / cell.dt
-
-    while neuron.h.t < tstop:
-        neuron.h.fadvance()
-        counter += 1
-        if counter % interval == 0:
-            rtfactor = (neuron.h.t - ti)  * 1E-3 / (time() - t0 + 1E-9)
-            if cell.verbose:
-                print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
-                                                                   rtfactor))
-            t0 = time()
-            ti = neuron.h.t
-
-
-def _run_simulation_with_electrode(cell, cvode, electrode=None,
-                                   variable_dt=False, atol=0.001,
-                                   to_memory=True, to_file=False,
-                                   file_name=None, dotprodcoeffs=None,
-                                   rec_current_dipole_moment=False):
-    """
-    Running the actual simulation in NEURON.
-    electrode argument used to determine coefficient
-    matrix, and calculate the LFP on every time step.
-    """
-
-    #c-declare some variables
-    cdef int i, j, tstep#, ncoeffs
-    #cdef int totnsegs = cell.totnsegs
-    cdef double tstop = cell.tstop
-    cdef int counter
-    cdef int lendotprodcoeffs0
-    cdef double interval
-    cdef double t0
-    cdef double ti
-    cdef double rtfactor
-    cdef double dt = cell.dt
-    cdef np.ndarray[DTYPE_t, ndim=2, negative_indices=False] coeffs
-    cdef np.ndarray[DTYPE_t, ndim=2, negative_indices=False] current_dipole_moment
-    cdef np.ndarray[DTYPE_t, ndim=2, negative_indices=False] midpoints
-
-    #check if h5py exist and saving is possible
-    try:
-        import h5py
-    except:
-        print('h5py not found, LFP to file not possible')
-        to_file = False
-        file_name = None
-
-
-    # Use electrode object(s) to calculate coefficient matrices for LFP
-    # calculations. If electrode is a list, then
-    if cell.verbose:
-        print('precalculating geometry - LFP mapping')
-
-    #put electrodecoeff in a list, if it isn't already
-    if dotprodcoeffs is not None:
-        if type(dotprodcoeffs) != list:
-            dotprodcoeffs = [dotprodcoeffs]
-        electrodes = []
-    else:
-        #create empty list if no dotprodcoeffs are supplied
-        dotprodcoeffs = []
-
-    #just for safekeeping
-    lendotprodcoeffs0 = len(dotprodcoeffs)
-
-    #access electrode object and append mapping
-    if electrode is not None:
-        #put electrode argument in list if needed
-        if type(electrode) == list:
-            electrodes = electrode
-        else:
-            electrodes = [electrode]
-
-        for el in electrodes:
-            el.calc_mapping(cell)
-            dotprodcoeffs.append(el.mapping)
-    elif electrode is None:
-        electrodes = None
-
-
-    # Initialize NEURON simulations of cell object
-    neuron.h.dt = dt
-
-    #don't know if this is the way to do, but needed for variable dt method
-    if cell.dt <= 1E-8:
-        cvode.active(1)
-        cvode.atol(atol)
-
-    #re-initialize state
-    neuron.h.finitialize(cell.v_init)
-    neuron.h.frecord_init() # wrong voltages t=0 for tstart < 0 otherwise
-    neuron.h.fcurrent()
-
-    #Starting simulation at t != 0
-    neuron.h.t = cell.tstart
-
-    #load spike times from NetCon
-    cell._loadspikes()
-
-    #print sim.time at intervals
-    counter = 0
-    tstep = 0
-    t0 = time()
-    ti = neuron.h.t
-    if tstop >= 10000:
-        interval = 1000. / dt
-    else:
-        interval = 100. / dt
-
-    #temp vector to store membrane currents at each timestep
-    imem = np.zeros(cell.totnsegs)
-    #LFPs for each electrode will be put here during simulation
-    if to_memory:
-        electrodesLFP = []
-        for coeffs in dotprodcoeffs:
-            electrodesLFP.append(np.zeros((coeffs.shape[0],
-                                    int(tstop / dt + 1))))
-    #LFPs for each electrode will be put here during simulations
-    if to_file:
-        #ensure right ending:
-        if file_name.split('.')[-1] != 'h5':
-            file_name += '.h5'
-        el_LFP_file = h5py.File(file_name, 'w')
-        i = 0
-        for coeffs in dotprodcoeffs:
-            el_LFP_file['electrode{:03d}'.format(i)] = np.zeros((coeffs.shape[0],
-                                            int(tstop / dt + 1)))
-            i += 1
-
-    # create a 2D array representation of segment midpoints for dot product
-    # with transmembrane currents when computing dipole moment
-    if rec_current_dipole_moment:
-        current_dipole_moment = cell.current_dipole_moment.copy()
-        cell.current_dipole_moment = np.array([[]])
-        midpoints = np.c_[cell.xmid, cell.ymid, cell.zmid]
-
-    #run fadvance until time limit, and calculate LFPs for each timestep
-    while neuron.h.t < tstop:
-        if neuron.h.t >= 0:
-            i = 0
-            for sec in cell.allseclist:
-                for seg in sec:
-                    imem[i] = seg.i_membrane_
-                    i += 1
-
-            if rec_current_dipole_moment:
-                current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
-
-            if to_memory:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
-
-            if to_file:
-                for j, coeffs in enumerate(dotprodcoeffs):
-                    el_LFP_file['electrode{:03d}'.format(j)
-                                ][:, tstep] = np.dot(coeffs, imem)
-
-            tstep += 1
-        neuron.h.fadvance()
-        counter += 1
-        if counter % interval == 0:
-            rtfactor = (neuron.h.t - ti) * 1E-3 / (time() - t0)
-            if cell.verbose:
-                print('t = {:.0f}, realtime factor: {:.3f}'.format(neuron.h.t,
-                                                                   rtfactor))
-            t0 = time()
-            ti = neuron.h.t
-
-    try:
-        #calculate LFP after final fadvance()
-        i = 0
-        for sec in cell.allseclist:
-            for seg in sec:
-                imem[i] = seg.i_membrane_
-                i += 1
-
-        if rec_current_dipole_moment:
-            current_dipole_moment[tstep, ] = np.dot(imem, midpoints)
-
-        if to_memory:
-            for j, coeffs in enumerate(dotprodcoeffs):
-                electrodesLFP[j][:, tstep] = np.dot(coeffs, imem)
-        if to_file:
-            for j, coeffs in enumerate(dotprodcoeffs):
-                el_LFP_file['electrode{:03d}'.format(j)
-                            ][:, tstep] = np.dot(coeffs, imem)
-
-    except:
-        pass
-
-    # update current dipole moment values
-    if rec_current_dipole_moment:
-        cell.current_dipole_moment = current_dipole_moment
-
-    # Final step, put LFPs in the electrode object, superimpose if necessary
-    # If electrode.perCellLFP, store individual LFPs
-    if to_memory:
-        #the first few belong to input dotprodcoeffs
-        cell.dotprodresults = electrodesLFP[:lendotprodcoeffs0]
-        #the remaining belong to input electrode arguments
-        if electrodes is not None:
-            for j, LFP in enumerate(electrodesLFP):
-                if not j < lendotprodcoeffs0:
-                    if hasattr(electrodes[j-lendotprodcoeffs0], 'LFP'):
-                        electrodes[j-lendotprodcoeffs0].LFP += LFP
-                    else:
-                        electrodes[j-lendotprodcoeffs0].LFP = LFP
-                    #will save each cell contribution separately
-                    if electrodes[j-lendotprodcoeffs0].perCellLFP:
-                        if not hasattr(electrodes[j], 'CellLFP'):
-                            electrodes[j-lendotprodcoeffs0].CellLFP = []
-                        electrodes[j-lendotprodcoeffs0].CellLFP.append(LFP)
-                    electrodes[j-lendotprodcoeffs0].electrodecoeff = dotprodcoeffs[j]
-
-    if to_file:
-        el_LFP_file.close()
-
-
-cpdef _collect_geometry_neuron(cell):
-    """Loop over allseclist to determine area, diam, xyz-start- and
-    endpoints, embed geometry to cell object"""
-
-
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] areavec = np.zeros(cell.totnsegs)
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] diamvec = np.zeros(cell.totnsegs)
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] lengthvec = np.zeros(cell.totnsegs)
-
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] xstartvec = np.zeros(cell.totnsegs)
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] xendvec = np.zeros(cell.totnsegs)
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] ystartvec = np.zeros(cell.totnsegs)
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] yendvec = np.zeros(cell.totnsegs)
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] zstartvec = np.zeros(cell.totnsegs)
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] zendvec = np.zeros(cell.totnsegs)
-
-    cdef DTYPE_t gsen2, secL
-    cdef LTYPE_t counter, nseg, n3d, i
-
-
-    cdef np.ndarray[DTYPE_t, ndim=1, negative_indices=False] L, x, y, z, segx, segx0, segx1
-
-
-    counter = 0
-
-    #loop over all segments
-    for sec in cell.allseclist:
-        n3d = int(neuron.h.n3d())
-        nseg = sec.nseg
-        gsen2 = 1./2/nseg
-        secL = sec.L
-        if n3d > 0:
-            #create interpolation objects for the xyz pt3d info:
-            L = np.zeros(n3d)
-            x = np.zeros(n3d)
-            y = np.zeros(n3d)
-            z = np.zeros(n3d)
-            for i in range(n3d):
-                L[i] = neuron.h.arc3d(i)
-                x[i] = neuron.h.x3d(i)
-                y[i] = neuron.h.y3d(i)
-                z[i] = neuron.h.z3d(i)
-
-            #normalize as seg.x [0, 1]
-            L /= secL
-
-            #temporary store position of segment midpoints
-            segx = np.zeros(nseg)
-            i = 0
-            for seg in sec:
-                segx[i] = seg.x
-                i += 1
-
-            #can't be >0 which may happen due to NEURON->Python float transfer:
-            #segx0 = (segx - gsen2).round(decimals=6)
-            #segx1 = (segx + gsen2).round(decimals=6)
-            segx0 = segx - gsen2
-            segx1 = segx + gsen2
-
-            #fill vectors with interpolated coordinates of start and end points
-            xstartvec[counter:counter+nseg] = np.interp(segx0, L, x)
-            xendvec[counter:counter+nseg] = np.interp(segx1, L, x)
-
-            ystartvec[counter:counter+nseg] = np.interp(segx0, L, y)
-            yendvec[counter:counter+nseg] = np.interp(segx1, L, y)
-
-            zstartvec[counter:counter+nseg] = np.interp(segx0, L, z)
-            zendvec[counter:counter+nseg] = np.interp(segx1, L, z)
-
-            #fill in values area, diam, length
-            for seg in sec:
-                areavec[counter] = neuron.h.area(seg.x)
-                diamvec[counter] = seg.diam
-                lengthvec[counter] = secL/nseg
-
-                counter += 1
-
-
-    #set cell attributes
-    cell.xstart = xstartvec
-    cell.ystart = ystartvec
-    cell.zstart = zstartvec
-
-    cell.xend = xendvec
-    cell.yend = yendvec
-    cell.zend = zendvec
-
-    cell.area = areavec
-    cell.diam = diamvec
-    cell.length = lengthvec
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/templatecell.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/templatecell.py
deleted file mode 100644
index 238a6ba..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/templatecell.py
+++ /dev/null
@@ -1,232 +0,0 @@
-"""
-Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-import os
-import posixpath
-import sys
-import pickle
-import numpy as np
-import neuron
-from LFPy import Cell, RecExtElectrode
-from LFPy.run_simulation import _run_simulation, _run_simulation_with_electrode
-
-class TemplateCell(Cell):
-
-    """
-    class LFPy.TemplateCell
-    
-    This class allow using NEURON templates with some limitations.
-
-    This takes all the same parameters as the Cell class, but requires three
-    more template related parameters
-    
-    Parameters
-    ----------
-    morphology : str
-        path to morphology file
-    templatefile : str
-        File with cell template definition(s)
-    templatename : str
-        Cell template-name used for this cell object
-    templateargs : str
-        Parameters provided to template-definition
-    v_init : float
-        Initial membrane potential. Default to -65.
-    Ra : float
-        axial resistance. Defaults to 150.
-    cm : float
-        membrane capacitance. Defaults to 1.0
-    passive : bool
-        Passive mechanisms are initialized if True. Defaults to True
-    passive_parameters : dict
-        parameter dictionary with values for the passive membrane mechanism in
-        NEURON ('pas'). The dictionary must contain keys 'g_pas' and 'e_pas',
-        like the default: passive_parameters=dict(g_pas=0.001, e_pas=-70)
-    extracellular : bool
-        switch for NEURON's extracellular mechanism. Defaults to False
-    dt: float
-        Simulation time step. Defaults to 2**-4
-    tstart : float
-        initialization time for simulation <= 0 ms. Defaults to 0.
-    tstop : float
-        stop time for simulation > 0 ms. Defaults to 100.
-    nsegs_method : 'lambda100' or 'lambda_f' or 'fixed_length' or None
-        nseg rule, used by NEURON to determine number of compartments.
-        Defaults to 'lambda100'
-    max_nsegs_length : float or None
-        max segment length for method 'fixed_length'. Defaults to None
-    lambda_f : int
-        AC frequency for method 'lambda_f'. Defaults to 100
-    d_lambda : float
-        parameter for d_lambda rule. Defaults to 0.1
-    delete_sections : bool
-        delete pre-existing section-references. Defaults to True
-    custom_code : list or None
-        list of model-specific code files ([.py/.hoc]). Defaults to None
-    custom_fun : list or None
-        list of model-specific functions with args. Defaults to None
-    custom_fun_args : list or None
-        list of args passed to custom_fun functions. Defaults to None
-    pt3d : bool
-        use pt3d-info of the cell geometries switch. Defaults to False
-    celsius : float or None
-        Temperature in celsius. If nothing is specified here
-        or in custom code it is 6.3 celcius
-    verbose : bool
-        verbose output switch. Defaults to False
-
-    Examples
-    --------
-
-    >>> import LFPy
-    >>> cellParameters = {
-    >>>     'morphology' : '',
-    >>>     'templatefile' :  ''
-    >>>     'templatename' :  'templatename'
-    >>>     'templateargs' :  None
-    >>>     'v_init' : -65,
-    >>>     'cm' : 1.0,
-    >>>     'Ra' : 150,
-    >>>     'passive' : True,
-    >>>     'passive_parameters' : {'g_pas' : 0.001, 'e_pas' : -65.},
-    >>>     'dt' : 2**-3,
-    >>>     'tstart' : 0,
-    >>>     'tstop' : 50,
-    >>> }
-    >>> cell = LFPy.TemplateCell(**cellParameters)
-    >>> cell.simulate()
-
-    """
-
-    def __init__(self,
-                 templatefile='LFPyCellTemplate.hoc',
-                 templatename='LFPyCellTemplate',
-                 templateargs=None,
-                 verbose=False,
-                 **kwargs):
-        """
-        Initialization of the Template Cell object.
-
-        """
-        if "win32" in sys.platform and type(templatefile) is str:
-            templatefile = templatefile.replace(os.sep, posixpath.sep)
-        self.templatefile = templatefile
-        self.templatename = templatename
-        self.templateargs = templateargs
-        self.verbose = verbose
-        
-        if not hasattr(neuron.h, 'd_lambda'):
-            neuron.h.load_file('stdlib.hoc', 'String')    #NEURON std. library
-            neuron.h.load_file('import3d.hoc')  #import 3D morphology lib
-                
-        #load the cell template specification
-        #check if templatename exist in neuron.h namespace:
-        if hasattr(neuron.h, self.templatename):
-            if self.verbose:
-                print('template %s exist already' % self.templatename)
-        else:
-            if type(self.templatefile) == str:
-                neuron.h.load_file(self.templatefile)
-            elif type(self.templatefile) == list:
-                for template in self.templatefile:
-                    if "win32" in sys.platform:
-                        template = template.replace(os.sep, posixpath.sep)
-                    neuron.h.load_file(template)
-        
-        #initialize the cell object
-        Cell.__init__(self, **kwargs)
-
-    def _load_geometry(self):
-        """Load the morphology-file in NEURON""" 
-        try: 
-            neuron.h.sec_counted = 0
-        except LookupError:
-            neuron.h('sec_counted = 0')
-                
-        #the python cell object we are loading the morphology into:
-        self.template = getattr(neuron.h, self.templatename)(self.templateargs)
-        
-        #perform a test if the morphology is already loaded:
-        seccount = 0
-        for sec in self.template.all:
-            seccount += 1
-        if seccount == 0:
-            #import the morphology, try and determine format
-            fileEnding = self.morphology.split('.')[-1]
-        
-            if not fileEnding == 'hoc' or fileEnding == 'HOC':            
-                #create objects for importing morphologies of different formats
-                if fileEnding == 'asc' or fileEnding == 'ASC':
-                    Import = neuron.h.Import3d_Neurolucida3()
-                    if not self.verbose:
-                        Import.quiet = 1
-                elif fileEnding == 'swc' or fileEnding ==  'SWC':
-                    Import = neuron.h.Import3d_SWC_read()
-                elif fileEnding == 'xml' or fileEnding ==  'XML':
-                    Import = neuron.h.Import3d_MorphML()
-                else:
-                    raise ValueError('%s is not a recognised morphology file format! ').with_traceback('Should be either .hoc, .asc, .swc, .xml!' \
-                         % self.morphology)
-                
-                #assuming now that morphology file is the correct format
-                try:
-                    Import.input(self.morphology)
-                except:
-                    if not hasattr(neuron, 'neuroml'):
-                        raise Exception('Can not import, try and copy the ' + \
-                        'nrn/share/lib/python/neuron/neuroml ' + \
-                        'folder into %s' % neuron.__path__[0])
-                    else:
-                        raise Exception('something wrong with file, see output')
-                try:
-                    imprt = neuron.h.Import3d_GUI(Import, 0)
-                except:
-                    raise Exception('See output, try to correct the file')
-                
-                #instantiate the cell object
-                if fileEnding == 'xml' or fileEnding ==  'XML':
-                    #can not currently assign xml to cell template
-                    try:
-                        imprt.instantiate(self.template)
-                    except:
-                        raise Exception("this xml file is not supported")
-                else:
-                    imprt.instantiate(self.template)
-                
-            else:
-                neuron.h.execute("xopen(\"%s\")" % self.morphology, self.template)
-        
-        #set shapes and create sectionlists
-        neuron.h.define_shape()
-        self._create_sectionlists()
-
-    def _create_sectionlists(self):
-        """Create section lists for different kinds of sections"""
-        
-        self.allsecnames = []
-        for sec in self.template.all:
-            self.allsecnames.append(sec.name())
-        
-        self.allseclist = self.template.all
-        
-        #list of soma sections, assuming it is named on the format "soma*"
-        self.nsomasec = 0
-        self.somalist = neuron.h.SectionList()
-        for sec in self.allseclist:
-            if 'soma' in sec.name():
-                self.somalist.append(sec=sec)
-                self.nsomasec += 1
-
-
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/__init__.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/__init__.py
deleted file mode 100644
index c273a5d..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/__init__.py
+++ /dev/null
@@ -1,115 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-def _test(verbosity=1):
-    """run all unit tests included with LFPy.
-    
-    Parameters
-    ----------
-    verbosity : int
-        unittest.TestCase verbosity level, default is 1
-    
-    Examples
-    --------
-    From Python:
-    >>> import LFPy
-    >>> LFPy.run_tests()
-    
-    Using external testing framework (nose, py.test etc.) from command line
-    $ cd 
-    $ nosetests-2.7
-    
-    Run single test modules
-    $ cd 
-    $ nosetests-2.7 LFPy/test/test_cell.py
-    
-    """
-    # import methods here to avoid polluting LFPy.test namespace
-    from .test_cell import testCell
-    from .test_eegmegcalc import testMEG, testFourSphereVolumeConductor, testInfiniteVolumeConductor
-    from .test_alias_method import testAliasMethod
-    from .test_recextelectrode import testRecExtElectrode
-    from .test_lfpcalc import testLfpCalc
-    from .test_misc import testMisc
-    from .test_pointprocess import testPointProcess, testSynapse, testStimIntElectrode 
-    from .test_inputgenerators import testInputGenerators
-    from .test_templatecell import testTemplateCell
-    from .test_networkcell import testNetworkCell
-    from .test_network import testNetworkPopulation, testNetwork
-    import unittest
-
-    print('\ntest LFPy.Cell class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testCell)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.TemplateCell class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testTemplateCell)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.lfpcalc methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testLfpCalc)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.RecExtElectrode class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testRecExtElectrode)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.NetworkCell class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testNetworkCell)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.NetworkPopulation class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testNetworkPopulation)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.Network class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testNetwork)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.MEG class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testMEG)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.FourSphereVolumeConductor class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testFourSphereVolumeConductor)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.InfiniteVolumeConductor class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testInfiniteVolumeConductor)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.alias_method methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testAliasMethod)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.PointProcess class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testPointProcess)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.Synapse class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testSynapse)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.StimIntElectrode class and methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testStimIntElectrode)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest LFPy.inputgenerators methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testInputGenerators)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
-
-    print('\ntest misc. methods:')
-    suite = unittest.TestLoader().loadTestsFromTestCase(testMisc)
-    unittest.TextTestRunner(verbosity=verbosity).run(suite)
\ No newline at end of file
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/ball_and_stick_template.hoc b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/ball_and_stick_template.hoc
deleted file mode 100644
index b0a802c..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/ball_and_stick_template.hoc
+++ /dev/null
@@ -1,13 +0,0 @@
-begintemplate ball_and_stick_template
-public soma, dend         
-public all
-objref all
-proc init() {
-    all = new SectionList()
-}
-
-create soma[1], dend[1]
-
-endtemplate ball_and_stick_template
-
-
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/ball_and_sticks.hoc b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/ball_and_sticks.hoc
deleted file mode 100644
index 74f3005..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/ball_and_sticks.hoc
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ----------------------------------------------------
-ball_and_Y.hoc
-
-This hoc file creates a neuron of the following shape:
-
-            \       
-             \     
-              \   /
-               \ /
-                V
-                |
-                |
-                |
-                O
-                
-Note the conventions:
- - soma needs to be a list (soma[0], not soma),
- - use soma for the soma compartment,
- - use a name starting with dend for the dendrites.
------------------------------------------------------*/
-
-
-create soma[1]
-create dend[3]
-
-soma[0] {
-    pt3dadd(0, 0, 0, 25)
-    pt3dadd(0, 0, 35, 25)
-}
-
-dend[0] {
-    pt3dadd(0, 0, 35, 5)
-    pt3dadd(0, 0, 150, 5)
-}
-
-dend[1] {
-    pt3dadd(0, 0, 150, 2)
-    pt3dadd(-50, 20, 200, 1)
-}
-
-dend[2] {
-    pt3dadd(0, 0, 150, 2)
-    pt3dadd(30, 0, 160, 2)
-}
-
-connect dend[0](0), soma[0](0.5)
-connect dend[1](0), dend[0](1)
-connect dend[2](0), dend[0](1)
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/ball_and_sticks_w_lists.hoc b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/ball_and_sticks_w_lists.hoc
deleted file mode 100644
index b35cc3f..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/ball_and_sticks_w_lists.hoc
+++ /dev/null
@@ -1,52 +0,0 @@
-/* ----------------------------------------------------
-ball_and_Y.hoc
-
-This hoc file creates a neuron of the following shape:
-
-            \       
-             \     
-              \   /
-               \ /
-                V
-                |
-                |
-                |
-                O
-                
-Note the conventions:
- - soma needs to be a list (soma[0], not soma),
- - use soma for the soma compartment,
- - use a name starting with dend for the dendrites.
------------------------------------------------------*/
-
-
-create soma[1]
-create dend[3]
-
-soma[0] {
-    pt3dadd(0, 0, 0, 25)
-    pt3dadd(0, 0, 35, 25)
-}
-
-dend[0] {
-    pt3dadd(0, 0, 35, 5)
-    pt3dadd(0, 0, 150, 5)
-}
-
-dend[1] {
-    pt3dadd(0, 0, 150, 2)
-    pt3dadd(-50, 20, 200, 1)
-}
-
-dend[2] {
-    pt3dadd(0, 0, 150, 2)
-    pt3dadd(30, 0, 160, 2)
-}
-
-connect dend[0](0), soma[0](0.5)
-connect dend[1](0), dend[0](1)
-connect dend[2](0), dend[0](1)
-
-forall {
-    all.append()
-}
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/common.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/common.py
deleted file mode 100644
index 475ef96..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/common.py
+++ /dev/null
@@ -1,281 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-import os
-import numpy as np
-from scipy.integrate import quad
-from scipy import real, imag
-import LFPy
-import neuron
-
-
-######## Functions used by tests: ##############################################
-def stickSimulation(method):
-    stickParams = {
-        'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-        'cm' : 1,
-        'Ra' : 150,
-        'v_init' : -65,
-        'passive' : True,
-        'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-        'tstart' : -100,
-        'tstop' : 100,
-        'dt' : 2**-6,
-        'nsegs_method' : 'lambda_f',
-        'lambda_f' : 1000,
-
-    }
-
-    electrodeParams = {
-        'sigma' : 0.3,
-        'x' : np.ones(11) * 100.,
-        'y' : np.zeros(11),
-        'z' : np.linspace(1000, 0, 11),
-        'method' : method
-    }
-
-    stimParams = {
-        'pptype' : 'SinSyn',
-        'delay' : -100.,
-        'dur' : 1000.,
-        'pkamp' : 1.,
-        'freq' : 100.,
-        'phase' : -np.pi/2,
-        'bias' : 0.,
-        'record_current' : True
-    }
-
-
-    electrode = LFPy.RecExtElectrode(**electrodeParams)
-
-    stick = LFPy.Cell(**stickParams)
-    stick.set_pos(z=-stick.zstart[0])
-
-    synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                           **stimParams)
-    stick.simulate(electrode, rec_imem=True, rec_vmem=True)
-
-    return electrode.LFP
-
-def stickSimulationAveragingElectrode(contactRadius, contactNPoints, method):
-    stickParams = {
-        'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-        'cm' : 1,
-        'Ra' : 150,
-        'v_init' : -65,
-        'passive' : True,
-        'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-        'tstart' : -100,
-        'tstop' : 100,
-        'dt' : 2**-6,
-        'nsegs_method' : 'lambda_f',
-        'lambda_f' : 1000,
-
-    }
-
-    N = np.empty((11, 3))
-    for i in range(N.shape[0]): N[i,] = [1, 0, 0] #normal unit vec. to contacts
-    electrodeParams = {
-        'sigma' : 0.3,
-        'x' : np.ones(11) * 100.,
-        'y' : np.zeros(11),
-        'z' : np.linspace(1000, 0, 11),
-        'r' : contactRadius,
-        'n' : 10,
-        'N' : N,
-        'method' : method
-    }
-
-    stimParams = {
-        'pptype' : 'SinSyn',
-        'delay' : -100.,
-        'dur' : 1000.,
-        'pkamp' : 1.,
-        'freq' : 100.,
-        'phase' : -np.pi/2,
-        'bias' : 0.,
-        'record_current' : True
-    }
-
-
-    electrode = LFPy.RecExtElectrode(**electrodeParams)
-
-    stick = LFPy.Cell(**stickParams)
-    stick.set_pos(z=-stick.zstart[0])
-    
-    synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                           **stimParams)
-    stick.simulate(electrode, rec_imem=True, rec_vmem=True)
-
-    return electrode.LFP
-
-def stickSimulationDotprodcoeffs(method):
-    stickParams = {
-        'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-        'cm' : 1,
-        'Ra' : 150,
-        'v_init' : -65,
-        'passive' : True,
-        'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-        'tstart' : -100,
-        'tstop' : 100,
-        'dt' : 2**-6,
-        'nsegs_method' : 'lambda_f',
-        'lambda_f' : 1000,
-
-    }
-
-    electrodeParams = {
-        'sigma' : 0.3,
-        'x' : np.ones(11) * 100.,
-        'y' : np.zeros(11),
-        'z' : np.linspace(1000, 0, 11),
-        'method' : method
-    }
-
-    stimParams = {
-        'pptype' : 'SinSyn',
-        'delay' : -100.,
-        'dur' : 1000.,
-        'pkamp' : 1.,
-        'freq' : 100.,
-        'phase' : -np.pi/2,
-        'bias' : 0.,
-        'record_current' : True
-    }
-
-
-
-    stick = LFPy.Cell(**stickParams)
-    stick.set_pos(z=-stick.zstart[0])
-    
-    #dummy variables for mapping
-    stick.imem = np.eye(stick.totnsegs)
-    stick.tvec = np.arange(stick.totnsegs)*stick.dt
-
-    electrode = LFPy.RecExtElectrode(stick, **electrodeParams)
-    electrode.calc_lfp()
-    #not needed anymore:
-    del stick.imem, stick.tvec
-
-    synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                           **stimParams)
-    stick.simulate(dotprodcoeffs=electrode.LFP,
-                   rec_imem=True, rec_vmem=True)
-
-    return stick.dotprodresults[0]
-
-
-def analytical_LFP(time=np.linspace(0, 100, 1001),
-                   stickLength=1000.,
-                   stickDiam=2.,
-                   Rm=30000.,
-                   Cm=1.,
-                   Ri=150.,
-                   stimFrequency=100.,
-                   stimAmplitude=1.,
-                   # stimPos=1.,
-                   sigma=0.3,
-                   electrodeR=100.,
-                   electrodeZ=0.,
-                   ):
-    """
-    Will calculate the analytical LFP from a dendrite stick aligned with z-axis.
-    The synaptic current is always assumed to be at the end of the stick, i.e.
-    Zin = stickLength.
-
-    Parameters
-    ----------
-    time : ndarray
-        The LFP is calculated for values in this np.array (ms)
-    stickLength : float
-        length of stick (mum)
-    stickDiam : float
-        diameter of stick (mum)
-    Rm : float
-        Membrane resistivity (Ohm * cm2)
-    Cm : float
-        Membrane capacitance (muF/cm2)
-    Ri : float
-        Intracellular resistivity (Ohm*cm)
-    stimFrequency : float
-        Frequency of cosine synapse current (Hz)
-    stimAmplitude : float
-        Amplitude of cosine synapse current (nA)
-    # stimPos : float in [0, 1]
-    #     Relative stimulus current position from start (0) to end (1) of stick
-    sigma : float
-        Extracellular conductivity (muS/mum)
-    electrodeR : float
-        Radial distance from stick (mum)
-    electrodeZ : float
-        Longitudal distance along stick(mum)
-    """
-    Gm = 1. / Rm            # specific membrane conductivity (S/cm2)
-    gm = 1E2 * np.pi * stickDiam / Rm     # absolute membrane conductance (muS / mum)
-    ri = 1E-2 * 4. * Ri / (np.pi * stickDiam**2) # intracellular resistance  (Mohm/mum)
-
-    Lambda = 1E2 / np.sqrt(gm * ri) # Electrotonic length constant of stick (mum)
-    Ginf = 10 / (ri * Lambda)   # infinite stick input cond (10*muS)?
-
-    tau_m = Rm * Cm / 1000        # membrane time constant (ms)
-    Omega = 2 * np.pi * stimFrequency * tau_m / 1000 #impedance
-    Zel = electrodeZ / Lambda    # z-position of extracellular point, in units of Lambda
-    L = stickLength / Lambda      # Length of stick in units of Lambda
-    Rel = electrodeR / Lambda    # extracellular, location along x-axis, or radius, in units of Lambda
-    q = np.sqrt(1 + 1j*Omega)	    # Note: j is sqrt(-1)
-    Yin = q * Ginf * np.tanh(q * L)	    # Admittance
-    Zin = stickLength / Lambda  # unitless location of input current
-    # Zin = stickLength / Lambda * stimPos  # unitless location of input current
-
-    PhiExImem = np.empty(time.size)
-    PhiExInput = np.empty(time.size)
-
-    def i_mem(z): #z is location at stick
-        return gm * q**2 * np.cosh(q * z) / np.cosh(q * L) * stimAmplitude / Yin
-
-    def f_to_integrate(z):
-        return 1E-3 / (4 * np.pi * sigma) * i_mem(z) \
-            / np.sqrt(Rel**2 + (z - Zel)**2)
-
-    #calculate contrib from membrane currents
-    Vex_imem = -complex_quadrature(f_to_integrate, 0, L, epsabs=1E-20)
-
-    #adding contrib from input current to Vex
-    Vex_input = stimAmplitude / (4 * np.pi * sigma * Lambda * np.sqrt(Rel**2 + (Zin-Zel)**2))
-
-    PhiExImemComplex = Vex_imem * np.exp(1j * 2 * np.pi * stimFrequency *
-                                              time / 1000)
-    PhiExInputComplex = Vex_input * np.exp(1j * 2 * np.pi * stimFrequency *
-                                             time / 1000)
-
-    #Using only real component
-    PhiExImem = PhiExImemComplex.real
-    PhiExInput = PhiExInputComplex.real
-
-    PhiEx = PhiExImem + PhiExInput
-    return PhiEx
-
-def complex_quadrature(func, a, b, **kwargs):
-    """
-    Will return the complex integral value.
-    """
-    def real_func(x):
-        return real(func(x))
-    def imag_func(x):
-        return imag(func(x))
-    real_integral = quad(real_func, a, b, **kwargs)
-    imag_integral = quad(imag_func, a, b, **kwargs)
-    return real_integral[0] + 1j*imag_integral[0]
-
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/expsyni.mod b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/expsyni.mod
deleted file mode 100644
index f04b555..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/expsyni.mod
+++ /dev/null
@@ -1,86 +0,0 @@
-TITLE Exponential-function synaptic current, with NET_RECEIVE
-
-COMMENT
-This model works with variable time-step methods (although it may not
-be very accurate) but at the expense of having to maintain the queues
-of spike times and weights.
-Andrew P. Davison, UNIC, CNRS, May 2006
-
-Note: converted to Exponential current kernel. 
-
-ENDCOMMENT
-
-DEFINE MAX_SPIKES 1000
-DEFINE CUTOFF 20
-
-NEURON {
-	POINT_PROCESS ExpSynI
-	RANGE tau, i, q
-	NONSPECIFIC_CURRENT i
-}
-
-UNITS {
-	(nA) = (nanoamp)
-}
-
-PARAMETER {
-	tau = 5 (ms) <1e-9,1e9>
-
-}
-
-ASSIGNED {
-	i (nA)
-	q
-	onset_times[MAX_SPIKES] (ms)
-	weight_list[MAX_SPIKES] (nA)
-}
-
-INITIAL {
-	i  = 0
-	q  = 0 : queue index
-}
-
-BREAKPOINT {
-	LOCAL k, expired_spikes, x
-	i = 0
-	expired_spikes = 0
-	FROM k=0 TO q-1 {
-		x = (t - onset_times[k])/tau
-		if (x > CUTOFF) {
-			expired_spikes = expired_spikes + 1
-		} else {
-			i = i - weight_list[k] * exp_current(x)
-		}
-	}
-	update_queue(expired_spikes)
-}
-
-FUNCTION update_queue(n) {
-	LOCAL k
-	:if (n > 0) { printf("Queue changed. t = %4.2f onset_times=[",t) }
-	FROM k=0 TO q-n-1 {
-		onset_times[k] = onset_times[k+n]
-		weight_list[k] = weight_list[k+n]
-		:if (n > 0) { printf("%4.2f ",onset_times[k]) }
-	}
-	:if (n > 0) { printf("]\n") }
-	q = q-n
-}
-
-FUNCTION exp_current(x) {
-	if (x < 0) {
-		exp_current = 0
-	} else {
-		exp_current = exp(-x)
-	}
-}
-
-NET_RECEIVE(weight (nA)) {
-	onset_times[q] = t
-	weight_list[q] = weight
-	if (q >= MAX_SPIKES-1) {
-		printf("Error in ExpSynI. Spike queue is full\n")
-	} else {
-		q = q + 1
-	}
-}
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/fem_mix_dip.npz b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/fem_mix_dip.npz
deleted file mode 100644
index 0441b80..0000000
Binary files a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/fem_mix_dip.npz and /dev/null differ
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/sinsyn.mod b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/sinsyn.mod
deleted file mode 100644
index 70dbf93..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/sinsyn.mod
+++ /dev/null
@@ -1,46 +0,0 @@
-COMMENT
-Since this is an electrode current, positive values of i depolarize the cell
-and in the presence of the extracellular mechanism there will be a change
-in vext since i is not a transmembrane current but a current injected
-directly to the inside of the cell.
-ENDCOMMENT
-
-NEURON {
-        POINT_PROCESS SinSyn
-        RANGE del, dur, pkamp, freq, phase, bias
-        NONSPECIFIC_CURRENT i
-}
-
-UNITS {
-        (nA) = (nanoamp)
-             }
-
-PARAMETER {
-        del=5   (ms)
-        dur=200   (ms)
-        pkamp=1 (nA)
-        freq=1  (Hz)
-        phase=0
-        bias=0  (nA)
-        PI=3.14159265358979323846
-}
-
-ASSIGNED {
-        i (nA)
-}
-
-BREAKPOINT {
-       at_time(del)
-       at_time(del + dur)
-
-       if (t < del) {
-      i=0   
-   }else{ 
-            if (t < del+dur) {
-           i = -pkamp*sin(2*PI*freq*(t-del)*(0.001)+phase)-bias
-      }else{ 
-           i = 0
-}}}
-
-NET_RECEIVE(weight (nA)) {
-}
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/stick.hoc b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/stick.hoc
deleted file mode 100644
index 932b4d6..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/stick.hoc
+++ /dev/null
@@ -1,33 +0,0 @@
-proc celldef() {
-  topol()
-  subsets()
-  geom()
-  biophys()
-  geom_nseg()
-}
-
-create dend
-
-proc topol() { local i
-  basic_shape()
-}
-proc basic_shape() {
-  dend {pt3dclear() pt3dadd(0, 0, 0, 2) pt3dadd(0, 0, 1000, 2)}
-}
-
-objref all
-proc subsets() { local i
-  objref all
-  all = new SectionList()
-    dend all.append()
-
-}
-proc geom() {
-}
-proc geom_nseg() {
-}
-proc biophys() {
-}
-access dend
-
-celldef()
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/stick_template.hoc b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/stick_template.hoc
deleted file mode 100644
index 8a459a0..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/stick_template.hoc
+++ /dev/null
@@ -1,14 +0,0 @@
-begintemplate stick_template
-public dend         
-public all, basal
-objref all, basal
-proc init() {
-    all = new SectionList()
-    basal = new SectionList()
-}
-
-create dend[1]
-
-endtemplate stick_template
-
-
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/sticks_not_connected_head_to_toe.hoc b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/sticks_not_connected_head_to_toe.hoc
deleted file mode 100644
index 0485596..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/sticks_not_connected_head_to_toe.hoc
+++ /dev/null
@@ -1,34 +0,0 @@
-/* ----------------------------------------------------
-sticks_not_connected_head_to_toe.hoc
-Note the conventions:
- - soma needs to be a list (soma[0], not soma),
- - use soma for the soma compartment,
- - use a name starting with dend for the dendrites.
------------------------------------------------------*/
-
-
-create soma, dend1, dend2, dend3
-
-soma {
-    pt3dadd(0, 0, -10, 10)
-    pt3dadd(0, 0, 0, 10)
-}
-
-dend1 {
-    pt3dadd(0, 0, 0, 5)
-    pt3dadd(0, 0, 200, 5)
-}
-
-dend2 {
-    pt3dadd(0, 0, 100, 2)
-    pt3dadd(0, 20, 200, 2)
-}
-
-dend3 {
-    pt3dadd(0, 0, 140, 2)
-    pt3dadd(-10, -50, 200, 2)
-}
-
-connect dend1(0), soma(1)
-connect dend2(0), dend1(.5)
-connect dend3(0), dend1(.7)
\ No newline at end of file
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_alias_method.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_alias_method.py
deleted file mode 100644
index 6c80cbe..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_alias_method.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import os
-import unittest
-import numpy as np
-import LFPy
-
-
-class testAliasMethod(unittest.TestCase):
-    """
-    test LFPy.alias_method methods
-    """
-
-
-    def test_alias_method_00(self):
-        """deterministic probabilities 0.0 and 1.0"""
-        idx = np.arange(2)
-        probs = np.arange(2).astype(float)
-        nidx = 1000000
-        bins = np.arange(3)
-
-        hist, _ = np.histogram(LFPy.alias_method.alias_method(idx, probs, nidx),
-                               bins)
-
-        self.assertEqual(nidx, hist[1])
-
-    def test_alias_method_01(self):
-        """probabilities 0.25 and 0.75"""
-        idx = np.arange(2)
-        probs = np.array([0.25, 0.75])
-        nidx = 1000000
-        bins = np.arange(3)
-
-        hist, _ = np.histogram(LFPy.alias_method.alias_method(idx, probs, nidx),
-                               bins)
-
-        # compute Pearson correlation coefficients between area and histogram
-        # reporting success if within 7 decimal places
-        self.assertAlmostEqual(np.corrcoef(probs, hist.astype(float))[0, 1], 1., places=7)
-
-    def test_alias_method_02(self):
-        """probabilities 0.75 and 0.25"""
-        idx = np.arange(2)
-        probs = np.array([0.75, 0.25])
-        nidx = 1000000
-        bins = np.arange(3)
-
-        hist, _ = np.histogram(LFPy.alias_method.alias_method(idx, probs, nidx),
-                               bins)
-
-        # compute Pearson correlation coefficients between area and histogram
-        # reporting success if within 7 decimal places
-        self.assertAlmostEqual(np.corrcoef(probs, hist.astype(float))[0, 1], 1., places=7)
-
-    def test_alias_method_03(self):
-        '''over range of normalized probabilities'''
-        size = 5
-        idx = np.arange(size)
-        probs = np.arange(size).astype(float)**2
-        probs /= probs.sum()
-        nidx = 1000000
-        bins = np.arange(probs.size + 1)
-
-        hist, _ = np.histogram(LFPy.alias_method.alias_method(idx, probs, nidx),
-                               bins)
-
-        # compute Pearson correlation coefficients between area and histogram
-        # reporting success if within 5 decimal places
-        self.assertAlmostEqual(np.corrcoef(probs, hist.astype(float))[0, 1], 1., places=4)
-
-
-    def test_alias_method_04(self):
-        """deterministic probabilities 1.0 and 0.0"""
-        idx = np.arange(2)
-        probs = np.arange(2).astype(float)[::-1]
-        nidx = 1000000
-        bins = np.arange(3)
-
-        hist, _ = np.histogram(LFPy.alias_method.alias_method(idx, probs, nidx),
-                               bins)
-
-        self.assertEqual(nidx, hist[0])
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_cell.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_cell.py
deleted file mode 100644
index c76478d..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_cell.py
+++ /dev/null
@@ -1,1636 +0,0 @@
-# -*- coding: utf-8 -*-
-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import os
-import posixpath
-import sys
-import unittest
-import numpy as np
-import LFPy
-import neuron
-import pickle
-import random
-
-# for nosetests to run load mechanisms
-if "win32" in sys.platform:
-    pth = os.path.join(LFPy.__path__[0], 'test', 'nrnmech.dll')
-    pth = pth.replace(os.sep, posixpath.sep)
-    if not pth in neuron.nrn_dll_loaded:
-        neuron.h.nrn_load_dll(pth)
-        neuron.nrn_dll_loaded.append(pth)
-else:
-    neuron.load_mechanisms(os.path.join(LFPy.__path__[0], 'test'))
-
-class testCell(unittest.TestCase):
-    """
-    test class LFPy.Cell
-    """
-
-    def test_cell_tvec_00(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : 0.,
-            'tstop' : 100.,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_01(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : 0.,
-            'tstop' : 10000.,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_02(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : 0,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_03(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : 0,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_04(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : 0,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_05(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : 0,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_06(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : -100,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_07(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_08(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        try:
-            stickSimulationTesttvec(**stickParams)
-        except AssertionError:
-            pass
-
-    def test_cell_tvec_09(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        try:
-            stickSimulationTesttvec(**stickParams)
-        except AssertionError:
-            pass
-
-    def test_cell_set_pos_00(self):
-        '''test LFPy.Cell.set_pos'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        np.testing.assert_allclose(cell.somapos, [0, 0, 0])
-
-    def test_cell_set_pos_01(self):
-        '''test LFPy.Cell.set_pos'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-    def test_cell_set_pos_02(self):
-        '''test LFPy.Cell.set_pos'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                          pt3d=True)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-    def test_cell_set_pos_03(self):
-        '''test LFPy.Cell.set_pos'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-    def test_cell_set_pos_04(self):
-        '''test LFPy.Cell.set_pos'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                          pt3d=True)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-
-    def test_cell_set_pos_05(self):
-        '''test LFPy.Cell.set_pos'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        np.testing.assert_allclose(cell.somapos,
-                                   [cell.xmid[0], cell.ymid[0], cell.zmid[0]])
-
-
-    def test_cell_set_pos_06(self):
-        '''test LFPy.Cell.set_pos'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                         pt3d=True)
-        np.testing.assert_allclose(cell.somapos,
-                                   [cell.xmid[0], cell.ymid[0], cell.zmid[0]])
-
-
-    def test_cell_set_rotation_00(self):
-        '''test LFPy.Cell.set_rotation()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.set_rotation(x=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_01(self):
-        '''test LFPy.Cell.set_rotation()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.set_rotation(y=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_02(self):
-        '''test LFPy.Cell.set_rotation()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        # test rotation 180 deg around z-axis
-        cell.set_rotation(z=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-
-    def test_cell_set_rotation_03(self):
-        '''test LFPy.Cell.set_rotation()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                         pt3d=True)
-
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.set_rotation(x=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_04(self):
-        '''test LFPy.Cell.set_rotation()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                         pt3d=True)
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.set_rotation(y=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_05(self):
-        '''test LFPy.Cell.set_rotation()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                         pt3d=True)
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        # test rotation 180 deg around z-axis
-        cell.set_rotation(z=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-
-    def test_cell_set_rotation_06(self):
-        '''test LFPy.Cell.set_rotation()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'))
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation: 90 deg around x-axis, 90 deg around y-axis, 90 deg around z-axis
-        cell.set_rotation(x=np.pi / 2., y=np.pi, z=np.pi / 4.)
-        # revert rotation: -90 deg around x-axis, -90 deg around y-axis, -90 deg around z-axis, rotation_order='zyx'
-        cell.set_rotation(x=-np.pi / 2., y=-np.pi, z=-np.pi / 4., rotation_order='zyx')
-        # assert that x-, y- and z-coordinates are same as beginning, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-
-    def test_cell_chiral_morphology_00(self):
-        '''test LFPy.Cell.chiral_morphology()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.chiral_morphology(axis='x')
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-
-
-    def test_cell_chiral_morphology_01(self):
-        '''test LFPy.Cell.chiral_morphology()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.chiral_morphology(axis='y')
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-
-    def test_cell_chiral_morphology_02(self):
-        '''test LFPy.Cell.chiral_morphology()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around z-axis
-        cell.chiral_morphology(axis='z')
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_get_rand_prob_area_norm_00(self):
-        '''test LFPy.Cell.get_rand_prob_area_norm()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc' ))
-        p = cell.get_rand_prob_area_norm()
-        self.assertAlmostEqual(p.sum(), 1.)
-        self.assertTrue(p.min() >= 0.)
-        self.assertTrue(p.max() <= 1.)
-
-
-    def test_cell_get_rand_prob_area_norm_from_idx(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc' ))
-        p = cell.get_rand_prob_area_norm_from_idx(idx=cell.get_idx(section='allsec'))
-        self.assertListEqual(cell.get_rand_prob_area_norm().tolist(), p.tolist())
-
-
-    def test_cell_get_rand_prob_area_norm_from_idx_00(self):
-        '''test LFPy.Cell.get_rand_prob_area_norm()'''
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        p = cell.get_rand_prob_area_norm_from_idx(idx=np.array([0]))
-        np.testing.assert_equal(p, np.array([1.]))
-
-
-    def test_cell_get_intersegment_vector_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        idx0 = 0
-        idx1 = 1
-        vector = cell.get_intersegment_vector(idx0=idx0, idx1=idx1)
-
-        self.assertListEqual(vector,
-                            [cell.xmid[idx1] - cell.xmid[idx0],
-                             cell.ymid[idx1] - cell.ymid[idx0],
-                             cell.zmid[idx1] - cell.zmid[idx0]])
-
-
-    def test_cell_get_intersegment_distance_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        idx0 = 0
-        idx1 = 1
-        distance = cell.get_intersegment_distance(idx0=idx0, idx1=idx1)
-        vector = cell.get_intersegment_vector(idx0=idx0, idx1=idx1)
-
-        self.assertEqual(np.sqrt(np.array(vector)**2).sum(), distance)
-
-
-    def test_cell_get_idx_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                         nsegs_method=None)
-        self.assertListEqual(cell.get_idx(section='soma').tolist(), [0])
-        self.assertListEqual(cell.get_idx(section='soma[0]').tolist(), [0])
-        self.assertListEqual(cell.get_idx(section='dend[0]').tolist(), [1])
-        self.assertListEqual(cell.get_idx(section='dend[1]').tolist(), [2])
-        self.assertListEqual(cell.get_idx(section='dend[2]').tolist(), [3])
-        self.assertListEqual(cell.get_idx(section='dend').tolist(), [1, 2, 3])
-        self.assertListEqual(cell.get_idx(section='allsec').tolist(),
-                             [0, 1, 2, 3])
-        self.assertListEqual(cell.get_idx(section=['soma', 'dend']).tolist(),
-                             [0, 1, 2, 3])
-        self.assertListEqual(cell.get_idx(section='apic').tolist(), [])
-
-
-    def test_cell_get_closest_idx_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ),
-                         nsegs_method=None)
-        self.assertEqual(cell.get_closest_idx(x=0, y=0, z=0),
-                             cell.get_idx(section='soma')[0])
-
-        self.assertEqual(cell.get_closest_idx(x=-25, y=0, z=175),
-                             cell.get_idx(section='dend[1]')[0])
-
-    def test_cell_get_closest_idx_01(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        x = -41.7
-        z = 156.7
-        sec_name = "dend"
-
-        idx1 = cell.get_closest_idx(x=x, z=z)
-        idx2 = cell.get_closest_idx(x=x, z=z, section=sec_name)
-        self.assertEqual(idx1, idx2)
-
-
-    def test_cell_get_idx_children_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-
-        np.testing.assert_array_equal(cell.get_idx_children(parent='soma[0]'),
-                                      cell.get_idx(section='dend[0]'))
-
-
-    def test_cell_get_idx_parent_children_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        np.testing.assert_array_equal(cell.get_idx_parent_children(parent='soma[0]'),
-                                      cell.get_idx(section=['soma[0]',
-                                                            'dend[0]']))
-
-
-    def test_cell_get_idx_name_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        np.testing.assert_array_equal(cell.get_idx_name(idx=np.array([0])),
-                                                np.array([[0, 'soma[0]', 0.5]],
-                                                         dtype=object))
-
-
-    def test_cell_get_rand_idx_area_norm_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        idx = cell.get_rand_idx_area_norm(nidx=1000000)
-
-
-        # compute histogram and correlate with segment area
-        bins = np.arange(cell.totnsegs+1)
-        hist, bin_edges = np.histogram(idx, bins=bins)
-
-        # compute Pearson correlation coefficients between area and histogram
-        # reporting success if within 4 decimal places
-        self.assertAlmostEqual(np.corrcoef(cell.area, hist)[0, 1], 1., places=4)
-
-        # check if min and max is in the range of segment indices
-        self.assertEqual(idx.min(), 0)
-        self.assertEqual(idx.max(), cell.totnsegs-1)
-
-
-    def test_cell_set_synapse_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        cell.set_synapse(idx=0, syntype='ExpSyn', record_curret=False,
-                         record_potential=False, weight=1.,
-                         **dict(e=10., tau=2.))
-
-        self.assertTrue('ExpSyn' in cell.synlist[0].hname())
-        self.assertEqual(len(cell.synlist), 1)
-        self.assertEqual(len(cell.netconlist), 1)
-        self.assertEqual(len(cell.netstimlist), 1)
-        self.assertEqual(cell.synlist[0].e, 10.)
-        self.assertEqual(cell.synlist[0].tau, 2.)
-        self.assertEqual(cell.netconlist[0].weight[0], 1.)
-
-
-    def test_cell_set_point_process_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        cell.set_point_process(idx=0, pptype='IClamp', record_current=False,
-                               **dict(delay=1., amp=1.))
-        self.assertEqual(cell.stimlist[0].hname(), 'IClamp[0]')
-        self.assertEqual(len(cell.stimlist), 1)
-        self.assertEqual(cell.stimlist[0].delay, 1.)
-        self.assertEqual(cell.stimlist[0].amp, 1.)
-
-
-    def test_cell_strip_hoc_objects_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        cell.strip_hoc_objects()
-        for attribute in dir(cell):
-            self.assertNotEqual(str(type(getattr(cell, attribute))),
-                                'hoc.HocObject')
-
-    def test_cell_cellpickler_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks.hoc' ))
-        cell_pickle = cell.cellpickler(filename=None, pickler=pickle.dumps)
-        pickled_cell = pickle.loads(cell_pickle)
-
-        for attribute in dir(cell):
-            if attribute.startswith('__') or attribute.startswith('_'):
-                pass
-            else:
-                self.assertEqual(type(getattr(cell, attribute)),
-                                 type(getattr(pickled_cell, attribute)))
-
-    def test_cell_get_axial_currents_from_vmem_00(self):
-        '''
-        Check Kirchhoff in single dend.
-        '''
-        neuron.h('forall delete_section()')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend2.connect(dend1(1.), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0], cell.imem[0], rtol=1E-5)
-        np.testing.assert_almost_equal(iaxial[1], cell.imem[1], decimal=9)
-        np.testing.assert_allclose(iaxial[1], cell.imem[1], rtol=1E-5)
-
-    def test_cell_get_axial_currents_from_vmem_01(self):
-        '''
-        Check Kirchhoff in soma when single dend connected to soma mid.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend = neuron.h.Section(name='dend')
-        dend.connect(soma(0.5), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0], cell.imem[0], decimal=9)
-        np.testing.assert_almost_equal(-iaxial[1], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0], cell.imem[0], rtol=1E-4)
-        np.testing.assert_allclose(-iaxial[1], cell.imem[0], rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_02(self):
-        '''
-        Check Kirchhoff in soma when single dend connected to soma end.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend = neuron.h.Section(name='dend')
-        dend.connect(soma(1.0), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0], cell.imem[0], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[1], cell.imem[1], decimal=9)
-        np.testing.assert_allclose(iaxial[1], cell.imem[1], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[0], iaxial[1], decimal=9)
-        np.testing.assert_allclose(iaxial[0], iaxial[1], rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_03(self):
-        '''
-        Check Kirchhoff in soma when single dend connected to random soma point.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend = neuron.h.Section(name='dend')
-        dend.connect(soma(random.uniform(1e-2, 1.)), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0], cell.imem[0], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[1], cell.imem[1], decimal=9)
-        np.testing.assert_allclose(iaxial[1], cell.imem[1], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[0], iaxial[1], decimal=9)
-        np.testing.assert_allclose(iaxial[0], iaxial[1], rtol=1E-4)
-
-
-    def test_cell_get_axial_currents_from_vmem_04(self):
-        '''
-        Check Kirchhoff in soma when two dends connected to soma mid.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend1.connect(soma(0.5), 0)
-        dend2.connect(soma(0.5), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[1]-iaxial[3], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[1]-iaxial[3], cell.imem[0], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[0], iaxial[1], decimal=9)
-        np.testing.assert_allclose(iaxial[0], iaxial[1], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[2], iaxial[3], decimal=9)
-        np.testing.assert_allclose(iaxial[2], iaxial[3], rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_05(self):
-        '''
-        Check Kirchhoff in soma when two dends connected to soma end.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend1.connect(soma(1.), 0)
-        dend2.connect(soma(1.), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0]-iaxial[2], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0]-iaxial[2], cell.imem[0], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[0]+iaxial[2], iaxial[1] + iaxial[3], decimal=9)
-        np.testing.assert_allclose(iaxial[0]+iaxial[2], iaxial[1] + iaxial[3], rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_06(self):
-        '''
-        Check Kirchhoff in soma when two dends connected to diff soma points.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend1.connect(soma(1.0), 0)
-        dend2.connect(soma(.5), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0]-iaxial[2], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0]-iaxial[2], cell.imem[0], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[0], iaxial[1], decimal=9)
-        np.testing.assert_allclose(iaxial[0], iaxial[1], rtol=1E-4)
-        np.testing.assert_almost_equal(iaxial[2], iaxial[3], decimal=9)
-        np.testing.assert_allclose(iaxial[2], iaxial[3], rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_07(self):
-        '''
-        Check Kirchhoff in mid dend when two dends connected to dend.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend1.connect(soma(1.0), 0)
-        dend2.connect(dend1(.5), 0)
-        dend3.connect(dend1(1.), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(iaxial[0]+iaxial[4], iaxial[1] + iaxial[5], decimal=9)
-        np.testing.assert_allclose(iaxial[0]+iaxial[4], iaxial[1] + iaxial[5], rtol=1E-4)
-        np.testing.assert_almost_equal(-iaxial[1]+iaxial[2]+iaxial[4], -cell.imem[1], decimal=9)
-        np.testing.assert_allclose(-iaxial[1]+iaxial[2]+iaxial[4], -cell.imem[1], rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_08(self):
-        '''
-        Check Kirchhoff in soma when three dends connected to soma.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend1.connect(soma(1.0), 0)
-        dend2.connect(soma(.5), 0)
-        dend3.connect(soma(.8), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0]-iaxial[2]-iaxial[4], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0]-iaxial[2]-iaxial[4], cell.imem[0], rtol=1E-3)
-
-    def test_cell_get_axial_currents_from_vmem_09(self):
-        '''
-        Check Kirchhoff in 2-comp model where dend 0 is connected to soma 0.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend1.connect(soma(0.0), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(iaxial[0], -cell.imem[0], decimal=9)
-        np.testing.assert_almost_equal(iaxial[0], cell.imem[1], decimal=9)
-        np.testing.assert_allclose(iaxial[0], -cell.imem[0], rtol=1E-3)
-        np.testing.assert_allclose(iaxial[0], cell.imem[1], rtol=1E-3)
-
-    def test_cell_get_axial_currents_from_vmem_10(self):
-        '''
-        Check that len(iaxial) = (cell.totnsegs - 1)*2
-        '''
-        soma = neuron.h.Section(name='soma[0]')
-        dend1 = neuron.h.Section(name='dend1[0]')
-        dend2 = neuron.h.Section(name='dend2[0]')
-        dend3 = neuron.h.Section(name='dend3[0]')
-        dend1.connect(soma(1.0), 0)
-        dend2.connect(soma(.5), 0)
-        dend3.connect(soma(0.8), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        self.assertEqual(iaxial.shape[0], (cell.totnsegs - 1)*2)
-
-    def test_cell_get_axial_currents_from_vmem_11(self):
-        '''
-        Check Kirchhoff in soma when three dends connected to soma mid.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend1.connect(soma(0.5), 0)
-        dend2.connect(soma(0.5), 0)
-        dend3.connect(soma(0.5), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-iaxial[0]-iaxial[2]-iaxial[4], cell.imem[0], decimal=9)
-        np.testing.assert_allclose(-iaxial[0]-iaxial[2]-iaxial[4], cell.imem[0], rtol=1E-3)
-
-    def test_cell_get_axial_currents_from_vmem_12(self):
-        '''
-        Check Kirchhoff in morph where secs are connected to arc length 0.5.
-        '''
-        morphology = os.path.join(LFPy.__path__[0], 'test', 'sticks_not_connected_head_to_toe.hoc')
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(iaxial[6]+iaxial[10]+cell.imem[3], iaxial[5], decimal=9)
-        np.testing.assert_allclose(iaxial[6]+iaxial[10]+cell.imem[3], iaxial[5], rtol=1E-5)
-
-    def test_cell_get_axial_currents_from_vmem_13(self):
-        '''
-        Check Kirchhoff in morph where secs are connected to arc length 0.7.
-        '''
-        morphology = os.path.join(LFPy.__path__[0], 'test', 'sticks_not_connected_head_to_toe.hoc')
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(iaxial[8]+iaxial[20]+cell.imem[4], iaxial[7], decimal=9)
-        np.testing.assert_allclose(iaxial[8]+iaxial[20]+cell.imem[4], iaxial[7], rtol=1E-5)
-
-
-    def test_cell_get_axial_currents_from_vmem_14(self):
-        '''
-        Check iaxial current mid positions in three-section stick.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend1.connect(soma(1), 0)
-        dend2.connect(soma(1), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree(sec=soma)
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        new_x = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
-        new_y = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
-        new_z = [[-10, 0, 10], [10, 15, 20], [20, 30, 50]]
-        new_d = [[20, 20, 20], [10, 10, 10], [5, 5, 5]]
-        for j, sec in enumerate(neuron.h.allsec()):
-            for n in range(3):
-                neuron.h.pt3dchange(n,
-                                new_x[j][n],
-                                new_y[j][n],
-                                new_z[j][n],
-                                new_d[j][n])
-                neuron.h.define_shape()
-        cell._collect_geometry()
-        cell2 = cell_w_synapse_from_sections(morphology)
-        iaxial2, d_list2, pos_list2 = cell2.get_axial_currents_from_vmem()
-        mid_current_positions = np.array([[0., 0., 5], [0., 0., 20], [0., 0., 5.], [0., 0., 12.5]])
-        np.testing.assert_almost_equal(mid_current_positions, pos_list2, decimal=9)
-        np.testing.assert_allclose(mid_current_positions, pos_list2, rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_15(self):
-        '''
-        Check iaxial current mid positions in ball-n-y.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend1.connect(soma(1.0), 0)
-        dend2.connect(dend1(1.), 0)
-        dend3.connect(dend1(.5), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree(sec=soma)
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial1, d_list1, pos_list1 = cell.get_axial_currents_from_vmem()
-        new_x = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 5, 10]]
-        new_y = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]
-        new_z = [[-10, 0, 10], [10, 15, 20], [20, 30, 40], [15, 15, 15]]
-        new_d = [[20, 20, 20], [10, 10, 10], [5, 5, 5], [2, 2, 2]]
-        for j, sec in enumerate(neuron.h.allsec()):
-            for n in range(3):
-                neuron.h.pt3dchange(n,
-                                new_x[j][n],
-                                new_y[j][n],
-                                new_z[j][n],
-                                new_d[j][n])
-                neuron.h.define_shape()
-        cell._collect_geometry()
-        cell2 = cell_w_synapse_from_sections(morphology)
-        iaxial2, d_list2, pos_list2 = cell2.get_axial_currents_from_vmem()
-        mid_current_positions = np.array([[0., 0., 5.], [0., 0., 12.5],
-                                          [0., 0., 15.], [2.5, 0., 15.],
-                                          [0., 0., 17.5], [0, 0., 25.]])
-        np.testing.assert_almost_equal(mid_current_positions, pos_list2, decimal=9)
-        np.testing.assert_allclose(mid_current_positions, pos_list2, rtol=1E-4)
-
-    def test_cell_get_axial_currents_from_vmem_16(self):
-        '''
-        Check Kirchhoff in soma when three dends connected to soma end.
-        '''
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend1.connect(soma(1.0), 0)
-        dend2.connect(soma(1.0), 0)
-        dend3.connect(soma(1.0), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        iaxial, d_list, pos_list = cell.get_axial_currents_from_vmem()
-        np.testing.assert_almost_equal(-cell.imem[0], iaxial[1] + iaxial[3] + iaxial[5], decimal=9)
-        np.testing.assert_allclose(-cell.imem[0], iaxial[1] + iaxial[3] + iaxial[5], rtol=1E-3)
-
-    def test_cell_simulate_recorder_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stick = LFPy.Cell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-
-    def test_cell_simulate_recorder_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_03(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stick = LFPy.Cell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-
-    def test_cell_simulate_recorder_04(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_05(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-
-    def test_cell_simulate_current_dipole_moment_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.Cell(**stickParams)
-                synapse = LFPy.StimIntElectrode(stick, idx=idx,
-                                       **stimParams)
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-
-
-    def test_cell_simulate_current_dipole_moment_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.Cell(**stickParams)
-                synapse = LFPy.StimIntElectrode(stick, idx=idx,
-                                       **stimParams)
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-
-    def test_cell_simulate_current_dipole_moment_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'e' : 0,                                # reversal potential
-            'syntype' : 'Exp2Syn',                   # synapse type
-            'tau1' : 0.1,                              # syn. time constant
-            'tau2' : 2.,                              # syn. time constant
-            'weight' : 0.01,
-        }
-
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.Cell(**stickParams)
-                synapse = LFPy.Synapse(stick, idx=idx,
-                                       **stimParams)
-                synapse.set_spike_times(np.array([10., 20., 30., 40., 50.]))
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-
-    def test_cell_tstart_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick0 = LFPy.Cell(tstart=0, tstop=200, **stickParams)
-        synapse0 = LFPy.StimIntElectrode(stick0,
-                                         stick0.get_closest_idx(0, 0, 1000),
-                                         delay=0, phase=0.,
-                                         **stimParams)
-        stick0.simulate(rec_imem=True, rec_vmem=True, rec_current_dipole_moment=True)
-
-
-        stick1 = LFPy.Cell(tstart=-100, tstop=100, **stickParams)
-        synapse1 = LFPy.StimIntElectrode(stick1,
-                                         stick1.get_closest_idx(0, 0, 1000),
-                                         delay=-100, phase=0.,
-                                         **stimParams)
-        stick1.simulate(rec_imem=True, rec_vmem=True, rec_current_dipole_moment=True)
-
-        inds = stick0.tvec >= 100
-        np.testing.assert_allclose(stick0.vmem[:, inds], stick1.vmem)
-        np.testing.assert_allclose(stick0.imem[:, inds], stick1.imem)
-        np.testing.assert_allclose(stick0.current_dipole_moment[inds, :],
-                                   stick1.current_dipole_moment)
-
-
-    def test_cell_with_recextelectrode_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.Cell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-
-    def test_cell_with_recextelectrode_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.Cell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_cell_with_recextelectrode_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.Cell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_cell_with_recextelectrode_03(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.Cell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_get_multi_current_dipole_moments00(self):
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend1.connect(soma(0.5), 0)
-        dend2.connect(dend1(1.0), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        dipoles, dipole_locs = cell.get_multi_current_dipole_moments()
-        t_point = -1
-        P_from_multi_dipoles = np.sum(dipoles[:,t_point,:],axis=0)
-        P = cell.current_dipole_moment[t_point]
-        np.testing.assert_almost_equal(P, P_from_multi_dipoles)
-        np.testing.assert_allclose(P, P_from_multi_dipoles, rtol=1E-5)
-
-    def test_get_multi_current_dipole_moments01(self):
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend1.connect(soma(1.), 0)
-        dend2.connect(soma(1.), 0)
-        dend3.connect(soma(1.), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        dipoles, dipole_locs = cell.get_multi_current_dipole_moments()
-        t_point = -1
-        P_from_multi_dipoles = np.sum(dipoles[:,t_point,:],axis=0)
-        P = cell.current_dipole_moment[t_point]
-        np.testing.assert_almost_equal(P, P_from_multi_dipoles)
-
-    def test_get_multi_current_dipole_moments02(self):
-        neuron.h('forall delete_section()')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend2.connect(dend1(1.), 0)
-        dend3.connect(dend2(.5), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        dipoles, dipole_locs = cell.get_multi_current_dipole_moments()
-        t_point = -1
-        P_from_multi_dipoles = np.sum(dipoles[:,t_point,:],axis=0)
-        P = cell.current_dipole_moment[t_point]
-        np.testing.assert_almost_equal(P, P_from_multi_dipoles)
-
-    def test_get_multi_current_dipole_moments03(self):
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend4 = neuron.h.Section(name='dend4')
-        dend5 = neuron.h.Section(name='dend5')
-        dend1.connect(soma(1.), 0)
-        dend2.connect(soma(0.), 0)
-        dend3.connect(soma(0.), 0)
-        dend4.connect(soma(0.), 0)
-        dend5.connect(soma(0.432), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        cell = cell_w_synapse_from_sections(morphology)
-        dipoles, dipole_locs = cell.get_multi_current_dipole_moments()
-        t_point = -1
-        P_from_multi_dipoles = np.sum(dipoles[:,t_point,:],axis=0)
-        P = cell.current_dipole_moment[t_point]
-        np.testing.assert_almost_equal(P, P_from_multi_dipoles)
-
-    def test_get_multi_current_dipole_moments04(self):
-        morphology = os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc')
-        cell = cell_w_synapse_from_sections(morphology)
-        dipoles, dipole_locs = cell.get_multi_current_dipole_moments()
-        t_point = -1
-        P_from_multi_dipoles = np.sum(dipoles[:,t_point,:],axis=0)
-        P = cell.current_dipole_moment[t_point]
-        np.testing.assert_almost_equal(P, P_from_multi_dipoles)
-
-
-    def test_cell_distort_geometry_01(self):
-        cell0 = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                          'ball_and_sticks.hoc' ))
-        factors = [-0.2, 0.1, 0., 0.1, 0.2]
-        nus = [-0.5, 0., 0.5]
-        for factor in factors:
-            for nu in nus:
-                for axis in 'xyz':
-                    cell1 = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0],
-                                                      'test',
-                                                      'ball_and_sticks.hoc' ))
-                    cell1.distort_geometry(factor=factor, nu=nu, axis=axis)
-                    for attr in ['start', 'mid', 'end']:
-                        for ax in 'xyz'.replace(axis, ''):
-                            np.testing.assert_allclose(getattr(cell0, ax+attr)*(1+factor*nu),
-                                                       getattr(cell1, ax+attr))
-                        np.testing.assert_allclose(getattr(cell0, axis+attr)*(1-factor),
-                                                   getattr(cell1, axis+attr))
-
-    ######## Functions used by tests: ##########################################
-def stickSimulationTesttvec(**kwargs):
-    stick = LFPy.Cell(morphology = os.path.join(LFPy.__path__[0], 'test',
-                                                'stick.hoc'), verbose=False,
-                      **kwargs)
-    stick.simulate(rec_imem=False)
-    return stick.tvec
-
-
-def cell_w_synapse_from_sections(morphology):
-    '''
-    Make cell and synapse objects, set spike, simulate and return cell
-    '''
-    cellParams = {
-        'morphology': morphology,
-        'cm' : 1,
-        'Ra' : 150,
-        'v_init' : -65,
-        'passive' : True,
-        'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-        'dt' : 2**-6,
-        'tstart' : -50,
-        'tstop' : 50,
-        'delete_sections' : False
-    }
-
-    synapse_parameters = {'e': 0.,
-                      'syntype': 'ExpSyn',
-                      'tau': 5.,
-                      'weight': .001,
-                      'record_current': True,
-                      'idx': 1}
-
-    cell = LFPy.Cell(**cellParams)
-    synapse = LFPy.Synapse(cell, **synapse_parameters)
-    synapse.set_spike_times(np.array([1.]))
-    cell.simulate(rec_imem=True, rec_vmem=True, rec_current_dipole_moment=True)
-    return cell
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_eegmegcalc.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_eegmegcalc.py
deleted file mode 100644
index c03d3c8..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_eegmegcalc.py
+++ /dev/null
@@ -1,742 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import unittest
-import os
-import numpy as np
-import LFPy
-import neuron
-
-
-class testMEG(unittest.TestCase):
-    """
-    test class LFPy.MEG
-    """
-
-    def test_MEG_00(self):
-        '''test LFPy.MEG.calculate_H()'''
-        current_dipole_moment = np.zeros((11, 3))
-        current_dipole_moment[:, 0] += 1.
-        dipole_location = np.zeros(3)
-        sensor_locations = np.r_[np.eye(3), -np.eye(3)]
-
-        gt = np.zeros((sensor_locations.shape[0],
-                       current_dipole_moment.shape[0], 3))
-        gt[1, :, 2] = 1./4/np.pi
-        gt[2, :, 1] = -1./4/np.pi
-        gt[4, :, 2] = -1./4/np.pi
-        gt[5, :, 1] = 1./4/np.pi
-
-        meg = LFPy.MEG(sensor_locations)
-        np.testing.assert_equal(gt, meg.calculate_H(current_dipole_moment,
-                                                    dipole_location))
-
-    def test_MEG_01(self):
-        '''test LFPy.MEG.calculate_H()'''
-        current_dipole_moment = np.zeros((11, 3))
-        current_dipole_moment[:, 1] += 1.
-        dipole_location = np.zeros(3)
-        sensor_locations = np.r_[np.eye(3), -np.eye(3)]
-
-        gt = np.zeros((sensor_locations.shape[0],
-                       current_dipole_moment.shape[0], 3))
-        gt[0, :, 2] = -1./4/np.pi
-        gt[2, :, 0] = 1./4/np.pi
-        gt[3, :, 2] = 1./4/np.pi
-        gt[5, :, 0] = -1./4/np.pi
-
-        meg = LFPy.MEG(sensor_locations)
-        np.testing.assert_equal(gt, meg.calculate_H(current_dipole_moment,
-                                                    dipole_location))
-
-    def test_MEG_02(self):
-        '''test LFPy.MEG.calculate_H()'''
-        current_dipole_moment = np.zeros((11, 3))
-        current_dipole_moment[:, 2] += 1.
-        dipole_location = np.zeros(3)
-        sensor_locations = np.r_[np.eye(3), -np.eye(3)]
-
-        # ground truth
-        gt = np.zeros((sensor_locations.shape[0],
-                       current_dipole_moment.shape[0], 3))
-        gt[0, :, 1] = 1./4/np.pi
-        gt[1, :, 0] = -1./4/np.pi
-        gt[3, :, 1] = -1./4/np.pi
-        gt[4, :, 0] = 1./4/np.pi
-
-        meg = LFPy.MEG(sensor_locations)
-        np.testing.assert_equal(gt, meg.calculate_H(current_dipole_moment,
-                                                    dipole_location))
-
-    def test_MEG_03(self):
-        '''test LFPy.MEG.calculate_H()'''
-        current_dipole_moment = np.zeros((1, 3))
-        current_dipole_moment[:, 0] += 1.
-        dipole_location = np.zeros(3)
-        sensor_locations = np.r_[np.eye(3), -np.eye(3)]
-
-        gt = np.zeros((sensor_locations.shape[0],
-                       current_dipole_moment.shape[0], 3))
-        gt[1, :, 2] = 1./4/np.pi
-        gt[2, :, 1] = -1./4/np.pi
-        gt[4, :, 2] = -1./4/np.pi
-        gt[5, :, 1] = 1./4/np.pi
-
-        meg = LFPy.MEG(sensor_locations)
-        np.testing.assert_equal(gt, meg.calculate_H(current_dipole_moment,
-                                                    dipole_location))
-
-    def test_MEG_04(self):
-        '''test LFPy.MEG.calculate_H()'''
-        current_dipole_moment = np.zeros((1, 3))
-        current_dipole_moment[:, 1] += 1.
-        dipole_location = np.zeros(3)
-        sensor_locations = np.r_[np.eye(3), -np.eye(3)]
-
-        gt = np.zeros((sensor_locations.shape[0],
-                       current_dipole_moment.shape[0], 3))
-        gt[0, :, 2] = -1./4/np.pi
-        gt[2, :, 0] = 1./4/np.pi
-        gt[3, :, 2] = 1./4/np.pi
-        gt[5, :, 0] = -1./4/np.pi
-
-        meg = LFPy.MEG(sensor_locations)
-        np.testing.assert_equal(gt, meg.calculate_H(current_dipole_moment,
-                                                    dipole_location))
-
-    def test_MEG_05(self):
-        '''test LFPy.MEG.calculate_H()'''
-        current_dipole_moment = np.zeros((1, 3))
-        current_dipole_moment[:, 2] += 1.
-        dipole_location = np.zeros(3)
-        sensor_locations = np.r_[np.eye(3), -np.eye(3)]
-
-        gt = np.zeros((sensor_locations.shape[0],
-                       current_dipole_moment.shape[0], 3))
-        gt[0, :, 1] = 1./4/np.pi
-        gt[1, :, 0] = -1./4/np.pi
-        gt[3, :, 1] = -1./4/np.pi
-        gt[4, :, 0] = 1./4/np.pi
-
-        meg = LFPy.MEG(sensor_locations)
-        np.testing.assert_equal(gt, meg.calculate_H(current_dipole_moment,
-                                                    dipole_location))
-
-
-class testFourSphereVolumeConductor(unittest.TestCase):
-    """
-    test class LFPy.FourSphereVolumeConductor
-    """
-
-    def test_rz_params(self):
-        radii = [1., 2., 4., 8.]
-        sigmas = [1., 2., 4., 8.]
-        r_el = np.array([[1., 0., 7.]])
-        fs = LFPy.FourSphereVolumeConductor(radii, sigmas, r_el)
-
-        rz1 = np.array([0., 0., 0.])
-        with np.testing.assert_raises(RuntimeError):
-            fs._rz_params(rz1)
-        rz2 = np.array([0., 0., 1.])
-        with np.testing.assert_raises(RuntimeError):
-            fs._rz_params(rz2)
-        rz3 = np.array([0., 0., 1.2])
-        with np.testing.assert_raises(RuntimeError):
-            fs._rz_params(rz3)
-
-    def test_check_params00(self):
-        '''Test that invalid radius values raises RuntimeError'''
-        radii1 = [-1., 2., 4., 8.]
-        radii2 = [1., .5, 4., 8.]
-        radii3 = [1., 2., 1.1, 8.]
-        radii4 = [1., 2., 4., 1.]
-        sigmas = [1., 2., 4., 8.]
-        rz1 = np.array([0., 0., .9])
-        r_el = np.array([[0., 0., 1.5]])
-        with np.testing.assert_raises(RuntimeError):
-            LFPy.FourSphereVolumeConductor(radii1, sigmas, r_el)
-        with np.testing.assert_raises(RuntimeError):
-            LFPy.FourSphereVolumeConductor(radii2, sigmas, r_el)
-        with np.testing.assert_raises(RuntimeError):
-            LFPy.FourSphereVolumeConductor(radii3, sigmas, r_el)
-        with np.testing.assert_raises(RuntimeError):
-            LFPy.FourSphereVolumeConductor(radii4, sigmas, r_el)
-
-    def test_check_params01(self):
-        '''Test that Error is raised if invalid entries in sigmas'''
-        radii = [1., 2., 4., 10.]
-        sigmas1 = [1., 'str', 4., 8.]
-        sigmas2 = [-1., 2., 4., 8.]
-        sigmas3 = [1., 2., -4., 8.]
-        sigmas4 = [1., 2., 4., -8.]
-        rz1 = np.array([0., 0., .9])
-        r_el = np.array([[0., 0., 1.5]])
-        with np.testing.assert_raises(ValueError):
-            LFPy.FourSphereVolumeConductor(radii, sigmas1, r_el)
-        with np.testing.assert_raises(RuntimeError):
-            LFPy.FourSphereVolumeConductor(radii, sigmas2, r_el)
-        with np.testing.assert_raises(RuntimeError):
-            LFPy.FourSphereVolumeConductor(radii, sigmas3, r_el)
-        with np.testing.assert_raises(RuntimeError):
-            LFPy.FourSphereVolumeConductor(radii, sigmas4, r_el)
-
-    def test_check_params02(self):
-        '''Test that ValueError is raised if electrode outside head'''
-        radii = [1., 2., 4., 10.]
-        sigmas = [1., 2., 4., 8.]
-        rz1 = np.array([0., 0., .9])
-        r_el1 = np.array([[0., 0., 15.]])
-        r_el2 = np.array([[0., 0., 1.5], [12., 0., 0.]])
-        with np.testing.assert_raises(ValueError):
-            LFPy.FourSphereVolumeConductor(radii, sigmas, r_el1)
-        with np.testing.assert_raises(ValueError):
-            LFPy.FourSphereVolumeConductor(radii, sigmas, r_el2)
-
-    def test_decompose_dipole01(self):
-        '''Test radial and tangential parts of dipole sums to dipole'''
-        P1 = np.array([[1., 1., 1.]])
-        p_rad, p_tan = decompose_dipole(P1)
-        np.testing.assert_equal(p_rad + p_tan, P1)
-
-    def test_decompose_dipole02(self):
-        '''Test radial and tangential parts of dipole sums to dipole'''
-        radii = [88000, 90000, 95000, 100000]
-        sigmas = [0.3, 1.5, 0.015, 0.3]
-        ps = np.array([[ 1000., 0., 0.],
-                       [-1000., 0., 0.],
-                       [0.,  1000., 0.],
-                       [0., -1000., 0.],
-                       [0., 0.,  1000.],
-                       [0., 0., -1000.],
-                       [10., 20., 30.],
-                       [-10., -20., -30.]])
-        p_locs = np.array([[ 87000., 0., 0.],
-                           [-87000., 0., 0.],
-                           [0.,  87000., 0.],
-                           [0., -87000., 0.],
-                           [0., 0.,  87000.],
-                           [0., 0., -87000.],
-                           [80000., 2000., 3000.],
-                           [-2000., -80000., -3000.]])
-        el_locs = np.array([[90000., 5000., -5000.]])
-        fs = LFPy.FourSphereVolumeConductor(radii, sigmas, el_locs)
-        for p_loc in p_locs:
-            fs._rz_params(p_loc)
-            p_rads, p_tans = fs._decompose_dipole(ps)
-            np.testing.assert_equal(p_rads + p_tans, ps)
-
-    def test_rad_dipole(self):
-        '''Test that radial part of decomposed dipole is correct'''
-        P1 = np.array([[1., 1., 1.]])
-        p_rad, p_tan = decompose_dipole(P1)
-        np.testing.assert_equal(p_rad, np.array([[0., 0., 1.]]))
-
-    def test_tan_dipole(self):
-        '''Test that tangential part of decomposed dipole is correct'''
-        P1 = np.array([[1., 1., 1.]])
-        p_rad, p_tan = decompose_dipole(P1)
-        np.testing.assert_equal(p_tan, np.array([[1., 1., 0.]]))
-
-    def test_calc_theta(self):
-        '''Test theta: angle between rz and r'''
-        rz1 = np.array([0., 0., 10.])
-        r_el = np.array([[0., 0., 90.], [0., 0., -90.],[0., 70., 0.], [0., -70., 0.], [0., 10., 10.]])
-        fs = make_class_object(rz1, r_el)
-        theta = fs.calc_theta()
-        np.testing.assert_almost_equal(theta, np.array([0., np.pi, np.pi/2, np.pi/2, np.pi/4]))
-
-    def test_calc_phi01(self):
-        '''Test phi: azimuthal angle between rx and rxy'''
-        rz1 = np.array([0., 0., 0.5])
-        r_el = np.array([[0., 1., 0], [-1., -1., 1.],
-                         [1., 1., 4.], [0., 0., 89.], [0., 0., -80.]])
-        fs = make_class_object(rz1, r_el)
-        P_tan = np.array([[0., 1., 0.], [1., 0., 0.], [0., 0., 0.]])
-        phi = fs.calc_phi(P_tan)
-        np.testing.assert_almost_equal(phi, np.array([[np.pi/2, np.pi, 0.],
-                                                      [-3*np.pi/4, -np.pi/4, 0.],
-                                                      [np.pi/4, 3*np.pi/4, 0.],
-                                                      [0., 0., 0.],
-                                                      [0., 0., 0.]]))
-
-    def test_calc_phi02(self):
-        '''Test phi: azimuthal angle between rx and rxy,
-           check that theta is not NaN, due to round-off errors'''
-        radii = [79000., 80000., 85000., 100000.]
-        sigmas = [0.3, 0.015, 15, 0.3]
-        rz = np.array([0., 0., 76500.])
-        r_el = np.array([[1e-5, 0, 99999.],
-                         [0, 0.000123, 99998.9],
-                         [-5.59822325e3, -9.69640709e3, -9.93712111e4],
-                         [99990., 0., 0.001]])
-
-        fs = LFPy.FourSphereVolumeConductor(radii, sigmas, r_el)
-        fs._rz_params(rz)
-
-        P1 = np.array([[0., 0., 123456789.],
-                       [0., 0., 0.05683939],
-                       [89892340., 0., -123456789],
-                       [0.00004, 0.002, .0987654321],
-                       [0., 0., 0.05683939],
-                       [0.0003, 0.001, 123456789.],
-                       [1e-11, 1e-12, 1000.],
-                       [1e-15, 0, 1000.]])
-        p_rad, p_tan = fs._decompose_dipole(P1)
-        phi = fs.calc_phi(p_tan)
-
-        np.testing.assert_equal(np.isnan(phi).any(), False)
-
-    def test_rad_sign(self):
-        '''Test if radial dipole points inwards or outwards'''
-        rz1 = np.array([0., 0., 70.])
-        r_el = np.array([[0., 0., 90.]])
-        fs = make_class_object(rz1, r_el)
-        P1 = np.array([[0., 0., 1.], [0., 0., -2.]])
-        s_vector = fs._sign_rad_dipole(P1)
-        np.testing.assert_almost_equal(s_vector, np.array([1., -1.]))
-
-    def test_calc_vn(self):
-        '''test that calc_vn gives correct values'''
-        n = 1
-        fs = make_simple_class_object()
-        v1 = fs._calc_vn(1)
-        np.testing.assert_almost_equal(v1, -4.75)
-
-    def test_calc_yn(self):
-        '''test that calc_yn gives correct values'''
-        n = 1
-        fs = make_simple_class_object()
-        y1 = fs._calc_yn(1)
-        np.testing.assert_almost_equal(y1, -2.3875)
-
-    def test_calc_zn(self):
-        '''test that calc_zn gives correct values'''
-        n = 1
-        fs = make_simple_class_object()
-        z1 = fs._calc_zn(1)
-        np.testing.assert_almost_equal(z1, -2.16574585635359)
-
-    def test_calc_potential(self):
-        '''test comparison between four-sphere model and model for
-        infinite homogeneous space
-        when sigma is constant and r4 goes to infinity'''
-        sigmas = [0.3, 0.3, 0.3+1e-16, 0.3]
-        radii = [10., 20*1e6, 30.*1e6, 40.*1e6]
-        rz = np.array([0., 0., 3.])
-        p = np.array([[0., 0., 100.], [50., 50., 0.]])
-        r_elec = np.array([[0., 0., 9.],
-                           [0., 0., 15.],
-                           [0., 0., 25.],
-                           [0., 0., 40.],
-                           [0., 9., 0.],
-                           [0., 15., 0.],
-                           [0., 25., 0.],
-                           [0., 40., 0.]])
-        four_s = LFPy.FourSphereVolumeConductor(radii, sigmas, r_elec)
-        pots_4s = four_s.calc_potential(p, rz)
-        inf_s = LFPy.InfiniteVolumeConductor(0.3)
-        pots_inf = inf_s.get_dipole_potential(p, r_elec - rz)
-
-        np.testing.assert_allclose(pots_4s, pots_inf, rtol=1e-6)
-
-    def test_calc_potential01(self):
-        '''test comparison between analytical 4S-model and FEM simulation'''
-        # load data
-        fem_sim = np.load(os.path.join(LFPy.__path__[0], 'test', 'fem_mix_dip.npz'))
-        pot_fem = fem_sim['pot_fem'] # [µV]
-        p = fem_sim['p'] # [nAµm]
-        rz = fem_sim['rz'] # [µm]
-        radii = fem_sim['radii'] # [µm]
-        sigmas = fem_sim['sigmas'] # [S/cm]
-        ele_coords = fem_sim['ele_coords'] # [µm]
-
-        fs = LFPy.FourSphereVolumeConductor(radii, sigmas, ele_coords)
-        k_mV_to_muV = 1e3
-        pot_analytical = fs.calc_potential(p, rz).reshape((len(ele_coords),)).reshape(pot_fem.shape)*k_mV_to_muV
-        global_error = np.abs(pot_analytical - pot_fem)/(np.max(np.abs(pot_fem)))
-        np.testing.assert_array_less(global_error, 0.01)
-
-    def test_calc_potential02(self):
-        '''Test radial and tangential parts of dipole sums to dipole'''
-        radii = [88000, 90000, 95000, 100000]
-        sigmas = [0.3, 1.5, 0.015, 0.3]
-
-        dips = np.array([[[ 1000., 0., 0.]],
-                         [[-1000., 0., 0.]],
-                         [[0.,  1000., 0.]],
-                         [[0., -1000., 0.]],
-                         [[0., 0.,  1000.]],
-                         [[0., 0., -1000.]]])
-
-        p_locs = np.array([[ 87000., 0., 0.],
-                           [-87000., 0., 0.],
-                           [0.,  87000., 0.],
-                           [0., -87000., 0.],
-                           [0., 0.,  87000],
-                           [0., 0., -87000]])
-
-        el_locs = np.array([[[ 99000., 0., 0.]],
-                            [[-99000., 0., 0.]],
-                            [[0.,  99000., 0.]],
-                            [[0., -99000., 0.]],
-                            [[0., 0.,  99000.]],
-                            [[0., 0., -99000.]]])
-
-
-        for i in range(len(p_locs)):
-            fs = LFPy.FourSphereVolumeConductor(radii, sigmas, el_locs[i])
-            phi = fs.calc_potential(dips[i], p_locs[i])
-            if i == 0:
-                phi0 = phi[0][0]
-            else:
-                np.testing.assert_equal(phi0, phi[0][0])
-
-
-    def test_calc_potential_from_multi_dipoles00(self):
-        """test comparison between multi-dipoles and single dipole approach"""
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend1.connect(soma(0.5), 0)
-        dend2.connect(dend1(1.0), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        radii = [300, 400, 500, 600]
-        sigmas = [0.3, 1.5, 0.015, 0.3]
-        electrode_locs = np.array([[0., 0., 290.],
-                                   [10., 90., 300.],
-                                   [-90, 50., 400.],
-                                   [110.3, -100., 500.]])
-        cell = cell_w_synapse_from_sections(morphology)
-        cell.set_pos(x=0, y=0, z=100)
-        t_point = [1,100,-1]
-
-        MD_4s = LFPy.FourSphereVolumeConductor(radii, sigmas, electrode_locs)
-        p, dipole_locs = cell.get_multi_current_dipole_moments(t_point)
-        Np, Nt, Nd = p.shape
-        Ne = electrode_locs.shape[0]
-        pot_MD = MD_4s.calc_potential_from_multi_dipoles(cell, t_point)
-
-        pot_sum = np.zeros((Ne, Nt))
-        for i in range(Np):
-            dip = p[i]
-            dip_loc = dipole_locs[i]
-            fs = LFPy.FourSphereVolumeConductor(radii, sigmas, electrode_locs)
-            pot = fs.calc_potential(dip, dip_loc)
-            pot_sum += pot
-
-        np.testing.assert_almost_equal(pot_MD, pot_sum)
-        np.testing.assert_allclose(pot_MD, pot_sum, rtol=1E-4)
-
-    def test_calc_potential_from_multi_dipoles01(self):
-        """test comparison between multi-dipoles and single dipole approach"""
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend1.connect(soma(1.0), 0)
-        dend2.connect(soma(1.0), 0)
-        dend3.connect(soma(1.0), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        radii = [300, 400, 500, 600]
-        sigmas = [0.3, 1.5, 0.015, 0.3]
-        electrode_locs = np.array([[0., 0., 290.],
-                                   [10., 90., 300.],
-                                   [-90, 50., 400.],
-                                   [110.3, -100., 500.]])
-        cell = cell_w_synapse_from_sections(morphology)
-        cell.set_pos(x=0, y=0, z=100)
-        t_point = [1,100,-1]
-
-        MD_4s = LFPy.FourSphereVolumeConductor(radii, sigmas, electrode_locs)
-        p, dipole_locs = cell.get_multi_current_dipole_moments(t_point)
-        Np, Nt, Nd = p.shape
-        Ne = electrode_locs.shape[0]
-        pot_MD = MD_4s.calc_potential_from_multi_dipoles(cell, t_point)
-
-        pot_sum = np.zeros((Ne, Nt))
-        for i in range(Np):
-            dip = p[i]
-            dip_loc = dipole_locs[i]
-            fs = LFPy.FourSphereVolumeConductor(radii, sigmas, electrode_locs)
-            pot = fs.calc_potential(dip, dip_loc)
-            pot_sum += pot
-
-        np.testing.assert_almost_equal(pot_MD, pot_sum)
-        np.testing.assert_allclose(pot_MD, pot_sum, rtol=1E-4)
-
-class testInfiniteVolumeConductor(unittest.TestCase):
-    """
-    test class InfiniteVolumeConductor
-    """
-    def test_get_dipole_potential(self):
-        sigma = 0.3
-        r = np.array([[0., 0., 1.], [0., 1., 0.]])
-        p = np.array([[0., 0., 4*np.pi*0.3], [0., 4*np.pi*0.3, 0.]])
-        inf_model = LFPy.InfiniteVolumeConductor(sigma)
-        phi = inf_model.get_dipole_potential(p, r)
-        np.testing.assert_allclose(phi, np.array([[1., 0.], [0., 1.]]))
-
-    def test_get_multi_dipole_potential00(self):
-        neuron.h('forall delete_section()')
-        soma = neuron.h.Section(name='soma')
-        dend1 = neuron.h.Section(name='dend1')
-        dend2 = neuron.h.Section(name='dend2')
-        dend3 = neuron.h.Section(name='dend3')
-        dend4 = neuron.h.Section(name='dend4')
-        dend5 = neuron.h.Section(name='dend5')
-        dend1.connect(soma(0.5), 0)
-        dend2.connect(dend1(1.0), 0)
-        dend3.connect(dend2(1.0), 0)
-        dend4.connect(dend3(1.0), 0)
-        dend5.connect(dend4(1.0), 0)
-        morphology = neuron.h.SectionList()
-        morphology.wholetree()
-        electrode_locs = np.array([[0., 0., 10000.]])
-        cell, electrode = cell_w_synapse_from_sections_w_electrode(morphology, electrode_locs)
-        sigma = 0.3
-        t_point = 0
-
-        MD_inf = LFPy.InfiniteVolumeConductor(sigma)
-        pot_MD = MD_inf.get_multi_dipole_potential(cell, electrode_locs)
-        pot_cb = electrode.LFP
-
-        np.testing.assert_almost_equal(pot_MD, pot_cb)
-        np.testing.assert_allclose(pot_MD, pot_cb, rtol=1E-4)
-
-    def test_get_multi_dipole_potential01(self):
-        morphology = os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc')
-        electrode_locs = np.array([[0., 0., 10000.]])
-        cell, electrode = cell_w_synapse_from_sections_w_electrode(morphology, electrode_locs)
-        sigma = 0.3
-        t_point = 0
-
-        MD_inf = LFPy.InfiniteVolumeConductor(sigma)
-        pot_MD = MD_inf.get_multi_dipole_potential(cell, electrode_locs)
-        pot_cb = electrode.LFP
-
-        np.testing.assert_almost_equal(pot_MD, pot_cb)
-        np.testing.assert_allclose(pot_MD, pot_cb, rtol=1E-3)
-
-    def test_get_multi_dipole_potential02(self):
-        morphology = os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc')
-        electrode_locs = np.array([[0., 0., 10000.]])
-        cell, electrode = cell_w_synapse_from_sections_w_electrode(morphology, electrode_locs)
-        sigma = 0.3
-        t_point = [10, 100, 1000]
-
-        MD_inf = LFPy.InfiniteVolumeConductor(sigma)
-        pot_MD = MD_inf.get_multi_dipole_potential(cell, electrode_locs, t_point)
-        pot_cb = electrode.LFP[:,t_point]
-
-        np.testing.assert_almost_equal(pot_MD, pot_cb)
-        np.testing.assert_allclose(pot_MD, pot_cb, rtol=1E-3)
-
-
-class testOneSphereVolumeConductor(unittest.TestCase):
-    """
-    test class OneSphereVolumeConductor
-    """
-    def test_OneSphereVolumeConductor_00(self):
-        """test case where sigma_i == sigma_o which
-        should be identical to the standard point-source potential in
-        infinite homogeneous media
-        """
-        # current magnitude
-        I = 1.
-        # conductivity
-        sigma = 0.3
-        # sphere radius
-        R = 1000
-        # source location (along x-axis)
-        rs = 800
-        # sphere coordinates of observation points
-        radius = np.r_[np.arange(0, rs), np.arange(rs+1, rs*2)]
-        theta = np.zeros(radius.shape)
-        phi = np.zeros(radius.shape)
-        r = np.array([radius, theta, phi])
-
-        # predict potential
-        sphere = LFPy.OneSphereVolumeConductor(r=r, R=R, sigma_i=sigma, sigma_o=sigma)
-        phi = sphere.calc_potential(rs=rs, I=I)
-
-        # ground truth
-        phi_gt = I / (4*np.pi*sigma*abs(radius-rs))
-
-        # test
-        np.testing.assert_almost_equal(phi, phi_gt)
-
-    def test_OneSphereVolumeConductor_01(self):
-        """test case where sigma_i == sigma_o which
-        should be identical to the standard point-source potential in
-        infinite homogeneous media
-        """
-        # current magnitude
-        I = np.ones(10)
-        # conductivity
-        sigma = 0.3
-        # sphere radius
-        R = 1000
-        # source location (along x-axis)
-        rs = 800
-        # sphere coordinates of observation points
-        radius = np.r_[np.arange(0, rs), np.arange(rs+1, rs*2)]
-        theta = np.zeros(radius.shape)
-        phi = np.zeros(radius.shape)
-        r = np.array([radius, theta, phi])
-
-        # predict potential
-        sphere = LFPy.OneSphereVolumeConductor(r=r, R=R, sigma_i=sigma, sigma_o=sigma)
-        phi = sphere.calc_potential(rs=rs, I=I)
-
-        # ground truth
-        phi_gt = I[0] / (4*np.pi*sigma*abs(radius-rs))
-
-        # test
-        np.testing.assert_almost_equal(phi, np.array([phi_gt]*I.size).T)
-
-    def test_OneSphereVolumeConductor_02(self):
-        """test case where sigma_i == sigma_o which
-        should be identical to the standard point-source potential in
-        infinite homogeneous media
-        """
-        # current magnitude
-        I = 1.
-        # conductivity
-        sigma = 0.3
-        # sphere radius
-        R = 10000
-        # cell body position
-        xs = 8000.
-        # sphere coordinates of observation points
-        radius = np.r_[np.arange(0, xs), np.arange(xs+1, xs*2)][::10]
-        theta = np.zeros(radius.shape)+np.pi/2
-        phi = np.zeros(radius.shape)
-        r = np.array([radius, theta, phi])
-        # set up cell
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'))
-        cell.set_pos(x=xs, y=0, z=0)
-        cell.set_rotation(y=np.pi/2)
-
-        # predict potential
-        sphere = LFPy.OneSphereVolumeConductor(r=r, R=R, sigma_i=sigma, sigma_o=sigma)
-        mapping = sphere.calc_mapping(cell=cell, n_max=100)
-
-        # ground truth and tests
-        for i, x in enumerate(cell.xmid):
-            dist = radius-x
-            dist[abs(dist) < cell.diam[i]] = cell.diam[i]
-            phi_gt = I / (4*np.pi*sigma*abs(dist))
-            np.testing.assert_almost_equal(mapping[:, i], phi_gt)
-
-
-######## Functions used by tests: ##############################################
-
-def make_class_object(rz, r_el):
-    '''Return class object fs'''
-    radii = [79., 80., 85., 90.]
-    sigmas = [0.3, 0.015, 15, 0.3]
-    fs = LFPy.FourSphereVolumeConductor(radii, sigmas, r_el)
-    fs._rz_params(rz)
-    return fs
-
-def make_simple_class_object():
-    '''Return class object fs'''
-    radii = [1., 2., 4., 8.]
-    sigmas = [1., 2., 4., 8.]
-    rz1 = np.array([0., 0., .9])
-    r_el = np.array([[0., 0., 1.5]])
-    fs = LFPy.FourSphereVolumeConductor(radii, sigmas, r_el)
-    fs._rz_params(rz1)
-    return fs
-
-def decompose_dipole(P1):
-    '''Return decomposed current dipole'''
-    rz1 = np.array([0., 0., 70.])
-    r_el = np.array([[0., 0., 90.]])
-    fs = make_class_object(rz1, r_el)
-    p_rad, p_tan = fs._decompose_dipole(P1)
-    return p_rad, p_tan
-
-def cell_w_synapse_from_sections(morphology):
-    '''
-    Make cell and synapse objects, set spike, simulate and return cell
-    '''
-    cellParams = {
-        'morphology': morphology,
-        'cm' : 1,
-        'Ra' : 150,
-        'v_init' : -65,
-        'passive' : True,
-        'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-        'dt' : 2**-6,
-        'tstart' : -50,
-        'tstop' : 50,
-        'delete_sections' : False
-    }
-
-    synapse_parameters = {'e': 0.,
-                      'syntype': 'ExpSyn',
-                      'tau': 5.,
-                      'weight': .001,
-                      'record_current': True,
-                      'idx': 1}
-
-    cell = LFPy.Cell(**cellParams)
-    synapse = LFPy.Synapse(cell, **synapse_parameters)
-    synapse.set_spike_times(np.array([1.]))
-    cell.simulate(rec_current_dipole_moment=True, rec_vmem=True)
-    return cell
-
-def cell_w_synapse_from_sections_w_electrode(morphology, electrode_locs):
-    '''
-    Make cell and synapse objects, set spike, simulate and return cell
-    '''
-    cellParams = {
-        'morphology': morphology,
-        'cm' : 1,
-        'Ra' : 150,
-        'v_init' : -65,
-        'passive' : True,
-        'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-        'dt' : 2**-6,
-        'tstart' : -50,
-        'tstop' : 50,
-        'delete_sections' : False
-    }
-
-    electrodeParams = {'sigma': 0.3,
-                        'x': electrode_locs[:,0],
-                        'y': electrode_locs[:,1],
-                        'z': electrode_locs[:,2],
-                        }
-    cell = LFPy.Cell(**cellParams)
-    electrode = LFPy.RecExtElectrode(cell, **electrodeParams)
-
-    synapse_parameters = {'e': 0.,
-                      'syntype': 'ExpSyn',
-                      'tau': 5.,
-                      'weight': .1,
-                      'record_current': True,
-                      'idx': cell.totnsegs-1}
-
-    synapse = LFPy.Synapse(cell, **synapse_parameters)
-    synapse.set_spike_times(np.array([1.]))
-    cell.simulate(electrode=[electrode],rec_current_dipole_moment=True, rec_vmem=True)
-    return cell, electrode
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_inputgenerators.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_inputgenerators.py
deleted file mode 100644
index fa22f5a..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_inputgenerators.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import unittest
-import numpy as np
-import scipy.stats as st
-import LFPy
-
-
-class testInputGenerators(unittest.TestCase):
-    """
-    test LFPy.inputgenerators module
-    """
-    def test_get_activation_times_from_distribution(self):
-        """test LFPy.inputgenerators.get_activation_times_from_distribution
-        """
-        n = 10
-        tstart = 0.
-        tstop = 1E4
-        distribution = st.expon
-        rvs_args = dict(loc=0, scale=100.)
-        times = LFPy.inputgenerators.get_activation_times_from_distribution(
-            n=n, tstart=tstart, tstop=tstop, rvs_args=rvs_args, maxiter=1E6
-        )
-        self.assertTrue(len(times) == n)
-        for t in times:
-            self.assertTrue((t.min() >= tstart) & (t.max() <= tstop))
-        
-        
\ No newline at end of file
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_lfpcalc.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_lfpcalc.py
deleted file mode 100644
index af9e25c..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_lfpcalc.py
+++ /dev/null
@@ -1,583 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-from __future__ import division
-import unittest
-import numpy as np
-from LFPy import lfpcalc
-
-class testLfpCalc(unittest.TestCase):
-    """
-    test class LFPy.lfpcalc
-    """
-    def test_return_dist_from_segment(self):
-        cell = DummyCell()
-        dist, clostest_point = lfpcalc.return_dist_from_segments(
-                                           cell.xstart, cell.ystart,
-                                           cell.zstart, cell.xend,
-                                           cell.yend, cell.zend, [1, 10, 0])
-        np.testing.assert_equal([10], dist)
-        np.testing.assert_equal([1, 0, 0], clostest_point.T[0])
-
-        dist, clostest_point = lfpcalc.return_dist_from_segments(
-                                           cell.xstart, cell.ystart,
-                                           cell.zstart, cell.xend,
-                                           cell.yend, cell.zend, [-1, 10, 0])
-        np.testing.assert_equal([np.sqrt(101)], dist)
-        np.testing.assert_equal([0, 0, 0], clostest_point.T[0])
-
-
-    def test_calc_lfp_pointsource(self):
-        """Test that function calc_lfp_pointsource
-        reproduces analytic formula"""
-        sigma = 0.3
-        cell = DummyCell()
-        np.testing.assert_equal(1./(4*np.pi*sigma),
-                                lfpcalc.calc_lfp_pointsource(cell,
-                                x=0.5, y=0, z=1, sigma=sigma,
-                                r_limit=cell.diam/2))
-
-    def test_calc_lfp_pointsource_moi_homogeneous(self):
-        """
-        Test that slice where all layers have same conductivity reproduces
-        in vivo results.
-        """
-        sigma_T = 0.3
-        sigma_G = 0.3
-        sigma_S = 0.3
-        h = 300
-        steps = 20
-        cell = DummyCell()
-        cell.zmid[0] = h/2
-        cell.zstart[0] = h/2
-        cell.zend[0] = h/2
-
-        in_vivo = lfpcalc.calc_lfp_pointsource(cell,
-                                x=0.5, y=0, z=1, sigma=sigma_T,
-                                r_limit=cell.diam/2)
-        in_vitro = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=0.5, y=0, z=1, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_equal(in_vivo, in_vitro)
-
-
-    def test_calc_lfp_moi_ecog(self):
-        """
-        Test that LFPy ECoG scenario gives expected analytical result
-        """
-
-        sigma_T = 0.3
-        sigma_G = 0.3
-        sigma_S = 1.5
-        h = 5000
-        steps = 20
-        cell = DummyCell()
-        cell.zmid[0] = h - 50
-        cell.zstart[0] = h - 50
-        cell.zend[0] = h - 50
-
-        cell.xmid[0] = 0
-        cell.xstart[0] = 0
-        cell.xend[0] = 0
-
-        source_scaling = (sigma_T - sigma_S) / (sigma_S + sigma_T)
-
-        z = h - 20  # Recording position z <= h, z != cell.zmid[0]
-
-        analytic = cell.imem[0] / (4 * np.pi * sigma_T) * (
-                   1 / np.abs(z - cell.zmid[0]) +  # real source
-                   source_scaling / np.abs(z - (2 * h - cell.zmid[0]))  # image source
-                   )
-
-        moi_method_lfpy = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=0., y=0, z=z, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_equal(analytic, moi_method_lfpy)
-
-
-
-    def test_calc_lfp_pointsource_moi_too_close(self):
-        """
-        Very close to point source, in vivo and in vitro have similar results,
-        e.g., the positions should be adjusted similarly.
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 2000
-        steps = 20
-        cell = DummyCell()
-        cell.zmid[0] = h/2
-        cell.zstart[0] = h/2
-        cell.zend[0] = h/2
-
-        in_vivo = lfpcalc.calc_lfp_pointsource(cell,
-                                x=0.5, y=0, z=h/2, sigma=sigma_T,
-                                r_limit=cell.diam/2)
-        in_vitro = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=0.5, y=0, z=h/2, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(in_vivo, in_vitro, 4)
-
-    def test_calc_lfp_linesource_moi_too_close(self):
-        """
-        Very close to point source, in vivo and in vitro have similar results,
-        e.g., the positions should be adjusted similarly.
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 0.3
-        h = 200
-
-        steps = 20
-        cell = DummyCell()
-        cell.zstart[0] = 0.0
-        cell.zend[0] = 0.0
-
-        in_vivo = lfpcalc.calc_lfp_linesource(cell,
-                                x=0.5, y=0, z=0, sigma=sigma_T,
-                                r_limit=cell.diam/2)
-        in_vitro = lfpcalc.calc_lfp_linesource_moi(cell,
-                                x=0.5, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(2*in_vivo, in_vitro, 4)
-
-    def test_calc_lfp_soma_as_point_moi_too_close(self):
-        """
-        Very close to point source, in vivo and in vitro have similar results,
-        e.g., the positions should be adjusted similarly.
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 2000
-        steps = 20
-        cell = DummyCell()
-        cell.zmid[0] = 0
-        cell.zstart[0] = 0
-        cell.zend[0] = 0
-
-        in_vivo = lfpcalc.calc_lfp_soma_as_point(cell,
-                                x=0.0, y=0, z=0, sigma=sigma_T,
-                                r_limit=cell.diam/2)
-        in_vitro = lfpcalc.calc_lfp_soma_as_point_moi(cell,
-                                x=0.0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(2*in_vivo, in_vitro, 4)
-
-
-    def test_calc_lfp_linesource_too_close(self):
-        """
-        Test that calc_lfp_linesource method does not give infinite potential
-        """
-        sigma_T = 0.3
-        cell = DummyCell()
-        cell.zmid[0] = 0.0
-        cell.zstart[0] = 0.0
-        cell.zend[0] = 0.0
-
-        in_vivo = lfpcalc.calc_lfp_linesource(cell,
-                                x=0.5, y=0.0, z=0, sigma=sigma_T,
-                                r_limit=cell.diam/2)[0]
-        np.testing.assert_array_less(in_vivo, 1e12)
-
-    def test_calc_lfp_pointsource_moi_doubling(self):
-        """
-        Test that slice with zero-conductivity MEA region (z<0) has twice
-        the potential as in vivo case at MEA electrode plane
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 0.3
-        h = 200
-        steps = 3
-
-        cell = DummyCell()
-        cell.zstart[0] = 50
-        cell.zmid[0] = 50
-        cell.zend[0] = 50
-
-        in_vivo = lfpcalc.calc_lfp_pointsource(cell,
-                                x=50., y=0, z=0, sigma=sigma_T,
-                                r_limit=cell.diam/2)
-        in_vitro = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=50, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(2 * in_vivo, in_vitro, decimal=9)
-
-    def test_calc_lfp_linesource_moi_doubling(self):
-        """
-        Test that slice with zero conductivity in MEA region (z<0) has twice
-        the potential as in vivo case at MEA electrode plane
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 0.3
-        h = 200
-        steps = 3
-
-        cell = DummyCell()
-        cell.zstart[0] = 50
-        cell.zmid[0] = 50
-        cell.zend[0] = 50
-
-        in_vivo = lfpcalc.calc_lfp_linesource(cell,
-                                x=50., y=0, z=0, sigma=sigma_T,
-                                r_limit=cell.diam/2)
-        in_vitro = lfpcalc.calc_lfp_linesource_moi(cell,
-                                x=50, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(2*in_vivo, in_vitro, decimal=9)
-
-    def test_calc_lfp_soma_as_point_moi_doubling(self):
-        """
-        Test that slice with zero conductivity in MEA region (z<0) has twice
-        the potential as in vivo case at MEA electrode plane
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 0.3
-        h = 200
-        steps = 3
-
-        cell = DummyCell()
-        cell.zstart[0] = 50
-        cell.zmid[0] = 50
-        cell.zend[0] = 50
-
-        in_vivo = lfpcalc.calc_lfp_soma_as_point(cell,
-                                x=50., y=0, z=0, sigma=sigma_T,
-                                r_limit=cell.diam/2)
-        in_vitro = lfpcalc.calc_lfp_soma_as_point_moi(cell,
-                                x=50, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(2*in_vivo, in_vitro, decimal=9)
-
-
-    def test_calc_lfp_pointsource_moi_saline_effect(self):
-        """
-        Test that the saline bath decreases signal as expected
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 200
-        steps = 20
-
-        cell = DummyCell()
-        cell.zstart[0] = 100
-        cell.zmid[0] = 100
-        cell.zend[0] = 100
-
-        with_saline = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        without_saline = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_T,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_array_less(with_saline, without_saline)
-
-    def test_calc_lfp_linesource_moi_saline_effect(self):
-        """
-        Test that the saline bath decreases signal as expected
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 200
-        steps = 20
-
-        cell = DummyCell()
-        cell.zstart[0] = 100
-        cell.zmid[0] = 100
-        cell.zend[0] = 100
-
-
-        with_saline = lfpcalc.calc_lfp_linesource_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        without_saline = lfpcalc.calc_lfp_linesource_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_T,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_array_less(with_saline, without_saline)
-
-    def test_calc_lfp_soma_as_point_moi_saline_effect(self):
-        """
-        Test that the saline bath decreases signal as expected
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 200
-        steps = 20
-
-        cell = DummyCell()
-        cell.zstart[0] = 100
-        cell.zmid[0] = 100
-        cell.zend[0] = 100
-
-        with_saline = lfpcalc.calc_lfp_soma_as_point_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        without_saline = lfpcalc.calc_lfp_soma_as_point_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_T,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_array_less(with_saline, without_saline)
-
-
-
-    def test_calc_lfp_pointsource_moi_20steps(self):
-        """
-        Test that the calc_lfp_pointsource_moi reproduces previously known
-        nummerical value
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 200
-        steps = 20
-
-        correct = 0.00108189
-
-        cell = DummyCell()
-        cell.zmid[0] = 110
-        cell.xmid[0] = -100
-
-        calculated = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=100, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(correct, calculated, 5)
-
-
-    def test_calc_lfp_linesource_moi_20steps(self):
-        """
-        Test that the calc_lfp_linesource_moi reproduces previously known
-        nummerical value
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 200
-        steps = 20
-
-        correct = 0.00246539
-
-        cell = DummyCell()
-        cell.zstart[0] = 0
-        cell.zend[0] = 110
-        cell.xstart[0] = -100
-        cell.xend[0] = 50
-
-        calculated = lfpcalc.calc_lfp_linesource_moi(cell,
-                                x=100, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(correct, calculated, 5)
-
-    def test_calc_lfp_soma_as_point_moi_20steps(self):
-        """
-        Test that the calc_lfp_soma_as_point_moi reproduces previously known
-        nummerical value
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 200
-        steps = 20
-
-        correct = 0.00108189
-
-        cell = DummyCell()
-        cell.zmid[0] = 110
-        cell.xmid[0] = -100
-
-        calculated = lfpcalc.calc_lfp_soma_as_point_moi(cell,
-                                x=100, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(correct, calculated, 5)
-
-
-
-    def test_calc_lfp_pointsource_moi_infinite_slice(self):
-        """
-        Test that infinitely thick slice does not affect potential.
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 1e10
-        steps = 20
-
-        cell = DummyCell()
-        cell.zstart[0] = 100
-        cell.zmid[0] = 100
-        cell.zend[0] = 100
-
-        with_saline = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=0, y=0, z=50, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        without_saline = lfpcalc.calc_lfp_pointsource_moi(cell,
-                                x=0, y=0, z=50, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_T,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(with_saline, without_saline)
-
-
-    def test_calc_lfp_linesource_moi_infinite_slice(self):
-        """
-        Test that infinitely thick slice does not affect potential.
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 1e10
-        steps = 20
-
-        cell = DummyCell()
-        cell.zstart[0] = 100
-        cell.zmid[0] = 100
-        cell.zend[0] = 100
-
-        with_saline = lfpcalc.calc_lfp_linesource_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        without_saline = lfpcalc.calc_lfp_linesource_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_T,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(with_saline, without_saline)
-
-    def test_calc_lfp_soma_as_point_moi_infinite_slice(self):
-        """
-        Test that infinitely thick slice does not affect potential.
-        """
-        sigma_T = 0.3
-        sigma_G = 0.0
-        sigma_S = 1.5
-        h = 1e10
-        steps = 20
-
-        cell = DummyCell()
-        cell.zstart[0] = 100
-        cell.zmid[0] = 100
-        cell.zend[0] = 100
-
-        with_saline = lfpcalc.calc_lfp_soma_as_point_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_S,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        without_saline = lfpcalc.calc_lfp_soma_as_point_moi(cell,
-                                x=0, y=0, z=0, sigma_T=sigma_T,
-                                sigma_G=sigma_G, sigma_S=sigma_T,
-                                r_limit=cell.diam/2, h=h, steps=steps)
-
-        np.testing.assert_almost_equal(with_saline, without_saline)
-
-
-
-    def test_calc_lfp_pointsource_anisotropic(self):
-
-        sigma = [0.6, 0.3, 0.45]
-        cell = DummyCell()
-        cell.xmid = cell.ymid = cell.zmid = np.array([1.2])
-        sigma_r = np.sqrt(sigma[1] * sigma[2] * 1.2**2
-                        + sigma[0] * sigma[2] * 1.2**2
-                        + sigma[0] * sigma[1] * 1.2**2)
-
-        phi_analytic = 1./(4*np.pi * sigma_r)
-        np.testing.assert_equal(phi_analytic,
-                                lfpcalc.calc_lfp_pointsource_anisotropic(cell,
-                                x=0, y=0, z=0, sigma=sigma,
-                                r_limit=cell.diam/2))
-
-
-    def test_deltaS_calc(self):
-        cell = DummyCell()
-        cell.yend[0] = 5
-        ds = lfpcalc._deltaS_calc(cell.xstart, cell.xend,
-                                  cell.ystart, cell.yend,
-                                  cell.zstart, cell.zend)
-        np.testing.assert_equal(ds, np.sqrt(26))
-
-
-
-class DummyCell(object):
-    """Cell like object with attributes for predicting extracellular potentials,
-    but with:
-        - 1 compartment
-        - position in (0.5,0,0)
-        - length 1
-        - diam 1
-        - current amplitude 1
-        - 1 timestep
-    """
-    def __init__(self):
-        self.imem = np.array([[1.]])
-        self.xstart = np.array([0.])
-        self.ystart = np.array([0.])
-        self.zstart = np.array([0.])
-        self.xmid = np.array([0.5])
-        self.ymid = np.array([0.])
-        self.zmid = np.array([0.])
-        self.xend = np.array([1.])
-        self.yend = np.array([0.])
-        self.zend = np.array([0.])
-        self.diam = np.array([1.])
-        self.totnsegs = len(self.xmid)
-    
-    def get_idx(self, section="soma"):
-        if section == "soma":
-            return np.array([0])
-        else:
-            return np.array([])
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_misc.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_misc.py
deleted file mode 100644
index cde574d..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_misc.py
+++ /dev/null
@@ -1,198 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import unittest
-import numpy as np
-import neuron
-
-
-class testMisc(unittest.TestCase):
-    """
-    test misc. code
-    """
-
-    def test_neuron_record_i_membrane_methods_00(self):
-        '''not a test of LFPy per se, but we're using this method for
-        calculating with the i_membrane_ attribute on each time step'''
-        # sections
-        soma = neuron.h.Section(name='soma')
-        dend = neuron.h.Section(name='dend')
-
-        # connect sections
-        dend.connect(soma, 1, 0)
-
-        # geometry
-        soma.L = 30.
-        soma.diam = 30.
-        soma.nseg = 1
-        dend.L = 500.
-        dend.diam = 2.
-        dend.nseg = 50
-
-        # biophysical parameters
-        for sec in [soma, dend]:
-            sec.Ra = 100
-            sec.cm = 1
-            sec.insert('pas')
-            for seg in sec:
-                seg.pas.g = 0.0002
-                seg.pas.e = -65.
-
-        # stimulus
-        syn = neuron.h.ExpSyn(0.5, sec=dend)
-        syn.e = 0.
-        syn.tau = 2.
-
-        # generators
-        ns = neuron.h.NetStim(0.5)
-        ns.noise = 1.
-        ns.start = 0.
-        ns.number = 1000
-        ns.interval = 10.
-        nc = neuron.h.NetCon(ns, syn)
-        nc.weight[0] = .01
-
-        # integrator
-        cvode = neuron.h.CVode()
-        cvode.use_fast_imem(1)
-
-        # record
-        i_membrane_control = []     # record currents using Vector.record method
-        i_membrane_fadvance = []    # record seg.i_membrane_ at each timestep
-        for sec in [soma, dend]:
-            for seg in sec:
-                i = neuron.h.Vector()
-                i.record(seg._ref_i_membrane_)
-                i_membrane_control.append(i)
-                i_membrane_fadvance.append([])
-
-        # Simulation control
-        neuron.h.dt =  2**-4          # simulation time resolution
-        tstop = 500.        # simulation duration
-        v_init = -65.       # membrane voltage(s) at t = 0
-
-        def initialize():
-            neuron.h.finitialize(v_init)
-            neuron.h.fcurrent()
-
-        def collect_i_membrane():
-            j = 0
-            for sec in [soma, dend]:
-                for seg in sec:
-                    i_membrane_fadvance[j].append(seg.i_membrane_)
-                    j += 1
-
-        def integrate():
-            while neuron.h.t < tstop:
-                collect_i_membrane()
-                neuron.h.fadvance()
-            collect_i_membrane() # otherwise shape mismatch
-
-        initialize()
-        integrate()
-
-        i_membrane_control = np.array(i_membrane_control)
-        i_membrane_fadvance = np.array(i_membrane_fadvance)
-
-        np.testing.assert_equal(i_membrane_control, i_membrane_fadvance)
-
-
-    def test_neuron_record_i_membrane_methods_01(self):
-        '''not a test of LFPy per se, but we're using this method for
-        calculating with the i_membrane_ attribute on each time step'''
-        # sections
-        soma = neuron.h.Section(name='soma')
-        dend = neuron.h.Section(name='dend')
-
-        # connect sections
-        dend.connect(soma, 1, 0)
-
-        # geometry
-        soma.L = 30.
-        soma.diam = 30.
-        soma.nseg = 1
-        dend.L = 500.
-        dend.diam = 2.
-        dend.nseg = 50
-
-        # biophysical parameters
-        for sec in [soma, dend]:
-            sec.Ra = 100
-            sec.cm = 1
-            sec.insert('pas')
-            for seg in sec:
-                seg.pas.g = 0.0002
-                seg.pas.e = -65.
-
-        # stimulus
-        syn = neuron.h.ExpSyn(0.5, sec=dend)
-        syn.e = 0.
-        syn.tau = 2.
-
-        # generators
-        ns = neuron.h.NetStim(0.5)
-        ns.noise = 1.
-        ns.start = 0.
-        ns.number = 1000
-        ns.interval = 10.
-        nc = neuron.h.NetCon(ns, syn)
-        nc.weight[0] = .01
-
-        # integrator
-        cvode = neuron.h.CVode()
-        cvode.use_fast_imem(1)
-
-        # record
-        i_membrane_control = []     # record currents using Vector.record method
-        i_membrane_fadvance = []    # record seg.i_membrane_ at each timestep
-        for sec in [soma, dend]:
-            for seg in sec:
-                i = neuron.h.Vector()
-                i.record(seg._ref_i_membrane_)
-                i_membrane_control.append(i)
-                i_membrane_fadvance.append([])
-
-        # Simulation control
-        neuron.h.dt = 2**-4          # simulation time resolution
-        tstop = 500.        # simulation duration
-        v_init = -65.       # membrane voltage(s) at t = 0
-
-        def initialize():
-            neuron.h.finitialize(v_init)
-            neuron.h.fcurrent()
-            neuron.h.frecord_init()
-            neuron.h.t = -100. # force simulations to start at some negative t
-
-        def collect_i_membrane():
-            j = 0
-            for sec in [soma, dend]:
-                for seg in sec:
-                    i_membrane_fadvance[j].append(seg.i_membrane_)
-                    j += 1
-
-        def integrate():
-            while neuron.h.t < tstop:
-                collect_i_membrane()
-                neuron.h.fadvance()
-            collect_i_membrane() # otherwise shape mismatch
-
-        initialize()
-        integrate()
-
-        i_membrane_control = np.array(i_membrane_control)
-        i_membrane_fadvance = np.array(i_membrane_fadvance)
-
-        np.testing.assert_equal(i_membrane_control, i_membrane_fadvance)
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_network.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_network.py
deleted file mode 100644
index 4529921..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_network.py
+++ /dev/null
@@ -1,502 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import os
-import unittest
-import numpy as np
-import LFPy
-import neuron
-import h5py
-import scipy.signal as ss
-
-class testNetworkPopulation(unittest.TestCase):
-    """
-    class LFPy.NetworkPopulation test suite
-    """
-    def test_NetworkPopulation_00(self):
-        cellParameters = dict(
-            morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks_w_lists.hoc'),
-            templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-            templatename='ball_and_stick_template',
-            templateargs=None,
-            passive=False,
-            dt=2**-3,
-            tstop=100,
-            delete_sections=False,
-        )
-
-        populationParameters = dict(
-            CWD=None,
-            CELLPATH=None,
-            Cell=LFPy.NetworkCell,
-            cell_args = cellParameters,
-            pop_args = dict(
-                radius=100,
-                loc=0.,
-                scale=20.),
-            rotation_args = dict(x=0, y=0),
-            POP_SIZE = 4,
-            name = 'ball_and_sticks',
-            OUTPUTPATH='tmp_testNetworkPopulation'
-        )
-
-        population = LFPy.NetworkPopulation(**populationParameters)
-
-        self.assertTrue(len(population.cells) == population.POP_SIZE)
-        for cell, soma_pos, gid in zip(population.cells, population.soma_pos, population.gids):
-            self.assertTrue(type(cell) is LFPy.NetworkCell)
-            self.assertTrue((cell.somapos[0] == soma_pos['x']) &
-                            (cell.somapos[1] == soma_pos['y']) &
-                            (cell.somapos[2] == soma_pos['z']))
-            self.assertEqual(cell.gid, gid)
-            self.assertTrue(np.sqrt(soma_pos['x']**2 + soma_pos['y']**2) <= 100.)
-        np.testing.assert_equal(population.gids, np.arange(4))
-
-
-        os.system('rm -r tmp_testNetworkPopulation')
-        neuron.h('forall delete_section()')
-
-
-class testNetwork(unittest.TestCase):
-    """
-    class LFPy.Network test suite
-    """
-    def test_Network_00(self):
-        cellParameters = dict(
-            morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks_w_lists.hoc'),
-            templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-            templatename='ball_and_stick_template',
-            templateargs=None,
-            passive=False,
-            dt=2**-3,
-            tstop=100,
-            delete_sections=False,
-        )
-
-        populationParameters = dict(
-            CWD=None,
-            CELLPATH=None,
-            Cell=LFPy.NetworkCell,
-            cell_args = cellParameters,
-            pop_args = dict(
-                radius=100,
-                loc=0.,
-                scale=20.),
-            rotation_args = dict(x=0, y=0),
-            POP_SIZE = 4,
-            name = 'test',
-        )
-        networkParameters = dict(
-            dt=2**-3,
-            tstart=0.,
-            tstop=100.,
-            v_init=-65.,
-            celsius=6.3,
-            OUTPUTPATH='tmp_testNetworkPopulation'
-            )
-        # set up
-        network = LFPy.Network(**networkParameters)
-        network.create_population(**populationParameters)
-        connectivity = network.get_connectivity_rand(pre='test', post='test', connprob=0.5)
-
-        # test set up
-        for population in network.populations.values():
-            self.assertTrue(len(population.cells) == population.POP_SIZE)
-            for cell, soma_pos, gid in zip(population.cells, population.soma_pos, population.gids):
-                self.assertTrue(type(cell) is LFPy.NetworkCell)
-                self.assertTrue((cell.somapos[0] == soma_pos['x']) &
-                                (cell.somapos[1] == soma_pos['y']) &
-                                (cell.somapos[2] == soma_pos['z']))
-                self.assertEqual(cell.gid, gid)
-                self.assertTrue(np.sqrt(soma_pos['x']**2 + soma_pos['y']**2) <= 100.)
-            np.testing.assert_equal(population.gids, np.arange(4))
-
-        np.testing.assert_equal(connectivity.shape, (population.POP_SIZE, population.POP_SIZE))
-        np.testing.assert_equal(connectivity.diagonal(), np.zeros(population.POP_SIZE))
-
-        # connect and run sim
-        network.connect(pre='test', post='test', connectivity=connectivity)
-        network.simulate()
-
-        # test output
-        for population in network.populations.values():
-            for cell in population.cells:
-                self.assertTrue(np.all(cell.somav == network.v_init))
-
-        network.pc.gid_clear()
-        os.system('rm -r tmp_testNetworkPopulation')
-        neuron.h('forall delete_section()')
-
-
-    def test_Network_01(self):
-        cellParameters = dict(
-            morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks_w_lists.hoc'),
-            templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-            templatename='ball_and_stick_template',
-            templateargs=None,
-            passive=False,
-            dt=2**-3,
-            tstop=100,
-            delete_sections=False,
-        )
-
-        populationParameters = dict(
-            CWD=None,
-            CELLPATH=None,
-            Cell=LFPy.NetworkCell,
-            cell_args = cellParameters,
-            pop_args = dict(
-                radius=100,
-                loc=0.,
-                scale=20.),
-            rotation_args = dict(x=0, y=0),
-            POP_SIZE = 4,
-            name = 'test',
-        )
-        networkParameters = dict(
-            dt=2**-3,
-            tstart=0.,
-            tstop=100.,
-            v_init=-65.,
-            celsius=6.3,
-            OUTPUTPATH='tmp_testNetworkPopulation'
-            )
-        # set up
-        network = LFPy.Network(**networkParameters)
-        network.create_population(**populationParameters)
-        connectivity = network.get_connectivity_rand(pre='test', post='test', connprob=0.5)
-
-        # connect and run sim
-        network.connect(pre='test', post='test', connectivity=connectivity)
-        SPIKES, LFP, P = network.simulate(rec_current_dipole_moment=True)
-
-        # test output
-        for population in network.populations.values():
-            for cell in population.cells:
-                self.assertTrue(np.all(cell.somav == network.v_init))
-
-        self.assertTrue(np.all(P['test'] == 0.))
-        self.assertTrue(P.shape[0] == cell.somav.size)
-        self.assertTrue(len(LFP) == 0)
-
-        network.pc.gid_clear()
-        os.system('rm -r tmp_testNetworkPopulation')
-        neuron.h('forall delete_section()')
-
-
-    def test_Network_02(self):
-        cellParameters = dict(
-            morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks_w_lists.hoc'),
-            templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-            templatename='ball_and_stick_template',
-            templateargs=None,
-            passive=False,
-            dt=2**-3,
-            tstop=100,
-            delete_sections=False,
-        )
-
-        populationParameters = dict(
-            CWD=None,
-            CELLPATH=None,
-            Cell=LFPy.NetworkCell,
-            cell_args = cellParameters,
-            pop_args = dict(
-                radius=100,
-                loc=0.,
-                scale=20.),
-            rotation_args = dict(x=0, y=0),
-            POP_SIZE = 4,
-            name = 'test',
-        )
-        networkParameters = dict(
-            dt=2**-3,
-            tstart=0.,
-            tstop=100.,
-            v_init=-65.,
-            celsius=6.3,
-            OUTPUTPATH='tmp_testNetworkPopulation'
-            )
-        clampParams = {
-            'idx' : 0,
-            'pptype' : 'VClamp',
-            'amp[0]' : -65,
-            'dur[0]' : 10,
-            'amp[1]' : 0,
-            'dur[1]' : 1,
-            'amp[2]' : -65,
-            'dur[2]' : 1E8,
-        }
-
-        # set up
-        network = LFPy.Network(**networkParameters)
-        network.create_population(**populationParameters)
-        connectivity = network.get_connectivity_rand(pre='test', post='test', connprob=1)
-
-        # test connectivity
-        self.assertTrue(np.all(connectivity == (np.eye(populationParameters['POP_SIZE']) == 0)))
-
-        # connect
-        network.connect(pre='test', post='test', connectivity=connectivity,
-                        multapseargs=dict(loc=1, scale=1E-9))
-
-        # create synthetic AP in cell with gid == 0
-        for population in network.populations.values():
-            for cell in population.cells:
-                if cell.gid == 0:
-                    vclamp = LFPy.StimIntElectrode(cell=cell, **clampParams)
-
-        # simulate
-        network.simulate()
-
-        # test output
-        for population in network.populations.values():
-            for cell in population.cells:
-                self.assertFalse(np.all(cell.somav == network.v_init))
-
-        network.pc.gid_clear()
-        os.system('rm -r tmp_testNetworkPopulation')
-        neuron.h('forall delete_section()')
-
-
-    def test_Network_03(self):
-        cellParameters = dict(
-            morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks_w_lists.hoc'),
-            templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-            templatename='ball_and_stick_template',
-            templateargs=None,
-            passive=False,
-            dt=2**-3,
-            tstop=100,
-            delete_sections=False,
-        )
-
-        populationParameters = dict(
-            CWD=None,
-            CELLPATH=None,
-            Cell=LFPy.NetworkCell,
-            cell_args = cellParameters,
-            pop_args = dict(
-                radius=100,
-                loc=0.,
-                scale=20.),
-            rotation_args = dict(x=0, y=0),
-            POP_SIZE = 4,
-            name = 'test',
-        )
-        networkParameters = dict(
-            dt=2**-3,
-            tstart=0.,
-            tstop=100.,
-            v_init=-65.,
-            celsius=6.3,
-            OUTPUTPATH='tmp_testNetworkPopulation'
-            )
-        electrodeParameters = dict(
-            sigma=0.3,
-            x = np.arange(10)*100,
-            y = np.arange(10)*100,
-            z = np.arange(10)*100
-        )
-        # set up
-        network = LFPy.Network(**networkParameters)
-        network.create_population(**populationParameters)
-        connectivity = network.get_connectivity_rand(pre='test', post='test', connprob=0.5)
-
-        # test set up
-        for population in network.populations.values():
-            self.assertTrue(len(population.cells) == population.POP_SIZE)
-            for cell, soma_pos, gid in zip(population.cells, population.soma_pos, population.gids):
-                self.assertTrue(type(cell) is LFPy.NetworkCell)
-                self.assertTrue((cell.somapos[0] == soma_pos['x']) &
-                                (cell.somapos[1] == soma_pos['y']) &
-                                (cell.somapos[2] == soma_pos['z']))
-                self.assertEqual(cell.gid, gid)
-                self.assertTrue(np.sqrt(soma_pos['x']**2 + soma_pos['y']**2) <= 100.)
-            np.testing.assert_equal(population.gids, np.arange(4))
-
-        np.testing.assert_equal(connectivity.shape, (population.POP_SIZE, population.POP_SIZE))
-        np.testing.assert_equal(connectivity.diagonal(), np.zeros(population.POP_SIZE))
-
-        # set up electrode
-        electrode = LFPy.RecExtElectrode(**electrodeParameters)
-
-        # connect and run sim
-        network.connect(pre='test', post='test', connectivity=connectivity)
-        network.simulate(electrode=electrode, to_file=True, to_memory=False,
-                         file_name='OUTPUT.h5')
-
-        # test output
-        for population in network.populations.values():
-            for cell in population.cells:
-                self.assertTrue(np.all(cell.somav == network.v_init))
-            
-        f = h5py.File(os.path.join(network.OUTPUTPATH, 'OUTPUT.h5'), 'r')        
-        np.testing.assert_equal(f['OUTPUT[0]'][()], np.zeros_like(f['OUTPUT[0]'][()]))
-        f.close()
-
-
-        network.pc.gid_clear()
-        os.system('rm -r tmp_testNetworkPopulation')
-        neuron.h('forall delete_section()')
-
-
-    def test_Network_04(self):
-        cellParameters = dict(
-            morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks_w_lists.hoc'),
-            templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-            templatename='ball_and_stick_template',
-            templateargs=None,
-            passive=True,
-            dt=2**-3,
-            tstop=100,
-            delete_sections=False,
-        )
-        
-        synapseParameters = dict(idx=0, syntype='Exp2Syn', weight=0.002,
-                                 tau1=0.1, tau2=0.1, e=0)
-        
-        populationParameters = dict(
-            CWD=None,
-            CELLPATH=None,
-            Cell=LFPy.NetworkCell,
-            cell_args = cellParameters,
-            pop_args = dict(
-                radius=100,
-                loc=0.,
-                scale=20.),
-            rotation_args = dict(x=0, y=0),
-            POP_SIZE = 1,
-            name = 'test',
-        )
-        networkParameters = dict(
-            dt=2**-3,
-            tstart=0.,
-            tstop=100.,
-            v_init=-70.,
-            celsius=6.3,
-            OUTPUTPATH='tmp_testNetworkPopulation'
-            )
-        # set up
-        network = LFPy.Network(**networkParameters)
-        network.create_population(**populationParameters)
-        
-        cell = network.populations['test'].cells[0]
-        
-        # create synapses
-        synlist = []
-        numsynapses = 2
-        for i in range(numsynapses):
-            synlist.append(LFPy.Synapse(cell=cell, **synapseParameters))
-            synlist[-1].set_spike_times(np.array([10+(i*10)]))
-        
-        network.simulate()
-        
-        # test that the input results in the correct amount of PSPs
-        np.testing.assert_equal(ss.argrelextrema(cell.somav, np.greater)[0].size, numsynapses)
-
-        # clean up
-        network.pc.gid_clear()
-        os.system('rm -r tmp_testNetworkPopulation')
-        neuron.h('forall delete_section()')
-
-
-    def test_Network_05(self):
-        cellParameters = dict(
-            morphology=os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks_w_lists.hoc'),
-            templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-            templatename='ball_and_stick_template',
-            templateargs=None,
-            passive=False,
-            dt=2**-3,
-            tstop=100,
-            delete_sections=False,
-        )
-
-        populationParameters = dict(
-            CWD=None,
-            CELLPATH=None,
-            Cell=LFPy.NetworkCell,
-            cell_args = cellParameters,
-            pop_args = dict(
-                radius=100,
-                loc=0.,
-                scale=20.),
-            rotation_args = dict(x=0, y=0),
-            POP_SIZE = 4,
-            name = 'test',
-        )
-        networkParameters = dict(
-            dt=2**-3,
-            tstart=0.,
-            tstop=100.,
-            v_init=-65.,
-            celsius=6.3,
-            OUTPUTPATH='tmp_testNetworkPopulation'
-            )
-        electrodeParameters = dict(
-            sigma=0.3,
-            x = np.arange(10)*100,
-            y = np.arange(10)*100,
-            z = np.arange(10)*100
-        )
-        # set up
-        network = LFPy.Network(**networkParameters)
-        network.create_population(**populationParameters)
-        connectivity = network.get_connectivity_rand(pre='test', post='test',
-                                                     connprob=0.5)
-
-        # test set up
-        for population in network.populations.values():
-            self.assertTrue(len(population.cells) == population.POP_SIZE)
-            for cell, soma_pos, gid in zip(population.cells,
-                                           population.soma_pos,
-                                           population.gids):
-                self.assertTrue(type(cell) is LFPy.NetworkCell)
-                self.assertTrue((cell.somapos[0] == soma_pos['x']) &
-                                (cell.somapos[1] == soma_pos['y']) &
-                                (cell.somapos[2] == soma_pos['z']))
-                self.assertEqual(cell.gid, gid)
-                self.assertTrue(np.sqrt(soma_pos['x']**2 + soma_pos['y']**2) <= 100.)
-            np.testing.assert_equal(population.gids, np.arange(4))
-
-        np.testing.assert_equal(connectivity.shape,
-                                (population.POP_SIZE, population.POP_SIZE))
-        np.testing.assert_equal(connectivity.diagonal(),
-                                np.zeros(population.POP_SIZE))
-
-        # set up electrode
-        electrode = LFPy.RecExtElectrode(**electrodeParameters)
-
-        # connect and run sim
-        network.connect(pre='test', post='test', connectivity=connectivity)
-        SPIKES, RESULTS, P = network.simulate(electrode=electrode, to_file=True,
-                                      to_memory=True, file_name='OUTPUT.h5')
-
-        # test output
-        for population in network.populations.values():
-            for cell in population.cells:
-                self.assertTrue(np.all(cell.somav == network.v_init))
-            
-        f = h5py.File(os.path.join(network.OUTPUTPATH, 'OUTPUT.h5'), 'r')        
-        np.testing.assert_equal(f['OUTPUT[0]'][()], RESULTS[0])
-        f.close()
-
-
-        network.pc.gid_clear()
-        os.system('rm -r tmp_testNetworkPopulation')
-        neuron.h('forall delete_section()')
-
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_networkcell.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_networkcell.py
deleted file mode 100644
index 8ed6463..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_networkcell.py
+++ /dev/null
@@ -1,1343 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import sys
-import os
-import posixpath
-import unittest
-import numpy as np
-import LFPy
-import neuron
-import pickle
-
-# for nosetests to run load the SinSyn sinusoid synapse currrent mechanism
-if "win32" in sys.platform:
-    pth = os.path.join(LFPy.__path__[0], 'test', 'nrnmech.dll')
-    pth = pth.replace(os.sep, posixpath.sep)
-    if not pth in neuron.nrn_dll_loaded:
-        neuron.h.nrn_load_dll(pth)
-        neuron.nrn_dll_loaded.append(pth)
-else:
-    neuron.load_mechanisms(os.path.join(LFPy.__path__[0], 'test'))
-
-
-class testNetworkCell(unittest.TestCase):
-    """
-
-    """
-    def test_cell_tvec_00(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : 0.,
-            'tstop' : 100.,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_01(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : 0.,
-            'tstop' : 10000.,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_02(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : 0,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_03(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : 0,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_04(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : 0,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_05(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : 0,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_06(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : -100,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_07(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_08(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        try:
-            stickSimulationTesttvec(**stickParams)
-        except AssertionError:
-            pass
-
-    def test_cell_tvec_09(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        try:
-            stickSimulationTesttvec(**stickParams)
-        except AssertionError:
-            pass
-    
-    def test_cell_set_pos_00(self):
-        '''test LFPy.NetworkCell.set_pos'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                         )
-        np.testing.assert_allclose(cell.somapos, [0, 0, 0])
-    
-    def test_cell_set_pos_01(self):
-        '''test LFPy.NetworkCell.set_pos'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-    
-    def test_cell_set_pos_02(self):
-        '''test LFPy.NetworkCell.set_pos'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                          pt3d=True)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-    
-    def test_cell_set_pos_03(self):
-        '''test LFPy.NetworkCell.set_pos'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                         )
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-    
-    def test_cell_set_pos_04(self):
-        '''test LFPy.NetworkCell.set_pos'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc'),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-    
-    
-    def test_cell_set_pos_05(self):
-        '''test LFPy.NetworkCell.set_pos'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        np.testing.assert_allclose(cell.somapos,
-                                   [cell.xmid[0], cell.ymid[0], cell.zmid[0]])
-    
-    
-    def test_cell_set_pos_06(self):
-        '''test LFPy.NetworkCell.set_pos'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-        np.testing.assert_allclose(cell.somapos,
-                                   [cell.xmid[0], cell.ymid[0], cell.zmid[0]])
-    
-    
-    def test_cell_set_rotation_00(self):
-        '''test LFPy.NetworkCell.set_rotation()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-    
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.set_rotation(x=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-    
-    
-    def test_cell_set_rotation_01(self):
-        '''test LFPy.NetworkCell.set_rotation()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-    
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.set_rotation(y=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-    
-    
-    def test_cell_set_rotation_02(self):
-        '''test LFPy.NetworkCell.set_rotation()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        # test rotation 180 deg around z-axis
-        cell.set_rotation(z=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-    
-    def test_cell_set_rotation_03(self):
-        '''test LFPy.NetworkCell.set_rotation()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-    
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.set_rotation(x=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-    
-    
-    def test_cell_set_rotation_04(self):
-        '''test LFPy.NetworkCell.set_rotation()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-    
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.set_rotation(y=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-    
-    
-    def test_cell_set_rotation_05(self):
-        '''test LFPy.NetworkCell.set_rotation()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-    
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        # test rotation 180 deg around z-axis
-        cell.set_rotation(z=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-    
-    def test_cell_set_rotation_06(self):
-        '''test LFPy.NetworkCell.set_rotation()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-    
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation: 90 deg around x-axis, 90 deg around y-axis, 90 deg around z-axis
-        cell.set_rotation(x=np.pi / 2., y=np.pi, z=np.pi / 4.)
-        # revert rotation: -90 deg around x-axis, -90 deg around y-axis, -90 deg around z-axis, rotation_order='zyx'
-        cell.set_rotation(x=-np.pi / 2., y=-np.pi, z=-np.pi / 4., rotation_order='zyx')
-        # assert that x-, y- and z-coordinates are same as beginning, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-    
-    def test_cell_chiral_morphology_00(self):
-        '''test LFPy.NetworkCell.chiral_morphology()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                         )
-    
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.chiral_morphology(axis='x')
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-    
-    
-    def test_cell_chiral_morphology_01(self):
-        '''test LFPy.NetworkCell.chiral_morphology()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-    
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.chiral_morphology(axis='y')
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-    
-    def test_cell_chiral_morphology_02(self):
-        '''test LFPy.NetworkCell.chiral_morphology()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-    
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around z-axis
-        cell.chiral_morphology(axis='z')
-        # assert that y- and z-coordinates are inverted, using absolute
-    
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-    
-    
-    def test_cell_get_rand_prob_area_norm_00(self):
-        '''test LFPy.NetworkCell.get_rand_prob_area_norm()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        p = cell.get_rand_prob_area_norm()
-        self.assertAlmostEqual(p.sum(), 1.)
-        self.assertTrue(p.min() >= 0.)
-        self.assertTrue(p.max() <= 1.)
-    
-    
-    def test_cell_get_rand_prob_area_norm_from_idx(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        p = cell.get_rand_prob_area_norm_from_idx(idx=cell.get_idx(section='allsec'))
-        self.assertListEqual(cell.get_rand_prob_area_norm().tolist(), p.tolist())
-    
-    
-    def test_cell_get_rand_prob_area_norm_from_idx_00(self):
-        '''test LFPy.NetworkCell.get_rand_prob_area_norm()'''
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        p = cell.get_rand_prob_area_norm_from_idx(idx=np.array([0]))
-        np.testing.assert_equal(p, np.array([1.]))
-    
-    
-    def test_cell_get_intersegment_vector_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        idx0 = 0
-        idx1 = 1
-        vector = cell.get_intersegment_vector(idx0=idx0, idx1=idx1)
-    
-        self.assertListEqual(vector,
-                            [cell.xmid[idx1] - cell.xmid[idx0],
-                             cell.ymid[idx1] - cell.ymid[idx0],
-                             cell.zmid[idx1] - cell.zmid[idx0]])
-    
-    
-    def test_cell_get_intersegment_distance_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        idx0 = 0
-        idx1 = 1
-        distance = cell.get_intersegment_distance(idx0=idx0, idx1=idx1)
-        vector = cell.get_intersegment_vector(idx0=idx0, idx1=idx1)
-    
-        self.assertEqual(np.sqrt(np.array(vector)**2).sum(), distance)
-    
-    
-    def test_cell_get_idx_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        nsegs_method=None)
-        self.assertListEqual(cell.get_idx(section='soma').tolist(), [0])
-        self.assertListEqual(cell.get_idx(section='soma[0]').tolist(), [0])
-        self.assertListEqual(cell.get_idx(section='dend[0]').tolist(), [1])
-        self.assertListEqual(cell.get_idx(section='dend[1]').tolist(), [2])
-        self.assertListEqual(cell.get_idx(section='dend[2]').tolist(), [3])
-        self.assertListEqual(cell.get_idx(section='dend').tolist(), [1, 2, 3])
-        self.assertListEqual(cell.get_idx(section='allsec').tolist(),
-                             [0, 1, 2, 3])
-        self.assertListEqual(cell.get_idx(section=['soma', 'dend']).tolist(),
-                             [0, 1, 2, 3])
-        self.assertListEqual(cell.get_idx(section='apic').tolist(), [])
-    
-    
-    def test_cell_get_closest_idx_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        nsegs_method=None)
-        self.assertEqual(cell.get_closest_idx(x=0, y=0, z=0),
-                             cell.get_idx(section='soma')[0])
-    
-        self.assertEqual(cell.get_closest_idx(x=-25, y=0, z=175),
-                             cell.get_idx(section='dend[1]')[0])
-    
-    
-    def test_cell_get_idx_children_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-    
-        np.testing.assert_array_equal(cell.get_idx_children(parent='soma[0]'),
-                                      cell.get_idx(section='dend[0]'))
-    
-    
-    def test_cell_get_idx_parent_children_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        np.testing.assert_array_equal(cell.get_idx_parent_children(parent='soma[0]'),
-                                      cell.get_idx(section=['soma[0]',
-                                                            'dend[0]']))
-    
-    
-    def test_cell_get_idx_name_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        np.testing.assert_array_equal(cell.get_idx_name(idx=np.array([0])),
-                                                np.array([[0, 'ball_and_stick_template[0].soma[0]', 0.5]],
-                                                         dtype=object))
-    
-    
-    def test_cell_get_rand_idx_area_norm_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        idx = cell.get_rand_idx_area_norm(nidx=1000000)
-    
-    
-        # compute histogram and correlate with segment area
-        bins = np.arange(cell.totnsegs+1)
-        hist, bin_edges = np.histogram(idx, bins=bins)
-    
-        # compute Pearson correlation coefficients between area and histogram
-        # reporting success if within 4 decimal places
-        self.assertAlmostEqual(np.corrcoef(cell.area, hist)[0, 1], 1., places=4)
-    
-        # check if min and max is in the range of segment indices
-        self.assertEqual(idx.min(), 0)
-        self.assertEqual(idx.max(), cell.totnsegs-1)
-    
-    
-    def test_cell_set_synapse_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.set_synapse(idx=0, syntype='ExpSyn', record_curret=False,
-                         record_potential=False, weight=1.,
-                         **dict(e=10., tau=2.))
-    
-        self.assertTrue('ExpSyn' in cell.synlist[0].hname())
-        self.assertEqual(len(cell.synlist), 1)
-        self.assertEqual(len(cell.netconlist), 1)
-        self.assertEqual(len(cell.netstimlist), 1)
-        self.assertEqual(cell.synlist[0].e, 10.)
-        self.assertEqual(cell.synlist[0].tau, 2.)
-        self.assertEqual(cell.netconlist[0].weight[0], 1.)
-    
-    
-    def test_cell_set_point_process_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.set_point_process(idx=0, pptype='IClamp', record_current=False,
-                               **dict(delay=1., amp=1.))
-        self.assertEqual(cell.stimlist[0].hname(), 'IClamp[0]')
-        self.assertEqual(len(cell.stimlist), 1)
-        self.assertEqual(cell.stimlist[0].delay, 1.)
-        self.assertEqual(cell.stimlist[0].amp, 1.)
-    
-    
-    def test_cell_strip_hoc_objects_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.strip_hoc_objects()
-        for attribute in dir(cell):
-            self.assertNotEqual(str(type(getattr(cell, attribute))),
-                                'hoc.HocObject')
-    
-    def test_cell_cellpickler_00(self):
-        cell = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell_pickle = cell.cellpickler(filename=None, pickler=pickle.dumps)
-        pickled_cell = pickle.loads(cell_pickle)
-    
-        for attribute in dir(cell):
-            if attribute.startswith('__') or attribute.startswith('_'):
-                pass
-            else:
-                self.assertEqual(type(getattr(cell, attribute)),
-                                 type(getattr(pickled_cell, attribute)))
-    
-    def test_cell_simulate_recorder_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stick = LFPy.NetworkCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-        
-
-    def test_cell_simulate_recorder_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.NetworkCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.NetworkCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_03(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stick = LFPy.NetworkCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-        
-
-    def test_cell_simulate_recorder_04(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.NetworkCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_05(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.NetworkCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-        
-    def test_cell_simulate_current_dipole_moment_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-    
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.NetworkCell(**stickParams)
-                synapse = LFPy.StimIntElectrode(stick, idx=idx,
-                                       **stimParams)
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-    
-    
-    def test_cell_simulate_current_dipole_moment_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-    
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-    
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.NetworkCell(**stickParams)
-                synapse = LFPy.StimIntElectrode(stick, idx=idx,
-                                       **stimParams)
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-    
-    def test_cell_simulate_current_dipole_moment_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-    
-        stimParams = {
-            'e' : 0,                                # reversal potential
-            'syntype' : 'Exp2Syn',                   # synapse type
-            'tau1' : 0.1,                              # syn. time constant
-            'tau2' : 2.,                              # syn. time constant
-            'weight' : 0.01,
-        }
-    
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.NetworkCell(**stickParams)
-                synapse = LFPy.Synapse(stick, idx=idx,
-                                       **stimParams)
-                synapse.set_spike_times(np.array([10., 20., 30., 40., 50.]))
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-    
-    def test_cell_tstart_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-    
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'bias' : 0.,
-            'record_current' : False
-        }
-    
-        stick0 = LFPy.NetworkCell(tstart=0, tstop=200, **stickParams)
-        synapse0 = LFPy.StimIntElectrode(stick0,
-                                         stick0.get_closest_idx(0, 0, 1000),
-                                         delay=0, phase=0.,
-                                         **stimParams)
-        stick0.simulate(rec_imem=True, rec_vmem=True, rec_current_dipole_moment=True)
-    
-    
-        stick1 = LFPy.NetworkCell(tstart=-100, tstop=100, **stickParams)
-        synapse1 = LFPy.StimIntElectrode(stick1,
-                                         stick1.get_closest_idx(0, 0, 1000),
-                                         delay=-100, phase=0.,
-                                         **stimParams)
-        stick1.simulate(rec_imem=True, rec_vmem=True, rec_current_dipole_moment=True)
-    
-        inds = stick0.tvec >= 100
-        np.testing.assert_allclose(stick0.vmem[:, inds], stick1.vmem)
-        np.testing.assert_allclose(stick0.imem[:, inds], stick1.imem)
-        np.testing.assert_allclose(stick0.current_dipole_moment[inds, :],
-                                   stick1.current_dipole_moment)
-    
-    
-    def test_cell_with_recextelectrode_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-    
-        }
-    
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-    
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-    
-        stick = LFPy.NetworkCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-    
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-    
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-    
-    
-    def test_cell_with_recextelectrode_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-    
-        }
-    
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-    
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-    
-        stick = LFPy.NetworkCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-    
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-    
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_cell_with_recextelectrode_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-    
-        }
-    
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-    
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-    
-        stick = LFPy.NetworkCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-    
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-    
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_cell_with_recextelectrode_03(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-    
-        }
-    
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-    
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-    
-        stick = LFPy.NetworkCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-    
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-    
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_cell_distort_geometry_01(self):
-        cell0 = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        factors = [-0.2, 0.1, 0., 0.1, 0.2]
-        nus = [-0.5, 0., 0.5]
-        for factor in factors:
-            for nu in nus:
-                for axis in 'xyz':
-                    cell1 = LFPy.NetworkCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-                    cell1.distort_geometry(factor=factor, nu=nu, axis=axis)
-                    for attr in ['start', 'mid', 'end']:
-                        for ax in 'xyz'.replace(axis, ''):
-                            np.testing.assert_allclose(getattr(cell0, ax+attr)*(1+factor*nu),
-                                                       getattr(cell1, ax+attr))
-                        np.testing.assert_allclose(getattr(cell0, axis+attr)*(1-factor),
-                                                   getattr(cell1, axis+attr))
-
-def stickSimulationTesttvec(**kwargs):
-    stick = LFPy.NetworkCell(morphology = os.path.join(LFPy.__path__[0], 'test',
-                                                'stick.hoc'), verbose=False,
-                              templatefile=os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-                              templatename='stick_template',
-                              templateargs=None,
-                              **kwargs)
-    stick.simulate(rec_imem=False)
-    return stick.tvec
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_pointprocess.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_pointprocess.py
deleted file mode 100644
index e17b0eb..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_pointprocess.py
+++ /dev/null
@@ -1,347 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import sys
-import os
-import posixpath
-import unittest
-import numpy as np
-import LFPy
-import neuron
-
-# for nosetests to run load mechanisms
-if "win32" in sys.platform:
-    pth = os.path.join(LFPy.__path__[0], 'test', 'nrnmech.dll')
-    pth = pth.replace(os.sep, posixpath.sep)
-    if not pth in neuron.nrn_dll_loaded:
-        neuron.h.nrn_load_dll(pth)
-        neuron.nrn_dll_loaded.append(pth)
-else:
-    neuron.load_mechanisms(os.path.join(LFPy.__path__[0], 'test'))
-
-class testPointProcess(unittest.TestCase):
-    """
-    test class LFPy.PointProcess
-    """
-    def test_PointProcess_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        pp = LFPy.PointProcess(cell=cell, idx=0)
-        self.assertTrue(np.alltrue(np.array([pp.x, pp.y, pp.z])==cell.somapos))
-        self.assertEqual(pp.idx, 0)
-    
-
-class testSynapse(unittest.TestCase):
-    """
-    test class LFPy.Synapse
-    """
-    def test_Synapse_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        syn = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=5., record_current=True,
-                           record_potential=True)
-        syn.set_spike_times(np.array([10.]))
-        cell.simulate()
-        
-        i = np.zeros(cell.tvec.size)
-        i[cell.tvec > 10.] = -np.exp(-np.arange((cell.tvec > 10.).sum())*cell.dt / 5.)
-
-        np.testing.assert_allclose(i, syn.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn.v)
-        
-
-    def test_Synapse_01(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        syn0 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=5., record_current=True,
-                           record_potential=True)
-        syn0.set_spike_times(np.array([10.]))
-
-        syn1 = LFPy.Synapse(cell=cell, idx=1, syntype='ExpSynI',
-                           weight=1., tau=5., record_current=True,
-                           record_potential=False)
-        syn1.set_spike_times(np.array([20.]))
-
-        syn2 = LFPy.Synapse(cell=cell, idx=2, syntype='ExpSynI',
-                           weight=1., tau=5., record_current=False,
-                           record_potential=True)
-        syn2.set_spike_times(np.array([30.]))
-
-        syn3 = LFPy.Synapse(cell=cell, idx=3, syntype='ExpSynI',
-                           weight=1., tau=5., record_current=False,
-                           record_potential=False)
-        syn3.set_spike_times(np.array([40.]))
-
-        cell.simulate()
-        
-        i = np.zeros(cell.tvec.size)
-        i[cell.tvec > 10.] = -np.exp(-np.arange((cell.tvec > 10.).sum())*cell.dt / 5.)
-
-        np.testing.assert_allclose(i, syn0.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn0.v)
-
-        self.assertTrue(hasattr(syn1, 'i'))
-        i = np.zeros(cell.tvec.size)
-        i[cell.tvec > 20.] = -np.exp(-np.arange((cell.tvec > 20.).sum())*cell.dt / 5.)
-        self.assertFalse(hasattr(syn1, 'v'))
-        np.testing.assert_allclose(i, syn1.i, rtol=1E-1)
-        
-        self.assertFalse(hasattr(syn2, 'i'))
-        self.assertTrue(hasattr(syn2, 'v'))
-        
-        self.assertFalse(hasattr(syn3, 'i'))
-        self.assertFalse(hasattr(syn3, 'v'))
-
-
-    def test_Synapse_02(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        t0 = 10.
-        t1 = 30.
-        tau = 5.
-        syn0 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-        syn0.set_spike_times_w_netstim(noise=0., start=t0-1, number=1) # -1 to acct for delay
-
-        syn1 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-        syn1.set_spike_times(np.array([t1]))
-
-        cell.simulate()
-        
-        i0 = np.zeros(cell.tvec.size)
-        i0[cell.tvec > t0] = -np.exp(-np.arange((cell.tvec > t0).sum())*cell.dt / tau)
-
-        i1 = np.zeros(cell.tvec.size)
-        i1[cell.tvec > t1] = -np.exp(-np.arange((cell.tvec > t1).sum())*cell.dt / tau)
-
-        np.testing.assert_allclose(i0, syn0.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn0.v)
-
-        np.testing.assert_allclose(i1, syn1.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn1.v)
-
-
-    def test_Synapse_03(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        t0 = 10.
-        t1 = 30.
-        tau = 5.
-        syn0 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-        syn0.set_spike_times_w_netstim(noise=0., start=t0-1, number=1) # -1 to acct for delay
-
-        syn1 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-        syn1.set_spike_times_w_netstim(noise=0., start=t1-1, number=1) # -1 to acct for delay
-
-        cell.simulate()
-        
-        i0 = np.zeros(cell.tvec.size)
-        i0[cell.tvec > t0] = -np.exp(-np.arange((cell.tvec > t0).sum())*cell.dt / tau)
-
-        i1 = np.zeros(cell.tvec.size)
-        i1[cell.tvec > t1] = -np.exp(-np.arange((cell.tvec > t1).sum())*cell.dt / tau)
-
-        np.testing.assert_allclose(i0, syn0.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn0.v)
-
-        np.testing.assert_allclose(i1, syn1.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn1.v)
-
-
-    def test_Synapse_04(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        t0 = 10.
-        t1 = 30.
-        tau = 5.
-        syn0 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-
-        syn1 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-
-        syn0.set_spike_times_w_netstim(noise=0., start=t0-1, number=1) # -1 to acct for delay
-        syn1.set_spike_times(np.array([t1]))
-
-        cell.simulate()
-        
-        i0 = np.zeros(cell.tvec.size)
-        i0[cell.tvec > t0] = -np.exp(-np.arange((cell.tvec > t0).sum())*cell.dt / tau)
-
-        i1 = np.zeros(cell.tvec.size)
-        i1[cell.tvec > t1] = -np.exp(-np.arange((cell.tvec > t1).sum())*cell.dt / tau)
-
-        np.testing.assert_allclose(i0, syn0.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn0.v)
-
-        np.testing.assert_allclose(i1, syn1.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn1.v)
-        
-        
-    def test_Synapse_05(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        t0 = 10.
-        t1 = 30.
-        tau = 5.
-        syn0 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-
-        syn1 = LFPy.Synapse(cell=cell, idx=0, syntype='ExpSynI',
-                           weight=1., tau=tau, record_current=True,
-                           record_potential=True)
-
-        syn1.set_spike_times(np.array([t1]))
-        syn0.set_spike_times_w_netstim(noise=0., start=t0-1, number=1) # -1 to acct for delay
-
-        cell.simulate()
-        
-        i0 = np.zeros(cell.tvec.size)
-        i0[cell.tvec > t0] = -np.exp(-np.arange((cell.tvec > t0).sum())*cell.dt / tau)
-
-        i1 = np.zeros(cell.tvec.size)
-        i1[cell.tvec > t1] = -np.exp(-np.arange((cell.tvec > t1).sum())*cell.dt / tau)
-
-        np.testing.assert_allclose(i0, syn0.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn0.v)
-
-        np.testing.assert_allclose(i1, syn1.i, rtol=1E-1)
-        np.testing.assert_equal(cell.somav, syn1.v)
-
-
-class testStimIntElectrode(unittest.TestCase):
-    """
-    test class LFPy.StimIntElectrode
-    """
-    def test_StimIntElectrode_00(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        stim = LFPy.StimIntElectrode(cell=cell, idx=0, pptype='IClamp',
-                            amp=1., dur=20., delay=10.,
-                            record_potential=True,
-                            record_current=True)
-        cell.simulate()
-        gt = np.zeros(cell.tvec.size)
-        gt[(cell.tvec > 10.) & (cell.tvec <= 30.)] = 1.
-        np.testing.assert_equal(gt, stim.i)
-        np.testing.assert_equal(cell.somav, stim.v)
-
-    def test_StimIntElectrode_01(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'), dt=1.,
-                         v_init=-65.,
-                         Ra = 150.,
-                         cm = 1.,
-                         passive=True,
-                         passive_parameters=dict(g_pas=1./30000, e_pas=-65)
-                         )
-        stim = LFPy.StimIntElectrode(cell=cell,
-                                     record_potential=True,
-                                     **{'idx' : 0,
-                                        'pptype' : 'VClamp',
-                                        'amp[0]' : -65,
-                                        'dur[0]' : 10,
-                                        'amp[1]' : -55.,
-                                        'dur[1]' : 20,
-                                        'amp[2]' : -65,
-                                        'dur[2]' : 10,
-                                   })
-        cell.simulate()
-        gt = np.zeros(cell.tvec.size)-65.
-        gt[(cell.tvec > 10.) & (cell.tvec <= 30.)] = -55.
-        np.testing.assert_allclose(gt, cell.somav, rtol=1E-3)
-        np.testing.assert_equal(cell.somav, stim.v)
-
-    def test_StimIntElectrode_02(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'), dt=1.,
-                         v_init=-65.,
-                         Ra = 150.,
-                         cm = 1.,
-                         passive=True,
-                         passive_parameters=dict(g_pas=1./30000, e_pas=-65)
-                         )
-        stim = LFPy.StimIntElectrode(cell=cell,
-                                     record_potential=True,
-                                     **{'idx' : 0,
-                                        'pptype' : 'SEClamp',
-                                        'amp1' : -65,
-                                        'dur1' : 10,
-                                        'amp2' : -55.,
-                                        'dur2' : 20,
-                                        'amp3' : -65,
-                                        'dur3' : 10,
-                                   })
-        cell.simulate()
-        gt = np.zeros(cell.tvec.size)-65.
-        gt[(cell.tvec > 10.) & (cell.tvec <= 30.)] = -55.
-        np.testing.assert_allclose(gt, cell.somav, rtol=1E-2)
-        np.testing.assert_equal(cell.somav, stim.v)
-
-
-    def test_StimIntElectrode_03(self):
-        cell = LFPy.Cell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks.hoc'))
-        stim0 = LFPy.StimIntElectrode(cell=cell, idx=0, pptype='IClamp',
-                            amp=1., dur=20., delay=10.,
-                            record_potential=True,
-                            record_current=True)
-
-        stim1 = LFPy.StimIntElectrode(cell=cell, idx=1, pptype='IClamp',
-                            amp=1., dur=20., delay=30.,
-                            record_potential=True,
-                            record_current=False)
-
-        stim2 = LFPy.StimIntElectrode(cell=cell, idx=2, pptype='IClamp',
-                            amp=1., dur=20., delay=50.,
-                            record_potential=False,
-                            record_current=True)
-
-        stim3 = LFPy.StimIntElectrode(cell=cell, idx=3, pptype='IClamp',
-                            amp=1., dur=20., delay=70.,
-                            record_potential=False,
-                            record_current=False)
-
-
-        cell.simulate()
-        gt = np.zeros(cell.tvec.size)
-        gt[(cell.tvec > 10.) & (cell.tvec <= 30.)] = 1.
-        np.testing.assert_equal(gt, stim0.i)
-        np.testing.assert_equal(cell.somav, stim0.v)
-        
-        self.assertTrue(hasattr(stim1, 'v'))
-        self.assertTrue(cell.tvec.shape == stim1.v.shape)
-        self.assertFalse(hasattr(stim2, 'v'))
-        self.assertFalse(hasattr(stim3, 'v'))
-        self.assertFalse(hasattr(stim1, 'i'))
-        self.assertTrue(hasattr(stim2, 'i'))
-        self.assertTrue(cell.tvec.shape == stim2.i.shape)        
-        self.assertFalse(hasattr(stim3, 'i'))
-        
-  
-    
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_recextelectrode.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_recextelectrode.py
deleted file mode 100644
index b48cdff..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_recextelectrode.py
+++ /dev/null
@@ -1,599 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import sys
-import os
-import posixpath
-import unittest
-import numpy as np
-import LFPy
-import neuron
-from .common import *
-
-# for nosetests to run load the SinSyn sinusoid synapse currrent mechanism
-if "win32" in sys.platform:
-    pth = os.path.join(LFPy.__path__[0], 'test', 'nrnmech.dll')
-    pth = pth.replace(os.sep, posixpath.sep)
-    if not pth in neuron.nrn_dll_loaded:
-        neuron.h.nrn_load_dll(pth)
-        neuron.nrn_dll_loaded.append(pth)
-else:
-    neuron.load_mechanisms(os.path.join(LFPy.__path__[0], 'test'))
-
-class testRecExtElectrode(unittest.TestCase):
-    """
-    test class LFPy.RecExtElectrode
-    """
-
-    def test_method_pointsource(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulation(method='pointsource')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-    
-    def test_method_linesource(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulation(method='linesource')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    
-    def test_method_soma_as_point(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulation(method='soma_as_point')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    
-    
-    def test_method_pointsource_dotprodcoeffs(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulationDotprodcoeffs(method='pointsource')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    
-    def test_method_linesource_dotprodcoeffs(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulationDotprodcoeffs(method='linesource')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    
-    def test_method_soma_as_point_dotprodcoeffs(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulationDotprodcoeffs(method='soma_as_point')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    
-    def test_method_pointsource_contact_average_r10n100(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulationAveragingElectrode(
-            contactRadius=10, contactNPoints=100, method='soma_as_point')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    
-    def test_method_linesource_contact_average_r10n100(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulationAveragingElectrode(
-            contactRadius=10, contactNPoints=100, method='linesource')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    
-    def test_method_soma_as_point_contact_average_r10n100(self):
-        #create LFPs using LFPy-model
-        LFP_LFPy = stickSimulationAveragingElectrode(
-            contactRadius=10, contactNPoints=100, method='soma_as_point')
-    
-        #create LFPs using the analytical approach
-        time = np.linspace(0, 100, 100*2**6+1)
-        R = np.ones(11)*100
-        Z = np.linspace(1000, 0, 11)
-    
-        LFP_analytic = np.empty((R.size, time.size))
-        for i in range(R.size):
-            LFP_analytic[i, ] = analytical_LFP(time, electrodeR=R[i],
-                                                    electrodeZ=Z[i])
-        np.testing.assert_allclose(LFP_analytic, LFP_LFPy, rtol=0,
-                                   atol=abs(LFP_analytic).max() / 10.)
-
-    def test_sigma_inputs(self):
-
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : 0,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 1000,
-
-        }
-        stick = LFPy.Cell(**stickParams)
-
-        electrodeParams = {
-            'sigma' : [0.3, 0.3, 0.3, 0.3],
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-        }
-
-        np.testing.assert_raises(ValueError, LFPy.RecExtElectrode, **electrodeParams)
-
-    def test_bad_cell_position_in_slice(self):
-
-        electrodeParams = {
-            'sigma_T' : 0.3,
-            'sigma_S' : 1.5,
-            'sigma_G' : 0.0,
-            'h': 200,
-            'x' : np.linspace(0, 1000, 11),
-            'y' : np.zeros(11),
-            'z' : np.zeros(11),
-            'method': "pointsource",
-        }
-
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : -10,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 1000,
-
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.set_rotation(y=np.pi/2)
-        stick.simulate(rec_imem=True)
-
-        stick.set_pos(z=-100)
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        np.testing.assert_raises(RuntimeError, MEA.calc_lfp)
-
-        stick.set_pos(z=300)
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        np.testing.assert_raises(RuntimeError, MEA.calc_lfp)
-
-    def test_sqeeze_cell_and_bad_position(self):
-
-        electrodeParams = {
-            'sigma_T' : 0.3,
-            'sigma_S' : 1.5,
-            'sigma_G' : 0.0,
-            'h': 200,
-            'x' : np.linspace(0, 1000, 11),
-            'y' : np.zeros(11),
-            'z' : np.zeros(11),
-            'method': "pointsource",
-            'squeeze_cell_factor': None,
-        }
-
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : -10,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 1000,
-
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.set_rotation(y=np.pi/2)
-        stick.simulate(rec_imem=True)
-
-        stick.set_pos(z=1)
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        np.testing.assert_raises(RuntimeError, MEA.test_cell_extent)
-
-        stick.set_pos(z=199)
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        np.testing.assert_raises(RuntimeError, MEA.test_cell_extent)
-
-        electrodeParams = {
-            'sigma_T' : 0.3,
-            'sigma_S' : 1.5,
-            'sigma_G' : 0.0,
-            'h': 200,
-            'x' : np.linspace(0, 1000, 11),
-            'y' : np.zeros(11),
-            'z' : np.zeros(11),
-            'method': "pointsource",
-            'squeeze_cell_factor': 0.1,
-        }
-
-        stick.set_pos(z=-1)
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        np.testing.assert_raises(RuntimeError, MEA.test_cell_extent)
-
-        stick.set_pos(z=201)
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        np.testing.assert_raises(RuntimeError, MEA.test_cell_extent)
-
-
-    def test_return_comp_outside_slice(self):
-
-        electrodeParams = {
-            'sigma_T' : 0.3,
-            'sigma_S' : 1.5,
-            'sigma_G' : 0.0,
-            'h': 200,
-            'x' : np.linspace(0, 1000, 11),
-            'y' : np.zeros(11),
-            'z' : np.zeros(11),
-            'method': "pointsource",
-            'squeeze_cell_factor': None,
-        }
-
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : -10,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 1000,
-
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.set_rotation(y=np.pi/2)
-        stick.set_pos(z=100)
-        stick.simulate(rec_imem=True)
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        np.testing.assert_raises(RuntimeError, MEA._return_comp_outside_slice)
-        true_bad_comp = np.array([2, 3, 6])
-
-        stick.zstart[true_bad_comp] = 1000
-        bad_comp, reason = MEA._return_comp_outside_slice()
-        np.testing.assert_equal(reason, "zstart above")
-        np.testing.assert_equal(true_bad_comp, bad_comp)
-        stick.zstart[true_bad_comp] = 100
-
-        stick.zstart[true_bad_comp] = -1000
-        bad_comp, reason = MEA._return_comp_outside_slice()
-        np.testing.assert_equal(reason, "zstart below")
-        np.testing.assert_equal(true_bad_comp, bad_comp)
-        stick.zstart[true_bad_comp] = 100
-
-        stick.zend[true_bad_comp] = 1000
-        bad_comp, reason = MEA._return_comp_outside_slice()
-        np.testing.assert_equal(reason, "zend above")
-        np.testing.assert_equal(true_bad_comp, bad_comp)
-        stick.zend[true_bad_comp] = 100
-
-        stick.zend[true_bad_comp] = -1000
-        bad_comp, reason = MEA._return_comp_outside_slice()
-        np.testing.assert_equal(reason, "zend below")
-        np.testing.assert_equal(true_bad_comp, bad_comp)
-        stick.zend[true_bad_comp] = 100
-
-    def test_position_shifted_slice(self):
-
-        electrodeParams = {
-            'sigma_T' : 0.3,
-            'sigma_S' : 1.5,
-            'sigma_G' : 0.0,
-            'h': 200,
-            'z_shift': -200,
-            'x' : np.linspace(0, 1000, 11),
-            'y' : np.zeros(11),
-            'z' : np.zeros(11) - 100,
-            'method': "pointsource",
-            'squeeze_cell_factor': None,
-        }
-
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : -10,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.set_rotation(y=np.pi/2)
-        stick.set_pos(z=-100)
-
-        MEA = LFPy.RecMEAElectrode(stick, **electrodeParams)
-        MEA.test_cell_extent()
-
-    def test_slice_shift_invariance_pointsource(self):
-        h = 200
-        z_shift_1 = 0
-        z_shift_2 = -352
-
-        electrodeParams_1 = {
-            'sigma_T' : 0.3,
-            'sigma_S' : 1.5,
-            'sigma_G' : 0.0,
-            'h': h,
-            'z_shift': z_shift_1,
-            'x' : np.linspace(0, 1000, 11),
-            'y' : np.zeros(11),
-            'z' : np.zeros(11) + z_shift_1,
-            'squeeze_cell_factor': None,
-        }
-
-        electrodeParams_2 = {
-            'sigma_T' : 0.3,
-            'sigma_S' : 1.5,
-            'sigma_G' : 0.0,
-            'h': h,
-            'z_shift': z_shift_2,
-            'x' : np.linspace(0, 1000, 11),
-            'y' : np.zeros(11),
-            'z' : np.zeros(11) + z_shift_2,
-            'squeeze_cell_factor': None,
-        }
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : -100.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : -np.pi/2,
-            'bias' : 0.,
-            'record_current' : True
-        }
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'ball_and_sticks.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : -10,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.Cell(**stickParams)
-        stick.set_rotation(y=np.pi/2)
-
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 0),
-                                   **stimParams)
-
-        stick.simulate(rec_imem=True)
-
-        methods = ["pointsource", "linesource", "soma_as_point"]
-
-        for method in methods:
-            electrodeParams_1["method"] = method
-            electrodeParams_2["method"] = method
-
-
-            stick.set_pos(z=z_shift_1 + h/2)
-            MEA_shift_1 = LFPy.RecMEAElectrode(stick, **electrodeParams_1)
-            MEA_shift_1.calc_lfp()
-
-            stick.set_pos(z=z_shift_2 + h/2)
-            MEA_shift_2 = LFPy.RecMEAElectrode(stick, **electrodeParams_2)
-            MEA_shift_2.calc_lfp()
-
-            np.testing.assert_allclose(MEA_shift_1.LFP,
-                                       MEA_shift_2.LFP, rtol=1E-7)
-
-    def test_isotropic_version_of_anisotropic_methods(self):
-
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : 0,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 1000,
-
-        }
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : -100.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : -np.pi/2,
-            'bias' : 0.,
-            'record_current' : True
-        }
-
-        isotropic_electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-        }
-        anisotropic_electrodeParams = isotropic_electrodeParams.copy()
-        anisotropic_electrodeParams["sigma"] = [isotropic_electrodeParams["sigma"]] * 3
-
-
-        methods = ["pointsource", "linesource", "soma_as_point"]
-
-        for method in methods:
-            isotropic_electrodeParams["method"] = method
-            anisotropic_electrodeParams["method"] = method
-
-            isotropic_electrode = LFPy.RecExtElectrode(**isotropic_electrodeParams)
-            anisotropic_electrode = LFPy.RecExtElectrode(**anisotropic_electrodeParams)
-
-            stick = LFPy.Cell(**stickParams)
-            stick.set_pos(z=-stick.zstart[0])
-
-            synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                                   **stimParams)
-            stick.simulate([isotropic_electrode, anisotropic_electrode],
-                           rec_imem=True, rec_vmem=True)
-
-            np.testing.assert_allclose(isotropic_electrode.LFP,
-                                       anisotropic_electrode.LFP, rtol=1E-7)
-
-    def test_compare_anisotropic_lfp_methods(self):
-
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'passive': True,
-            'tstart' : 0,
-            'tstop' : 20,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 1000,
-
-        }
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : -100.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : -np.pi/2,
-            'bias' : 0.,
-            'record_current' : True
-        }
-
-        electrodeParams = {
-            'sigma' : [0.3, 0.3, 0.45],
-            'x' : np.array([0, 1000]),
-            'y' : np.zeros(2),
-            'z' : np.zeros(2),
-
-        }
-
-        ps_electrodeParams = electrodeParams.copy()
-        ls_electrodeParams = electrodeParams.copy()
-        sap_electrodeParams = electrodeParams.copy()
-
-        ps_electrodeParams["method"] = "pointsource"
-        ls_electrodeParams["method"] = "linesource"
-        sap_electrodeParams["method"] = "soma_as_point"
-
-        electrode_ps = LFPy.RecExtElectrode(**ps_electrodeParams)
-        electrode_ls = LFPy.RecExtElectrode(**ls_electrodeParams)
-        electrode_sap = LFPy.RecExtElectrode(**sap_electrodeParams)
-
-        stick = LFPy.Cell(**stickParams)
-        stick.set_pos(z=-stick.zstart[0])
-
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        stick.simulate([electrode_ps, electrode_ls, electrode_sap],
-                       rec_imem=True, rec_vmem=True)
-
-        # Test that distant electrode is independent of choice of method
-        np.testing.assert_almost_equal(electrode_ps.LFP[1,:],
-                                   electrode_ls.LFP[1,:])
-
-        np.testing.assert_almost_equal(electrode_ps.LFP[1,:],
-                                   electrode_sap.LFP[1,:])
-
-        # Hack to test that LFP close to stick is dependent on choice of method
-        np.testing.assert_raises(AssertionError, np.testing.assert_array_equal,
-                                 electrode_ps.LFP[0,:], electrode_ls.LFP[0,:])
-
-        np.testing.assert_raises(AssertionError, np.testing.assert_array_equal,
-                                 electrode_ps.LFP[0,:], electrode_sap.LFP[0,:])
-
-
-    
-
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_templatecell.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_templatecell.py
deleted file mode 100644
index 780734e..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_templatecell.py
+++ /dev/null
@@ -1,1346 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import sys
-import os
-import posixpath
-import unittest
-import numpy as np
-import LFPy
-import neuron
-import pickle
-
-# for nosetests to run load the SinSyn sinusoid synapse currrent mechanism
-if "win32" in sys.platform:
-    pth = os.path.join(LFPy.__path__[0], 'test', 'nrnmech.dll')
-    pth = pth.replace(os.sep, posixpath.sep)
-    if not pth in neuron.nrn_dll_loaded:
-        neuron.h.nrn_load_dll(pth)
-        neuron.nrn_dll_loaded.append(pth)
-else:
-    neuron.load_mechanisms(os.path.join(LFPy.__path__[0], 'test'))
-
-
-class testTemplateCell(unittest.TestCase):
-    """
-    test class LFPy.TemplateCell
-    """
-    def test_cell_tvec_00(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : 0.,
-            'tstop' : 100.,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_01(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : 0.,
-            'tstop' : 10000.,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_02(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : 0,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_03(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : 0,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_04(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : 0,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_05(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : 0,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_06(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : -100,
-            'tstop' : 100,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_07(self):
-        stickParams = {
-            'dt' : 2**-3,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        tvec = stickSimulationTesttvec(**stickParams)
-        tvec_numpy = np.linspace(0, stickParams['tstop'],
-                    int(stickParams['tstop']/stickParams['dt']) + 1)
-
-        np.testing.assert_equal(tvec, tvec_numpy)
-
-    def test_cell_tvec_08(self):
-        stickParams = {
-            'dt' : 0.1,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        try:
-            stickSimulationTesttvec(**stickParams)
-        except AssertionError:
-            pass
-
-    def test_cell_tvec_09(self):
-        stickParams = {
-            'dt' : 0.2,
-            'tstart' : -100,
-            'tstop' : 10000,
-        }
-
-        try:
-            stickSimulationTesttvec(**stickParams)
-        except AssertionError:
-            pass
-
-    def test_cell_set_pos_00(self):
-        '''test LFPy.TemplateCell.set_pos'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                         )
-        np.testing.assert_allclose(cell.somapos, [0, 0, 0])
-
-    def test_cell_set_pos_01(self):
-        '''test LFPy.TemplateCell.set_pos'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-    def test_cell_set_pos_02(self):
-        '''test LFPy.TemplateCell.set_pos'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                          pt3d=True)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-    def test_cell_set_pos_03(self):
-        '''test LFPy.TemplateCell.set_pos'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                         )
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-    def test_cell_set_pos_04(self):
-        '''test LFPy.TemplateCell.set_pos'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc'),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        cell.set_pos(10., 20., -30.)
-        np.testing.assert_allclose(cell.somapos, [10., 20., -30.])
-
-
-    def test_cell_set_pos_05(self):
-        '''test LFPy.TemplateCell.set_pos'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        np.testing.assert_allclose(cell.somapos,
-                                   [cell.xmid[0], cell.ymid[0], cell.zmid[0]])
-
-
-    def test_cell_set_pos_06(self):
-        '''test LFPy.TemplateCell.set_pos'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-        np.testing.assert_allclose(cell.somapos,
-                                   [cell.xmid[0], cell.ymid[0], cell.zmid[0]])
-
-
-    def test_cell_set_rotation_00(self):
-        '''test LFPy.TemplateCell.set_rotation()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.set_rotation(x=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_01(self):
-        '''test LFPy.TemplateCell.set_rotation()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.set_rotation(y=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_02(self):
-        '''test LFPy.TemplateCell.set_rotation()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        # test rotation 180 deg around z-axis
-        cell.set_rotation(z=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-
-    def test_cell_set_rotation_03(self):
-        '''test LFPy.TemplateCell.set_rotation()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.set_rotation(x=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_04(self):
-        '''test LFPy.TemplateCell.set_rotation()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.set_rotation(y=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_set_rotation_05(self):
-        '''test LFPy.TemplateCell.set_rotation()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        pt3d=True)
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        # test rotation 180 deg around z-axis
-        cell.set_rotation(z=np.pi)
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-
-    def test_cell_set_rotation_06(self):
-        '''test LFPy.TemplateCell.set_rotation()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation: 90 deg around x-axis, 90 deg around y-axis, 90 deg around z-axis
-        cell.set_rotation(x=np.pi / 2., y=np.pi, z=np.pi / 4.)
-        # revert rotation: -90 deg around x-axis, -90 deg around y-axis, -90 deg around z-axis, rotation_order='zyx'
-        cell.set_rotation(x=-np.pi / 2., y=-np.pi, z=-np.pi / 4., rotation_order='zyx')
-        # assert that x-, y- and z-coordinates are same as beginning, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-
-    def test_cell_chiral_morphology_00(self):
-        '''test LFPy.TemplateCell.chiral_morphology()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                         )
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around x-axis
-        cell.chiral_morphology(axis='x')
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, -xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, -xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, -xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-
-
-    def test_cell_chiral_morphology_01(self):
-        '''test LFPy.TemplateCell.chiral_morphology()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around y-axis
-        cell.chiral_morphology(axis='y')
-        # assert that y- and z-coordinates are inverted, using absolute
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, -ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, -ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, -yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, zends, atol=1e-07)
-
-    def test_cell_chiral_morphology_02(self):
-        '''test LFPy.TemplateCell.chiral_morphology()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-
-        xstarts = cell.xstart.copy()
-        xmids = cell.xmid.copy()
-        xends = cell.xend.copy()
-        ystarts = cell.ystart.copy()
-        ymids = cell.ymid.copy()
-        yends = cell.yend.copy()
-        zstarts = cell.zstart.copy()
-        zmids = cell.zmid.copy()
-        zends = cell.zend.copy()
-        # test rotation 180 deg around z-axis
-        cell.chiral_morphology(axis='z')
-        # assert that y- and z-coordinates are inverted, using absolute
-
-        # tolerances
-        np.testing.assert_allclose(cell.xstart, xstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.xmid, xmids, atol=1e-07)
-        np.testing.assert_allclose(cell.xend, xends, atol=1e-07)
-        np.testing.assert_allclose(cell.ystart, ystarts, atol=1e-07)
-        np.testing.assert_allclose(cell.ymid, ymids, atol=1e-07)
-        np.testing.assert_allclose(cell.yend, yends, atol=1e-07)
-        np.testing.assert_allclose(cell.zstart, -zstarts, atol=1e-07)
-        np.testing.assert_allclose(cell.zmid, -zmids, atol=1e-07)
-        np.testing.assert_allclose(cell.zend, -zends, atol=1e-07)
-
-
-    def test_cell_get_rand_prob_area_norm_00(self):
-        '''test LFPy.TemplateCell.get_rand_prob_area_norm()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        p = cell.get_rand_prob_area_norm()
-        self.assertAlmostEqual(p.sum(), 1.)
-        self.assertTrue(p.min() >= 0.)
-        self.assertTrue(p.max() <= 1.)
-
-
-    def test_cell_get_rand_prob_area_norm_from_idx(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                 'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        p = cell.get_rand_prob_area_norm_from_idx(idx=cell.get_idx(section='allsec'))
-        self.assertListEqual(cell.get_rand_prob_area_norm().tolist(), p.tolist())
-
-
-    def test_cell_get_rand_prob_area_norm_from_idx_00(self):
-        '''test LFPy.TemplateCell.get_rand_prob_area_norm()'''
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        p = cell.get_rand_prob_area_norm_from_idx(idx=np.array([0]))
-        np.testing.assert_equal(p, np.array([1.]))
-
-
-    def test_cell_get_intersegment_vector_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        idx0 = 0
-        idx1 = 1
-        vector = cell.get_intersegment_vector(idx0=idx0, idx1=idx1)
-
-        self.assertListEqual(vector,
-                            [cell.xmid[idx1] - cell.xmid[idx0],
-                             cell.ymid[idx1] - cell.ymid[idx0],
-                             cell.zmid[idx1] - cell.zmid[idx0]])
-
-
-    def test_cell_get_intersegment_distance_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        idx0 = 0
-        idx1 = 1
-        distance = cell.get_intersegment_distance(idx0=idx0, idx1=idx1)
-        vector = cell.get_intersegment_vector(idx0=idx0, idx1=idx1)
-
-        self.assertEqual(np.sqrt(np.array(vector)**2).sum(), distance)
-
-
-    def test_cell_get_idx_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        nsegs_method=None)
-        self.assertListEqual(cell.get_idx(section='soma').tolist(), [0])
-        self.assertListEqual(cell.get_idx(section='soma[0]').tolist(), [0])
-        self.assertListEqual(cell.get_idx(section='dend[0]').tolist(), [1])
-        self.assertListEqual(cell.get_idx(section='dend[1]').tolist(), [2])
-        self.assertListEqual(cell.get_idx(section='dend[2]').tolist(), [3])
-        self.assertListEqual(cell.get_idx(section='dend').tolist(), [1, 2, 3])
-        self.assertListEqual(cell.get_idx(section='allsec').tolist(),
-                             [0, 1, 2, 3])
-        self.assertListEqual(cell.get_idx(section=['soma', 'dend']).tolist(),
-                             [0, 1, 2, 3])
-        self.assertListEqual(cell.get_idx(section='apic').tolist(), [])
-
-
-    def test_cell_get_closest_idx_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        nsegs_method=None)
-        self.assertEqual(cell.get_closest_idx(x=0, y=0, z=0),
-                             cell.get_idx(section='soma')[0])
-
-        self.assertEqual(cell.get_closest_idx(x=-25, y=0, z=175),
-                             cell.get_idx(section='dend[1]')[0])
-
-
-    def test_cell_get_idx_children_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-
-        np.testing.assert_array_equal(cell.get_idx_children(parent='soma[0]'),
-                                      cell.get_idx(section='dend[0]'))
-
-
-    def test_cell_get_idx_parent_children_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        np.testing.assert_array_equal(cell.get_idx_parent_children(parent='soma[0]'),
-                                      cell.get_idx(section=['soma[0]',
-                                                            'dend[0]']))
-
-
-    def test_cell_get_idx_name_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        np.testing.assert_array_equal(cell.get_idx_name(idx=np.array([0])),
-                                                np.array([[0, 'ball_and_stick_template[0].soma[0]', 0.5]],
-                                                         dtype=object))
-
-
-    def test_cell_get_rand_idx_area_norm_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        idx = cell.get_rand_idx_area_norm(nidx=1000000)
-
-
-        # compute histogram and correlate with segment area
-        bins = np.arange(cell.totnsegs+1)
-        hist, bin_edges = np.histogram(idx, bins=bins)
-
-        # compute Pearson correlation coefficients between area and histogram
-        # reporting success if within 5 decimal places
-        self.assertAlmostEqual(np.corrcoef(cell.area, hist)[0, 1], 1., places=5)
-
-        # check if min and max is in the range of segment indices
-        self.assertEqual(idx.min(), 0)
-        self.assertEqual(idx.max(), cell.totnsegs-1)
-
-
-    def test_cell_set_synapse_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.set_synapse(idx=0, syntype='ExpSyn', record_curret=False,
-                         record_potential=False, weight=1.,
-                         **dict(e=10., tau=2.))
-
-        self.assertTrue('ExpSyn' in cell.synlist[0].hname())
-        self.assertEqual(len(cell.synlist), 1)
-        self.assertEqual(len(cell.netconlist), 1)
-        self.assertEqual(len(cell.netstimlist), 1)
-        self.assertEqual(cell.synlist[0].e, 10.)
-        self.assertEqual(cell.synlist[0].tau, 2.)
-        self.assertEqual(cell.netconlist[0].weight[0], 1.)
-
-
-    def test_cell_set_point_process_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.set_point_process(idx=0, pptype='IClamp', record_current=False,
-                               **dict(delay=1., amp=1.))
-        self.assertEqual(cell.stimlist[0].hname(), 'IClamp[0]')
-        self.assertEqual(len(cell.stimlist), 1)
-        self.assertEqual(cell.stimlist[0].delay, 1.)
-        self.assertEqual(cell.stimlist[0].amp, 1.)
-
-
-    def test_cell_strip_hoc_objects_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell.strip_hoc_objects()
-        for attribute in dir(cell):
-            self.assertNotEqual(str(type(getattr(cell, attribute))),
-                                'hoc.HocObject')
-
-    def test_cell_cellpickler_00(self):
-        cell = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        cell_pickle = cell.cellpickler(filename=None, pickler=pickle.dumps)
-        pickled_cell = pickle.loads(cell_pickle)
-
-        for attribute in dir(cell):
-            if attribute.startswith('__') or attribute.startswith('_'):
-                pass
-            else:
-                self.assertEqual(type(getattr(cell, attribute)),
-                                 type(getattr(pickled_cell, attribute)))
-
-    def test_cell_simulate_recorder_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stick = LFPy.TemplateCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-        
-
-    def test_cell_simulate_recorder_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.TemplateCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.TemplateCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_03(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stick = LFPy.TemplateCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-        
-
-    def test_cell_simulate_recorder_04(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.TemplateCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-
-    def test_cell_simulate_recorder_05(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 10000,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-        stick = LFPy.TemplateCell(**stickParams)
-        stick.simulate(rec_vmem=True, rec_imem=True,
-                       rec_current_dipole_moment=True)
-        self.assertTrue(stick.tvec.size ==
-                        stick.vmem.shape[1] ==
-                        stick.imem.shape[1] ==
-                        stick.current_dipole_moment.shape[0])
-        self.assertTrue(np.all(stick.vmem == stick.v_init))
-        self.assertTrue(np.all(stick.imem == 0.))
-        self.assertTrue(np.all(stick.current_dipole_moment == 0.))
-        
-    def test_cell_simulate_current_dipole_moment_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.TemplateCell(**stickParams)
-                synapse = LFPy.StimIntElectrode(stick, idx=idx,
-                                       **stimParams)
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-
-
-    def test_cell_simulate_current_dipole_moment_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.TemplateCell(**stickParams)
-                synapse = LFPy.StimIntElectrode(stick, idx=idx,
-                                       **stimParams)
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-
-    def test_cell_simulate_current_dipole_moment_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'e' : 0,                                # reversal potential
-            'syntype' : 'Exp2Syn',                   # synapse type
-            'tau1' : 0.1,                              # syn. time constant
-            'tau2' : 2.,                              # syn. time constant
-            'weight' : 0.01,
-        }
-
-        for idx in range(31): #31 segments
-            if idx != 15: # no net dipole moment because of stick symmetry
-                stick = LFPy.TemplateCell(**stickParams)
-                synapse = LFPy.Synapse(stick, idx=idx,
-                                       **stimParams)
-                synapse.set_spike_times(np.array([10., 20., 30., 40., 50.]))
-                stick.simulate(rec_imem=True, rec_current_dipole_moment=True)
-                p = np.dot(stick.imem.T, np.c_[stick.xmid, stick.ymid, stick.zmid])
-                np.testing.assert_allclose(p, stick.current_dipole_moment)
-
-    def test_cell_tstart_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick0 = LFPy.TemplateCell(tstart=0, tstop=200, **stickParams)
-        synapse0 = LFPy.StimIntElectrode(stick0,
-                                         stick0.get_closest_idx(0, 0, 1000),
-                                         delay=0, phase=0.,
-                                         **stimParams)
-        stick0.simulate(rec_imem=True, rec_vmem=True, rec_current_dipole_moment=True)
-
-
-        stick1 = LFPy.TemplateCell(tstart=-100, tstop=100, **stickParams)
-        synapse1 = LFPy.StimIntElectrode(stick1,
-                                         stick1.get_closest_idx(0, 0, 1000),
-                                         delay=-100, phase=0.,
-                                         **stimParams)
-        stick1.simulate(rec_imem=True, rec_vmem=True, rec_current_dipole_moment=True)
-
-        inds = stick0.tvec >= 100
-        np.testing.assert_allclose(stick0.vmem[:, inds], stick1.vmem)
-        np.testing.assert_allclose(stick0.imem[:, inds], stick1.imem)
-        np.testing.assert_allclose(stick0.current_dipole_moment[inds, :],
-                                   stick1.current_dipole_moment)
-
-
-    def test_cell_with_recextelectrode_00(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.TemplateCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-
-    def test_cell_with_recextelectrode_01(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : -100,
-            'tstop' : 100,
-            'dt' : 2**-4,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.TemplateCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_cell_with_recextelectrode_02(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.1,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.TemplateCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-
-    def test_cell_with_recextelectrode_03(self):
-        stickParams = {
-            'morphology' : os.path.join(LFPy.__path__[0], 'test', 'stick.hoc'),
-            'templatefile' : os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-            'templatename' : 'stick_template',
-            'templateargs' : None,
-            'cm' : 1,
-            'Ra' : 150,
-            'v_init' : -65,
-            'passive' : True,
-            'passive_parameters' : {'g_pas' : 1./30000, 'e_pas' : -65},
-            'tstart' : 0,
-            'tstop' : 100,
-            'dt' : 0.2,
-            'nsegs_method' : 'lambda_f',
-            'lambda_f' : 100,
-
-        }
-
-        electrodeParams = {
-            'sigma' : 0.3,
-            'x' : np.ones(11) * 100.,
-            'y' : np.zeros(11),
-            'z' : np.linspace(1000, 0, 11),
-            'method' : 'pointsource'
-        }
-
-        stimParams = {
-            'pptype' : 'SinSyn',
-            'delay' : 0.,
-            'dur' : 1000.,
-            'pkamp' : 1.,
-            'freq' : 100.,
-            'phase' : 0,
-            'bias' : 0.,
-            'record_current' : False
-        }
-
-        stick = LFPy.TemplateCell(**stickParams)
-        synapse = LFPy.StimIntElectrode(stick, stick.get_closest_idx(0, 0, 1000),
-                               **stimParams)
-        electrode = LFPy.RecExtElectrode(**electrodeParams)
-        stick.simulate(electrode, rec_imem=True)
-
-        electrode1 = LFPy.RecExtElectrode(cell=stick, **electrodeParams)
-        electrode1.calc_lfp()
-
-        np.testing.assert_allclose(electrode.LFP, electrode1.LFP)
-        self.assertTrue(stick.tvec.size == stick.imem.shape[1] ==
-                        electrode.LFP.shape[1] == electrode1.LFP.shape[1] ==
-                        int(stick.tstop/stick.dt)+1)
-        
-    def test_cell_distort_geometry_01(self):
-        cell0 = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-        factors = [-0.2, 0.1, 0., 0.1, 0.2]
-        nus = [-0.5, 0., 0.5]
-        for factor in factors:
-            for nu in nus:
-                for axis in 'xyz':
-                    cell1 = LFPy.TemplateCell(morphology=os.path.join(LFPy.__path__[0], 'test',
-                                                  'ball_and_sticks_w_lists.hoc' ),
-                        templatefile=os.path.join(LFPy.__path__[0], 'test', 'ball_and_stick_template.hoc'),
-                        templatename='ball_and_stick_template',
-                        templateargs=None,
-                        )
-                    cell1.distort_geometry(factor=factor, nu=nu, axis=axis)
-                    for attr in ['start', 'mid', 'end']:
-                        for ax in 'xyz'.replace(axis, ''):
-                            np.testing.assert_allclose(getattr(cell0, ax+attr)*(1+factor*nu),
-                                                       getattr(cell1, ax+attr))
-                        np.testing.assert_allclose(getattr(cell0, axis+attr)*(1-factor),
-                                                   getattr(cell1, axis+attr))
-
-
-    ######## Functions used by tests: ##########################################
-
-def stickSimulationTesttvec(**kwargs):
-    stick = LFPy.TemplateCell(morphology = os.path.join(LFPy.__path__[0], 'test',
-                                                'stick.hoc'), verbose=False,
-                              templatefile=os.path.join(LFPy.__path__[0], 'test', 'stick_template.hoc'),
-                              templatename='stick_template',
-                              templateargs=None,
-                              **kwargs)
-    stick.simulate(rec_imem=False)
-    return stick.tvec
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_tools.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_tools.py
deleted file mode 100644
index e81a0bf..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/test/test_tools.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import os
-import unittest
-import numpy as np
-import LFPy
-import pickle
-
-class testTools(unittest.TestCase):
-    """
-    test LFPy.tools methods
-    """
-    def test_tools_load_00(self):
-        filename = 'test.cpickle'
-        x = object()
-        f = open(filename, 'wb')
-        pickle.dump(x, f)
-        f.close()
-        self.assertTrue(isinstance(LFPy.tools.load(filename), object))
-        os.remove(filename)
-        
-    
-    def test_tools_noise_brown(self):
-        ncols=3
-        nrows=2
-        self.assertEqual(LFPy.tools.noise_brown(ncols, nrows).shape, (nrows, ncols))
\ No newline at end of file
diff --git a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/tools.py b/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/tools.py
deleted file mode 100644
index 423f5c5..0000000
--- a/LFPy-2.0.7/build/lib.linux-x86_64-3.8/LFPy/tools.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
-
-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.
-
-"""
-
-from __future__ import division
-import numpy as np
-import scipy.signal as ss
-
-def load(filename):
-    """Generic loading of cPickled objects from file"""
-    import pickle
-    
-    filen = open(filename,'rb')
-    obj = pickle.load(filen)
-    filen.close()
-    return obj
-
-def noise_brown(ncols, nrows=1, weight=1., filter=None, filterargs=None):
-    """Return 1/f^2 noise of shape(nrows, ncols obtained by taking
-    the cumulative sum of gaussian white noise, with rms weight.
-    
-    If filter is not None, this function will apply
-    the filter coefficients obtained
-    by:
-        
-    >>> b, a = filter(**filterargs)
-    >>> signal = scipy.signal.lfilter(b, a, signal)
-    """
-    def rms_flat(a):
-        """
-        Return the root mean square of all the elements of *a*, flattened out.
-        """
-        return np.sqrt(np.mean(np.absolute(a)**2))
-
-    if filter is not None:
-        coeff_b, coeff_a = list(filter(**filterargs))
-    
-    noise = np.zeros((nrows, ncols))    
-    for i in range(nrows):
-        signal = np.random.normal(size=ncols+10000).cumsum()
-        if filter is not None:
-            signal = ss.lfilter(coeff_b, coeff_a, signal)
-        noise[i, :] = signal[10000:]
-        noise[i, :] /= rms_flat(noise[i, :])
-        noise[i, :] *= weight
-    return noise
-
diff --git a/LFPy-2.0.7/build/temp.linux-x86_64-3.8/LFPy/alias_method.o b/LFPy-2.0.7/build/temp.linux-x86_64-3.8/LFPy/alias_method.o
deleted file mode 100644
index f252816..0000000
Binary files a/LFPy-2.0.7/build/temp.linux-x86_64-3.8/LFPy/alias_method.o and /dev/null differ
diff --git a/LFPy-2.0.7/build/temp.linux-x86_64-3.8/LFPy/run_simulation.o b/LFPy-2.0.7/build/temp.linux-x86_64-3.8/LFPy/run_simulation.o
deleted file mode 100644
index 3a83038..0000000
Binary files a/LFPy-2.0.7/build/temp.linux-x86_64-3.8/LFPy/run_simulation.o and /dev/null differ
diff --git a/LFPy-2.0.7/conda_environment_macos.yml b/LFPy-2.0.7/conda_environment_macos.yml
deleted file mode 100644
index 152ab43..0000000
--- a/LFPy-2.0.7/conda_environment_macos.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-name: lfpy
-channels:
-  - conda-forge
-  - defaults
-dependencies:
-  - python=3
-  - numpy
-  - scipy
-  - matplotlib
-  - Cython
-  - h5py
-  - clang_osx-64
-  - neuron=*=mpi_*
-  - pytest
-  - mpi4py
diff --git a/LFPy-2.0.7/conda_environment_ubuntu.yml b/LFPy-2.0.7/conda_environment_ubuntu.yml
deleted file mode 100644
index 9592234..0000000
--- a/LFPy-2.0.7/conda_environment_ubuntu.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-name: lfpy
-channels:
-  - conda-forge
-  - defaults
-dependencies:
-  - python=3
-  - numpy
-  - scipy
-  - matplotlib
-  - Cython
-  - h5py
-  - gxx_linux-64
-  - neuron=*=mpi_*
-  - pytest
-  - mpi4py
diff --git a/LFPy-2.0.7/continuous_integration/install.sh b/LFPy-2.0.7/continuous_integration/install.sh
deleted file mode 100644
index 142f1d1..0000000
--- a/LFPy-2.0.7/continuous_integration/install.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-export PATH=$HOME/.local/nrn/x86_64/bin:$PATH
-
-cd $HOME
-git clone https://github.com/neuronsimulator/nrn.git
-cd nrn
-git checkout 7.7.0
-echo "installing NEURON:"
-echo "running sh build.sh"
-sh build.sh > /dev/null
-echo "running ./configure"
-./configure --prefix=$HOME/.local/nrn --without-iv --with-nrnpython=python --with-mpi --disable-rx3d > /dev/null
-echo "running make"
-make -j8 > /dev/null
-echo "running make install"
-make install > /dev/null
-cd src/nrnpython
-echo "installing neuron python module"
-python setup.py install > /dev/null
-cd $TRAVIS_BUILD_DIR
diff --git a/LFPy-2.0.7/continuous_integration/test_script.sh b/LFPy-2.0.7/continuous_integration/test_script.sh
deleted file mode 100644
index 9ba0fa6..0000000
--- a/LFPy-2.0.7/continuous_integration/test_script.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-
-set -e
-
-python --version
-python -c "import numpy; print('numpy %s' % numpy.__version__)"
-python -c "import scipy; print('scipy %s' % scipy.__version__)"
-python -c "import neuron; print('neuron %s' % neuron.version); print(neuron.__file__)"
-
-# build LFPy inplace (compile cython extensions, NMODL files)
-python setup.py develop
-
-# run tests, but if mystery segmentation fault occurr, rerun tests to get
-# clean exit
-while true; do
-    py.test LFPy/test/test*.py --cov-report term --cov=LFPy/test/
-    if [ $? -eq 0 ]
-    then
-        exit 0
-        break
-    fi
-done
-
diff --git a/LFPy-2.0.7/debugfiles.list b/LFPy-2.0.7/debugfiles.list
deleted file mode 100644
index d0df7fa..0000000
--- a/LFPy-2.0.7/debugfiles.list
+++ /dev/null
@@ -1,10 +0,0 @@
-%dir /usr/lib/debug
-%dir /usr/lib/debug/usr
-%dir /usr/lib/debug/usr/lib64
-%dir /usr/lib/debug/usr/lib64/python3.8
-%dir /usr/lib/debug/usr/lib64/python3.8/site-packages
-%dir /usr/lib/debug/usr/lib64/python3.8/site-packages/LFPy
-%dir /usr/lib/debug/.dwz
-/usr/lib/debug/usr/lib64/python3.8/site-packages/LFPy/run_simulation.cpython-38-x86_64-linux-gnu.so-2.0.7-4.fc32.x86_64.debug
-/usr/lib/debug/usr/lib64/python3.8/site-packages/LFPy/alias_method.cpython-38-x86_64-linux-gnu.so-2.0.7-4.fc32.x86_64.debug
-/usr/lib/debug/.dwz/python-lfpy-2.0.7-4.fc32.x86_64
diff --git a/LFPy-2.0.7/debuglinks.list b/LFPy-2.0.7/debuglinks.list
deleted file mode 100644
index e69de29..0000000
--- a/LFPy-2.0.7/debuglinks.list
+++ /dev/null
diff --git a/LFPy-2.0.7/debugsourcefiles.list b/LFPy-2.0.7/debugsourcefiles.list
deleted file mode 100644
index 4eb453b..0000000
--- a/LFPy-2.0.7/debugsourcefiles.list
+++ /dev/null
@@ -1 +0,0 @@
-/usr/src/debug/python-lfpy-2.0.7-4.fc32.x86_64
diff --git a/LFPy-2.0.7/debugsources.list b/LFPy-2.0.7/debugsources.list
deleted file mode 100644
index c309c23..0000000
Binary files a/LFPy-2.0.7/debugsources.list and /dev/null differ
diff --git a/LFPy-2.0.7/doc/Logo.ai b/LFPy-2.0.7/doc/Logo.ai
deleted file mode 100644
index e3f75a7..0000000
--- a/LFPy-2.0.7/doc/Logo.ai
+++ /dev/null
@@ -1,1599 +0,0 @@
-%PDF-1.5
%����
-1 0 obj
<>/OCGs[5 0 R 29 0 R]>>/Pages 3 0 R/Type/Catalog>>
endobj
2 0 obj
<>stream
-
-
-   
-      
-         application/pdf
-         
-            
-               Web
-            
-         
-      
-      
-         Adobe Illustrator CS4
-         2011-06-22T15:38:57+02:00
-         2011-06-22T15:42:08+02:00
-         2011-06-22T15:42:08+02:00
-         
-            
-               
-                  256
-                  200
-                  JPEG
-                  /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA
AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgAyAEAAwER
AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYq7FXYq7FXzD/
AM5T6957sNfsNPN+0Pl25jFzYx2waGs0L/GJWB5O8Z4MN6CoIAOKss/IL89G8yKvlnzRcL+nkqbG
9figu0/321KD1l9vtD3Bqq9yxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV
2KuxV2KuxV2KuxV2KuxV2KvLf+cj/KEOv/lvd3gIS70M/X4XIqSigrLHXsGQ8vmoxV8h6dp95NZP
qGmCQXemuJZ3jejqp3jkjAAYcGU1IO2xy+GEzgTEbx5+78c3HnnEJgSO0uXv/HJ9H/kh/wA5DRam
IPLfnK5Eep7R2OryEKk/ZY5zsFl8G6N3+L7VDkPf8VdirsVdiriQBU9MVef+b/z1/LXywjrPqiah
eoSPqOnFbiTkDQqzKRGhB6h3BxV4z5p/5y18yXMoj8taXBp1uCCZrutxM1DXoOCID0P2vnir6F/L
7zY/m3ydpnmF7RrF76Ms1u5BoyOUYqe6MVqpPbFWQ4q7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FX
Yq+RvN358fmroX5k6q7sLJLaX6sdCmHq24hiYlPA8nVuRkQjlX+WgxV7R+W3/OQXk7zgIrK8caLr
jfD9TuHHpSN/xRMeKtX+VqN7Hrir1HFXYq7FUFrWtaZomlXOq6pcLa2Fohknmc0AA7DxJOwA3J2x
V4Zpv/OT/lvzJcT+XdX0S4tbLVmewiuopElrFckxK0sbenw+F/i4s2KvFPy2kl03zZc6ZcoUndJY
HQ1+GWFuTAj24Nm27HyVlr+cHUds4+LDf80/sT7zP+WVretLd6Swt7tzyNu39yxJ3pQVTx7j5Zna
vsmM7lDaXd0/Y6/R9ryhUZ7x7+v7W/Lv5z/m15CMWm3bfXbJBxgtNRRpVCjakUylZKeA5EDwzQZc
E8ZqQp6HFnhkFxNs8sv+cwk9Kl75XPqjq0N58J/2LQ1H3nKm5Czf85hakefo+WIUrXhzu2enhWkS
V/DFUj1L/nK38x74PBptlYWJfaN44pJpl69PUdoz9MeEC0E1zYxc3P5u+dCn6a1K9awkor+u/pQ8
dgT9XUxq23+Tvmbg7Oy5OlDvLg5+0sWPrZ7gmOi/lXptrP62ozG94k8IAOEdNwOfVj47U+nNvg7H
hE3M8Tp9R2zOQqA4fPqkcuhp5u/MCx8q6Dapap6xtC8aAABWJnmYL1CKpPyGajtCcDk4YChHZ3HZ
2OYx8Uzcpbvt/TNOs9M02102yjEVpZQpb28Y/ZjjUKo+4ZgueicVdirsVdirsVdirsVdirsVdirs
VdirsVdirsVeF/8AOTf5XrrOiHzhpsZOp6THxv40A/e2gJJc0FeUNa/6tfAYq+etD8u2XmSxmSxK
Wer2vAmJmYwyx0oW35urV69s2Wn0sdRE8PpmPkQ6zUaqWnkDL1Yz8wWaeVPzn/Mz8vb2LTNXZ9U0
iMqptbss5Ee1fq1wfiFBsASVHhmHn088UqkHNwaiGWNxL3zQ/wDnIf8AKjVYoWbV/wBHTTFlFtfR
vEy8aH43UPCoNdjz3yluQPnD/nJX8udCgkTTrhtd1BR+7gtARDy7c7hhw4+6cj7Yq+fvNPnn8w/z
Xv1hnIg0iBw0dnCGS1iPQO53aR6HqfegArmTp9LPMaiPi42p1cMIuR+HVbJ5ags/P/krSoogIJbi
ygac1X1ZGuwJC1N/2wfpzJ7SwDFKMR0j89y4vZmc5YykesvlsG9dtbmy/PrVopCY5H1i7kFQRVLh
3kX/AIJJBlPZ5rPH3t3aIvBL3PT0gzrTJ48RVlt/bImTIRS688neXb2VZrrToZJFBUMVpsd+gpmN
PT45GzEOVj1OWIoSKvB5Z0SCGOGKwgWKKpjX01NCep3HU5KOKAFCIYyzZCbMj80RFp1tACIIUiB6
hFC1+4ZZGhyDVIk8y5oMmJMDFj/nPVf0LoFzeI3G4p6dttX94+w29tzv4ZRrNT4WMyHPp73I0em8
XKInl19ydf8AOJnk9iurec7xCZJWNhYOw3IqJLhxXxPBajwYZyBNvZAVs+jMCXYq7FXYq7FXYq7F
XYq7FXnf5kfnj5R8hajb6ZqEVzeX8yCZ4LRUPpxMSAzl2QVYrsB+G2Kst8qeatF81aFba3o03rWN
yDxqOLoymjI6/ssp6/htiqb4q7FXYq7FXYqtljSWN4pByjdSrqe4IoRir4h806Mfy5/Nm6sEDJp0
M4a3L1PKyuByX4j9rgrUr/MuZOjz+FlEunX3OLrcHi4jHr0970e6sbS8i9G6gjuIq19OVQ61HQ0Y
HOxnCMhUgCHi4TlE3EkHyY/P+WXlWeQuLZ4a7lY5GA+4k0+jMCfZeAnlXxdhDtXOBzv4Imy/Lvyr
aurrYrK603mZpAadyrEr+GSh2fgj/Dfv3Y5O0c8tuKvdsn6WyooVFCqNgoFAANu2ZwIDgkE82I6V
fXGsfnf5Z0gJGYNK1COWJgDyJCpNJyqafD6O1BnLdq5uPMR0js9X2Th4MIPWW6X6vMD/AM5Caq1w
zS11S7jUuzMRs6RipJ2XYAdANsp0BAzR/HRu7RBOCVfjd6qkOdOZPKiKssGQMmYiqCDI8SeFv0Me
JPCtMGHiRwqbw5ISYmLy/wDO6SSPTdMtx/dyzSSMPeNAB/ycOartafpiPN23Y8BxSPk+q/JWlW2k
+T9F022YyQWllBGkjKEZ6Rj42UdC3UjNG79OsVdirsVdirsVdirsVdiriQBU9MVfFuoWMn5jeeNd
8zXUxGly3csNvT7ZjROEAXqPgj4E+ObHs/ReOTf0h1vaOu8ACvqLIPyU843nkL8wh5PvZlfRNWuF
RpCtCJ5UC28negY8Vbf37Zi6nAcUzA9HK0ucZcYmOr6yyhyHYq7FXYqsaaJZUiLASOGZF7kLStPl
yGKr8VfO3/OXPlNZLHR/NcKj1IHOnXhA3KPWWE/JWDj/AGWKpH5F1Zda8u29zxCSxfuJkBqA8YAr
/shQ51uj1HiYwevJ4/W6bw8pHTmyRbf2zIMnF4VQW+DiZcLjb48S8LCvyXhTUf8AnIW4ulWi2H12
QUII+CM2vLan2vUr/nXOU1cuLLI+b1+jhw4YjyYlrE0kn59akx2b/ENxHt/Kt0yfqGDSn97H3p1Y
/dS9z3OOHOlJeWEVdIcgZMxFUEOR4mXCoXl3p1iqte3MNqrbK00ixgn25EZE5AOZZRxk8haml/pc
sphjvIHmBCmNZELAt0FAa70wjIO9TiPcqvDlgk1GLzH88tNL+X7O9Xra3PBuv2ZVO/8AwSDNf2nG
4A9xdj2XKpkd4fSvkHzRZ+aPJ+la3aspW6gX1kWg4TIOMsdB04uCM0jvmQYq8/8Azy85a95T8g3W
o6LavLdystubxaFbRZaj12HWtfhXanIivgVXiHkz/nKrzNpUNpY69p8WqWcC+m9zGzRXZUUAYli6
MRv2FfEYq9y8nfnj+XHmoxw2eprZ38lAthfgW8pY/sqSTG59kc4qz3FXYqkHn/zGfLXkrWtcRkWe
xtJZLYyCqGcrxgVhVahpWUdcVeM/kl+evnHzh59Gja61sLSe1meCO3i9Ok0YVh8RZmI4BtsVexfm
PqraT5B8w6gjcZbfT7kwt4SGMrH/AMORir5g/KS2lHliZnFEku5Gj9xwjUn71pnS9j7Yj/W/U8x2
zvlHlH9aH/NLy1PNaQ61aKfXsvhn4V5elWocU/kb9de2Q7W0/FETHMc/cz7H1PBI4zyly9/7XsP5
df8AOSnku+8uW0fmq/8A0brltGI7ovFK8c5Xb1UaNXFW6sppv02znXpEw1T/AJyf/KizUm2urvUj
2W2tnX/qI9DFWC6x/wA5b6hcSfV/LPlsGVto5LyRpWJ/4wQBD/yUwxiSaCJSAFnYMS1b8x/z/wDM
JkV7ybSrUVLLbCOxVB3Il2m/4c5lw7PzS/hr37OHPtHBH+K/dv8AcxfyJ5o8waP+ZukalBcz67fJ
cLFOsLS3Dzxy/BLGhYcnPAmm1K75jTiImrv3OVjmZC6r3vujIM2I/m15cHmL8ude0wJzma1ae2Hf
1rf99GB82Sn04q+ZfyP1O3eG/wBHIpchvraHj1Sixt8Vexp9+bnsvKKMevN0fa2E2J9OT1hYM2pk
6kRVBBg4k8LjBjxLwsJ/5xbgM/5leZb9wQ6WkqENswM10jGo/wCeecrkNyPveuxiogeTD7qSzm/5
yD1Np1YRjW7xEpx/vUlkVK1qKF1+eXaSvFFtGsvwpU9yjizfkvOgIhIsgS2CLxfzRdeePOf5mf4K
0O6+qpDMBAEkaFAYUErzSuPiPClQB4bb75p9VnkZEXsHdaTTxEAa3L0gf84q2mof6T5j81ahqWpM
o5zqqgA+H74zMQPmMwybc0Ckn1P/AJw/X7WleZiD2iurX/mZHJ/xpgSlN3+Q/wCfVjALax12O6tk
/u1gvp4yAK0A9RY6fKtMtGeYFWWo4MZN8I+SSXn5Efn1ewmG7R7iE0rDLqEbqd+W6mQjqK/PfIyy
yIokpjigDYAfQP5I/l1c+RfJi6ffuG1S8ma6vlVuUaOQEVE7bIoqe5r2pkGx6BiqhfWNpf2c9leQ
rPaXKNFPC4qro4oyke4xV8U/nF+Ut9+X2uI6/wCleX7+R202ep5AKamCalKOoPX9objuAhBSvT/I
cWuaWNR0S647lJLS5HxJIoBK+ogoetR8Iza4+zhmhx4z8D3+91WXtI4Z8GQfEd3u/amHl/Xfzj8k
TpDpMt9FBWi2ir9btW6mgjpLGCfahzEyaLLE0Yn7/uczHrsMxYkPu+9mSf8AOWH5h2qG3vNJ05rq
KqyM8dxG3IfzJ6ux8emYxBBouSCCLDFPMP5ifmb+al1HpVxIgsuYkNjaoYbVCP25CS7tx7cmPtvl
mHDLJKotWbPHHG5F35VA+V/zv0a1eUP6V81iZKcA31mNoF2NevqjBmx8EzHuThyccBLvfSP/ADkV
dm2/KDXeNeU31aEH/WuouVf9iDlba8a/KW0ZfJkMhBpNNM6kmoIDcNvAVXOk7M2xD3l5jtTfMfcG
XtACKEbHrmw4nW8LGL38tvKFzO076eqO9eXpO6LuP5FIUfQMxJaDDI2YuZHtDPEVxKcP5eeUbZ+c
emoxH+/GeUfdIzDLIaDADfD+lhPtDPIVxfo+5EXk+j6Bp7zSCKytENeEahAWPZVUCrHMiU8eGFmo
xcaMMmadC5SSDy5oXnH82tRax0pTpflu3al9qEgJXfcKaEeo9OiKad2I2znNb2jLNsNo/f73ptF2
bHD6jvP7vc+jPy7/ACj8n+RLcnSoDPqUi8bjVLijzsO6qQAI0r+yv01zWuzZrirsVfF3l62g8s/n
fqOjqfRtReXljCNwPTLs0C7U68U8f45l6GfDkHm4WvhxYj5PcVhzemToBFeIcjxMuFxhx4l4WD/8
4nqsnmbzdOVAkCQgAbAB5ZSQANv2RnNHm9THkxVrldO/5yF1q1lEQhu9TuDxZSQJJOTxstBs/wC8
Ir7n55k6OdZA4utheM+T2iNM3RLowESkdcrJZgPFPzEtPMvkT8x7X8wNMQzWryI5d+TIr+n6UkEh
6hZI/s/Og6ZqtXAiXF0LuNHkBjw9Q9e8sf8AOTn5aatCg1KabRLwgc4rmNpI+XcLNEHFPdwuYjmM
rH5w/ld6Xq/4n0/jStPWXl/wP2vwxVK9Q/5yD/KKyqG19J37Jbw3Eten7Sxle/jiqA0z/nJL8stS
1ex0y3uLhHvphCJ54vSijLA8S7E7BmovtWpoMVep4q7FXYqkfnTyfo3m/wAu3Wh6tHztrgVjkFOc
Uq/YljJ6Mp+/odjir49FpL+XH5lX3l++uTJYRv6MtwUZFaN1DxTcG8OQrSo60JGZ/Z+q8LJv9J5u
v7R0vi49h6hyetQxhgGG4O4I8M6cyeVEV/6KsJJfVktonlqD6jIpao6bkVymUYk3TdGUgKso2K2V
FCqoVR0AFBgtNPG/zLkbQ/zJ07WI4xGYvqt4HQ/E7wS/aPgfgA+jOf7SH7y+8PRdmSvFXcXu3/OU
d5GPyqXgwZLu+tlRq9RxeQEeOyZgOxYl+XnpTeSdHeNeK+gFIoB8SEqx28WBOdJpJfuo+55fWR/e
y97IGhzK4nFMVF4ckJMDFKtd1Kx0fTptQvX4QQipp9pieiqO5J6Y5M0ccTI8k4sEskhGPMsB8keT
PMv5weZjPcs1l5asH/0mZekatQ+jDUfFK46seg3PYHmNTqpZpWeXQPVaXSRwxoc+pfW/l3y9pHl3
RrXRtIgFtYWicIoxufEsxO7Mx3JPfMZykxxV2KuxV8a/m7BNov8AzkBc3Ijbi19ZXkQAJMiukTNx
6k1fkuTxGpA+bXljcCPJ7usWb8l50BUEXtgtlTjF7Y2tPN/+cUSYfNnm204kD04yeR5MDHM60J7/
AGtznPnm9GOTE/zismsv+cg5WDmFbq6sJ4pQQCvOOJS1TtQOp+jJ4vqHvYZfoPue5xrm9JefAR9t
BWmUzk3QimH6PhnhaGaNZYpAVkjcBlZT1BB2IzHlJyYwYjq35F/lvqTtLJo6W8rA/FavJAAT3CIw
j/4XKDCJ6OQJzHVjc/8AzjX5BAbjNqC16Umj2+VYj+OIwRKDqJhdH+Rv5d2rMTp8lxUUpLPKQNqE
jiybnMiGmx9zjT1WTveW/nVoXlPy/Lp2maLYJa3UqtcXMgaRm9OvCMfGzfaYN92Y+rhCNABydHOc
7Mi9I8t/85U+XNL8s6bp13pupX2oWdrFBPcyND+9kjQKzly3LeldxXx8cw3OZVpn/OU35Y3UIa7N
7p8vBnaOWD1ByXogaIvUt26DxIxVlOl/nf8AlTqUKyQ+ZLSHlSqXRa2YE9iJgn9MVT/TfOvk3VLg
W+ma9p19cGgENtdwTOa9PhR2OKvJP+cpvICan5bh822cdb/R6RXnEbvaSNSpp/vqRq/Itirz38nv
Mh1LSn0m4bldacB6RJ3aBtl/4A7fKmb/ALO1PFDhPOP3PPdp6bhnxjlL73pMcWZxLrwEQkWQMmYi
8e/P/TeFxo+oAbOksDnsOBV1+/m2ajtIbgu57MO0gyj87NfXUPyH8g1fnJdfVpJD1Je1s2hkPj9t
zmsdqnP5aWgj8iaPsRzgD0Nf2iTt7Hrm/wBKaxh53V75SyRocyhJxTFQeLJAsDF5F5sXVPP/AJ8s
vJOhEPBFKBcTqCyK4H72VyP2YVNPnUdxml7Q1HHLhHIfe73s3TcEeI8z9z6u8p+VtI8raBaaHpMX
p2lonEE05SOd3kcjqznc5rnZJvirsVdirsVfJf8AzlSz2H5p6be2jGK5Gm21wsq9RLHczhWHuOC4
QaNoIsUXsuj8rrTrW4atZoY5DXr8Sg/xzd8ezoeDdNEs9umVmbYMbns9umImpxvHv+cWXMX5gear
VyWk+rsS/j6dzxP38s1Eubuo8mP/APORl4lp+dUF1OplhtobGVo69URuRUbjrvhiaIKJiwQ9whG4
zeyeeCb2iDbMaZcrGE6tIgQMxJlzIBGvbAJXKhJuMEru4wK5kQLjTCSXijfMuBcPIHz1+ZNgt9+c
dhbXYV7dreJlRwCrJGsj8SO9WUjfK44xPUxB5NsshhpZEc03byh5YYODplv8Zq1EAP0U6fRm+/I4
f5odB+ezfzyh28h+UWBB05PiJJo0g6+FG2yH8nYP5v3tg7Sz/wA77kJdfll5TnUCOGW1I/ailYk/
8jfUGVT7JwHkCPcf122w7XzjmQfeP1UkGo/lJIpL6bfVoPhjnWh5f669v9jmFl7FP8Evm52Ltz+f
H5JhY+fPzQ8k2D6frTfpnyzeo9pcafeSGeNo5FKukctTJESleP7P+Sc1eo0WTFvIbO00+tx5jUTu
xj8sL5rTz5YC3Lehcu9uwYhS0bqactwKghT8xtjopmOULroCWI+T6SjjzfkvOgIhI8rJbAGA/nlo
xu/JJukTlJp86TFu4jasb/8AEgfozB1sbhfc5+glU673l2v60l5+UXlLT9/VsNR1WECtfhpbT/R/
vTtmod0+jNJsfquk2VqV4mCCKMr4FEA7/LOghsAHnJ7klXaLJgtZDFfzG8xDy75Wu75G43bj0LP/
AIzSVAP+xFW+jK9Rm4IE9W3TYOOYHRE/84q+R5dP0C8823qkXOsn0bIN1FtEx5P4/vJfwUHvmgei
e74q7FXYq7FXYq+Xf+cvkYeYvLz8TxazmAamxIlBIr7VxV6r5B5XHk7QZm+1Lp1o7d92gQ5sxL0j
3OqMfUfey6G0qOmUym3Rg6a0oOmMZrKDwb/nG+EQ/m55xiWpSKK5QE9aC9UCv3Zhy5ubHkEj/wCc
phb3H5p6bbiNlJ0+2jmeMcnbncTfZXuQp28cQN0k0HslkQIYqEsOK0Zup26nN8eTzwTm0kG2Y0w5
OMp1azgUzFnFy4SRb3QK0rlYg2maW3cwNcvhFx5ySW7cb5lQDh5C8B/PJ5tL86aBrgFUEXADufQl
5Ov0rNlOeZx5Yz7nJ08BkxSh3sujiWRFdDyRwGVh3B3Bzp+O3ljCl/1f2x4l4VptzjxI4VjRMMla
KQ9za29zC8FzEs0Mgo8bgMpHuDglESFEWExmYmwaLzLzh+X8mmB9W0ZittBSRoAW9SLj+2jEkkDr
4jOe13ZnBc8f0jp3PR6DtTxKhk+o9e97X5B8y23mTy5bX8b1uEURXqGlVnQDnUDs32h7HLcObjiC
0Z8JxzIZSiZIlgAl/m20nl8p6ykIUymyuOCuAysRGx4kHsemU5T6S34R6h73yr5fdr7U9G0icc7I
6gjen4m5eKOT71iXNNAbh3kzsX2O1qRm6E3RGChJERkwWBDxL82Fu/NP5haF5KsG+IvGshHRZLlh
VmHhHEvL6Tmu1uS5CPc7PQY6iZd76u0nS7LSdLtNMsU9OzsoUt7dPBI1Cr09hmC56KxV2KuxV2Ku
xV8zf85hel+kPK9Fb1fSvObVPEryh4gLWgINan+mKvUfy6YHyT5ePEJXTbM8BWg/cJsK1O2bAfSP
c60/Ufeze0ZKCuY03KgW7pkoaYwWZeF/844z2c/5j/mFNAvFJbkyW6tTmImupjTv4rXfKZc2+PJi
H/ORulanc/nNax2ELy3dxZW00CCpqI2kBYUoaD0zXJQiSaHNjkkBEk8nsMEgZFYEMCAQw6H3Gb4v
PBHW89MqlFtjJIPzR1zzNpXk661Ly6zC8tavNQIwWAqVeQhhX93XmOPhU1FRmHnBAsObpyDKi8mm
/N/85fLNjpOo6slpc6VrFv6ultIkTJJHGF50Nu6OrpzAYP37ZiDKQ5pwxLJtG/5yX0G6Kxa3p0+n
yGgaaEieIHuSPgcD5BsyIZ49XGnp5dGcaV5w8ua8nPSdRgu9qmNGpIB/lRtR1+kZnY5xlyLr8sJR
5hgP5+acbrydHeKPisLlHY+CSAxnt/My5VrYXC+5u0M6yV3hv8vbs6j5P02djV0j9B/GsJMe/wAw
oObLR5eLFH8cnV67Dw5pD4/Nkf1f2zK4nF4VrW/tjxI4VJ7f2yYkxMUNJb+2TEmBigL+wgurWa1u
E5wTKUkU9wwpkpxE4mJ5FEJGEhIcwwL8tL+78n/mH+g7uQG01ErbOQfhLtvbvTx5Hj/sjnLQgcGY
wP47nq5zjnwiY/He+jII6nM2RcCITBYYlhd5f7tVJeoqOIG+2Y8pOTCD5B/K+zbUvzL0CMAAm/ju
CBsP3Lesaf8AAZrIfUHa5PpL7LktaDpmeJuuMEuu4kjRnchUUEsx2AA3JOXRk0Sg8m/5x708+avz
R8x+eZ1LW9lyjsWYUIa5rHHT/UtkKn/WzVZJcUiXcY4cMQH0rkGbsVdirsVdirsVfLX/ADl7IT5m
0CP1AQtlI3pb1XlLTl4fFxp9GKvXPKEwTy5pK8QlLO3HBegpEuwpm04dg6ji9RZLFd0HXKjBvjNu
W8qOuIgspvBf+cZGVvzT81MoIVrecqD1obtOuwzBlzc+PJr/AJyliltvzE8sakJTaKbVVW9ReTRm
C5Z2eg3PpiQNTDA0R0RMXE9XoVpcQyQRSQENC6q0RX7JUiq09qZ0VdzzV77oxJMgQzBW6hCl9pt3
YSn9zeQS28tP5JkKN+DZVPHxAhsx5DEgvnu8mn1L8nLrRLun6S8jat37Wd8zxuorv8N0N/mM0hFO
/BsWm/kTQ9E8y+TrcanaLcT27SW7XBBWX4W5LSQcWoFYDqRm/wBJjhmwjiFkbPPazLkw5zwGgd66
KGpfkiRJ6+h6k0MgNUjuAdj7Sxiop/q5Rl7MHOB+bfi7VPKcfkhtR8qfnKultpD3X6T064AWWP1o
5aDkCAWuAsgoVB+HplE9NnA4eY/He5ENTpyeLkfx3PSPI3lBvLegxafJObiYsZZm/YDt1WMfyj36
/hmx02Lw4Vbq9Vl8WfFTHfzG/MHUNA1K20jSLZZ9RnVXYSI715sBGsaoRyLUZT+GY+r1pxmo83J0
ehGQcUuSn5H/ADXtNevI9M1OBbK/l2gkQkwyN2QcqlWPap3+e2HTa8TNS2KNV2cYDijuGfvBmyEn
WGKGlhywSazFBzQ5bGTVIPJ/zZtJLPVNM1aD4JaFOY7PCwdD8/i/DNH2xCpRmPxTvuxZ3GUD+LfS
ehXcd9p1pep9i6hjmX5SKGH68iZWLSI0aZFaRg0zGmXKgHyt/wA456XHqX5r2s/ot6NnFcXKhalU
JQonIjt8e1cwYnd2EhYfXNzAADl8ZOPOLAvzVvYtP8g69cPP9XrZyxRyb19SZfTRRQE1ZmAHhls5
VEtMI3MKn/OOPlkaJ+V2nyuvG51d31CbbektFh38PRRD9OYLsHp+KuxV2KuxV2KuxV8n/wDOVTQ3
/wCZGlWNo0j362MVvJCaemDJM7Rcf8pvU+L6MIFmkE0Lew6aiWVnb2sQAjt40iRR0CooUUr8s3nB
tTz/AB72mCXm3XIGDYMjnvKjriIKcjyT/nGmD0fzW83RAHjFDcJWlOl4oH6s08xUi7qBuI9yn/zl
ncNbebfLNwoBaK2kcKaEHjMDQggihwRNG2UhYpmOi3v1nSrK54qnrwRScErxHNA1Fr232zpY7xBe
WltIjzTJJcTFIkqiXIcLLieAfmfHJoXnPW40ISw8yWPKVaVBYOso/wBl9ZtVb6c02sx8M/e7zRZO
LH7tkz/Iq59Sy1SzLH91LFKqk7fvFKkgf8898z+y5+mQdd2tD1RL1uKHNkS6wRRKQ5WZNgirLDkO
JnwvKNFsx5m/5yRsYd0h0iZZW5j/AJYEMopSuzSgUr45pNXPiyF32jhw4whv+cmvLNn5b8/2Gs6S
n1U6nELlo41CIlxbsFLpxoBUcSfffvmODRtySLFF6Xo91+ktFsNRK8DeW8VwU8PVQPT8c6THk4og
97y+XHwyI7l8sWXgtBig5ostiWqQecfnHCv+GoHI+JbtOJ+cbjMHtbfEP6363YdkbZj/AFf1PWvy
svEufIegyI/MLZxRFveEemR/sSlMwce8A5uTaZ97O4Z/TiZ9vhUn4jxGwruewyqYboF4D/zjN5b8
2aJ53ur3UtHvbKwudOlhE9xDJDGX9aGRftha7KaZhRiXPlMPpC5nBBy6MWicnjf5/S3V/peieVrJ
gLnzDqUNuF6kopG9K9BI6E45zsAuAbkvc7Cxt7CwtrG2XhbWkSQQJ4JGoVR9wzGcpXxV2KuxV2Ku
xV2KvjP8379tV/P26WJjxivrKziK7kGJYkan/PTlk8YuQ97DKaifc93SXOgIebElQS4KZW4y40tv
L/8AnHBm/wCV1+aRU8TaXxI7VF/BT9eaDJ9R970OL6R7kd/zlJ9RTzj5ZuLtlaOO1uW9L4TV4mDo
sgP7DsQPfDiri3XLfDsll1+b3li1AgsEn1OdQAI7WIhNtur8dvkDm7nr8Y2j6vc6GHZ+Q7yqPvV/
L35ppeamlhrOmTaI10aafJccuErCgK8mSOjVO3bt8xj1dyqQMb5Msuj4Y3GQlXOmdibMvhcLieVf
n1YpJa6RqZXaGZ7eUjeokAdf+TbZrO0obAu17LybyCUfkJdD9M6lZemhMluJhJT94PTcKVB/lPqb
5X2bL1EeTZ2pC4g+b3SKPNpIupiEUkeVktoCISAntkDJmIsA/JfSYdX/ADv83eYDBIkekGS1hJ3X
12b0GYmg3KROQvv7ZpcxuZ97vcAqA9ySf85eanbTeY9A02N1a4tLWaWZVNSouHUIG22/uiev9tTa
zvytYfVPK2kWxBBis4FKsyuQRGKjkvwmniNs3+HaIHk87m3kT5ouWPMiJcaQQM0eXRLTIPMvzrdU
8t20Zryku0IpSnwxv1+/MHtSX7oDz/W5/ZMf3pP9H9TJf+cfvMD3flN9Nk9MfoyVkhC1DlJSZCXB
O/xOdxmFpZXCu5zdZHhnfe9fguKU3yyUWuM0Yl3QdcqMG4TWyXVR1wiCDN5N5XkPnP8A5yIe5/vN
L8oW0ix90M/93/wXqysR/qZhZpXJzsEai+hMqbnYq7FXYq7FXYq7FXxH5eMfmf8AOS91WOVWt21C
61NC5ZS6CYvGEBqa/EpoewzK0WPiyDy3cTXZOHEfPZ7ys2b8xedElQT5HhZcTjPjwrxPLdU/JSwu
NTuL+z1eezaeRpeHAOV5mrgMGQ99v45gT7NBJILsYdpmIAMb+K2w/JHy5b3Amv7y4vlBqYtolY/5
RWr/AHMMnj7MiD6jbDL2rMj0ivtZlYaRo2lRmPTbOG0UgBjEgVmA6cm+030nNljwxjyFOry5pT+o
2878xy/pH829EszvHZqknHr8ac5yfuVc12o9WpjHu/tdnpvRpZy7/wCx6kJ82nC6niYN+csLXHk/
1QxH1a4ikYA0BDVjoR33cHNd2nD93fcXZdlz/e13hhP5MXL2Pn9LOT4WuYp7Zh/lIPUp98WazQyr
J73a6+N4/cX0dEubcl00QjbeHkcplJtjG00gtKjpmPKblRghdeTWNC0m5m8haLYnW9QcPfPOfQjZ
wp/fsqUEj161IrWpzAnjJJLsIZQAA8X0/wDJTzjrHnA+YPPN2tw8r+veFHo7yIaIiGOgVAFXpSg2
AyePBvu15dRts9bni4nNtEuokEFMuWxLVIIGdcuiWiQeMfmubjXPOOi+V7Ilp5GSMKOnrXciotR7
AA/Tmp7TyXIR7ncdlYqiZd/6Ff8AJDTNY0rzxq1pN8EVostlfRhh/vRFJRRwJ5GnB96ZRogeLycj
XkcI73vkc5GbExdYJK4ushwMuNK/NHmJdG8v6hqjUP1OCSVFPRnC/Av+yagyM/TElnD1SASn/nFX
QHt/JmoeYrkFrvXbxj6zbl4reqA1/wCMrS5pnePbMVdirsVdirsVdirH/wAwNbGh+R9d1atHtLGd
4a95ShWIfS5AxV8p/knZWzpeX8kS+vbOY4JgRypKo5gr1oOA4n3ObnsvGCDLudJ2tkIIj3vWlnzb
GLphJeJ/fBwsuJxn98eFeJY0+ERYmSi8/vkxFiZIWWfLBFrMnnNii3P5v3lwrBltLfnt2PpJER97
nNTCHFrD5D9ADt5z4dEB3n9JL0QXGbfhdPxJH55j+ueUdUhpyPoGQD3iIkH/ABHMTXY7wy933buZ
oMnDmj7/AL9nlNldRaB510XVIaiCRLK7leUrQ+vEguipFAF9RpAK/Z+iucvhnwzBeqzQ4oEPqWIZ
vS8+E1slG2Y+QuTjCe2cSmmYcy52MJi1sojrlAlu3mGyU3sYFcyYFxcgSK8UVOZkC4WRLZsvi48k
m1vUbTTNPuNQu39O2tkMkjew7D3J2HvlhmIizyDWIGUgBzLCP+cefKeo+a/P155/1WFhY2Tu1ozD
4HunHBVQn7Qgj+48c5zLkM5GR6vTYsYhERHRKfLYku/z88z3dvMkVrFfah6yAgiZfXZV47fzqJK+
2ZOhiTNxtfIDG9lWXNvTpgV3qYKTbzj8+dWa28lLZofi1C5jjcf5EYMp/wCGRcw9aahXe5uhFzvu
D3f8udAPl/yJoWkMnpy2tnELhPCZ15zf8lGbNS7hkWKuxV2KuxV2KuxV5F/zlFrS2H5XyWQcLLqt
3BbhO5SNvXany9IVxV5D+VNi9j5b9d2P+nSGVU5VAA+AGlBQnj79vlnTdl4THFf855btbMJZaH8L
N1uPfNiYutElQXHvkeFlxONx748K8Sxrj3yQixMlF7jJCLEyUGkJyYDElgOmy31r558wX0enz3dp
CIUvrq3UuttG4UiSWg2T4dz2pmgGqji1UzIc9noDpZZtJARPLf382a2eo2d4hktLiO4QbFonVwCR
XfiTm8hkjMXEg+50M8coGpAj3qsoEsTxOKo6lWHiCKHJSgCKPVEZmJBHMPJfOuhyWehaf6jEz6Pc
3OkSArQtAzfXrSb/AJ6rdSUr2XOHyQMJGJ6F7vHMTiJDqHv/AOX+vNrnlLTNSevqyxcJ6mpMsRMU
h/2TITm5xT4oAujzQ4JkMxs5AKZGYZYyndpcAUzEnFzYSRrXgKUrlPA3HIlt3ODXL4Rceckku3qc
zIBwplj/AJg1/R9Es2vNVuktbcGgZqksfBVFWY/IZZKcYiyWuOOUzURbyC2l8x/nH5wh0LTFksfL
cLc7yalQkINfVl7F2pREr1+k5qdTqjkND6XcabSDGLO8n0R55vtM/Lr8p786TGtpDptn9V0yNeom
l/dRt4s3N+bHqdycxXLfPf5E6dZvbXeqPE/1yCR4En3CFZVRmXruw4DttX3223Z2MEGXV0/aeQgi
PR68s2bLhdWJL/WwcLLiYB5ktn8y/m15O8qsA9mkg1C6TxSMs7hv9hAR9OantGXqA8ncdmx9JPm+
nM1zsnYq7FXYq7FXYq7FXyp/zlxrLT+cNI0hZQ0VjYmdo1IPGW5lYMGodjwhQ79j74qi9NVLPS7K
CXhAyRRRcK8V5hQOK1987jEOGEQdtg8JlPHORG+5UrnzNolpJ6c14ity4tSrBSd/jKghP9lTIT1W
KJolnDS5ZCwPx+lCXvn7y3aI7G9SYxmnCEh2Y1oeND2ynJr8Mf4r9zfj7PzS/hr3tN+YHlZVUvqC
KWp8IDORXx4Bh+OP8oYBzl+Pgv8AJ2c8o/j4oiy83+Xb+ZYLXUI3meoRDVSSN9uQGWY9ZhmajIW1
ZNFmgLlE0m2ZTitYqmX5IEWf5veYLZ6D9JaXHdQ9q+jIkTD3NSTnJ9qQrOfOvueu7JneAeV/e9E8
y/kt5P1S4uNS02EaLrs4FNQteQSoYMTJbB0ik5Uo1Rv86HMPDmljlxRO7mZsEcseGQsMA1zyprWh
MqX6h1JYJcJQLIEIBcIGcoDUGhPenXOq0euhmFcpd36nk9ZoJ4TfOHf+tR80+VdJ138otf1JLb1N
a02FGkIYqClmzSxzEDq8UE0yA91qD2I0fa2LhzX/ADnfdkZuLDXWOzGf+cftcgl0K90cki5tJvXA
J6xzAD4R/kshr8xh0M7iR3MdfAiQl3vXoZeJzLkHDiUwhu6DrlEoN8cjCdZ/PfyVpGr3Gk3pu0ub
VzHMwgPAMPmQxr2NKZiHLEGnMjhmRbHtU/5yT8ootLKyvbp6V+JY4k+VS7N/wuH8zEdEflZHqGKz
/nd548w3JtPK2g1mNPgjSS9mp40RUUfSpyMtbLoKZR0MeptPtB/5xy/MHzVqa6l+YOpmzhU0a3SR
J7llrXinDlBEp9q/6uYs5mRsly4Y4xFAPobyr5S8v+VdIj0nQ7RLS0j3bju8j0oXkc/E7HxP6siz
eLf85Ta0982i+S7WVUkl9TVb2pNQkKOsQ4qCW5fvDTxA+ieOBkaDDJkEBZQnk/QrHy/o0dlZhwrn
1pjKQXMjgVrQL0AA6ds6bBpxjjQeW1GoOSdlPlmy3haeJd63vg4U8SV/lnare/n5qV1LQjTtGHob
moaR41r/AMC75z2v/vT8Ho+zh+5Hx+99AZhuc7FXYq7FXYq7FVK7uoLS1mup24QW6NLK57IgLMfu
GKvgHXPM2p+YfOV7r7xmbUNQuGlgh4iXiWNIkCsG5cEoqinYZOE+E2wnDiFPQbD8j/zi843kc+p2
o0q3QKiz37rGQFHX0owZC3epUbntlmfUTym5FrwaaGIVEPUtB/5xV8rxRI3mTVrzWbhBRVQ/V4Vq
SzAD95Idyf2x8sqlInmW2MAOQZrpv5GflPp6KsPly2lK/tXJkuCT4n1mfIsk5H5cfl4KEeV9I2BU
f6BbbKagj+76bnFUHd/lF+WV0rBvLOnRs24aG2ijIIBAICqB36Up44qwXVvyB1DTYJG8k6wIlJDj
TdWUzRFuhCTx0eNafs8G37jM3T6/LiFA7ebg6js/FlNkb+TH7vy75s0tpI9a0xrf024rdwsJraUU
ryRx8S/6rgH550Gj7Qjm2O0vxyed1vZ08O/OP45p1+X2hPfeaLDU7SVYb/Rnd3VgeE9ndJ6NxGxA
J5IeDx9qgjvUYHbeL6Z/D8fa7DsPL9UPj+Pse3ZoXoFskcciNHIodGFGRgCCD2IOEEjcIIBFFI4v
JejQDUo7ZGhtdVga3u7UGsdGBXkoPTZzt0zIzaueWIEt669XGw6SGKRlDbi6dHx7+VjXmgfmd+ir
gFZeVzp92vg0VT0/4yRDJaKVZB5sddG8ZPc+i0lzcEOkBVll98iQzthP5R+VvKGsfmf56S90q11C
3tTbCGO9hS4VJH5esyiVW3Z1O+aLKPWfe9BhPoHuD2SH8uvy+hcSQ+WNJjcdHSxtlP3hMrbE8trW
2tYhDbQpBEOkcahFH0LQYqq4qgNf1zTtB0W81jUpRDZWMTTTOfBeijxZjso7nFXyXocmrec/NV95
31aXj9ZnIt7apYxxIQ0caHYBFAC+4rX7Vc3PZmkMvWeTpO1NYI/uxzehLP75vTF0AkqCfI8LLiXe
vg4U8Sn+VVytt+eWoxTbfpLRQ1u3iYpY6r77Ix+jOb7ShWY+dPTdlzBwjyJe/wCYDsXYq7FXYq7F
XYq4gEUPTFUh8v8AkTyd5durm70TSLaxurxmeeaJPjJY8iqk14rU/ZWi+2Kp9irsVdirsVdirsVW
TQxTRNFKoeNwVZT0IIocVQNj5d0awvpL6ytlt55U9OT06hSKhvs/ZrUdsvyanJOIjI2A4+PS44SM
oiiUxyhyHYq7FXx/+Ztg1r/zkPex6bdC0uZri2mjcbASTQRvIjUP+7AzfOtO9cv04JmKNFo1JAxm
xYevJNnRGLzIkqrNkOFmJMW/5x0uh/ys38wIDu8s7yAk70jupV6f7MZz2f65e8vS4P7uPuD6Gypt
dirsVfO3/OTHmbUtW1Sy8h6SpkiiEd9rHFgtSzcYI2PYKPjIPip7ZdgwyySqItpz54443I0kVpfa
Fp0UNmt1a27AKqwCVB8VAtByPI9KDOvhPFACNxHxeNnjyzJlUj50i4ta0ySVYo7yB5X+xGsiFm2r
sAanbJDLAmhIX72BxTAsxNe5HCfLOFhxN+vg4U8S23Elvr+j+ZbYH19Cu45bxl6/o64YW12aDrwW
VX9gGOaXtnD6Yz+Du+xc3qlDv3fR2c+9E7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FW
D/mL+cHk/wAkWkwvbtLnWFStvpELcpmYiq+pSvpKevJ+3Sp2xV8u+SH1zzP+YUnmzUE9T1Jp7i5n
AHprKyUVFBrTiHHH2Htmw7OwylkEq2Dre088Y4zG/UXtCT5vzF54SVRP75HhZcTDfIl3/hP8/wBX
uH9LT/NEckEcrEcTJNxcKfc3EYUf6wzntdi4Mh893pNBlE8Q7xs+n8w3NdirsVeX+Zf+cdfIPmPz
Le+YNSm1A3V86yTQJOoiqqhfh5RtIK8enPbtTFVfTP8AnHb8pLBuf6GN29KVup5pB1rXjyC1+jFU
4f8AJ78snkeU+XrUSOKB1DqUHYRcWHp0ptwpTDaKCUT/APOP/wCXhuzdWSXunysG5C3vZ+JZgQGb
1GkJ4k1ArT6NsshnnE2CWueCEhRAQj/kvc26qlrq73ahWLPdogk5CnED0lRSDvUnp79tpp+2JR2m
OJ1Oo7FhLeB4Vnlnyd5l0bzDZT3ll6lnLyiueDJIoSVCpDgE7Cu+1MydVrcObDIA0fNxtJoc2DNE
kXHyerZzr0jsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVSfzh5mtPK/ljUdfu0aSDT4TKYl2Z
2qFRAd6cnIFe2KvlfWf+civza8yXbxaGU0u2ZwqQWcSySBXNFDzShzX/ACl4/RlmPFKZqItryZYw
FyNMf8vflxqV3fvfeZalHZmliaUvNLITUs7qTsTvXlU5t9J2TIm8mw7nT6ztiIFYtz3vULFLe0to
7a2jWKCJQscaigAGb2OMRFDk6CWQyNk7lGpce+AxUSVBcZHhZcTH/OnluLX9PX0m9DVLQ+rYXQJV
kcb05DcA0+g75h6zRjLH+kOTm6LWnDL+ieb1X8mPzTXzdpjaTq9LbzdpK+nqNq1FMqpRfrCDuDtz
p0b2IzmJRMTR5vVRkJCxyL0rIsnYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7F
XYq7FXYqhdU0vT9V0+407UbdLqxukMdxbyCqup7HFXzT+Y3/ADjfrHl6uteRHn1GASM8ulHeeJBQ
p6ZBBm4mu1OXT7W+ThkMTYYZMYmKLCfLv5hait5c2evxhJIz0KCF0IJ5q4Yr9nw65vNH2rIkjI6H
WdkxABxs6sNQtL+2W4tX5xMSKkFSCOxVgCM3ePJGYuPJ0eTFKBqXNFBiMnTC2xK2Ck236zY8K2ld
5o8z6tba3pN2dK8wWZBtdRSpXbbhMoB5xkbNsdux6HW6/s8ZRxR+v73Zdn9onCeGX0fc+jPKWrar
quhwXWrWP6P1D7FxCrrLCxABEsEikh4pAQy9x0O4zliCDResjIEWOScYEuxV2KuxV2KuxV2KuxV2
KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kse81fl75M81xcNe0mC8enFbgrwnUf5MycZB
8uVMVeO6t/zjDrGmTfWPJPmRoVDFksdSWqCv/Fkasp/5FfTl2LUTxn0mmjNpseQVIWx+fyV+dugW
0cU/l5NZjjHx3FpcJIxoaUCbSdBX7B/gNji7YnEAEW63N2NCRJB4VC0ufPcsrRz+R9Xt1QHlI0Lq
gI3+3KsSU268v15lx7bj1iXEl2HLpIfJHQQedbiOIQeT9X+sSH4oprcwKgrQFpJeK7/hkz21jrkb
YDsTJfMUzrRfyq803MRfVRb6e9WCxJKZyQrAAswVQOQqRSvvQ7ZWe2xW0ftbR2Gb3l9j1LQdGi0f
S4tPilkmjhrxeSlfiPIgUA2qc0uoznLMyIq3d6bAMUBAG6TDKG92KuxV2KuxV2KuxV2KuxV2KuxV
2KuxV//Z
-               
-            
-         
-      
-      
-         proof:pdf
-         uuid:65E6390686CF11DBA6E2D887CEACB407
-         xmp.did:0180117407206811B34BA05DB10BBD00
-         uuid:6430ca7d-3b67-9f47-9e6e-92d8e8a06d18
-         
-            
-               
-                  converted
-                  from application/pdf to <unknown>
-               
-               
-                  saved
-                  xmp.iid:D47F11740720681191099C3B601C4548
-                  2008-04-17T14:19:21+05:30
-                  Adobe Illustrator CS4
-                  
-                     
-                        /
-                     
-                  
-               
-               
-                  converted
-                  from application/pdf to <unknown>
-               
-               
-                  converted
-                  from application/pdf to <unknown>
-               
-               
-                  saved
-                  xmp.iid:FD7F11740720681197C1BF14D1759E83
-                  2008-05-16T17:01:20-07:00
-                  Adobe Illustrator CS4
-                  
-                     
-                        /
-                     
-                  
-               
-               
-                  saved
-                  xmp.iid:F77F117407206811BC18AC99CBA78E83
-                  2008-05-19T18:10:15-07:00
-                  Adobe Illustrator CS4
-                  
-                     
-                        /
-                     
-                  
-               
-               
-                  converted
-                  from application/vnd.adobe.illustrator to application/vnd.adobe.illustrator
-               
-               
-                  saved
-                  xmp.iid:FB7F117407206811B628E3BF27C8C41B
-                  2008-05-22T14:26:44-07:00
-                  Adobe Illustrator CS4
-                  
-                     
-                        /
-                     
-                  
-               
-               
-                  converted
-                  from application/vnd.adobe.illustrator to application/vnd.adobe.illustrator
-               
-               
-                  saved
-                  xmp.iid:08C3BD25102DDD1181B594070CEB88D9
-                  2008-05-28T16:51:46-07:00
-                  Adobe Illustrator CS4
-                  
-                     
-                        /
-                     
-                  
-               
-               
-                  converted
-                  from application/vnd.adobe.illustrator to application/vnd.adobe.illustrator
-               
-               
-                  saved
-                  xmp.iid:F77F11740720681192B0DFFC927805D7
-                  2008-05-30T21:26:38-07:00
-                  Adobe Illustrator CS4
-                  
-                     
-                        /
-                     
-                  
-               
-               
-                  converted
-                  from application/vnd.adobe.illustrator to application/vnd.adobe.illustrator
-               
-               
-                  saved
-                  xmp.iid:F87F11740720681192B0DFFC927805D7
-                  2008-05-30T21:27-07:00
-                  Adobe Illustrator CS4
-                  
-                     
-                        /
-                     
-                  
-               
-               
-                  converted
-                  from application/vnd.adobe.illustrator to application/vnd.adobe.illustrator
-               
-               
-                  saved
-                  xmp.iid:F97F1174072068119098B097FDA39BEF
-                  2008-06-02T13:26:10-07:00
-                  Adobe Illustrator CS4
-                  
-                     
-                        /
-                     
-                  
-               
-               
-                  saved
-                  xmp.iid:FFE440664A3DDD11BD33D3EB8D3A1068
-                  2008-06-18T22:23:18+07:00
-                  Adobe Illustrator CS4
-                  
-                     
-                        /
-                     
-                  
-               
-               
-                  saved
-                  xmp.iid:686AE2A5723EDD11A6F1BABF7C5A7A51
-                  2008-06-19T20:14:43-07:00
-                  Adobe Illustrator CS4
-                  
-                     
-                        /
-                     
-                  
-               
-               
-                  saved
-                  xmp.iid:696AE2A5723EDD11A6F1BABF7C5A7A51
-                  2008-06-19T20:29:57-07:00
-                  Adobe Illustrator CS4
-                  
-                     
-                        /
-                     
-                  
-               
-               
-                  saved
-                  xmp.iid:0B9FED37200A11689FE8CB9EA85C5459
-                  2008-06-26T06:08:02-07:00
-                  Adobe Illustrator CS4
-                  
-                     
-                        /
-                     
-                  
-               
-               
-                  saved
-                  xmp.iid:8FA7BEF06548DD1194DA8463B7D22218
-                  2008-07-02T11:53:26-07:00
-                  Adobe Illustrator CS4
-                  
-                     
-                        /
-                     
-                  
-               
-               
-                  saved
-                  xmp.iid:0180117407206811B34BA05DB10BBD00
-                  2011-06-22T15:38:57+02:00
-                  Adobe Illustrator CS4
-                  /
-               
-            
-         
-         
-            uuid:e4313704-06b8-49c7-8650-a20a5315a7dd
-            xmp.did:8FA7BEF06548DD1194DA8463B7D22218
-            uuid:65E6390686CF11DBA6E2D887CEACB407
-            proof:pdf
-         
-      
-      
-         Web
-         Document
-      
-      
-         1
-         False
-         False
-         
-            549.000000
-            422.999512
-            Pixels
-         
-         
-            
-               Cyan
-               Magenta
-               Yellow
-               Black
-            
-         
-         
-            
-               
-                  Default Swatch Group
-                  0
-                  
-                     
-                        
-                           White
-                           RGB
-                           PROCESS
-                           255
-                           255
-                           255
-                        
-                        
-                           Black
-                           RGB
-                           PROCESS
-                           0
-                           0
-                           0
-                        
-                        
-                           RGB Red
-                           RGB
-                           PROCESS
-                           255
-                           0
-                           0
-                        
-                        
-                           RGB Yellow
-                           RGB
-                           PROCESS
-                           255
-                           255
-                           0
-                        
-                        
-                           RGB Green
-                           RGB
-                           PROCESS
-                           0
-                           255
-                           0
-                        
-                        
-                           RGB Cyan
-                           RGB
-                           PROCESS
-                           0
-                           255
-                           255
-                        
-                        
-                           RGB Blue
-                           RGB
-                           PROCESS
-                           0
-                           0
-                           255
-                        
-                        
-                           RGB Magenta
-                           RGB
-                           PROCESS
-                           255
-                           0
-                           255
-                        
-                        
-                           R=193 G=39 B=45
-                           RGB
-                           PROCESS
-                           193
-                           39
-                           45
-                        
-                        
-                           R=237 G=28 B=36
-                           RGB
-                           PROCESS
-                           237
-                           28
-                           36
-                        
-                        
-                           R=241 G=90 B=36
-                           RGB
-                           PROCESS
-                           241
-                           90
-                           36
-                        
-                        
-                           R=247 G=147 B=30
-                           RGB
-                           PROCESS
-                           247
-                           147
-                           30
-                        
-                        
-                           R=251 G=176 B=59
-                           RGB
-                           PROCESS
-                           251
-                           176
-                           59
-                        
-                        
-                           R=252 G=238 B=33
-                           RGB
-                           PROCESS
-                           252
-                           238
-                           33
-                        
-                        
-                           R=217 G=224 B=33
-                           RGB
-                           PROCESS
-                           217
-                           224
-                           33
-                        
-                        
-                           R=140 G=198 B=63
-                           RGB
-                           PROCESS
-                           140
-                           198
-                           63
-                        
-                        
-                           R=57 G=181 B=74
-                           RGB
-                           PROCESS
-                           57
-                           181
-                           74
-                        
-                        
-                           R=0 G=146 B=69
-                           RGB
-                           PROCESS
-                           0
-                           146
-                           69
-                        
-                        
-                           R=0 G=104 B=55
-                           RGB
-                           PROCESS
-                           0
-                           104
-                           55
-                        
-                        
-                           R=34 G=181 B=115
-                           RGB
-                           PROCESS
-                           34
-                           181
-                           115
-                        
-                        
-                           R=0 G=169 B=157
-                           RGB
-                           PROCESS
-                           0
-                           169
-                           157
-                        
-                        
-                           R=41 G=171 B=226
-                           RGB
-                           PROCESS
-                           41
-                           171
-                           226
-                        
-                        
-                           R=0 G=113 B=188
-                           RGB
-                           PROCESS
-                           0
-                           113
-                           188
-                        
-                        
-                           R=46 G=49 B=146
-                           RGB
-                           PROCESS
-                           46
-                           49
-                           146
-                        
-                        
-                           R=27 G=20 B=100
-                           RGB
-                           PROCESS
-                           27
-                           20
-                           100
-                        
-                        
-                           R=102 G=45 B=145
-                           RGB
-                           PROCESS
-                           102
-                           45
-                           145
-                        
-                        
-                           R=147 G=39 B=143
-                           RGB
-                           PROCESS
-                           147
-                           39
-                           143
-                        
-                        
-                           R=158 G=0 B=93
-                           RGB
-                           PROCESS
-                           158
-                           0
-                           93
-                        
-                        
-                           R=212 G=20 B=90
-                           RGB
-                           PROCESS
-                           212
-                           20
-                           90
-                        
-                        
-                           R=237 G=30 B=121
-                           RGB
-                           PROCESS
-                           237
-                           30
-                           121
-                        
-                        
-                           R=199 G=178 B=153
-                           RGB
-                           PROCESS
-                           199
-                           178
-                           153
-                        
-                        
-                           R=153 G=134 B=117
-                           RGB
-                           PROCESS
-                           153
-                           134
-                           117
-                        
-                        
-                           R=115 G=99 B=87
-                           RGB
-                           PROCESS
-                           115
-                           99
-                           87
-                        
-                        
-                           R=83 G=71 B=65
-                           RGB
-                           PROCESS
-                           83
-                           71
-                           65
-                        
-                        
-                           R=198 G=156 B=109
-                           RGB
-                           PROCESS
-                           198
-                           156
-                           109
-                        
-                        
-                           R=166 G=124 B=82
-                           RGB
-                           PROCESS
-                           166
-                           124
-                           82
-                        
-                        
-                           R=140 G=98 B=57
-                           RGB
-                           PROCESS
-                           140
-                           98
-                           57
-                        
-                        
-                           R=117 G=76 B=36
-                           RGB
-                           PROCESS
-                           117
-                           76
-                           36
-                        
-                        
-                           R=96 G=56 B=19
-                           RGB
-                           PROCESS
-                           96
-                           56
-                           19
-                        
-                        
-                           R=66 G=33 B=11
-                           RGB
-                           PROCESS
-                           66
-                           33
-                           11
-                        
-                     
-                  
-               
-               
-                  Grays
-                  1
-                  
-                     
-                        
-                           R=0 G=0 B=0
-                           RGB
-                           PROCESS
-                           0
-                           0
-                           0
-                        
-                        
-                           R=26 G=26 B=26
-                           RGB
-                           PROCESS
-                           26
-                           26
-                           26
-                        
-                        
-                           R=51 G=51 B=51
-                           RGB
-                           PROCESS
-                           51
-                           51
-                           51
-                        
-                        
-                           R=77 G=77 B=77
-                           RGB
-                           PROCESS
-                           77
-                           77
-                           77
-                        
-                        
-                           R=102 G=102 B=102
-                           RGB
-                           PROCESS
-                           102
-                           102
-                           102
-                        
-                        
-                           R=128 G=128 B=128
-                           RGB
-                           PROCESS
-                           128
-                           128
-                           128
-                        
-                        
-                           R=153 G=153 B=153
-                           RGB
-                           PROCESS
-                           153
-                           153
-                           153
-                        
-                        
-                           R=179 G=179 B=179
-                           RGB
-                           PROCESS
-                           179
-                           179
-                           179
-                        
-                        
-                           R=204 G=204 B=204
-                           RGB
-                           PROCESS
-                           204
-                           204
-                           204
-                        
-                        
-                           R=230 G=230 B=230
-                           RGB
-                           PROCESS
-                           230
-                           230
-                           230
-                        
-                        
-                           R=242 G=242 B=242
-                           RGB
-                           PROCESS
-                           242
-                           242
-                           242
-                        
-                     
-                  
-               
-               
-                  Web Color Group
-                  1
-                  
-                     
-                        
-                           R=63 G=169 B=245
-                           RGB
-                           PROCESS
-                           63
-                           169
-                           245
-                        
-                        
-                           R=122 G=201 B=67
-                           RGB
-                           PROCESS
-                           122
-                           201
-                           67
-                        
-                        
-                           R=255 G=147 B=30
-                           RGB
-                           PROCESS
-                           255
-                           147
-                           30
-                        
-                        
-                           R=255 G=29 B=37
-                           RGB
-                           PROCESS
-                           255
-                           29
-                           37
-                        
-                        
-                           R=255 G=123 B=172
-                           RGB
-                           PROCESS
-                           255
-                           123
-                           172
-                        
-                        
-                           R=189 G=204 B=212
-                           RGB
-                           PROCESS
-                           189
-                           204
-                           212
-                        
-                     
-                  
-               
-            
-         
-      
-      
-         Adobe PDF library 9.00
-      
-   
-
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                                                                                                    
-                           
-
endstream
endobj
3 0 obj
<>
endobj
31 0 obj
<>/Resources<>/ExtGState<>/Properties<>/Shading<>>>/Thumb 37 0 R/TrimBox[0.0 0.0 549.0 423.0]/Type/Page>>
endobj
32 0 obj
<>stream
-H�\�Ɏd�
E����u��Vm�+����
��