/* Generated by Cython 0.25.2 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "include/allele_ages.hpp", 
            "include/deps.hpp", 
            "include/evolve_regions_sampler.hpp", 
            "include/fwdpy_add_mutations.hpp", 
            "include/fwdpy_fitness.hpp", 
            "include/internal_callbacks.hpp", 
            "include/internal_region_manager.hpp", 
            "include/sample.hpp", 
            "include/sampler_additive_variance.hpp", 
            "include/sampler_base.hpp", 
            "include/sampler_no_sampling.hpp", 
            "include/sampler_pop_properties.hpp", 
            "include/sampler_sample_n.hpp", 
            "include/sampler_selected_mut_tracker.hpp", 
            "include/sampling_wrappers.hpp", 
            "include/types.hpp"
        ], 
        "extra_compile_args": [
            "-std=c++11", 
            "-fopenmp", 
            "-DPACKAGE_VERSION=\"0.0.4\"", 
            "-DHAVE_INLINE"
        ], 
        "extra_link_args": [
            "-std=c++11", 
            "-fopenmp"
        ], 
        "include_dirs": [
            ".", 
            "..", 
            "include"
        ], 
        "language": "c++", 
        "libraries": [
            "sequence", 
            "gsl", 
            "gslcblas", 
            "z"
        ], 
        "sources": [
            "fwdpy/fwdpy/sample.cc", 
            "fwdpy/fwdpy/deps.cc"
        ]
    }, 
    "module_name": "fwdpy.fwdpy"
}
END: Cython Metadata */

#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 < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_25_2"
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && 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_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #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
#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_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
#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_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
#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
#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"
  #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 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_FASTCALL
  #define METH_FASTCALL 0x80
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args,
                                              Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
#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)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              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
#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_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
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? 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
#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
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
#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) : PyInstanceMethod_New(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
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#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<class T> 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)

#ifndef __cplusplus
  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
#endif
#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #else
    #define CYTHON_INLINE inline
  #endif
#endif
template<typename T>
void __Pyx_call_destructor(T& x) {
    x.~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
    T *operator->() { return ptr; }
    T *operator&() { return ptr; }
    operator T&() { return *ptr; }
    template<typename U> bool operator ==(U other) { return *ptr == other; }
    template<typename U> bool operator !=(U other) { return *ptr != other; }
  private:
    T *ptr;
};

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#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; \
}

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

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

#define __PYX_HAVE__fwdpy__fwdpy
#define __PYX_HAVE_API__fwdpy__fwdpy
#include <vector>
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#include <utility>
#include <string.h>
#include <string>
#include <memory>
#include <map>
#include <stdint.h>
#include <math.h>
#include <stdio.h>
#include "gsl/gsl_mode.h"
#include "gsl/gsl_math.h"
#include "gsl/gsl_complex.h"
#include "gsl/gsl_complex_math.h"
#include "gsl/gsl_poly.h"
#include "gsl/gsl_sf_result.h"
#include "gsl/gsl_sf_airy.h"
#include "gsl/gsl_sf_bessel.h"
#include "gsl/gsl_sf_clausen.h"
#include "gsl/gsl_sf_coulomb.h"
#include "gsl/gsl_sf_coupling.h"
#include "gsl/gsl_sf_dawson.h"
#include "gsl/gsl_sf_debye.h"
#include "gsl/gsl_sf_dilog.h"
#include "gsl/gsl_sf_elementary.h"
#include "gsl/gsl_sf_ellint.h"
#include "gsl/gsl_sf_elljac.h"
#include "gsl/gsl_sf_erf.h"
#include "gsl/gsl_sf_exp.h"
#include "gsl/gsl_sf_expint.h"
#include "gsl/gsl_sf_fermi_dirac.h"
#include "gsl/gsl_sf_gamma.h"
#include "gsl/gsl_sf_gegenbauer.h"
#include "gsl/gsl_sf_hyperg.h"
#include "gsl/gsl_sf_laguerre.h"
#include "gsl/gsl_sf_lambert.h"
#include "gsl/gsl_sf_legendre.h"
#include "gsl/gsl_sf_log.h"
#include "gsl/gsl_sf_pow_int.h"
#include "gsl/gsl_sf_psi.h"
#include "gsl/gsl_sf_synchrotron.h"
#include "gsl/gsl_sf_transport.h"
#include "gsl/gsl_sf_trig.h"
#include "gsl/gsl_sf_zeta.h"
#include "gsl/gsl_block_double.h"
#include "gsl/gsl_block_complex_double.h"
#include "gsl/gsl_vector.h"
#include "gsl/gsl_vector_complex_double.h"
#include "gsl/gsl_matrix_double.h"
#include "gsl/gsl_matrix_complex_double.h"
#include "gsl/gsl_permutation.h"
#include "gsl/gsl_permute_double.h"
#include "gsl/gsl_permute_vector_double.h"
#include "gsl/gsl_permute_vector_complex_double.h"
#include "gsl/gsl_combination.h"
#include "gsl/gsl_heapsort.h"
#include "gsl/gsl_sort_double.h"
#include "gsl/gsl_sort_vector_double.h"
#include "gsl/gsl_cblas.h"
#include "gsl/gsl_blas_types.h"
#include "gsl/gsl_blas.h"
#include "gsl/gsl_linalg.h"
#include "gsl/gsl_eigen.h"
#include "gsl/gsl_fft.h"
#include "gsl/gsl_fft_complex.h"
#include "gsl/gsl_fft_real.h"
#include "gsl/gsl_fft_halfcomplex.h"
#include "gsl/gsl_integration.h"
#include "gsl/gsl_rng.h"
#include "gsl/gsl_qrng.h"
#include "gsl/gsl_randist.h"
#include "gsl/gsl_cdf.h"
#include "gsl/gsl_statistics_double.h"
#include "gsl/gsl_histogram.h"
#include "gsl/gsl_histogram2d.h"
#include "gsl/gsl_ntuple.h"
#include "gsl/gsl_monte.h"
#include "gsl/gsl_monte_plain.h"
#include "gsl/gsl_monte_miser.h"
#include "gsl/gsl_monte_vegas.h"
#include "gsl/gsl_odeiv.h"
#include "gsl/gsl_odeiv2.h"
#include "gsl/gsl_interp.h"
#include "gsl/gsl_spline.h"
#include "gsl/gsl_diff.h"
#include "gsl/gsl_chebyshev.h"
#include "gsl/gsl_sum.h"
#include "gsl/gsl_roots.h"
#include "gsl/gsl_min.h"
#include "gsl/gsl_fit.h"
#include "fwdpp/forward_types.hpp"
#include "fwdpp/sugar/popgenmut.hpp"
#include "fwdpp/fitness_models.hpp"
#include "fwdpp/fwd_functional.hpp"
#include "fwdpp/debug.hpp"
#include "fwdpp/sugar/generalmut.hpp"
#include "fwdpp/sugar/sampling.hpp"
#include "fwdpp/sugar/change_neutral.hpp"
#include "fwdpp/extensions/callbacks.hpp"
#include "fwdpp/internal/gsl_discrete.hpp"
#include "internal_callbacks.hpp"
#include "internal_region_manager.hpp"
#include <functional>
#include <unordered_set>
#include "sample.hpp"
#include "sampler_selected_mut_tracker.hpp"
#include "sampler_pop_properties.hpp"
#include "sampler_additive_variance.hpp"
#include "allele_ages.hpp"
#include <algorithm>
#include "fwdpy_fitness.hpp"
#include "types.hpp"
#include "sampler_base.hpp"
#include "sampler_no_sampling.hpp"
#include "sampler_sample_n.hpp"
#include "deps.hpp"
#include "evolve_regions_sampler.hpp"
#include "sampling_wrappers.hpp"
#include "fwdpy_add_mutations.hpp"
#include "pythread.h"
#include <limits>
#include <iterator>
#include <stdlib.h>
#include "pystate.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_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_DEFAULT 0
#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)))  )
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #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) && defined (_M_X64)
    #define __Pyx_sst_abs(value) _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 char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE 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_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((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)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
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));
    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 PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
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;


static const char *__pyx_f[] = {
  "fwdpy/regions.pyx",
  "fwdpy/classes.pyx",
  "fwdpy/sampling.pyx",
  "fwdpy/views.pyx",
  "fwdpy/temporal_samplers.pyx",
  "fwdpy/evolve_regions.pyx",
  "fwdpy/copy.pyx",
  "fwdpy/view_fixations.pyx",
  "fwdpy/debug.pyx",
  "fwdpy/ages.pyx",
  "fwdpy/add_mutations.pyx",
  "fwdpy/fwdpy.pyx",
  "array.pxd",
  "stringsource",
  "fwdpy/fwdpy.pxd",
  "fwdpy/internal/internal.pxd",
  "fwdpy/fitness.pxd",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
};
/* MemviewSliceStruct.proto */
struct __pyx_memoryview_obj;
typedef struct {
  struct __pyx_memoryview_obj *memview;
  char *data;
  Py_ssize_t shape[8];
  Py_ssize_t strides[8];
  Py_ssize_t suboffsets[8];
} __Pyx_memviewslice;

/* 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;

/* Atomics.proto */
#include <pythread.h>
#ifndef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 1
#endif
#define __pyx_atomic_int_type int
#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
                    !defined(__i386__)
    #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using GNU atomics"
    #endif
#elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
    #include <Windows.h>
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type LONG
    #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
    #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
    #ifdef __PYX_DEBUG_ATOMICS
        #pragma message ("Using MSVC atomics")
    #endif
#elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
    #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
    #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using Intel atomics"
    #endif
#else
    #undef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 0
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Not using atomics"
    #endif
#endif
typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
#if CYTHON_ATOMICS
    #define __pyx_add_acquisition_count(memview)\
             __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
#else
    #define __pyx_add_acquisition_count(memview)\
            __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
#endif


/* "cython_gsl/gsl_blas_types.pxd":23
 *     CblasRight=142
 * 
 * ctypedef size_t CBLAS_INDEX             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "gsl/gsl_blas_types.h":
 */
typedef size_t __pyx_t_10cython_gsl_14gsl_blas_types_CBLAS_INDEX;

/* "../../.local/lib/python2.7/site-packages/cython_gsl/__init__.pxd":23
 *   GSL_SUCCESS = 0
 * 
 * ctypedef int size_t             # <<<<<<<<<<<<<<
 * from cython_gsl.gsl_mode cimport *
 * from cython_gsl.gsl_math cimport *
 */
typedef int __pyx_t_10cython_gsl_size_t;

/* "fwdpy/fwdpy.pxd":376
 *     freqTraj merge_trajectories_details( const freqTraj & traj1, const freqTraj & traj2 )
 * 
 * ctypedef unsigned uint             # <<<<<<<<<<<<<<
 * cdef extern from "evolve_regions_sampler.hpp" namespace "fwdpy" nogil:
 *     void evolve_regions_sampler_cpp( GSLrng_t * rng,
 */
typedef unsigned int __pyx_t_5fwdpy_5fwdpy_uint;

/*--- Type declarations ---*/
#ifndef _ARRAYARRAY_H
struct arrayobject;
typedef struct arrayobject arrayobject;
#endif
struct __pyx_obj_5fwdpy_8internal_8internal_shwrappervec;
struct __pyx_obj_5fwdpy_8internal_8internal_region_manager_wrapper;
struct __pyx_obj_5fwdpy_7fitness_SpopFitness;
struct __pyx_obj_5fwdpy_7fitness_SpopAdditive;
struct __pyx_obj_5fwdpy_7fitness_SpopMult;
struct __pyx_obj_5fwdpy_7fitness_MlocusFitness;
struct __pyx_obj_5fwdpy_7fitness_MlocusAdditive;
struct __pyx_obj_5fwdpy_7fitness_MlocusMult;
struct __pyx_obj_5fwdpy_5fwdpy_PopType;
struct __pyx_obj_5fwdpy_5fwdpy_Spop;
struct __pyx_obj_5fwdpy_5fwdpy_MetaPop;
struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop;
struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut;
struct __pyx_obj_5fwdpy_5fwdpy_PopVec;
struct __pyx_obj_5fwdpy_5fwdpy_SpopVec;
struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec;
struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec;
struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec;
struct __pyx_obj_5fwdpy_5fwdpy_GSLrng;
struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler;
struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler;
struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler;
struct __pyx_obj_5fwdpy_5fwdpy_PopSampler;
struct __pyx_obj_5fwdpy_5fwdpy_VASampler;
struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler;
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__;
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__;
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__;
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__;
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__;
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__;
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__;
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__;
struct __pyx_array_obj;
struct __pyx_MemviewEnum_obj;
struct __pyx_memoryview_obj;
struct __pyx_memoryviewslice_obj;

/* "../../.local/lib/python2.7/site-packages/cython_gsl/__init__.pxd":20
 * from libc.stdio cimport *
 * 
 * cdef enum:             # <<<<<<<<<<<<<<
 *   GSL_SUCCESS = 0
 * 
 */
enum  {
  __pyx_e_10cython_gsl_GSL_SUCCESS = 0
};

/* "fwdpy/fitness.pxd":10
 *     T max[T](T,T)
 * 
 * ctypedef gamete_base[void] gamete_t             # <<<<<<<<<<<<<<
 * ctypedef vector[gamete_t] gcont_t
 * ctypedef vector[popgenmut] mcont_t
 */
typedef KTfwd::gamete_base<void>  __pyx_t_5fwdpy_7fitness_gamete_t;

/* "fwdpy/fitness.pxd":11
 * 
 * ctypedef gamete_base[void] gamete_t
 * ctypedef vector[gamete_t] gcont_t             # <<<<<<<<<<<<<<
 * ctypedef vector[popgenmut] mcont_t
 * 
 */
typedef std::vector<__pyx_t_5fwdpy_7fitness_gamete_t>  __pyx_t_5fwdpy_7fitness_gcont_t;

/* "fwdpy/fitness.pxd":12
 * ctypedef gamete_base[void] gamete_t
 * ctypedef vector[gamete_t] gcont_t
 * ctypedef vector[popgenmut] mcont_t             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "fwdpy_fitness.hpp" namespace "fwdpy" nogil:
 */
typedef std::vector<KTfwd::popgenmut>  __pyx_t_5fwdpy_7fitness_mcont_t;
struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data;
struct __pyx_t_5fwdpy_5fwdpy_gamete_data;
struct __pyx_t_5fwdpy_5fwdpy_diploid_data;
struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data;
struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data;

/* "fwdpy/fwdpy.pxd":17
 * 
 * ##Create hooks to C++ types
 * ctypedef vector[unsigned] ucont_t             # <<<<<<<<<<<<<<
 * 
 * #Wrap the classes:
 */
typedef std::vector<unsigned int>  __pyx_t_5fwdpy_5fwdpy_ucont_t;

/* "fwdpy/fwdpy.pxd":263
 *         vector[VAcum] final()
 * 
 * ctypedef vector[pair[sep_sample_t,popsample_details]] popSampleData             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "sampler_sample_n.hpp" namespace "fwdpy" nogil:
 */
typedef std::vector<std::pair<KTfwd::sep_sample_t,struct fwdpy::popsample_details> >  __pyx_t_5fwdpy_5fwdpy_popSampleData;

/* "fwdpy/fwdpy.pxd":276
 * #The following typedefs help us with the
 * #frequency tracker API.
 * ctypedef pair[uint,double] genfreqPair             # <<<<<<<<<<<<<<
 * ctypedef vector[pair[selected_mut_data,vector[genfreqPair]]] freqTraj
 * 
 */
typedef std::pair<unsigned int,double>  __pyx_t_5fwdpy_5fwdpy_genfreqPair;

/* "fwdpy/fwdpy.pxd":277
 * #frequency tracker API.
 * ctypedef pair[uint,double] genfreqPair
 * ctypedef vector[pair[selected_mut_data,vector[genfreqPair]]] freqTraj             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "sampler_selected_mut_tracker.hpp" namespace "fwdpy" nogil:
 */
typedef std::vector<std::pair<struct fwdpy::selected_mut_data,std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair> > >  __pyx_t_5fwdpy_5fwdpy_freqTraj;

/* "fwdpy/fwdpy.pxd":313
 * 
 * #Typedefs for convenience
 * ctypedef vector[popgenmut].iterator mcont_t_itr             # <<<<<<<<<<<<<<
 * ctypedef vector[mcont_t_itr] mut_container_t
 * ctypedef vector[gamete_t].iterator gcont_t_itr
 */
typedef std::vector<KTfwd::popgenmut> ::iterator __pyx_t_5fwdpy_5fwdpy_mcont_t_itr;

/* "fwdpy/fwdpy.pxd":314
 * #Typedefs for convenience
 * ctypedef vector[popgenmut].iterator mcont_t_itr
 * ctypedef vector[mcont_t_itr] mut_container_t             # <<<<<<<<<<<<<<
 * ctypedef vector[gamete_t].iterator gcont_t_itr
 * ctypedef vector[diploid_t].iterator dipvector_t_itr
 */
typedef std::vector<__pyx_t_5fwdpy_5fwdpy_mcont_t_itr>  __pyx_t_5fwdpy_5fwdpy_mut_container_t;

/* "fwdpy/fwdpy.pxd":315
 * ctypedef vector[popgenmut].iterator mcont_t_itr
 * ctypedef vector[mcont_t_itr] mut_container_t
 * ctypedef vector[gamete_t].iterator gcont_t_itr             # <<<<<<<<<<<<<<
 * ctypedef vector[diploid_t].iterator dipvector_t_itr
 * #vector of mutation counts (replaces KTfwd::mutation_base::n in fwdpp >= 0.4.4)
 */
typedef std::vector<fwdpy::gamete_t> ::iterator __pyx_t_5fwdpy_5fwdpy_gcont_t_itr;

/* "fwdpy/fwdpy.pxd":316
 * ctypedef vector[mcont_t_itr] mut_container_t
 * ctypedef vector[gamete_t].iterator gcont_t_itr
 * ctypedef vector[diploid_t].iterator dipvector_t_itr             # <<<<<<<<<<<<<<
 * #vector of mutation counts (replaces KTfwd::mutation_base::n in fwdpp >= 0.4.4)
 * ctypedef ucont_t mcounts_cont_t
 */
typedef std::vector<fwdpy::diploid_t> ::iterator __pyx_t_5fwdpy_5fwdpy_dipvector_t_itr;

/* "fwdpy/fwdpy.pxd":318
 * ctypedef vector[diploid_t].iterator dipvector_t_itr
 * #vector of mutation counts (replaces KTfwd::mutation_base::n in fwdpp >= 0.4.4)
 * ctypedef ucont_t mcounts_cont_t             # <<<<<<<<<<<<<<
 * 
 * ##Define some low-level functions that may be useful for others
 */
typedef __pyx_t_5fwdpy_5fwdpy_ucont_t __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t;

/* "fwdpy/fwdpy.pxd":321
 * 
 * ##Define some low-level functions that may be useful for others
 * cdef struct popgen_mut_data:             # <<<<<<<<<<<<<<
 *     double pos,s,h
 *     unsigned n,g,ftime
 */
struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data {
  double pos;
  double s;
  double h;
  unsigned int n;
  unsigned int g;
  unsigned int ftime;
  int neutral;
  uint16_t label;
};

/* "fwdpy/fwdpy.pxd":327
 *     uint16_t label
 * 
 * cdef struct gamete_data:             # <<<<<<<<<<<<<<
 *     vector[popgen_mut_data] neutral,selected
 *     unsigned n
 */
struct __pyx_t_5fwdpy_5fwdpy_gamete_data {
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data>  neutral;
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data>  selected;
  unsigned int n;
};

/* "fwdpy/fwdpy.pxd":331
 *     unsigned n
 * 
 * cdef struct diploid_data:             # <<<<<<<<<<<<<<
 *     gamete_data chrom0,chrom1
 *     double g,e,w,sh0,sh1
 */
struct __pyx_t_5fwdpy_5fwdpy_diploid_data {
  struct __pyx_t_5fwdpy_5fwdpy_gamete_data chrom0;
  struct __pyx_t_5fwdpy_5fwdpy_gamete_data chrom1;
  double g;
  double e;
  double w;
  double sh0;
  double sh1;
  int n0;
  int n1;
};

/* "fwdpy/fwdpy.pxd":336
 *     int n0,n1
 * 
 * cdef struct diploid_mloc_data:             # <<<<<<<<<<<<<<
 *     vector[gamete_data] chrom0,chrom1
 *     double g,e,w
 */
struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data {
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data>  chrom0;
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data>  chrom1;
  double g;
  double e;
  double w;
  std::vector<double>  sh0;
  std::vector<double>  sh1;
  std::vector<int>  n0;
  std::vector<int>  n1;
};

/* "fwdpy/views.pyx":485
 * 
 * 
 * ctypedef vector[pair[double,string]].iterator vec_itr             # <<<<<<<<<<<<<<
 * ctypedef vector[pair[double,string]] fwdpy_sample_t
 * ctypedef back_insert_iterator[fwdpy_sample_t] back_insert_itr
 */
typedef std::vector<std::pair<double,std::string> > ::iterator __pyx_t_5fwdpy_5fwdpy_vec_itr;

/* "fwdpy/views.pyx":486
 * 
 * ctypedef vector[pair[double,string]].iterator vec_itr
 * ctypedef vector[pair[double,string]] fwdpy_sample_t             # <<<<<<<<<<<<<<
 * ctypedef back_insert_iterator[fwdpy_sample_t] back_insert_itr
 * 
 */
typedef std::vector<std::pair<double,std::string> >  __pyx_t_5fwdpy_5fwdpy_fwdpy_sample_t;

/* "fwdpy/views.pyx":487
 * ctypedef vector[pair[double,string]].iterator vec_itr
 * ctypedef vector[pair[double,string]] fwdpy_sample_t
 * ctypedef back_insert_iterator[fwdpy_sample_t] back_insert_itr             # <<<<<<<<<<<<<<
 * 
 * #This doesn't appear to actually move, but it is cool that it compiles!
 */
typedef std::back_insert_iterator<__pyx_t_5fwdpy_5fwdpy_fwdpy_sample_t>  __pyx_t_5fwdpy_5fwdpy_back_insert_itr;

/* "fwdpy/views.pyx":614
 *     return {'neutral':vneutral,'selected':vselected,'neutral_info':neutral_df,'selected_info':selected_df}
 * 
 * cdef struct diploid_view_data:             # <<<<<<<<<<<<<<
 *     vector[double] s,h
 *     vector[unsigned] n,g,ind,chrom
 */
struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data {
  std::vector<double>  s;
  std::vector<double>  h;
  std::vector<unsigned int>  n;
  std::vector<unsigned int>  g;
  std::vector<unsigned int>  ind;
  std::vector<unsigned int>  chrom;
};

/* "fwdpy/internal/internal.pxd":7
 * 
 * ##These are the callback wrappers from fwdpp
 * cdef class shwrappervec:             # <<<<<<<<<<<<<<
 *     """
 *     Wrapper for a vector of callback objects from fwdpp's extension library.
 */
struct __pyx_obj_5fwdpy_8internal_8internal_shwrappervec {
  PyObject_HEAD
  std::vector<KTfwd::extensions::shmodel>  vec;
};


/* "fwdpy/internal/internal.pxd":17
 * 
 * ##Quick wrapper for region_manager
 * cdef class region_manager_wrapper:             # <<<<<<<<<<<<<<
 *     cdef region_manager * thisptr
 * 
 */
struct __pyx_obj_5fwdpy_8internal_8internal_region_manager_wrapper {
  PyObject_HEAD
  fwdpy::internal::region_manager *thisptr;
};


/* "fwdpy/fitness.pxd":108
 *     return rv
 * 
 * cdef class SpopFitness(object):             # <<<<<<<<<<<<<<
 *     """
 *     Base object for single-deme fitness functions
 */
struct __pyx_obj_5fwdpy_7fitness_SpopFitness {
  PyObject_HEAD
  std::unique_ptr<fwdpy::singlepop_fitness>  wfxn;
};


/* "fwdpy/fitness.pxd":114
 *     cdef unique_ptr[singlepop_fitness] wfxn
 * 
 * cdef class SpopAdditive(SpopFitness):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_5fwdpy_7fitness_SpopAdditive {
  struct __pyx_obj_5fwdpy_7fitness_SpopFitness __pyx_base;
};


/* "fwdpy/fitness.pxd":117
 *     pass
 * 
 * cdef class SpopMult(SpopFitness):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_5fwdpy_7fitness_SpopMult {
  struct __pyx_obj_5fwdpy_7fitness_SpopFitness __pyx_base;
};


/* "fwdpy/fitness.pxd":120
 *     pass
 * 
 * cdef class MlocusFitness(object):             # <<<<<<<<<<<<<<
 *     """
 *     Base object for multi-locus fitness functions
 */
struct __pyx_obj_5fwdpy_7fitness_MlocusFitness {
  PyObject_HEAD
  fwdpy::multilocus_fitness wfxn;
};


/* "fwdpy/fitness.pxd":126
 *     cdef multilocus_fitness wfxn
 * 
 * cdef class MlocusAdditive(MlocusFitness):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_5fwdpy_7fitness_MlocusAdditive {
  struct __pyx_obj_5fwdpy_7fitness_MlocusFitness __pyx_base;
};


/* "fwdpy/fitness.pxd":129
 *     pass
 * 
 * cdef class MlocusMult(MlocusFitness):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_5fwdpy_7fitness_MlocusMult {
  struct __pyx_obj_5fwdpy_7fitness_MlocusFitness __pyx_base;
};


/* "fwdpy/fwdpy.pxd":124
 * 
 * #Now, provide definitions for classes in classes.pyx
 * cdef class PopType(object):             # <<<<<<<<<<<<<<
 *     """
 *     Empty base class for a population object.
 */
struct __pyx_obj_5fwdpy_5fwdpy_PopType {
  PyObject_HEAD
};


/* "fwdpy/fwdpy.pxd":132
 *     pass
 * 
 * cdef class Spop(PopType):             # <<<<<<<<<<<<<<
 *     cdef shared_ptr[singlepop_t] pop
 *     cpdef gen(self)
 */
struct __pyx_obj_5fwdpy_5fwdpy_Spop {
  struct __pyx_obj_5fwdpy_5fwdpy_PopType __pyx_base;
  struct __pyx_vtabstruct_5fwdpy_5fwdpy_Spop *__pyx_vtab;
  std::shared_ptr<fwdpy::singlepop_t>  pop;
};


/* "fwdpy/fwdpy.pxd":138
 *     cpdef sane(self)
 * 
 * cdef class MetaPop(PopType):             # <<<<<<<<<<<<<<
 *     cdef shared_ptr[metapop_t] mpop
 *     cpdef gen(self)
 */
struct __pyx_obj_5fwdpy_5fwdpy_MetaPop {
  struct __pyx_obj_5fwdpy_5fwdpy_PopType __pyx_base;
  struct __pyx_vtabstruct_5fwdpy_5fwdpy_MetaPop *__pyx_vtab;
  std::shared_ptr<fwdpy::metapop_t>  mpop;
};


/* "fwdpy/fwdpy.pxd":145
 *     cpdef from_Spop(self,Spop p)
 * 
 * cdef class MlocusPop(PopType):             # <<<<<<<<<<<<<<
 *     cdef shared_ptr[multilocus_t] pop
 *     cpdef gen(self)
 */
struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop {
  struct __pyx_obj_5fwdpy_5fwdpy_PopType __pyx_base;
  struct __pyx_vtabstruct_5fwdpy_5fwdpy_MlocusPop *__pyx_vtab;
  std::shared_ptr<fwdpy::multilocus_t>  pop;
};


/* "fwdpy/fwdpy.pxd":151
 *     cpdef sane(self)
 * 
 * cdef class SpopGenMut(PopType):             # <<<<<<<<<<<<<<
 *     cdef shared_ptr[singlepop_gm_vec_t] pop
 *     cpdef gen(self)
 */
struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut {
  struct __pyx_obj_5fwdpy_5fwdpy_PopType __pyx_base;
  struct __pyx_vtabstruct_5fwdpy_5fwdpy_SpopGenMut *__pyx_vtab;
  std::shared_ptr<fwdpy::singlepop_gm_vec_t>  pop;
};


/* "fwdpy/fwdpy.pxd":157
 *     cpdef sane(self)
 * 
 * cdef class PopVec(object):             # <<<<<<<<<<<<<<
 *     """
 *     Empty base class for containers of population objects.
 */
struct __pyx_obj_5fwdpy_5fwdpy_PopVec {
  PyObject_HEAD
};


/* "fwdpy/fwdpy.pxd":165
 *     pass
 * 
 * cdef class SpopVec(PopVec):             # <<<<<<<<<<<<<<
 *     cdef vector[shared_ptr[singlepop_t]] pops
 *     cpdef size(self)
 */
struct __pyx_obj_5fwdpy_5fwdpy_SpopVec {
  struct __pyx_obj_5fwdpy_5fwdpy_PopVec __pyx_base;
  struct __pyx_vtabstruct_5fwdpy_5fwdpy_SpopVec *__pyx_vtab;
  std::vector<std::shared_ptr<fwdpy::singlepop_t> >  pops;
};


/* "fwdpy/fwdpy.pxd":171
 *     cpdef append(self,SpopVec p)
 * 
 * cdef class SpopGenMutVec(PopVec):             # <<<<<<<<<<<<<<
 *     cdef vector[shared_ptr[singlepop_gm_vec_t]] pops
 *     cpdef size(self)
 */
struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec {
  struct __pyx_obj_5fwdpy_5fwdpy_PopVec __pyx_base;
  struct __pyx_vtabstruct_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_vtab;
  std::vector<std::shared_ptr<fwdpy::singlepop_gm_vec_t> >  pops;
};


/* "fwdpy/fwdpy.pxd":176
 *     cdef reset(self,const vector[shared_ptr[singlepop_gm_vec_t]] newpops)
 * 
 * cdef class MetaPopVec(PopVec):             # <<<<<<<<<<<<<<
 *     cdef vector[shared_ptr[metapop_t]] mpops
 *     cpdef size(self)
 */
struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec {
  struct __pyx_obj_5fwdpy_5fwdpy_PopVec __pyx_base;
  struct __pyx_vtabstruct_5fwdpy_5fwdpy_MetaPopVec *__pyx_vtab;
  std::vector<std::shared_ptr<fwdpy::metapop_t> >  mpops;
};


/* "fwdpy/fwdpy.pxd":182
 *     cpdef append(self,MetaPopVec p)
 * 
 * cdef class MlocusPopVec(PopVec):             # <<<<<<<<<<<<<<
 *     cdef vector[shared_ptr[multilocus_t]] pops
 *     cpdef size(self)
 */
struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec {
  struct __pyx_obj_5fwdpy_5fwdpy_PopVec __pyx_base;
  struct __pyx_vtabstruct_5fwdpy_5fwdpy_MlocusPopVec *__pyx_vtab;
  std::vector<std::shared_ptr<fwdpy::multilocus_t> >  pops;
};


/* "fwdpy/fwdpy.pxd":189
 * 
 * 
 * cdef class GSLrng:             # <<<<<<<<<<<<<<
 *     cdef GSLrng_t * thisptr
 * 
 */
struct __pyx_obj_5fwdpy_5fwdpy_GSLrng {
  PyObject_HEAD
  fwdpy::GSLrng_t *thisptr;
};


/* "fwdpy/fwdpy.pxd":285
 * 
 * #Extension classes for temporal sampling
 * cdef class TemporalSampler:             # <<<<<<<<<<<<<<
 *     """
 *     Base class representing containers of functions
 */
struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler {
  PyObject_HEAD
  struct __pyx_vtabstruct_5fwdpy_5fwdpy_TemporalSampler *__pyx_vtab;
  std::vector<std::unique_ptr<fwdpy::sampler_base> >  vec;
};


/* "fwdpy/fwdpy.pxd":293
 *     cpdef size_t size(self)
 * 
 * cdef class NothingSampler(TemporalSampler):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler {
  struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler __pyx_base;
};


/* "fwdpy/fwdpy.pxd":296
 *     pass
 * 
 * cdef class QtraitStatsSampler(TemporalSampler):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler {
  struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler __pyx_base;
};


/* "fwdpy/fwdpy.pxd":299
 *     pass
 * 
 * cdef class PopSampler(TemporalSampler):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_5fwdpy_5fwdpy_PopSampler {
  struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler __pyx_base;
};


/* "fwdpy/fwdpy.pxd":302
 *     pass
 * 
 * cdef class VASampler(TemporalSampler):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_5fwdpy_5fwdpy_VASampler {
  struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler __pyx_base;
};


/* "fwdpy/fwdpy.pxd":305
 *     pass
 * 
 * cdef class FreqSampler(TemporalSampler):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler {
  struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler __pyx_base;
};


/* "fwdpy/classes.pyx":123
 *     def __dealloc__(self):
 *         self.pops.clear()
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.pops.size()):
 *             x = Spop()
 */
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__ {
  PyObject_HEAD
  size_t __pyx_v_i;
  struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self;
  struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_x;
  size_t __pyx_t_0;
  size_t __pyx_t_1;
};


/* "fwdpy/classes.pyx":184
 *     def __dealloc__(self):
 *         self.pops.clear()
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.pops.size()):
 *             pi = MlocusPop()
 */
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ {
  PyObject_HEAD
  size_t __pyx_v_i;
  struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_pi;
  struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self;
  size_t __pyx_t_0;
  size_t __pyx_t_1;
};


/* "fwdpy/classes.pyx":236
 *     def __dealloc__(self):
 *         self.pops.clear()
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.pops.size()):
 *             pi = SpopGenMut()
 */
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ {
  PyObject_HEAD
  size_t __pyx_v_i;
  struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_pi;
  struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self;
  size_t __pyx_t_0;
  size_t __pyx_t_1;
};


/* "fwdpy/classes.pyx":324
 *     def __dealloc__(self):
 *         self.mpops.clear()
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.mpops.size()):
 *             pi = MetaPop()
 */
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ {
  PyObject_HEAD
  size_t __pyx_v_i;
  struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_pi;
  struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self;
  size_t __pyx_t_0;
  size_t __pyx_t_1;
};


/* "fwdpy/temporal_samplers.pyx":54
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[pop_properties](new pop_properties(optimum)))
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.vec.size()):
 *             yield (<pop_properties*>(self.vec[i].get())).final()
 */
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ {
  PyObject_HEAD
  size_t __pyx_v_i;
  struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *__pyx_v_self;
  size_t __pyx_t_0;
  size_t __pyx_t_1;
};


/* "fwdpy/temporal_samplers.pyx":123
 *                 self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[sample_n](new
 *                 sample_n(nsam,rng.thisptr.get(),nfile,sfile,removeFixed,recordSamples,recordDetails,locus_boundaries,append)))
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.vec.size()):
 *             yield (<sample_n*>self.vec[i].get()).final()
 */
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ {
  PyObject_HEAD
  size_t __pyx_v_i;
  struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *__pyx_v_self;
  size_t __pyx_t_0;
  size_t __pyx_t_1;
};


/* "fwdpy/temporal_samplers.pyx":153
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[additive_variance](new additive_variance()))
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.vec.size()):
 *             yield (<additive_variance*>(self.vec[i].get())).final()
 */
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ {
  PyObject_HEAD
  size_t __pyx_v_i;
  struct __pyx_obj_5fwdpy_5fwdpy_VASampler *__pyx_v_self;
  size_t __pyx_t_0;
  size_t __pyx_t_1;
};


/* "fwdpy/temporal_samplers.pyx":191
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[selected_mut_tracker](new selected_mut_tracker()))
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.vec.size()):
 *             yield (<selected_mut_tracker*>self.vec[i].get()).final()
 */
struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ {
  PyObject_HEAD
  size_t __pyx_v_i;
  struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *__pyx_v_self;
  size_t __pyx_t_0;
  size_t __pyx_t_1;
};


/* "View.MemoryView":103
 * 
 * @cname("__pyx_array")
 * cdef class array:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_array_obj {
  PyObject_HEAD
  struct __pyx_vtabstruct_array *__pyx_vtab;
  char *data;
  Py_ssize_t len;
  char *format;
  int ndim;
  Py_ssize_t *_shape;
  Py_ssize_t *_strides;
  Py_ssize_t itemsize;
  PyObject *mode;
  PyObject *_format;
  void (*callback_free_data)(void *);
  int free_data;
  int dtype_is_object;
};


/* "View.MemoryView":275
 * 
 * @cname('__pyx_MemviewEnum')
 * cdef class Enum(object):             # <<<<<<<<<<<<<<
 *     cdef object name
 *     def __init__(self, name):
 */
struct __pyx_MemviewEnum_obj {
  PyObject_HEAD
  PyObject *name;
};


/* "View.MemoryView":326
 * 
 * @cname('__pyx_memoryview')
 * cdef class memoryview(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef object obj
 */
struct __pyx_memoryview_obj {
  PyObject_HEAD
  struct __pyx_vtabstruct_memoryview *__pyx_vtab;
  PyObject *obj;
  PyObject *_size;
  PyObject *_array_interface;
  PyThread_type_lock lock;
  __pyx_atomic_int acquisition_count[2];
  __pyx_atomic_int *acquisition_count_aligned_p;
  Py_buffer view;
  int flags;
  int dtype_is_object;
  __Pyx_TypeInfo *typeinfo;
};


/* "View.MemoryView":951
 * 
 * @cname('__pyx_memoryviewslice')
 * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
 *     "Internal class for passing memoryview slices to Python"
 * 
 */
struct __pyx_memoryviewslice_obj {
  struct __pyx_memoryview_obj __pyx_base;
  __Pyx_memviewslice from_slice;
  PyObject *from_object;
  PyObject *(*to_object_func)(char *);
  int (*to_dtype_func)(char *, PyObject *);
};



/* "View.MemoryView":103
 * 
 * @cname("__pyx_array")
 * cdef class array:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_array {
  PyObject *(*get_memview)(struct __pyx_array_obj *);
};
static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;


/* "fwdpy/classes.pyx":4
 * from cython.operator import dereference as deref
 * 
 * cdef class Spop(PopType):             # <<<<<<<<<<<<<<
 *     """
 *     Object representing data structures for single-deme simulations
 */

struct __pyx_vtabstruct_5fwdpy_5fwdpy_Spop {
  PyObject *(*gen)(struct __pyx_obj_5fwdpy_5fwdpy_Spop *, int __pyx_skip_dispatch);
  PyObject *(*popsize)(struct __pyx_obj_5fwdpy_5fwdpy_Spop *, int __pyx_skip_dispatch);
  PyObject *(*sane)(struct __pyx_obj_5fwdpy_5fwdpy_Spop *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_Spop *__pyx_vtabptr_5fwdpy_5fwdpy_Spop;


/* "fwdpy/classes.pyx":266
 *         self.pops.clear()
 * 
 * cdef class MetaPop(PopType):             # <<<<<<<<<<<<<<
 *     """
 *     Object representing data structures for single-deme simulations.
 */

struct __pyx_vtabstruct_5fwdpy_5fwdpy_MetaPop {
  PyObject *(*gen)(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *, int __pyx_skip_dispatch);
  PyObject *(*popsizes)(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *, int __pyx_skip_dispatch);
  PyObject *(*sane)(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *, int __pyx_skip_dispatch);
  PyObject *(*from_Spop)(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *, struct __pyx_obj_5fwdpy_5fwdpy_Spop *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_MetaPop *__pyx_vtabptr_5fwdpy_5fwdpy_MetaPop;


/* "fwdpy/classes.pyx":70
 *         return self.pop.get().sane()
 * 
 * cdef class MlocusPop(PopType):             # <<<<<<<<<<<<<<
 *     """
 *     Object representing data structures for single-deme, multi-locus/region simulations
 */

struct __pyx_vtabstruct_5fwdpy_5fwdpy_MlocusPop {
  PyObject *(*gen)(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *, int __pyx_skip_dispatch);
  PyObject *(*popsize)(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *, int __pyx_skip_dispatch);
  PyObject *(*sane)(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_MlocusPop *__pyx_vtabptr_5fwdpy_5fwdpy_MlocusPop;


/* "fwdpy/classes.pyx":36
 *         return self.pop.get().sane()
 * 
 * cdef class SpopGenMut(PopType):             # <<<<<<<<<<<<<<
 *     """
 *     Object representing data structures for single-deme simulations
 */

struct __pyx_vtabstruct_5fwdpy_5fwdpy_SpopGenMut {
  PyObject *(*gen)(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *, int __pyx_skip_dispatch);
  PyObject *(*popsize)(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *, int __pyx_skip_dispatch);
  PyObject *(*sane)(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_SpopGenMut *__pyx_vtabptr_5fwdpy_5fwdpy_SpopGenMut;


/* "fwdpy/classes.pyx":102
 *         return self.pop.get().sane()
 * 
 * cdef class SpopVec(PopVec):             # <<<<<<<<<<<<<<
 *     """
 *     Vector of single-deme objects
 */

struct __pyx_vtabstruct_5fwdpy_5fwdpy_SpopVec {
  PyObject *(*size)(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *, int __pyx_skip_dispatch);
  PyObject *(*reset)(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *, std::vector<std::shared_ptr<fwdpy::singlepop_t> >  const );
  PyObject *(*append)(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_SpopVec *__pyx_vtabptr_5fwdpy_5fwdpy_SpopVec;


/* "fwdpy/classes.pyx":224
 *         self.pops.clear()
 * 
 * cdef class SpopGenMutVec(PopVec):             # <<<<<<<<<<<<<<
 *     def __cinit__(self,unsigned npops,unsigned N):
 *         """
 */

struct __pyx_vtabstruct_5fwdpy_5fwdpy_SpopGenMutVec {
  PyObject *(*size)(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *, int __pyx_skip_dispatch);
  PyObject *(*reset)(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *, std::vector<std::shared_ptr<fwdpy::singlepop_gm_vec_t> >  const );
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_vtabptr_5fwdpy_5fwdpy_SpopGenMutVec;


/* "fwdpy/classes.pyx":301
 *          self.mpop.reset(new metapop_t(deref(p.pop.get())))
 * 
 * cdef class MetaPopVec(PopVec):             # <<<<<<<<<<<<<<
 *     """
 *     Vector of metapopulation objects.
 */

struct __pyx_vtabstruct_5fwdpy_5fwdpy_MetaPopVec {
  PyObject *(*size)(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *, int __pyx_skip_dispatch);
  PyObject *(*reset)(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *, std::vector<std::shared_ptr<fwdpy::metapop_t> >  const &);
  PyObject *(*append)(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *, struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_MetaPopVec *__pyx_vtabptr_5fwdpy_5fwdpy_MetaPopVec;


/* "fwdpy/classes.pyx":162
 *         self.pops.clear()
 * 
 * cdef class MlocusPopVec(PopVec):             # <<<<<<<<<<<<<<
 *     """
 *     Vector of single-deme objects representing multiple partially-linked regions.
 */

struct __pyx_vtabstruct_5fwdpy_5fwdpy_MlocusPopVec {
  PyObject *(*size)(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *, int __pyx_skip_dispatch);
  PyObject *(*reset)(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *, std::vector<std::shared_ptr<fwdpy::multilocus_t> >  const );
  PyObject *(*append)(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_MlocusPopVec *__pyx_vtabptr_5fwdpy_5fwdpy_MlocusPopVec;


/* "fwdpy/temporal_samplers.pyx":5
 * 
 * # distutils: language = c++
 * cdef class TemporalSampler:             # <<<<<<<<<<<<<<
 *     cpdef size_t size(self):
 *         return self.vec.size()
 */

struct __pyx_vtabstruct_5fwdpy_5fwdpy_TemporalSampler {
  size_t (*size)(struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_TemporalSampler *__pyx_vtabptr_5fwdpy_5fwdpy_TemporalSampler;


/* "fwdpy/temporal_samplers.pyx":13
 *         clear_samplers(self.vec)
 * 
 * cdef class NothingSampler(TemporalSampler):             # <<<<<<<<<<<<<<
 *     """
 *     A :class:`fwdpy.fwdpy.TemporalSampler` that does nothing.
 */

struct __pyx_vtabstruct_5fwdpy_5fwdpy_NothingSampler {
  struct __pyx_vtabstruct_5fwdpy_5fwdpy_TemporalSampler __pyx_base;
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_NothingSampler *__pyx_vtabptr_5fwdpy_5fwdpy_NothingSampler;


/* "fwdpy/temporal_samplers.pyx":36
 *         return None
 * 
 * cdef class QtraitStatsSampler(TemporalSampler):             # <<<<<<<<<<<<<<
 *     """
 *     A :class:`fwdpy.fwdpy.TemporalSampler` that records various statistics about the population.
 */

struct __pyx_vtabstruct_5fwdpy_5fwdpy_QtraitStatsSampler {
  struct __pyx_vtabstruct_5fwdpy_5fwdpy_TemporalSampler __pyx_base;
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_QtraitStatsSampler *__pyx_vtabptr_5fwdpy_5fwdpy_QtraitStatsSampler;


/* "fwdpy/temporal_samplers.pyx":77
 *         return rv
 * 
 * cdef class PopSampler(TemporalSampler):             # <<<<<<<<<<<<<<
 *     """
 *     A :class:`fwdpy.fwdpy.TemporalSampler` that takes a sample of size :math:`n \leq N` from the population.
 */

struct __pyx_vtabstruct_5fwdpy_5fwdpy_PopSampler {
  struct __pyx_vtabstruct_5fwdpy_5fwdpy_TemporalSampler __pyx_base;
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_PopSampler *__pyx_vtabptr_5fwdpy_5fwdpy_PopSampler;


/* "fwdpy/temporal_samplers.pyx":135
 *         return self.vec.size()
 * 
 * cdef class VASampler(TemporalSampler):             # <<<<<<<<<<<<<<
 *     """
 *     A :class:`fwdpy.fwdpy.TemporalSampler` that estimates the relationship between mutation frequency and total additive
 */

struct __pyx_vtabstruct_5fwdpy_5fwdpy_VASampler {
  struct __pyx_vtabstruct_5fwdpy_5fwdpy_TemporalSampler __pyx_base;
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_VASampler *__pyx_vtabptr_5fwdpy_5fwdpy_VASampler;


/* "fwdpy/temporal_samplers.pyx":176
 *         return rv
 * 
 * cdef class FreqSampler(TemporalSampler):             # <<<<<<<<<<<<<<
 *     """
 *     A :class:`fwdpy.fwdpy.TemporalSampler` to track the frequencies of selected mutations over time.
 */

struct __pyx_vtabstruct_5fwdpy_5fwdpy_FreqSampler {
  struct __pyx_vtabstruct_5fwdpy_5fwdpy_TemporalSampler __pyx_base;
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_FreqSampler *__pyx_vtabptr_5fwdpy_5fwdpy_FreqSampler;


/* "View.MemoryView":326
 * 
 * @cname('__pyx_memoryview')
 * cdef class memoryview(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef object obj
 */

struct __pyx_vtabstruct_memoryview {
  char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
  PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
};
static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;


/* "View.MemoryView":951
 * 
 * @cname('__pyx_memoryviewslice')
 * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
 *     "Internal class for passing memoryview slices to Python"
 * 
 */

struct __pyx_vtabstruct__memoryviewslice {
  struct __pyx_vtabstruct_memoryview __pyx_base;
};
static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;

/* --- 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) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* 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, int nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#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

/* 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

/* 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);

/* IterNext.proto */
#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);

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

/* GetModuleGlobalName.proto */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = PyThreadState_GET();
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#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);
#else
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(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);

/* 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 CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* pyobject_as_double.proto */
static double __Pyx__PyObject_AsDouble(PyObject* obj);
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyObject_AsDouble(obj)\
(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
 likely(PyInt_CheckExact(obj)) ?\
 PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
#else
#define __Pyx_PyObject_AsDouble(obj)\
((likely(PyFloat_CheckExact(obj))) ?\
 PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
#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

/* BufferFormatCheck.proto */
static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
    __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
static 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); // PROTO

/* MemviewSliceInit.proto */
#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
#define __Pyx_MEMVIEW_DIRECT   1
#define __Pyx_MEMVIEW_PTR      2
#define __Pyx_MEMVIEW_FULL     4
#define __Pyx_MEMVIEW_CONTIG   8
#define __Pyx_MEMVIEW_STRIDED  16
#define __Pyx_MEMVIEW_FOLLOW   32
#define __Pyx_IS_C_CONTIG 1
#define __Pyx_IS_F_CONTIG 2
static int __Pyx_init_memviewslice(
                struct __pyx_memoryview_obj *memview,
                int ndim,
                __Pyx_memviewslice *memviewslice,
                int memview_is_new_reference);
static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);

/* IncludeStringH.proto */
#include <string.h>

/* BytesEquals.proto */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* 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) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\
    PyObject_RichCompare(op1, op2, Py_EQ)
    #endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* 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);

/* 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);

/* 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

/* 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 Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);

/* UnaryNegOverflows.proto */
#define UNARY_NEG_WOULD_OVERFLOW(x)\
        (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))

static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* decode_c_string.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
/* ListExtend.proto */
static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject* none = _PyList_Extend((PyListObject*)L, v);
    if (unlikely(!none))
        return -1;
    Py_DECREF(none);
    return 0;
#else
    return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
#endif
}

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

/* None.proto */
static CYTHON_INLINE long __Pyx_div_long(long, long);

/* SetVTable.proto */
static int __Pyx_SetVtable(PyObject *dict, void *vtable);

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunction.proto */
#define __Pyx_CyFunction_USED 1
#include <structmember.h>
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* 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);

/* None.proto */
#include <new>

#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


/* 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;

/* None.proto */
static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};

/* MemviewSliceIsContig.proto */
static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs,
                                        char order, int ndim);

/* OverlappingSlices.proto */
static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
                                __Pyx_memviewslice *slice2,
                                int ndim, size_t itemsize);

/* Capsule.proto */
static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);

/* ArrayAPI.proto */
#ifndef _ARRAYARRAY_H
#define _ARRAYARRAY_H
typedef struct arraydescr {
    int typecode;
    int itemsize;
    PyObject * (*getitem)(struct arrayobject *, Py_ssize_t);
    int (*setitem)(struct arrayobject *, Py_ssize_t, PyObject *);
#if PY_MAJOR_VERSION >= 3
    char *formats;
#endif
} arraydescr;
struct arrayobject {
    PyObject_HEAD
    Py_ssize_t ob_size;
    union {
        char *ob_item;
        float *as_floats;
        double *as_doubles;
        int *as_ints;
        unsigned int *as_uints;
        unsigned char *as_uchars;
        signed char *as_schars;
        char *as_chars;
        unsigned long *as_ulongs;
        long *as_longs;
        short *as_shorts;
        unsigned short *as_ushorts;
        Py_UNICODE *as_pyunicodes;
        void *as_voidptr;
    } data;
    Py_ssize_t allocated;
    struct arraydescr *ob_descr;
    PyObject *weakreflist;
#if PY_MAJOR_VERSION >= 3
        int ob_exports;
#endif
};
#ifndef NO_NEWARRAY_INLINE
static CYTHON_INLINE PyObject * newarrayobject(PyTypeObject *type, Py_ssize_t size,
    struct arraydescr *descr) {
    arrayobject *op;
    size_t nbytes;
    if (size < 0) {
        PyErr_BadInternalCall();
        return NULL;
    }
    nbytes = size * descr->itemsize;
    if (nbytes / descr->itemsize != (size_t)size) {
        return PyErr_NoMemory();
    }
    op = (arrayobject *) type->tp_alloc(type, 0);
    if (op == NULL) {
        return NULL;
    }
    op->ob_descr = descr;
    op->allocated = size;
    op->weakreflist = NULL;
    op->ob_size = size;
    if (size <= 0) {
        op->data.ob_item = NULL;
    }
    else {
        op->data.ob_item = PyMem_NEW(char, nbytes);
        if (op->data.ob_item == NULL) {
            Py_DECREF(op);
            return PyErr_NoMemory();
        }
    }
    return (PyObject *) op;
}
#else
PyObject* newarrayobject(PyTypeObject *type, Py_ssize_t size,
    struct arraydescr *descr);
#endif
static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) {
    void *items = (void*) self->data.ob_item;
    PyMem_Resize(items, char, (size_t)(n * self->ob_descr->itemsize));
    if (items == NULL) {
        PyErr_NoMemory();
        return -1;
    }
    self->data.ob_item = (char*) items;
    self->ob_size = n;
    self->allocated = n;
    return 0;
}
static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) {
    void *items = (void*) self->data.ob_item;
    Py_ssize_t newsize;
    if (n < self->allocated && n*4 > self->allocated) {
        self->ob_size = n;
        return 0;
    }
    newsize = n + (n / 2) + 1;
    if (newsize <= n) {
        PyErr_NoMemory();
        return -1;
    }
    PyMem_Resize(items, char, (size_t)(newsize * self->ob_descr->itemsize));
    if (items == NULL) {
        PyErr_NoMemory();
        return -1;
    }
    self->data.ob_item = (char*) items;
    self->ob_size = n;
    self->allocated = newsize;
    return 0;
}
#endif

/* TypeInfoCompare.proto */
static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);

/* MemviewSliceValidateAndInit.proto */
static int __Pyx_ValidateAndInit_memviewslice(
                int *axes_specs,
                int c_or_f_flag,
                int buf_flags,
                int ndim,
                __Pyx_TypeInfo *dtype,
                __Pyx_BufFmt_StackElem stack[],
                __Pyx_memviewslice *memviewslice,
                PyObject *original_obj);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_int(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint16_t(uint16_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* CppExceptionConversion.proto */
#ifndef __Pyx_CppExn2PyErr
#include <new>
#include <typeinfo>
#include <stdexcept>
#include <ios>
static void __Pyx_CppExn2PyErr() {
  try {
    if (PyErr_Occurred())
      ; // let the latest Python exn pass through and ignore the current one
    else
      throw;
  } catch (const std::bad_alloc& exn) {
    PyErr_SetString(PyExc_MemoryError, exn.what());
  } catch (const std::bad_cast& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::bad_typeid& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::domain_error& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::invalid_argument& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::ios_base::failure& exn) {
    PyErr_SetString(PyExc_IOError, exn.what());
  } catch (const std::out_of_range& exn) {
    PyErr_SetString(PyExc_IndexError, exn.what());
  } catch (const std::overflow_error& exn) {
    PyErr_SetString(PyExc_OverflowError, exn.what());
  } catch (const std::range_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::underflow_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::exception& exn) {
    PyErr_SetString(PyExc_RuntimeError, exn.what());
  }
  catch (...)
  {
    PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
  }
}
#endif

static PyObject* __pyx_convert__to_py_struct__fwdpy_3a__3a_popsample_details(struct fwdpy::popsample_details s);
/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_unsigned_int(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_unsigned_int(const char *itemp, PyObject *obj);

struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data;
static PyObject* __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data(struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data s);
struct __pyx_t_5fwdpy_5fwdpy_gamete_data;
static PyObject* __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data(struct __pyx_t_5fwdpy_5fwdpy_gamete_data s);
struct __pyx_t_5fwdpy_5fwdpy_diploid_data;
static PyObject* __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_data(struct __pyx_t_5fwdpy_5fwdpy_diploid_data s);
struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data;
static PyObject* __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data(struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data s);
struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data;
static PyObject* __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_view_data(struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data s);
static PyObject* __pyx_convert__to_py_struct__fwdpy_3a__3a_allele_age_data_t(struct fwdpy::allele_age_data_t s);
static PyObject* __pyx_convert__to_py_struct__fwdpy_3a__3a_selected_mut_data(struct fwdpy::selected_mut_data s);
static PyObject* __pyx_convert__to_py_struct__fwdpy_3a__3a_selected_mut_data_tidy(struct fwdpy::selected_mut_data_tidy s);
static PyObject* __pyx_convert__to_py_struct__fwdpy_3a__3a_qtrait_stats_cython(struct fwdpy::qtrait_stats_cython s);
static PyObject* __pyx_convert__to_py_struct__fwdpy_3a__3a_VAcum(struct fwdpy::VAcum s);
/* MemviewSliceCopyTemplate.proto */
static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
                                 const char *mode, int ndim,
                                 size_t sizeof_dtype, int contig_flag,
                                 int dtype_is_object);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyObject *);
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static int __Pyx_Coroutine_clear(PyObject *self);
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue)
#endif

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchGeneratorABC.proto */
static int __Pyx_patch_abc(void);

/* Generator.proto */
#define __Pyx_Generator_USED
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_New(body, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_GeneratorType, body, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(void);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* FunctionExport.proto */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);

/* PyIdentifierFromString.proto */
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

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

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

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

static PyObject *__pyx_f_5fwdpy_5fwdpy_4Spop_gen(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_4Spop_popsize(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_4Spop_sane(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_10SpopGenMut_gen(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_10SpopGenMut_popsize(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_10SpopGenMut_sane(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_9MlocusPop_gen(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_9MlocusPop_popsize(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_9MlocusPop_sane(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_7SpopVec_reset(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self, std::vector<std::shared_ptr<fwdpy::singlepop_t> >  const &__pyx_v_newpops); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_7SpopVec_append(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_7SpopVec_size(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_12MlocusPopVec_reset(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self, std::vector<std::shared_ptr<fwdpy::multilocus_t> >  const &__pyx_v_newpops); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_12MlocusPopVec_append(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_12MlocusPopVec_size(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_13SpopGenMutVec_reset(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self, std::vector<std::shared_ptr<fwdpy::singlepop_gm_vec_t> >  const &__pyx_v_newpops); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_13SpopGenMutVec_size(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_7MetaPop_gen(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_7MetaPop_popsizes(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_7MetaPop_sane(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_7MetaPop_from_Spop(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_10MetaPopVec_size(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_10MetaPopVec_reset(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self, std::vector<std::shared_ptr<fwdpy::metapop_t> >  const &__pyx_v_mpops); /* proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_10MetaPopVec_append(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_p, int __pyx_skip_dispatch); /* proto*/
static size_t __pyx_f_5fwdpy_5fwdpy_15TemporalSampler_size(struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/

/* Module declarations from 'libcpp.vector' */

/* Module declarations from 'libcpp.utility' */

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

/* Module declarations from 'libcpp.string' */

/* Module declarations from 'libcpp' */

/* Module declarations from 'libcpp.memory' */

/* Module declarations from 'libcpp.map' */

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

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

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

/* Module declarations from 'cython_gsl.gsl_mode' */

/* Module declarations from 'cython_gsl.gsl_math' */

/* Module declarations from 'cython_gsl.gsl_complex' */

/* Module declarations from 'cython_gsl.gsl_poly' */

/* Module declarations from 'cython_gsl.gsl_sf_result' */

/* Module declarations from 'cython_gsl.gsl_airy' */

/* Module declarations from 'cython_gsl.gsl_bessel' */

/* Module declarations from 'cython_gsl.gsl_clausen' */

/* Module declarations from 'cython_gsl.gsl_coulomb' */

/* Module declarations from 'cython_gsl.gsl_coupling' */

/* Module declarations from 'cython_gsl.gsl_dawson' */

/* Module declarations from 'cython_gsl.gsl_debye' */

/* Module declarations from 'cython_gsl.gsl_dilog' */

/* Module declarations from 'cython_gsl.gsl_elementary' */

/* Module declarations from 'cython_gsl.gsl_ellint' */

/* Module declarations from 'cython_gsl.gsl_elljac' */

/* Module declarations from 'cython_gsl.gsl_erf' */

/* Module declarations from 'cython_gsl.gsl_exp' */

/* Module declarations from 'cython_gsl.gsl_expint' */

/* Module declarations from 'cython_gsl.gsl_fermi_dirac' */

/* Module declarations from 'cython_gsl.gsl_gamma' */

/* Module declarations from 'cython_gsl.gsl_gegenbauer' */

/* Module declarations from 'cython_gsl.gsl_hyperg' */

/* Module declarations from 'cython_gsl.gsl_laguerre' */

/* Module declarations from 'cython_gsl.gsl_lambert' */

/* Module declarations from 'cython_gsl.gsl_legendre' */

/* Module declarations from 'cython_gsl.gsl_log' */

/* Module declarations from 'cython_gsl.gsl_pow_int' */

/* Module declarations from 'cython_gsl.gsl_psi' */

/* Module declarations from 'cython_gsl.gsl_synchrotron' */

/* Module declarations from 'cython_gsl.gsl_transport' */

/* Module declarations from 'cython_gsl.gsl_trig' */

/* Module declarations from 'cython_gsl.gsl_zeta' */

/* Module declarations from 'cython_gsl.gsl_block' */

/* Module declarations from 'cython_gsl.gsl_vector' */

/* Module declarations from 'cython_gsl.gsl_vector_complex' */

/* Module declarations from 'cython_gsl.gsl_matrix' */

/* Module declarations from 'cython_gsl.gsl_matrix_complex' */

/* Module declarations from 'cython_gsl.gsl_permutation' */

/* Module declarations from 'cython_gsl.gsl_combination' */

/* Module declarations from 'cython_gsl.gsl_sort' */

/* Module declarations from 'cython_gsl.gsl_blas_types' */

/* Module declarations from 'cython_gsl.gsl_blas' */

/* Module declarations from 'cython_gsl.gsl_linalg' */

/* Module declarations from 'cython_gsl.gsl_eigen' */

/* Module declarations from 'cython_gsl.gsl_fft' */

/* Module declarations from 'cython_gsl.gsl_integration' */

/* Module declarations from 'cython_gsl.gsl_rng' */

/* Module declarations from 'cython_gsl.gsl_qrng' */

/* Module declarations from 'cython_gsl.gsl_random' */

/* Module declarations from 'cython_gsl.gsl_statistics' */

/* Module declarations from 'cython_gsl.gsl_histogram' */

/* Module declarations from 'cython_gsl.gsl_ntuple' */

/* Module declarations from 'cython_gsl.gsl_monte' */

/* Module declarations from 'cython_gsl.gsl_odeiv' */

/* Module declarations from 'cython_gsl.gsl_odeiv2' */

/* Module declarations from 'cython_gsl.gsl_interp' */

/* Module declarations from 'cython_gsl.gsl_diff' */

/* Module declarations from 'cython_gsl.gsl_chebyshev' */

/* Module declarations from 'cython_gsl.gsl_sum' */

/* Module declarations from 'cython_gsl.gsl_roots' */

/* Module declarations from 'cython_gsl.gsl_min' */

/* Module declarations from 'cython_gsl.gsl_fit' */

/* Module declarations from 'cython_gsl' */

/* Module declarations from 'fwdpy.fwdpp' */

/* Module declarations from 'fwdpy.internal.internal' */
static PyTypeObject *__pyx_ptype_5fwdpy_8internal_8internal_shwrappervec = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_8internal_8internal_region_manager_wrapper = 0;

/* Module declarations from 'fwdpy.cpp' */

/* Module declarations from 'libcpp.unordered_set' */

/* Module declarations from 'fwdpy.structs' */

/* Module declarations from 'fwdpy.fitness' */
static PyTypeObject *__pyx_ptype_5fwdpy_7fitness_SpopFitness = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_7fitness_SpopAdditive = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_7fitness_SpopMult = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_7fitness_MlocusFitness = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_7fitness_MlocusAdditive = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_7fitness_MlocusMult = 0;
static CYTHON_INLINE void __pyx_f_5fwdpy_7fitness_hom_additive_update_2(double &, KTfwd::popgenmut const &); /*proto*/
static CYTHON_INLINE void __pyx_f_5fwdpy_7fitness_hom_additive_update_1(double &, KTfwd::popgenmut const &); /*proto*/

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

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

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.bool' */
static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;

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

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

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.complex' */
static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from 'cpython' */

/* Module declarations from 'array' */

/* Module declarations from 'cpython.array' */
static PyTypeObject *__pyx_ptype_7cpython_5array_array = 0;
static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *, char *, Py_ssize_t); /*proto*/

/* Module declarations from 'cython' */

/* Module declarations from 'libcpp.limits' */

/* Module declarations from 'fwdpy.fwdpy' */
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_PopType = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_Spop = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_MetaPop = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_MlocusPop = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_SpopGenMut = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_PopVec = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_SpopVec = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_SpopGenMutVec = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_MetaPopVec = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_GSLrng = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_TemporalSampler = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_NothingSampler = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_QtraitStatsSampler = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_PopSampler = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_VASampler = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy_FreqSampler = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct____iter__ = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ = 0;
static PyTypeObject *__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ = 0;
static PyTypeObject *__pyx_array_type = 0;
static PyTypeObject *__pyx_MemviewEnum_type = 0;
static PyTypeObject *__pyx_memoryview_type = 0;
static PyTypeObject *__pyx_memoryviewslice_type = 0;
static PyObject *generic = 0;
static PyObject *strided = 0;
static PyObject *indirect = 0;
static PyObject *contiguous = 0;
static PyObject *indirect_contiguous = 0;
static int __pyx_memoryview_thread_locks_used;
static PyThread_type_lock __pyx_memoryview_thread_locks[8];
static struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data __pyx_f_5fwdpy_5fwdpy_get_mutation(KTfwd::popgenmut const &, size_t); /*proto*/
static struct __pyx_t_5fwdpy_5fwdpy_gamete_data __pyx_f_5fwdpy_5fwdpy_get_gamete(fwdpy::gamete_t const &, fwdpy::mcont_t const &, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &); /*proto*/
static struct __pyx_t_5fwdpy_5fwdpy_diploid_data __pyx_f_5fwdpy_5fwdpy_get_diploid(fwdpy::diploid_t const &, fwdpy::gcont_t const &, fwdpy::mcont_t const &, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &); /*proto*/
static struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data __pyx_f_5fwdpy_5fwdpy_get_diploid_mloc(fwdpy::dipvector_t const &, fwdpy::gcont_t const &, fwdpy::mcont_t const &, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &); /*proto*/
static std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data>  __pyx_f_5fwdpy_5fwdpy_view_mutations_details(fwdpy::mcont_t const &, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &); /*proto*/
static std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data>  __pyx_f_5fwdpy_5fwdpy_view_gametes_details(fwdpy::singlepop_t const *); /*proto*/
static std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data>  __pyx_f_5fwdpy_5fwdpy_view_gametes_details_mloc(fwdpy::multilocus_t const *); /*proto*/
static std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_data>  __pyx_f_5fwdpy_5fwdpy_view_diploids_details(fwdpy::dipvector_t const &, fwdpy::gcont_t const &, fwdpy::mcont_t const &, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &, std::vector<unsigned int>  const &); /*proto*/
static std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data>  __pyx_f_5fwdpy_5fwdpy_view_diploids_details_mloc(std::vector<fwdpy::dipvector_t>  const &, fwdpy::gcont_t const &, fwdpy::mcont_t const &, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &, std::vector<unsigned int>  const &); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_init_containers(PyObject *, std::map<double,std::string>  *, PyObject *, size_t const ); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_fill_containers_details(PyObject *, std::map<double,std::string>  *, unsigned int const ); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_fill_containers(PyObject *, std::map<double,std::string>  *, std::map<double,std::string>  *); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_mloc_view_to_sample_fill_containers(PyObject *, std::map<double,std::string>  *, std::map<double,std::string>  *); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_copy_map(std::map<double,std::string>  &, std::vector<std::pair<double,std::string> >  &); /*proto*/
static void __pyx_f_5fwdpy_5fwdpy_resize_dip_view_data(struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data &, size_t); /*proto*/
static size_t __pyx_f_5fwdpy_5fwdpy_fill_dip_view_data(std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data> ::iterator, std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data> ::iterator, struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data &, size_t const , size_t const , size_t const ); /*proto*/
static struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data __pyx_f_5fwdpy_5fwdpy_view_diploids_pd_details(fwdpy::singlepop_t const *, std::vector<unsigned int>  const &, int); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_traits_singlepop(struct __pyx_obj_5fwdpy_5fwdpy_Spop *); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_traits_popvec(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_traits_singlepop_mloc(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_traits_popvec_mloc(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_traits_mpop(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *, PyObject *); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_traits_mpopvec(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *, PyObject *); /*proto*/
static struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data __pyx_f_5fwdpy_5fwdpy_get_fixed_mutation(KTfwd::popgenmut const &, unsigned int const , unsigned int const ); /*proto*/
static std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data>  __pyx_f_5fwdpy_5fwdpy_view_fixations_details(fwdpy::mcont_t const &, std::vector<unsigned int>  const &, unsigned int const ); /*proto*/
static std::vector<unsigned int>  __pyx_convert_vector_from_py_unsigned_int(PyObject *); /*proto*/
static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/
static std::pair<double,std::string>  __pyx_convert_pair_from_py_double__and_std_3a__3a_string(PyObject *); /*proto*/
static std::vector<std::pair<double,std::string> >  __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(PyObject *); /*proto*/
static std::vector<size_t>  __pyx_convert_vector_from_py_size_t(PyObject *); /*proto*/
static std::vector<short>  __pyx_convert_vector_from_py_short(PyObject *); /*proto*/
static PyObject *__pyx_convert_vector_to_py_unsigned_int(const std::vector<unsigned int>  &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/
static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/
static PyObject *__pyx_convert_pair_to_py_double____std_3a__3a_string(std::pair<double,std::string>  const &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(const std::vector<std::pair<double,std::string> >  &); /*proto*/
static PyObject *__pyx_convert_pair_to_py_KTfwd_3a__3a_sample_t____KTfwd_3a__3a_sample_t(std::pair<KTfwd::sample_t,KTfwd::sample_t>  const &); /*proto*/
static std::pair<double,double>  __pyx_convert_pair_from_py_double__and_double(PyObject *); /*proto*/
static std::vector<std::pair<double,double> >  __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_double_3e___(PyObject *); /*proto*/
static PyObject *__pyx_convert_vector_to_py_KTfwd_3a__3a_sep_sample_t(const std::vector<KTfwd::sep_sample_t>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_double(const std::vector<double>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_uint16_t(const std::vector<uint16_t>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data(const std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data_3e___(const std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data> >  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data(const std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_gamete_data_3e___(const std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data> >  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_data(const std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_data>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_int(const std::vector<int>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data(const std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_data_3e___(const std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_data> >  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data_3e___(const std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data> >  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_view_data(const std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data>  &); /*proto*/
static struct fwdpy::selected_mut_data __pyx_convert__from_py_struct__fwdpy_3a__3a_selected_mut_data(PyObject *); /*proto*/
static std::pair<unsigned int,double>  __pyx_convert_pair_from_py_unsigned_int__and_double(PyObject *); /*proto*/
static std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair>  __pyx_convert_vector_from_py___pyx_t_5fwdpy_5fwdpy_genfreqPair(PyObject *); /*proto*/
static std::pair<struct fwdpy::selected_mut_data,std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair> >  __pyx_convert_pair_from_py_struct__fwdpy_3a__3a_selected_mut_data__and_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___(PyObject *); /*proto*/
static std::vector<std::pair<struct fwdpy::selected_mut_data,std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair> > >  __pyx_convert_vector_from_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(PyObject *); /*proto*/
static PyObject *__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_allele_age_data_t(const std::vector<struct fwdpy::allele_age_data_t>  &); /*proto*/
static PyObject *__pyx_convert_pair_to_py_unsigned_int____double(std::pair<unsigned int,double>  const &); /*proto*/
static PyObject *__pyx_convert_vector_to_py___pyx_t_5fwdpy_5fwdpy_genfreqPair(const std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair>  &); /*proto*/
static PyObject *__pyx_convert_pair_to_py_struct__fwdpy_3a__3a_selected_mut_data____std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___(std::pair<struct fwdpy::selected_mut_data,std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair> >  const &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(const std::vector<std::pair<struct fwdpy::selected_mut_data,std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair> > >  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_selected_mut_data_tidy(const std::vector<struct fwdpy::selected_mut_data_tidy>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_qtrait_stats_cython(const std::vector<struct fwdpy::qtrait_stats_cython>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_qtrait_stats_cython_3e___(const std::vector<std::vector<struct fwdpy::qtrait_stats_cython> >  &); /*proto*/
static PyObject *__pyx_convert_pair_to_py_KTfwd_3a__3a_sep_sample_t____struct__fwdpy_3a__3a_popsample_details(std::pair<KTfwd::sep_sample_t,struct fwdpy::popsample_details>  const &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_pair_3c_KTfwd_3a__3a_sep_sample_t_2c_struct__fwdpy_3a__3a_popsample_details_3e___(const std::vector<std::pair<KTfwd::sep_sample_t,struct fwdpy::popsample_details> >  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_VAcum(const std::vector<struct fwdpy::VAcum>  &); /*proto*/
static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_VAcum_3e___(const std::vector<std::vector<struct fwdpy::VAcum> >  &); /*proto*/
static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
static void *__pyx_align_pointer(void *, size_t); /*proto*/
static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
static PyObject *_unellipsify(PyObject *, int); /*proto*/
static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_unsigned_int = { "unsigned int", NULL, sizeof(unsigned int), { 0 }, 0, IS_UNSIGNED(unsigned int) ? 'U' : 'I', IS_UNSIGNED(unsigned int), 0 };
#define __Pyx_MODULE_NAME "fwdpy.fwdpy"
int __pyx_module_is_main_fwdpy__fwdpy = 0;

/* Implementation of 'fwdpy.fwdpy' */
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_sum;
static PyObject *__pyx_builtin_format;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_Ellipsis;
static PyObject *__pyx_builtin_id;
static const char __pyx_k_1[] = "1";
static const char __pyx_k_N[] = "N";
static const char __pyx_k_O[] = "O";
static const char __pyx_k_b[] = "b";
static const char __pyx_k_c[] = "c";
static const char __pyx_k_e[] = "e";
static const char __pyx_k_f[] = "f";
static const char __pyx_k_g[] = "g";
static const char __pyx_k_h[] = "h";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_l[] = "l";
static const char __pyx_k_m[] = "m";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_o[] = "o";
static const char __pyx_k_p[] = "p";
static const char __pyx_k_s[] = "s";
static const char __pyx_k_v[] = "v";
static const char __pyx_k_w[] = "w";
static const char __pyx_k_9f[] = "{:.9f}";
static const char __pyx_k_Ns[] = "Ns";
static const char __pyx_k_gz[] = ".gz";
static const char __pyx_k_hi[] = "hi";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_il[] = "il";
static const char __pyx_k_lo[] = "lo";
static const char __pyx_k_n0[] = "n0";
static const char __pyx_k_n1[] = "n1";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_pd[] = "pd";
static const char __pyx_k_ps[] = "ps";
static const char __pyx_k_rv[] = "rv";
static const char __pyx_k_sd[] = "sd";
static const char __pyx_k_ul[] = "ul";
static const char __pyx_k__26[] = ", ";
static const char __pyx_k__74[] = ".";
static const char __pyx_k_beg[] = "beg";
static const char __pyx_k_dip[] = "dip";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_end[] = "end";
static const char __pyx_k_ffa[] = "ffa";
static const char __pyx_k_ffm[] = "ffm";
static const char __pyx_k_gen[] = "gen";
static const char __pyx_k_h_2[] = "h = ";
static const char __pyx_k_ind[] = "ind";
static const char __pyx_k_obj[] = "obj";
static const char __pyx_k_pds[] = "pds";
static const char __pyx_k_pop[] = "pop";
static const char __pyx_k_pos[] = "pos";
static const char __pyx_k_pss[] = "pss";
static const char __pyx_k_raf[] = "raf";
static const char __pyx_k_rgb[] = "rgb";
static const char __pyx_k_rng[] = "rng";
static const char __pyx_k_sh0[] = "sh0";
static const char __pyx_k_sh1[] = "sh1";
static const char __pyx_k_str[] = "__str__";
static const char __pyx_k_sum[] = "sum";
static const char __pyx_k_ExpS[] = "ExpS";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_base[] = "base";
static const char __pyx_k_bstr[] = "bstr";
static const char __pyx_k_cite[] = "cite";
static const char __pyx_k_csum[] = "csum";
static const char __pyx_k_deme[] = "deme";
static const char __pyx_k_estr[] = "estr";
static const char __pyx_k_fpio[] = "fpio";
static const char __pyx_k_freq[] = "freq";
static const char __pyx_k_gams[] = "gams";
static const char __pyx_k_hi_2[] = ", hi = ";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_iter[] = "__iter__";
static const char __pyx_k_lpds[] = "lpds";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_math[] = "math";
static const char __pyx_k_mean[] = "mean";
static const char __pyx_k_mode[] = "mode";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_ndim[] = "ndim";
static const char __pyx_k_nsam[] = "nsam";
static const char __pyx_k_pack[] = "pack";
static const char __pyx_k_pops[] = "pops";
static const char __pyx_k_rmgr[] = "rmgr";
static const char __pyx_k_sane[] = "sane";
static const char __pyx_k_seed[] = "seed";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_site[] = "site";
static const char __pyx_k_size[] = "size";
static const char __pyx_k_stat[] = "stat";
static const char __pyx_k_step[] = "step";
static const char __pyx_k_stop[] = "stop";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_tlen[] = "tlen";
static const char __pyx_k_view[] = "view";
static const char __pyx_k_warn[] = "warn";
static const char __pyx_k_wstr[] = "wstr";
static const char __pyx_k_ASCII[] = "ASCII";
static const char __pyx_k_beg_2[] = "beg = ";
static const char __pyx_k_chrom[] = "chrom";
static const char __pyx_k_class[] = "__class__";
static const char __pyx_k_clist[] = "clist";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_count[] = "count";
static const char __pyx_k_dfreq[] = "dfreq";
static const char __pyx_k_dummy[] = "dummy";
static const char __pyx_k_end_2[] = ", end = ";
static const char __pyx_k_error[] = "error";
static const char __pyx_k_esize[] = "esize";
static const char __pyx_k_flags[] = "flags";
static const char __pyx_k_ftime[] = "ftime";
static const char __pyx_k_fwdpy[] = "fwdpy";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_isinf[] = "isinf";
static const char __pyx_k_isnan[] = "isnan";
static const char __pyx_k_label[] = "label";
static const char __pyx_k_locus[] = "locus";
static const char __pyx_k_nlist[] = "nlist";
static const char __pyx_k_nloci[] = "nloci";
static const char __pyx_k_npops[] = "npops";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_shape[] = "shape";
static const char __pyx_k_slist[] = "slist";
static const char __pyx_k_start[] = "start";
static const char __pyx_k_super[] = "super";
static const char __pyx_k_temp1[] = "temp1";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_umuts[] = "umuts";
static const char __pyx_k_utf_8[] = "utf-8";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_GammaS[] = "GammaS";
static const char __pyx_k_Region[] = "Region";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_chrom0[] = "chrom0";
static const char __pyx_k_chrom1[] = "chrom1";
static const char __pyx_k_concat[] = "concat";
static const char __pyx_k_dcount[] = "dcount";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_ndemes[] = "ndemes";
static const char __pyx_k_nmpops[] = "nmpops";
static const char __pyx_k_object[] = "object";
static const char __pyx_k_origin[] = "origin";
static const char __pyx_k_pandas[] = "pandas";
static const char __pyx_k_psizes[] = "psizes";
static const char __pyx_k_sample[] = "sample";
static const char __pyx_k_size_2[] = "size_";
static const char __pyx_k_struct[] = "struct";
static const char __pyx_k_unpack[] = "unpack";
static const char __pyx_k_weight[] = "weight";
static const char __pyx_k_Sregion[] = "Sregion";
static const char __pyx_k_allgams[] = "allgams";
static const char __pyx_k_allmuts[] = "allmuts";
static const char __pyx_k_copypop[] = "copypop";
static const char __pyx_k_coupled[] = "coupled";
static const char __pyx_k_derived[] = "derived";
static const char __pyx_k_fitness[] = "fitness";
static const char __pyx_k_fortran[] = "fortran";
static const char __pyx_k_fwdpyio[] = "fwdpyio";
static const char __pyx_k_getfreq[] = "getfreq";
static const char __pyx_k_indlist[] = "indlist";
static const char __pyx_k_label_2[] = ", label = ";
static const char __pyx_k_listlen[] = "listlen";
static const char __pyx_k_locusID[] = "locusID";
static const char __pyx_k_map_itr[] = "map_itr";
static const char __pyx_k_memview[] = "memview";
static const char __pyx_k_minfreq[] = "minfreq";
static const char __pyx_k_neutral[] = "neutral";
static const char __pyx_k_optimum[] = "optimum";
static const char __pyx_k_popsize[] = "popsize";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_recrate[] = "recrate";
static const char __pyx_k_sampler[] = "sampler";
static const char __pyx_k_scaling[] = "scaling";
static const char __pyx_k_shape_2[] = ", shape = ";
static const char __pyx_k_Ellipsis[] = "Ellipsis";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_UniformS[] = "UniformS";
static const char __pyx_k_additive[] = "additive";
static const char __pyx_k_but_deme[] = ", but deme = ";
static const char __pyx_k_copypops[] = "copypops";
static const char __pyx_k_getfreqs[] = "getfreqs";
static const char __pyx_k_internal[] = "internal";
static const char __pyx_k_itemsize[] = "itemsize";
static const char __pyx_k_max_freq[] = "max_freq";
static const char __pyx_k_min_freq[] = "min_freq";
static const char __pyx_k_nderived[] = "nderived";
static const char __pyx_k_nregions[] = "nregions";
static const char __pyx_k_popsizes[] = "popsizes";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_selected[] = "selected";
static const char __pyx_k_sregions[] = "sregions";
static const char __pyx_k_ttl_nsam[] = "ttl_nsam";
static const char __pyx_k_vneutral[] = "vneutral";
static const char __pyx_k_warnings[] = "warnings";
static const char __pyx_k_weight_2[] = ", weight = ";
static const char __pyx_k_ConstantS[] = "ConstantS";
static const char __pyx_k_DataFrame[] = "DataFrame";
static const char __pyx_k_GaussianS[] = "GaussianS";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_ancestral[] = "ancestral";
static const char __pyx_k_check_sum[] = "check_sum";
static const char __pyx_k_donothing[] = "donothing";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_from_Spop[] = "from_Spop";
static const char __pyx_k_last_freq[] = "last_freq";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_ms_sample[] = "ms_sample";
static const char __pyx_k_serialize[] = "serialize";
static const char __pyx_k_set_index[] = "set_index";
static const char __pyx_k_vselected[] = "vselected";
static const char __pyx_k_ExpS___str[] = "ExpS.__str__";
static const char __pyx_k_IndexError[] = "IndexError";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_boundaries[] = "boundaries";
static const char __pyx_k_freqfilter[] = "freqfilter";
static const char __pyx_k_generation[] = "generation";
static const char __pyx_k_minsojourn[] = "minsojourn";
static const char __pyx_k_mu_neutral[] = "mu_neutral";
static const char __pyx_k_neutral_df[] = "neutral_df";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_recregions[] = "recregions";
static const char __pyx_k_ExpS___init[] = "ExpS.__init__";
static const char __pyx_k_MemoryError[] = "MemoryError";
static const char __pyx_k_allele_ages[] = "allele_ages";
static const char __pyx_k_fwdpy_fwdpy[] = "fwdpy.fwdpy";
static const char __pyx_k_get_samples[] = "get_samples";
static const char __pyx_k_min_sojourn[] = "min_sojourn";
static const char __pyx_k_mu_selected[] = "mu_selected";
static const char __pyx_k_pkg_version[] = "pkg_version";
static const char __pyx_k_removeFixed[] = "removeFixed";
static const char __pyx_k_selected_df[] = "selected_df";
static const char __pyx_k_unique_gams[] = "unique_gams";
static const char __pyx_k_GammaS___str[] = "GammaS.__str__";
static const char __pyx_k_Region___str[] = "Region.__str__";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_add_mutation[] = "add_mutation";
static const char __pyx_k_neutral_file[] = "neutral_file";
static const char __pyx_k_neutral_info[] = "neutral_info";
static const char __pyx_k_popdata_sane[] = "popdata_sane";
static const char __pyx_k_selectedOnly[] = "selectedOnly";
static const char __pyx_k_trajectories[] = "trajectories";
static const char __pyx_k_view_gametes[] = "view_gametes";
static const char __pyx_k_GammaS___init[] = "GammaS.__init__";
static const char __pyx_k_Region___init[] = "Region.__init__";
static const char __pyx_k_Sregion___str[] = "Sregion.__str__";
static const char __pyx_k_apply_sampler[] = "apply_sampler";
static const char __pyx_k_check_popdata[] = "check_popdata";
static const char __pyx_k_nderived_site[] = "nderived_site";
static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
static const char __pyx_k_recordDetails[] = "recordDetails";
static const char __pyx_k_recordSamples[] = "recordSamples";
static const char __pyx_k_selected_file[] = "selected_file";
static const char __pyx_k_selected_info[] = "selected_info";
static const char __pyx_k_trajectories1[] = "trajectories1";
static const char __pyx_k_trajectories2[] = "trajectories2";
static const char __pyx_k_view_diploids[] = "view_diploids";
static const char __pyx_k_Gamma_DFE_mean[] = "Gamma DFE, mean = ";
static const char __pyx_k_SpopVec___iter[] = "SpopVec.__iter__";
static const char __pyx_k_Sregion___init[] = "Sregion.__init__";
static const char __pyx_k_UniformS___str[] = "UniformS.__str__";
static const char __pyx_k_append_details[] = "__append_details__";
static const char __pyx_k_diploid_traits[] = "diploid_traits";
static const char __pyx_k_evolve_regions[] = "evolve_regions";
static const char __pyx_k_multiplicative[] = "multiplicative";
static const char __pyx_k_view_fixations[] = "view_fixations";
static const char __pyx_k_view_mutations[] = "view_mutations";
static const char __pyx_k_ConstantS___str[] = "ConstantS.__str__";
static const char __pyx_k_GaussianS___str[] = "GaussianS.__str__";
static const char __pyx_k_UniformS___init[] = "UniformS.__init__";
static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
static const char __pyx_k_locusBoundaries[] = "locusBoundaries";
static const char __pyx_k_ConstantS___init[] = "ConstantS.__init__";
static const char __pyx_k_Constant_s_DFE_s[] = "Constant s DFE, s = ";
static const char __pyx_k_Expecting_PopVec[] = "Expecting PopVec.";
static const char __pyx_k_GaussianS___init[] = "GaussianS.__init__";
static const char __pyx_k_Gaussian_DFE_s_d[] = "Gaussian DFE, s.d. = ";
static const char __pyx_k_Uniform_s_DFE_lo[] = "Uniform s DFE, lo = ";
static const char __pyx_k_VASampler___iter[] = "VASampler.__iter__";
static const char __pyx_k_fitness_function[] = "fitness_function";
static const char __pyx_k_getfreq_line_159[] = "getfreq (line 159)";
static const char __pyx_k_is_not_supported[] = " is not supported";
static const char __pyx_k_ms_sample_line_6[] = "ms_sample (line 6)";
static const char __pyx_k_sample_must_be_0[] = "sample must be >= 0";
static const char __pyx_k_unsupported_type[] = "unsupported type";
static const char __pyx_k_view_diploids_pd[] = "view_diploids_pd";
static const char __pyx_k_Expecting_PopType[] = "Expecting PopType.";
static const char __pyx_k_MetaPopVec___iter[] = "MetaPopVec.__iter__";
static const char __pyx_k_PopSampler___iter[] = "PopSampler.__iter__";
static const char __pyx_k_getfreqs_line_187[] = "getfreqs (line 187)";
static const char __pyx_k_nderived_line_142[] = "nderived (line 142)";
static const char __pyx_k_tidy_trajectories[] = "tidy_trajectories";
static const char __pyx_k_FreqSampler___iter[] = "FreqSampler.__iter__";
static const char __pyx_k_check_input_params[] = "check_input_params";
static const char __pyx_k_get_sample_details[] = "get_sample_details";
static const char __pyx_k_index_out_of_range[] = "index out of range";
static const char __pyx_k_merge_trajectories[] = "merge_trajectories";
static const char __pyx_k_remove_arose_after[] = "remove_arose_after";
static const char __pyx_k_remove_gone_before[] = "remove_gone_before";
static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
static const char __pyx_k_unupported_PopType[] = "unupported PopType";
static const char __pyx_k_MlocusPopVec___iter[] = "MlocusPopVec.__iter__";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_add_mutation_line_3[] = "add_mutation (line 3)";
static const char __pyx_k_deme_cannot_be_None[] = "deme cannot be None";
static const char __pyx_k_evolve_regions_more[] = "evolve_regions_more";
static const char __pyx_k_freqfilter_line_208[] = "freqfilter (line 208)";
static const char __pyx_k_get_samples_line_30[] = "get_samples (line 30)";
static const char __pyx_k_make_region_manager[] = "make_region_manager";
static const char __pyx_k_view_gametes_popvec[] = "view_gametes_popvec";
static const char __pyx_k_Exponential_DFE_mean[] = "Exponential DFE, mean = ";
static const char __pyx_k_SpopGenMutVec___iter[] = "SpopGenMutVec.__iter__";
static const char __pyx_k_apply_sampler_single[] = "apply_sampler_single";
static const char __pyx_k_check_popdata_popvec[] = "check_popdata_popvec";
static const char __pyx_k_deserialize_metapops[] = "deserialize_metapops";
static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
static const char __pyx_k_view_diploids_popvec[] = "view_diploids_popvec";
static const char __pyx_k_view_gametes_metapop[] = "view_gametes_metapop";
static const char __pyx_k_PopType_not_supported[] = "PopType not supported";
static const char __pyx_k_check_popdata_metapop[] = "check_popdata_metapop";
static const char __pyx_k_check_popdata_mpopvec[] = "check_popdata_mpopvec";
static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
static const char __pyx_k_fwdpy_copypop_PopType[] = "fwdpy.copypop: PopType ";
static const char __pyx_k_view_diploids_metapop[] = "view_diploids_metapop";
static const char __pyx_k_view_fixations_popvec[] = "view_fixations_popvec";
static const char __pyx_k_view_gametes_line_308[] = "view_gametes (line 308)";
static const char __pyx_k_view_mutations_popvec[] = "view_mutations_popvec";
static const char __pyx_k_ExpS___init___line_286[] = "ExpS.__init__ (line 286)";
static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
static const char __pyx_k_deserialize_singlepops[] = "deserialize_singlepops";
static const char __pyx_k_diploid_view_to_sample[] = "diploid_view_to_sample";
static const char __pyx_k_evolve_regions_line_29[] = "evolve_regions (line 29)";
static const char __pyx_k_evolve_regions_sampler[] = "evolve_regions_sampler";
static const char __pyx_k_nderived_site_line_117[] = "nderived_site (line 117)";
static const char __pyx_k_view_diploids_line_398[] = "view_diploids (line 398)";
static const char __pyx_k_view_gametes_singlepop[] = "view_gametes_singlepop";
static const char __pyx_k_view_mutations_metapop[] = "view_mutations_metapop";
static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
static const char __pyx_k_Region___init___line_18[] = "Region.__init__ (line 18)";
static const char __pyx_k_check_popdata_singlepop[] = "check_popdata_singlepop";
static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
static const char __pyx_k_deme_value_out_of_range[] = "deme value out of range";
static const char __pyx_k_fwdpy_Region_weight_0_0[] = "fwdpy.Region: weight < 0.0";
static const char __pyx_k_view_diploids_pd_popvec[] = "view_diploids_pd_popvec";
static const char __pyx_k_view_diploids_singlepop[] = "view_diploids_singlepop";
static const char __pyx_k_view_mutations_line_218[] = "view_mutations (line 218)";
static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
static const char __pyx_k_GammaS___init___line_139[] = "GammaS.__init__ (line 139)";
static const char __pyx_k_Sregion___init___line_91[] = "Sregion.__init__ (line 91)";
static const char __pyx_k_f_0_will_be_treated_as_0[] = "f < 0 will be treated as 0";
static const char __pyx_k_view_gametes_popvec_mloc[] = "view_gametes_popvec_mloc";
static const char __pyx_k_view_mutations_singlepop[] = "view_mutations_singlepop";
static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
static const char __pyx_k_QtraitStatsSampler___iter[] = "QtraitStatsSampler.__iter__";
static const char __pyx_k_tidy_trajectories_details[] = "tidy_trajectories_details";
static const char __pyx_k_view_diploids_popvec_mloc[] = "view_diploids_popvec_mloc";
static const char __pyx_k_UniformS___init___line_235[] = "UniformS.__init__ (line 235)";
static const char __pyx_k_fwdpy_ExpS_mean_not_finite[] = "fwdpy.ExpS: mean not finite";
static const char __pyx_k_fwdpy_Sregion_h_not_finite[] = "fwdpy.Sregion: h not finite";
static const char __pyx_k_get_sample_details_line_67[] = "get_sample_details (line 67)";
static const char __pyx_k_object_type_not_understood[] = "object type not understood";
static const char __pyx_k_view_diploids_pd_singlepop[] = "view_diploids_pd_singlepop";
static const char __pyx_k_view_mutations_popvec_mloc[] = "view_mutations_popvec_mloc";
static const char __pyx_k_ConstantS___init___line_189[] = "ConstantS.__init__ (line 189)";
static const char __pyx_k_GaussianS___init___line_333[] = "GaussianS.__init__ (line 333)";
static const char __pyx_k_diploid_mloc_view_to_sample[] = "diploid_mloc_view_to_sample";
static const char __pyx_k_fwdpy_Region_beg_not_finite[] = "fwdpy.Region: beg not finite";
static const char __pyx_k_fwdpy_Region_end_not_finite[] = "fwdpy.Region: end not finite";
static const char __pyx_k_fwdpy_Segion_h_not_a_number[] = "fwdpy.Segion: h not a number";
static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
static const char __pyx_k_view_fixations_mlocuspopvec[] = "view_fixations_mlocuspopvec";
static const char __pyx_k_view_gametes_singlepop_mloc[] = "view_gametes_singlepop_mloc";
static const char __pyx_k_evolve_regions_more_line_102[] = "evolve_regions_more (line 102)";
static const char __pyx_k_fwdpy_ConstantS_s_not_finite[] = "fwdpy.ConstantS: s not finite";
static const char __pyx_k_fwdpy_ExpS_mean_not_a_number[] = "fwdpy.ExpS: mean not a number";
static const char __pyx_k_fwdpy_GammaS_mean_not_finite[] = "fwdpy.GammaS: mean not finite";
static const char __pyx_k_fwdpy_UniformS_hi_not_finite[] = "fwdpy.UniformS: hi not finite";
static const char __pyx_k_fwdpy_UniformS_lo_not_finite[] = "fwdpy.UniformS: lo not finite";
static const char __pyx_k_fwdpy_copypopvec_popvec_type[] = "fwdpy.copypopvec: popvec type ";
static const char __pyx_k_index_greater_than_deme_size[] = "index greater than deme size";
static const char __pyx_k_recombination_rate_must_be_0[] = "recombination rate must be >= 0.";
static const char __pyx_k_view_diploids_singlepop_mloc[] = "view_diploids_singlepop_mloc";
static const char __pyx_k_Not_implemented_for_this_type[] = "Not implemented for this type";
static const char __pyx_k_fwdpy_GammaS_shape_not_finite[] = "fwdpy.GammaS: shape not finite";
static const char __pyx_k_fwdpy_GaussianS_sd_not_finite[] = "fwdpy.GaussianS: sd not finite";
static const char __pyx_k_fwdpy_Region_beg_not_a_number[] = "fwdpy.Region: beg not a number";
static const char __pyx_k_fwdpy_Region_end_not_a_number[] = "fwdpy.Region: end not a number";
static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
static const char __pyx_k_view_mutations_singlepop_mloc[] = "view_mutations_singlepop_mloc";
static const char __pyx_k_Add_a_mutation_to_a_population[] = "\n    Add a mutation to a population at a specific position.\n\n    :param p: A :class:`fwdpy.fwdpy.PopType`.\n    :param indlist: A list of individuals to whom the mutation will be added.  Must be unsigned indexes [0,N).\n    :param clist: A list of chromosomes to which to add the new mutation in each individual. 0 = chrom1, 1 = chrom2, 2 = both.\n    :param pos: The position of the new mutation\n    :param s: The selection coefficient/effect size of the new mutation\n    :param h: The dominance coefficient of the new mutation\n\n    .. note:: Only :class:`fwdpy.fwdpy.Spop` is currently supported\n\n    .. note:: RuntimeError will be thrown if pos already exists in p or if any element in clist and/or indlist is out of range.\n\n    Example:\n\n    >>> import fwdpy as fp\n    >>> #init a monomorphic pop\n    >>> p = fp.SpopVec(1,1000)\n    >>> x = fp.add_mutation(p[0],[0,10,20],[0,1,2],0.01,0.0,1.0)\n    >>> #x will have value 0 b/c it is first mutation entered into pop\n    >>> x\n    0\n    >>> fp.view_mutations(p[0])\n    [{'g': 0, 'h': 1.0, 'pos': 0.01, 'n': 4, 's': 0.0, 'ftime': 4294967295, 'label': 0, 'neutral': True}]\n    ";
static const char __pyx_k_Get_mutation_frequencies_param[] = "\n    Get mutation frequencies\n\n    :param site: A tuple. See example\n    :param derived:  If True, report derived allele frequency (DAF).  If False, return minor allele freqency (MAF)\n\n    .. note:: Do **not** use this function to calculate :math:`\\pi` (a.k.a. :math:`\\hat\\theta_\\pi`, a.k.a. \"sum of site heterozygosity\").\n       :math:`\\pi` for a **sample** is not :math:`2\\sum_ip_iq_i`. because the sample is *finite*.\n       In general, it will be more convenient to call :func:`fwdpy.fwdpy.getfreqs` on a list of tuples.\n\n    Example:\n\n    >>> import fwdpy\n    >>> #DAF = 7/10\n    >>> #MAF = 3/10\n    >>> x = (0.1,'0111111100')\n    >>> round(fwdpy.getfreq(x,True),3)\n    0.7\n    >>> round(fwdpy.getfreq(x,False),3)\n    0.3\n    ";
static const char __pyx_k_evolve_regions_sampler_fitness[] = "evolve_regions_sampler_fitness";
static const char __pyx_k_fwdpy_ConstantS_s_not_a_number[] = "fwdpy.ConstantS: s not a number";
static const char __pyx_k_fwdpy_GammaS_mean_not_a_number[] = "fwdpy.GammaS: mean not a number";
static const char __pyx_k_fwdpy_Region_weight_not_finite[] = "fwdpy.Region: weight not finite";
static const char __pyx_k_fwdpy_UniformS_hi_not_a_number[] = "fwdpy.UniformS: hi not a number";
static const char __pyx_k_fwdpy_UniformS_lo_not_a_number[] = "fwdpy.UniformS: lo not a number";
static const char __pyx_k_home_kevin_src_fwdpy_fwdpy_add[] = "/home/kevin/src/fwdpy/fwdpy/add_mutations.pyx";
static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
static const char __pyx_k_Constant_fixed_selection_coeffi[] = "\n    Constant/fixed selection coefficient\n\n    Attributes:\n        * b: the beginning of the region\n        * e: the end of the region\n        * w: the \"weight\" assigned to the region\n        * s: the selection coefficient\n        * h: the dominance term\n        * l: A label assigned to the region.  Labels must be integers, and can be used to 'tag' mutations arising in different regions.\n\n    See :func:`evolve_regions` for how this class may be used to parameterize a simulation\n    ";
static const char __pyx_k_Constructor_param_beg_the_begin[] = "\n        Constructor\n\n        :param beg: the beginning of the region\n        :param end: the end of the region\n        :param weight: the weight to assign\n        :param coupled: if True, the weight is converted to (end-beg)*weight\n        :param label: Not relevant to recombining regions.  Otherwise, this value will be used to take mutations from this region.\n\n        When coupled is True, the \"weight\" may be interpreted as a \"per base pair\"\n        (or per unit, generally speaking) term.\n\n        Example:\n\n        >>> #A simple case\n        >>> import fwdpy\n        >>> r = fwdpy.Region(0,1,1)\n        >>> #A more \"biological\" case:\n        >>> #  The region covers positions 1 through 1,000,\n        >>> #  and the per-base pair \"weight\" is 1e-5:\n        >>> r = fwdpy.Region(1,1000,1e-5,True)\n        ";
static const char __pyx_k_Continue_to_evolve_a_region_wit[] = "\n    Continue to evolve a region with variable mutation, fitness effects, and recombination rates.\n\n    :param rng: a :class:`GSLrng`\n    :param pops: a :class:`SpopVec`\n    :param nlist: An array view of a NumPy array.  This represents the population sizes over time.  The length of this view is the length of the simulation in generations. The view must be of an array of 32 bit, unsigned integers (see example).\n    :param mu_neutral: The mutation rate to variants not affecting fitness (\"neutral\" mutations).  The unit is per gamete, per generation.\n    :param mu_selected: The mutation rate to variants affecting fitness (\"selected\" mutations).  The unit is per gamete, per generation.\n    :param recrate: The recombination rate in the regions (per diploid, per generation)\n    :param nregions: A list specifying where neutral mutations occur\n    :param sregions: A list specifying where selected mutations occur\n    :param recregions: A list specifying how the genetic map varies along the region\n    :param f: The selfing probabilty\n    :param scaling: For a single mutation, fitness is calculated as 1, 1+sh, and 1+scaling*s for genotypes AA, Aa, and aa, respectively.\n    :param fitness: The fitness model.  Must be either \"multiplicative\" or \"additive\".\n\n    :raises: RuntimeError if parameters do not pass checks\n\n    Example:\n\n    >>> # See docstring for fwdpy.evolve_regions for the gory details\n    >>> import fwdpy\n    >>> import numpy as np\n    >>> nregions = [fwdpy.Region(0,1,1),fwdpy.Region(2,3,1)]\n    >>> sregions = [fwdpy.ExpS(1,2,1,-0.1),fwdpy.ExpS(1,2,0.01,0.001)]\n    >>> rregions = [fwdpy.Region(0,3,1)]\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes = np.array([1000],dtype=np.uint32)\n    >>> # Evolve for 5N generations initially\n    >>> popsizes=np.tile(popsizes,5000)\n    >>> pops = fwdpy.evolve_regions(rng,1,1000,popsizes[0:],0.001,0.0001,0.001,nregions,sregions,rregions)\n    >>> # Evolve for another 5N generations\n    >>> f""wdpy.evolve_regions_more(rng,pops,popsizes[0:],0.001,0.0001,0.001,nregions,sregions,rregions)\n    ";
static const char __pyx_k_Convenience_wrapper_around_func[] = "\n    Convenience wrapper around :func:`fwdpy.fwdpy.nderived`\n\n    :param sample: a sample from a population.  For example, the return value of :func:`fwdpy.fwdpy.ms_sample` or :func:`fwdpy.fwdpy.get_samples`\n\n    Example:\n\n    >>> import fwdpy,array\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes=array.array('I',[1000]*1000)\n    >>> pop = fwdpy.evolve_regions(rng,3,1000,popsizes[0:],0.001,0,0.001,[fwdpy.Region(0,1,1)],[],[fwdpy.Region(0,1,1)])\n    >>> s = [fwdpy.ms_sample(rng,i,10) for i in pop]\n    >>> nd = [fwdpy.nderived(i) for i in s]\n    ";
static const char __pyx_k_Evolve_a_region_with_variable_m[] = "\n    Evolve a region with variable mutation, fitness effects, and recombination rates.\n\n    :param rng: a :class:`GSLrng`\n    :param npops: The number of populations to simulate.  This is equal to the number of threads that will be used!\n    :param N: The diploid population size to simulate\n    :param nlist: An array view of a NumPy array.  This represents the population sizes over time.  The length of this view is the length of the simulation in generations. The view must be of an array of 32 bit, unsigned integers (see example).\n    :param mu_neutral: The mutation rate to variants not affecting fitness (\"neutral\" mutations).  The unit is per gamete, per generation.\n    :param mu_selected: The mutation rate to variants affecting fitness (\"selected\" mutations).  The unit is per gamete, per generation.\n    :param recrate: The recombination rate in the regions (per diploid, per generation)\n    :param nregions: A list specifying where neutral mutations occur\n    :param sregions: A list specifying where selected mutations occur\n    :param recregions: A list specifying how the genetic map varies along the region\n    :param f: The selfing probabilty\n    :param scaling: For a single mutation, fitness is calculated as 1, 1+sh, and 1+scaling*s for genotypes AA, Aa, and aa, respectively.\n    :param fitness: The fitness model.  Must be either \"multiplicative\" or \"additive\".\n\n    :raises: RuntimeError if parameters do not pass checks\n\n    Example:\n\n    >>> import fwdpy\n    >>> import numpy as np\n    >>> #Our \"neutral\" regions will be from positions [0,1) and [2,3).\n    >>> #The regions will have equal weights, and thus will each get\n    >>> #1/2 of newly-arising, neutral mutations\n    >>> nregions = [fwdpy.Region(0,1,1),fwdpy.Region(2,3,1)]\n    >>> #Our \"selected\" mutations will have positions on the continuous\n    >>> #interval [1,2).  There will be two classes of such mutations,\n    >>> #each with exponentially-distrubted selection coe""fficients.\n    >>> #The first class will have a mean of s = -0.1 (deleterious), and the second\n    >>> #will have a mean of 1e-3 (adaptive).  The former will be 100x more common than\n    >>> #the latter, as the weights are 1 and 0.01, respectively.\n    >>> sregions = [fwdpy.ExpS(1,2,1,-0.1),fwdpy.ExpS(1,2,0.01,0.001)]\n    >>> #Recombination will be uniform along the interval [0,3).\n    >>> rregions = [fwdpy.Region(0,3,1)]\n    >>> rng = fwdpy.GSLrng(100)\n    >>> #popsizes are NumPy arrays of 32bit unsigned integers\n    >>> #Initial pop size will be N = 1,000, and\n    >>> #the type must be uint32 (32 bit unsigned integer)\n    >>> popsizes = np.array([1000],dtype=np.uint32)\n    >>> #The simulation will be for 10*N generations,\n    >>> #so we replicate that value in the array\n    >>> popsizes=np.tile(popsizes,100)\n    >>> #Simulate 1 deme under this model.\n    >>> #The total neutral mutation rate is 1e-3,\n    >>> #which is also the recombination rate.\n    >>> #The total mutation rate to selected variants is 0.1*(the neutral mutation rate).\n    >>> pops = fwdpy.evolve_regions(rng,1,1000,popsizes[0:],0.001,0.0001,0.001,nregions,sregions,rregions)\n    ";
static const char __pyx_k_Exponential_distribution_on_sel[] = "\n    Exponential distribution on selection coefficients\n\n    Attributes:\n        * b: the beginning of the region\n        * e: the end of the region\n        * w: the \"weight\" assigned to the region\n        * mean: the mean selection coefficient\n        * h: the dominance term\n        * l: A label assigned to the region.  Labels must be integers, and can be used to 'tag' mutations arising in different regions.\n\n    See :func:`evolve_regions` for how this class may be used to parameterize a simulation\n    ";
static const char __pyx_k_Gamma_distribution_of_fitness_e[] = "\n    Gamma distribution of fitness effects\n\n    Attributes:\n        * b: the beginning of the region\n        * e: the end of the region\n        * w: the \"weight\" assigned to the region\n        * mean: mean of the Gamma\n        * shape: shape of the Gamma\n        * h: the dominance term\n        * l: A label assigned to the region.  Labels must be integers, and can be used to 'tag' mutations arising in different regions.\n\n    See :func:`evolve_regions` for how this class may be used to parameterize a simulation\n    ";
static const char __pyx_k_Gaussian_distribution_on_select[] = "\n    Gaussian distribution on selection coefficients (effect sizes for sims of quantitative traits)\n\n    Attributes:\n        * b: the beginning of the region\n        * e: the end of the region\n        * w: the \"weight\" assigned to the region\n        * sd: the standard deviation\n        * h: the dominance ter\n        * l: A label assigned to the region.  Labels must be integers, and can be used to 'tag' mutations arising in different regions.\n\n    The mean is zero.\n\n    See :func:`evolve_regions` for how this class may be used to parameterize a simulation\n    ";
static const char __pyx_k_Get_additional_details_for_popu[] = "\n    Get additional details for population samples\n\n    :param ms_samples: A list returned by :func:`ms_sample`\n    :param pops: A :class:`PopType` \n    :params locusID: (None) A numerical label for a locus.  Only used/relevant if pop is :class:`fwdpy.fwdpy.MlocusPop`\n\n    :return: A dictionary of data for each mutation in the sample.\n\n    :rtype: dict\n    \n    Example:\n\n    >>> import fwdpy,array\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes=array.array('I',[1000]*1000)\n    >>> pop = fwdpy.evolve_regions(rng,3,1000,popsizes[0:],0.001,0,0.001,[fwdpy.Region(0,1,1)],[],[fwdpy.Region(0,1,1)])\n    >>> s = [fwdpy.ms_sample(rng,i,10) for i in pop]\n    >>> details = [fwdpy.get_sample_details(i,j) for i,j in zip(s,pop)]\n    ";
static const char __pyx_k_Get_detailed_list_of_a_set_of_d[] = "\n    Get detailed list of a set of diploids in the population\n\n    :param p: a :class:`fwdpy.fwdpy.PopType` or a :class:`fwdpy.fwdpy.PopVec`\n    :param deme: if p is a :class`fwdpy.fwdpy.MetaPop`, deme is the index of the deme to sample\n    \n    :rtype: a list of dictionaries.  See Note.\n\n    Example:\n\n    >>> import fwdpy\n    >>> import numpy as np\n    >>> nregions = [fwdpy.Region(0,1,1),fwdpy.Region(2,3,1)]\n    >>> sregions = [fwdpy.ExpS(1,2,1,-0.1),fwdpy.ExpS(1,2,0.01,0.001)]\n    >>> rregions = [fwdpy.Region(0,3,1)]\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes = np.array([1000],dtype=np.uint32)\n    >>> popsizes=np.tile(popsizes,100)\n    >>> pops = fwdpy.evolve_regions(rng,1,1000,popsizes[0:],0.001,0.0001,0.001,nregions,sregions,rregions)\n    >>> dips = [fwdpy.view_diploids(i,[0,101,201,301]) for i in pops]\n\n    .. note:: :class:`fwdpy.fwdpy.MetaPopVec` currently not supported\n    ";
static const char __pyx_k_Get_detailed_list_of_all_gamete[] = "\n    Get detailed list of all gametes in the population\n\n    :param p: a :class:`fwdpy.fwdpy.PopType` or a :class:`fwdpy.fwdpy.PopVec`\n    :param deme: If p is a :class:`fwdpy.fwdpy.MetaPop`, deme is the index of the deme to view\n\n    :rtype: a list of dictionaries.  See note.\n\n    Example for a single deme:\n\n    >>> import fwdpy\n    >>> import numpy as np\n    >>> nregions = [fwdpy.Region(0,1,1),fwdpy.Region(2,3,1)]\n    >>> sregions = [fwdpy.ExpS(1,2,1,-0.1),fwdpy.ExpS(1,2,0.01,0.001)]\n    >>> rregions = [fwdpy.Region(0,3,1)]\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes = np.array([1000],dtype=np.uint32)\n    >>> popsizes=np.tile(popsizes,100)\n    >>> pops = fwdpy.evolve_regions(rng,1,1000,popsizes[0:],0.001,0.0001,0.001,nregions,sregions,rregions)\n    >>> dips = [fwdpy.view_gametes(i) for i in pops]\n\n    .. note:: :class:`fwdpy.fwdpy.MetaPopVec` currently not supported\n    ";
static const char __pyx_k_Get_detailed_list_of_all_mutati[] = "\n    Get detailed list of all mutations in the population\n\n    :param p: a :class:`fwdpy.fwdpy.PopType` or a :class:`fwdpy.fwdpy.PopVec`\n\n    :rtype: a list of dictionaries.  See Note.\n\n    Example:\n\n    >>> import fwdpy\n    >>> import numpy as np\n    >>> nregions = [fwdpy.Region(0,1,1),fwdpy.Region(2,3,1)]\n    >>> sregions = [fwdpy.ExpS(1,2,1,-0.1),fwdpy.ExpS(1,2,0.01,0.001)]\n    >>> rregions = [fwdpy.Region(0,3,1)]\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes = np.array([1000],dtype=np.uint32)\n    >>> popsizes=np.tile(popsizes,100)\n    >>> pops = fwdpy.evolve_regions(rng,1,1000,popsizes[0:],0.001,0.0001,0.001,nregions,sregions,rregions)\n    >>> #muts[0] will be a list and muts[0][0] will be a dict\n    >>> muts = [fwdpy.view_mutations(i) for i in pops]\n\n    .. note:: :class:`fwdpy.fwdpy.MetaPopVec` currently not supported\n    ";
static const char __pyx_k_Get_the_number_of_derived_mutat[] = "\n    Get the number of derived mutations at a site.\n\n    :param site: A tuple.  See example\n\n    .. note:: In general, it will be more convenient to call :func:`fwdpy.fwdpy.nderived` on a list of tuples.\n\n    Example:\n\n    >>> import fwdpy\n    >>> #Create a site at position 0.1 with the\n    >>> #genotypes as the second element. 0/1 = ancestral/derived\n    >>> x = (0.1,'01100111')\n    >>> fwdpy.nderived_site(x)\n    5\n    >>> #Process simulation results:\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes=array.array('I',[1000]*1000)\n    >>> pop = fwdpy.evolve_regions(rng,3,1000,popsizes[0:],0.001,0,0.001,[fwdpy.Region(0,1,1)],[],[fwdpy.Region(0,1,1)])\n    >>> s = [fwdpy.ms_sample(rng,i,10) for i in pop]\n    >>> for i in s[0]: ndi = fwdpy.nderived_site(i)\n    ";
static const char __pyx_k_Neutral_regions_must_be_defined[] = "Neutral regions must be defined when mutation rate > 0";
static const char __pyx_k_Remove_low_frequency_variants_f[] = "\n    Remove low-frequency variants from a sample.\n\n    :param sample: a sample from a population.  For example, the return value of :func:`fwdpy.fwdpy.ms_sample` or :func:`fwdpy.fwdpy.get_samples`\n    :param minfreq: Remove all sites with frequency < minfreq\n    :param derived: if True, filter on derived allele frequency.  If False, filter on minor allele frequency.\n\n    Example:\n\n    >>> import fwdpy,array\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes=array.array('I',[1000]*1000)\n    >>> pop = fwdpy.evolve_regions(rng,3,1000,popsizes[0:],0.001,0,0.001,[fwdpy.Region(0,1,1)],[],[fwdpy.Region(0,1,1)])\n    >>> s = [fwdpy.ms_sample(rng,i,10) for i in pop]\n    >>> s2 = [fwdpy.freqfilter(i,0.2) for i in s]\n    ";
static const char __pyx_k_Representation_of_a_region_in_a[] = "\n    Representation of a \"region\" in a simulation.\n\n    Attributes:\n        b: the beginning of the region\n        e: the end of the region\n        w: the \"weight\" assigned to the region\n        l: A label assigned to the region.  Labels must be integers, and can be used to 'tag' mutations arising in different regions.\n\n    See :func:`evolve_regions` for how this class may be used to parameterize a simulation.\n\n    This class is extended by:\n        * :class:`fwdpy.fwdpy.Sregion`\n    ";
static const char __pyx_k_Take_a_sample_from_a_set_of_sim[] = "\n    Take a sample from a set of simulated populations.\n\n    :param rng: a :class:`GSLrng`\n    :param pops: An object inheriting from :class:`PopType`\n    :param nsam: List of sample sizes (no. chromosomes) to sample.\n    :param removeFixed: if True, only polymorphic sites are retained\n\n    Note: nsam will likely be changed to a list soon, to accomodate multi-deme simulations\n\n    Example:\n\n    >>> import fwdpy,array\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes=array.array('I',[1000]*1000)\n    >>> pop = fwdpy.evolve_regions(rng,3,1000,popsizes[0:],0.001,0,0.001,[fwdpy.Region(0,1,1)],[],[fwdpy.Region(0,1,1)])\n    >>> s = [fwdpy.ms_sample(rng,i,10) for i in pop]\n    ";
static const char __pyx_k_Uniform_distribution_on_selecti[] = "\n    Uniform distribution on selection coefficients\n\n    Attributes:\n        * b: the beginning of the region\n        * e: the end of the region\n        * w: the \"weight\" assigned to the region\n        * lo: the lower bound on s\n        * hi: the upper bound on s\n        * h: the dominance term\n        * l: A label assigned to the region.  Labels must be integers, and can be used to 'tag' mutations arising in different regions.\n\n    See :func:`evolve_regions` for how this class may be used to parameterize a simulation\n    ";
static const char __pyx_k_fwdpy_GammaS_shape_not_a_number[] = "fwdpy.GammaS: shape not a number";
static const char __pyx_k_fwdpy_GaussianS_sd_not_a_number[] = "fwdpy.GaussianS: sd not a number";
static const char __pyx_k_home_kevin_src_fwdpy_fwdpy_ages[] = "/home/kevin/src/fwdpy/fwdpy/ages.pyx";
static const char __pyx_k_home_kevin_src_fwdpy_fwdpy_copy[] = "/home/kevin/src/fwdpy/fwdpy/copy.pyx";
static const char __pyx_k_home_kevin_src_fwdpy_fwdpy_debu[] = "/home/kevin/src/fwdpy/fwdpy/debug.pyx";
static const char __pyx_k_home_kevin_src_fwdpy_fwdpy_evol[] = "/home/kevin/src/fwdpy/fwdpy/evolve_regions.pyx";
static const char __pyx_k_home_kevin_src_fwdpy_fwdpy_fwdp[] = "/home/kevin/src/fwdpy/fwdpy/fwdpy.pyx";
static const char __pyx_k_home_kevin_src_fwdpy_fwdpy_regi[] = "/home/kevin/src/fwdpy/fwdpy/regions.pyx";
static const char __pyx_k_home_kevin_src_fwdpy_fwdpy_samp[] = "/home/kevin/src/fwdpy/fwdpy/sampling.pyx";
static const char __pyx_k_home_kevin_src_fwdpy_fwdpy_temp[] = "/home/kevin/src/fwdpy/fwdpy/temporal_samplers.pyx";
static const char __pyx_k_home_kevin_src_fwdpy_fwdpy_view[] = "/home/kevin/src/fwdpy/fwdpy/views.pyx";
static const char __pyx_k_the_two_input_lists_must_be_the[] = "the two input lists must be the same length";
static const char __pyx_k_value_for_deme_out_of_range_len[] = "value for deme out of range. len(pop) = ";
static const char __pyx_k_values_is_sample_must_be_tuples[] = "values is sample must be tuples, not";
static const char __pyx_k_view_diploids_deme_index_out_of[] = "view_diploids: deme index out of range";
static const char __pyx_k_view_gametes_unsupported_object[] = "view_gametes: unsupported object type";
static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
static const char __pyx_k_MetaPopVec_deme_size_0_encounter[] = "MetaPopVec: deme size < 0 encountered";
static const char __pyx_k_No_value_specified_for_struct_at[] = "No value specified for struct attribute 'pos'";
static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
static const char __pyx_k_PopVec_PopType_type_not_supporte[] = "PopVec/PopType type not supported";
static const char __pyx_k_Recombination_regions_must_be_de[] = "Recombination regions must be defined when recombination rate > 0";
static const char __pyx_k_Selected_regions_must_be_defined[] = "Selected regions must be defined when mutation rate > 0";
static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
static const char __pyx_k_deme_may_not_be_set_to_None_when[] = "deme may not be set to None when sampling from a meta-population";
static const char __pyx_k_diploid_mloc_view_to_sample_fill[] = "diploid_mloc_view_to_sample_fill_containers: indexing incorrect";
static const char __pyx_k_diploid_view_to_sample_fill_cont[] = "diploid_view_to_sample_fill_containers_details: fatal error due to mutation position not being found";
static const char __pyx_k_diploid_view_unequal_container_s[] = "diploid_view: unequal container sizes for neutral mutations";
static const char __pyx_k_fitness_must_be_either_multiplic[] = "fitness must be either multiplicative or additive";
static const char __pyx_k_fwdpy_Region_weight_not_a_number[] = "fwdpy.Region: weight not a number";
static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
static const char __pyx_k_index_greater_than_population_si[] = "index greater than population size";
static const char __pyx_k_ms_sample_unsupported_type_of_po[] = "ms_sample: unsupported type of popcontainer";
static const char __pyx_k_mutation_rate_to_neutral_variant[] = "mutation rate to neutral variants must be >= 0.";
static const char __pyx_k_mutation_rate_to_selected_varian[] = "mutation rate to selected variants must be >= 0.";
static const char __pyx_k_non_finite_value_encountered_for[] = "non-finite value encountered for mutation and/or recombination rates";
static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
static const char __pyx_k_view_diploids_deme_index_require[] = "view_diploids: deme index required for metapopulation";
static const char __pyx_k_view_diploids_unsupported_object[] = "view_diploids: unsupported object type";
static const char __pyx_k_view_gametes_deme_cannot_be_None[] = "view_gametes: deme cannot be None when p is a MetaPop";
static const char __pyx_k_view_gametes_deme_index_out_of_r[] = "view_gametes: deme index out of range";
static const char __pyx_k_view_mutations_deme_cannot_be_no[] = "view_mutations: deme cannot be none for metapops";
static const char __pyx_k_view_mutations_deme_index_out_of[] = "view_mutations: deme index out of range";
static const char __pyx_k_view_mutations_unsupported_objec[] = "view_mutations: unsupported object type";
static const char __pyx_k_Constructor_param_beg_the_begin_2[] = "\n        Constructor\n\n        :param beg: the beginning of the region\n        :param end: the end of the region\n        :param weight: the weight to assign\n        :param h: the dominance\n        :param coupled: if True, the weight is converted to (end-beg)*weight\n        :param label: Not relevant to recombining regions.  Otherwise, this value will be used to take mutations from this region.\n\n        When coupled is True, the \"weight\" may be interpreted as a \"per base pair\"\n        (or per unit, generally speaking) term.\n\n        Example:\n\n        >>> #A simple case\n        >>> import fwdpy\n        >>> #Examples for models where the 3 genotype fitnesses are\n        >>> #1, 1+sh, and 1+2s, respectively\n        >>> recessive = fwdpy.Sregion(0,1,1,0)\n        >>> additive = fwdpy.Sregion(0,1,1,1.0)\n        >>> dominant = fwdpy.Sregion(0,1,1,2.0)\n        ";
static const char __pyx_k_Constructor_param_beg_the_begin_3[] = "\n        Constructor\n\n        :param beg: the beginning of the region\n        :param end: the end of the region\n        :param weight: the weight to assign\n        :param mean: the mean selection coefficient\n        :param shape: the shape parameter of the distribution\n        :param h: the dominance\n        :param coupled: if True, the weight is converted to (end-beg)*weight\n        :param label: Not relevant to recombining regions.  Otherwise, this value will be used to take mutations from this region.\n\n        When coupled is True, the \"weight\" may be interpreted as a \"per base pair\"\n        (or per unit, generally speaking) term.\n\n        Example:\n\n        >>> #A simple case\n        >>> import fwdpy\n        >>> gdist = fwdpy.GammaS(0,1,1,-0.1,0.35)\n        ";
static const char __pyx_k_Constructor_param_beg_the_begin_4[] = "\n        Constructor\n\n        :param beg: the beginning of the region\n        :param end: the end of the region\n        :param weight: the weight to assign\n        :param s: the selection coefficient\n        :param h: the dominance\n        :param coupled: if True, the weight is converted to (end-beg)*weight\n        :param label: Not relevant to recombining regions.  Otherwise, this value will be used to take mutations from this region.\n\n        When coupled is True, the \"weight\" may be interpreted as a \"per base pair\"\n        (or per unit, generally speaking) term.\n\n        Example:\n\n        >>> #A simple case\n        >>> import fwdpy\n        >>> #s = -0.1 and h = 0\n        >>> constantS = fwdpy.ConstantS(0,1,1,-0.1,0)\n        ";
static const char __pyx_k_Constructor_param_beg_the_begin_5[] = "\n        Constructor\n    \n        :param beg: the beginning of the region\n        :param end: the end of the region\n        :param weight: the weight to assign\n        :param lo: lower bound on s\n        :param hi: upper bound on s\n        :param h: the dominance\n        :param coupled: if True, the weight is converted to (end-beg)*weight\n        :param label: Not relevant to recombining regions.  Otherwise, this value will be used to take mutations from this region.\n\n        When coupled is True, the \"weight\" may be interpreted as a \"per base pair\"\n        (or per unit, generally speaking) term.\n\n        Example:\n\n        >>> #A simple case\n        >>> import fwdpy\n        >>> #s is uniform on [0,-1]\n        >>> constantS = fwdpy.UniformS(0,1,1,0,-1,0)\n        ";
static const char __pyx_k_Constructor_param_beg_the_begin_6[] = "\n        Constructor\n    \n        :param beg: the beginning of the region\n        :param end: the end of the region\n        :param weight: the weight to assign\n        :param mean: the mean selection coefficient\n        :param h: the dominance\n        :param coupled: if True, the weight is converted to (end-beg)*weight\n        :param label: Not relevant to recombining regions.  Otherwise, this value will be used to take mutations from this region.\n\n        When coupled is True, the \"weight\" may be interpreted as a \"per base pair\"\n        (or per unit, generally speaking) term.\n\n        Example:\n\n        >>> #A simple case\n        >>> import fwdpy\n        >>> #s is exp(-0.1) and recessive\n        >>> constantS = fwdpy.ExpS(0,1,1,0,-0.1,0)\n        ";
static const char __pyx_k_Constructor_param_beg_the_begin_7[] = "\n        Constructor\n    \n        :param beg: the beginning of the region\n        :param end: the end of the region\n        :param weight: the weight to assign\n        :param mean: the mean selection coefficient\n        :param h: the dominance\n        :param coupled: if True, the weight is converted to (end-beg)*weight\n        :param label: Not relevant to recombining regions.  Otherwise, this value will be used to take mutations from this region.\n\n        When coupled is True, the \"weight\" may be interpreted as a \"per base pair\"\n        (or per unit, generally speaking) term.\n\n        Example:\n\n        >>> #A simple case\n        >>> import fwdpy\n        >>> #s N(0,0.1) and co-dominant\n        >>> constantS = fwdpy.GaussianS(0,1,1,0,0.1,1)\n        ";
static const char __pyx_k_Convenience_wrapper_around_func_2[] = "\n    Convenience wrapper around :func:`fwdpy.fwdpy.getfreq`\n\n    :param sample: a sample from a population.  For example, the return value of :func:`fwdpy.fwdpy.ms_sample` or :func:`fwdpy.fwdpy.get_samples`\n    :param derived: If True, report derived allele frequency (DAF).  If False, return minor allele freqency (MAF).\n\n    .. note:: Do **not** use this function to calculate :math:`\\pi` (a.k.a. :math:`\\hat\\theta_\\pi`, a.k.a. \"sum of site heterozygosity\").\n       :math:`\\pi` for a **sample** is not :math:`2\\sum_ip_iq_i`. because the sample is *finite*.\n\n    Example:\n\n    >>> import fwdpy,array\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes=array.array('I',[1000]*1000)\n    >>> pop = fwdpy.evolve_regions(rng,3,1000,popsizes[0:],0.001,0,0.001,[fwdpy.Region(0,1,1)],[],[fwdpy.Region(0,1,1)])\n    >>> s = [fwdpy.ms_sample(rng,i,10) for i in pop]\n    >>> freqs = [fwdpy.getfreqs(i) for i in s]\n    ";
static const char __pyx_k_Representation_of_a_region_in_a_2[] = "\n    Representation of a \"region\" in a simulation with a dominance term.\n\n    This class is the base class for a general set of objects representing distributions of fitness effects.\n\n    Attributes:\n        * b: the beginning of the region\n        * e: the end of the region\n        * w: the \"weight\" assigned to the region\n        * h: the dominance term\n        * l: A label assigned to the region.  Labels must be integers, and can be used to 'tag' mutations arising in different regions.\n\n    See :func:`evolve_regions` for how this class may be used to parameterize a simulation.\n\n    .. note:: This class cannot be used directly to parameterize a simulation.  Rather, you must used\n       a derived type that specifies a distribution of fitness effects.  These types include:\n       :class:`fwdpy.fwdpy.ConstantS`,\n       :class:`fwdpy.fwdpy.UniformS`,\n       :class:`fwdpy.fwdpy.ExpS`,\n       :class:`fwdpy.fwdpy.GammaS`, and \n       :class:`fwdpy.fwdpy.GaussianS`\n    ";
static const char __pyx_k_Take_a_sample_from_a_set_of_sim_2[] = "\n    Take a sample from a set of simulated populations.\n\n    :param rng: a :class:`GSLrng`\n    :param pop: An object inheriting from :class:`PopType`\n    :param nsam: The sample size to take.\n    :param removeFixed: if True, only polymorphic sites are retained\n    :param deme: Optional.  If 'pop' is a :class:`MetaPop`, deme is required and represents the sub-population to sample.\n\n    :return: A list. Element 0 is neutral mutations, and element 1 is selected mutations.  Within each list is a tuple of size 2.  The first element is the mutation position.  The second element is the genotype for each of the 'nsam' chromosomes.  Genotypes are coded as 0 = the ancestral state and 1 = the derived state.  For each site, each pair of genotypes constitutes a single diploid.  In other words, for nsam = 50, the data will represent the complete haplotypes of 25 diploids.\n\n    :raise: IndexError if 'deme' is out of range and pop is a :class:`fwdpy.fwdpy.MetaPop`\n\n    Please note that if you desire an odd 'nsam', you should input nsam+2 and randomly remove one haplotype to obtain your desired sample size.  This is due to an issue with how we are sampling chromosomes from the population.\n\n    Example:\n\n    >>> import fwdpy,array\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes=array.array('I',[1000]*1000)\n    >>> pop = fwdpy.evolve_regions(rng,3,1000,popsizes[0:],0.001,0,0.001,[fwdpy.Region(0,1,1)],[],[fwdpy.Region(0,1,1)])\n    >>> s = [fwdpy.get_samples(rng,i,10) for i in pop]\n    ";
static const char __pyx_k_home_kevin_src_fwdpy_fwdpy_view_2[] = "/home/kevin/src/fwdpy/fwdpy/view_fixations.pyx";
static const char __pyx_k_No_value_specified_for_struct_at_2[] = "No value specified for struct attribute 'esize'";
static const char __pyx_k_No_value_specified_for_struct_at_3[] = "No value specified for struct attribute 'origin'";
static const char __pyx_k_diploid_view_to_sample_fill_cont_2[] = "diploid_view_to_sample_fill_containers_details: offset out of range";
static const char __pyx_k_diploid_view_to_sample_fill_cont_3[] = "diploid_view_to_sample_fill_containers: indexing incorrect";
static const char __pyx_k_diploid_view_unequal_container_s_2[] = "diploid_view: unequal container sizes for selected mutations";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_s_9f;
static PyObject *__pyx_n_s_ASCII;
static PyObject *__pyx_kp_u_Add_a_mutation_to_a_population;
static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
static PyObject *__pyx_n_s_ConstantS;
static PyObject *__pyx_n_s_ConstantS___init;
static PyObject *__pyx_kp_u_ConstantS___init___line_189;
static PyObject *__pyx_n_s_ConstantS___str;
static PyObject *__pyx_kp_s_Constant_fixed_selection_coeffi;
static PyObject *__pyx_kp_s_Constant_s_DFE_s;
static PyObject *__pyx_kp_u_Constructor_param_beg_the_begin;
static PyObject *__pyx_kp_u_Constructor_param_beg_the_begin_2;
static PyObject *__pyx_kp_u_Constructor_param_beg_the_begin_3;
static PyObject *__pyx_kp_u_Constructor_param_beg_the_begin_4;
static PyObject *__pyx_kp_u_Constructor_param_beg_the_begin_5;
static PyObject *__pyx_kp_u_Constructor_param_beg_the_begin_6;
static PyObject *__pyx_kp_u_Constructor_param_beg_the_begin_7;
static PyObject *__pyx_kp_u_Continue_to_evolve_a_region_wit;
static PyObject *__pyx_kp_u_Convenience_wrapper_around_func;
static PyObject *__pyx_kp_u_Convenience_wrapper_around_func_2;
static PyObject *__pyx_n_s_DataFrame;
static PyObject *__pyx_n_s_Ellipsis;
static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
static PyObject *__pyx_kp_u_Evolve_a_region_with_variable_m;
static PyObject *__pyx_n_s_ExpS;
static PyObject *__pyx_n_s_ExpS___init;
static PyObject *__pyx_kp_u_ExpS___init___line_286;
static PyObject *__pyx_n_s_ExpS___str;
static PyObject *__pyx_kp_s_Expecting_PopType;
static PyObject *__pyx_kp_s_Expecting_PopVec;
static PyObject *__pyx_kp_s_Exponential_DFE_mean;
static PyObject *__pyx_kp_s_Exponential_distribution_on_sel;
static PyObject *__pyx_n_s_FreqSampler___iter;
static PyObject *__pyx_n_s_GammaS;
static PyObject *__pyx_n_s_GammaS___init;
static PyObject *__pyx_kp_u_GammaS___init___line_139;
static PyObject *__pyx_n_s_GammaS___str;
static PyObject *__pyx_kp_s_Gamma_DFE_mean;
static PyObject *__pyx_kp_s_Gamma_distribution_of_fitness_e;
static PyObject *__pyx_n_s_GaussianS;
static PyObject *__pyx_n_s_GaussianS___init;
static PyObject *__pyx_kp_u_GaussianS___init___line_333;
static PyObject *__pyx_n_s_GaussianS___str;
static PyObject *__pyx_kp_s_Gaussian_DFE_s_d;
static PyObject *__pyx_kp_s_Gaussian_distribution_on_select;
static PyObject *__pyx_kp_u_Get_additional_details_for_popu;
static PyObject *__pyx_kp_u_Get_detailed_list_of_a_set_of_d;
static PyObject *__pyx_kp_u_Get_detailed_list_of_all_gamete;
static PyObject *__pyx_kp_u_Get_detailed_list_of_all_mutati;
static PyObject *__pyx_kp_u_Get_mutation_frequencies_param;
static PyObject *__pyx_kp_u_Get_the_number_of_derived_mutat;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
static PyObject *__pyx_kp_s_MemoryView_of_r_object;
static PyObject *__pyx_n_s_MetaPopVec___iter;
static PyObject *__pyx_kp_s_MetaPopVec_deme_size_0_encounter;
static PyObject *__pyx_n_s_MlocusPopVec___iter;
static PyObject *__pyx_n_s_N;
static PyObject *__pyx_kp_s_Neutral_regions_must_be_defined;
static PyObject *__pyx_kp_s_No_value_specified_for_struct_at;
static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_2;
static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_3;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_kp_s_Not_implemented_for_this_type;
static PyObject *__pyx_n_s_Ns;
static PyObject *__pyx_n_b_O;
static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
static PyObject *__pyx_n_s_PopSampler___iter;
static PyObject *__pyx_kp_s_PopType_not_supported;
static PyObject *__pyx_kp_s_PopVec_PopType_type_not_supporte;
static PyObject *__pyx_n_s_QtraitStatsSampler___iter;
static PyObject *__pyx_kp_s_Recombination_regions_must_be_de;
static PyObject *__pyx_n_s_Region;
static PyObject *__pyx_n_s_Region___init;
static PyObject *__pyx_kp_u_Region___init___line_18;
static PyObject *__pyx_n_s_Region___str;
static PyObject *__pyx_kp_u_Remove_low_frequency_variants_f;
static PyObject *__pyx_kp_s_Representation_of_a_region_in_a;
static PyObject *__pyx_kp_s_Representation_of_a_region_in_a_2;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_kp_s_Selected_regions_must_be_defined;
static PyObject *__pyx_n_s_SpopGenMutVec___iter;
static PyObject *__pyx_n_s_SpopVec___iter;
static PyObject *__pyx_n_s_Sregion;
static PyObject *__pyx_n_s_Sregion___init;
static PyObject *__pyx_kp_u_Sregion___init___line_91;
static PyObject *__pyx_n_s_Sregion___str;
static PyObject *__pyx_kp_u_Take_a_sample_from_a_set_of_sim;
static PyObject *__pyx_kp_u_Take_a_sample_from_a_set_of_sim_2;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
static PyObject *__pyx_n_s_UniformS;
static PyObject *__pyx_n_s_UniformS___init;
static PyObject *__pyx_kp_u_UniformS___init___line_235;
static PyObject *__pyx_n_s_UniformS___str;
static PyObject *__pyx_kp_s_Uniform_distribution_on_selecti;
static PyObject *__pyx_kp_s_Uniform_s_DFE_lo;
static PyObject *__pyx_n_s_VASampler___iter;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_kp_s__26;
static PyObject *__pyx_kp_b__74;
static PyObject *__pyx_n_s_add_mutation;
static PyObject *__pyx_kp_u_add_mutation_line_3;
static PyObject *__pyx_n_b_additive;
static PyObject *__pyx_n_s_allele_ages;
static PyObject *__pyx_n_s_allgams;
static PyObject *__pyx_n_s_allmuts;
static PyObject *__pyx_n_s_allocate_buffer;
static PyObject *__pyx_n_s_ancestral;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_append_details;
static PyObject *__pyx_n_s_apply_sampler;
static PyObject *__pyx_n_s_apply_sampler_single;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_base;
static PyObject *__pyx_n_s_beg;
static PyObject *__pyx_kp_s_beg_2;
static PyObject *__pyx_n_s_boundaries;
static PyObject *__pyx_n_s_bstr;
static PyObject *__pyx_kp_s_but_deme;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_n_u_c;
static PyObject *__pyx_n_s_check_input_params;
static PyObject *__pyx_n_s_check_popdata;
static PyObject *__pyx_n_s_check_popdata_metapop;
static PyObject *__pyx_n_s_check_popdata_mpopvec;
static PyObject *__pyx_n_s_check_popdata_popvec;
static PyObject *__pyx_n_s_check_popdata_singlepop;
static PyObject *__pyx_n_s_check_sum;
static PyObject *__pyx_n_s_chrom;
static PyObject *__pyx_n_s_chrom0;
static PyObject *__pyx_n_s_chrom1;
static PyObject *__pyx_n_s_cite;
static PyObject *__pyx_n_s_class;
static PyObject *__pyx_n_s_clist;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_concat;
static PyObject *__pyx_kp_s_contiguous_and_direct;
static PyObject *__pyx_kp_s_contiguous_and_indirect;
static PyObject *__pyx_n_s_copypop;
static PyObject *__pyx_n_s_copypops;
static PyObject *__pyx_n_s_count;
static PyObject *__pyx_n_s_coupled;
static PyObject *__pyx_n_s_csum;
static PyObject *__pyx_n_s_dcount;
static PyObject *__pyx_n_s_deme;
static PyObject *__pyx_kp_s_deme_cannot_be_None;
static PyObject *__pyx_kp_s_deme_may_not_be_set_to_None_when;
static PyObject *__pyx_kp_s_deme_value_out_of_range;
static PyObject *__pyx_n_s_derived;
static PyObject *__pyx_n_s_deserialize_metapops;
static PyObject *__pyx_n_s_deserialize_singlepops;
static PyObject *__pyx_n_s_dfreq;
static PyObject *__pyx_n_s_dip;
static PyObject *__pyx_n_s_diploid_mloc_view_to_sample;
static PyObject *__pyx_kp_s_diploid_mloc_view_to_sample_fill;
static PyObject *__pyx_n_s_diploid_traits;
static PyObject *__pyx_n_s_diploid_view_to_sample;
static PyObject *__pyx_kp_s_diploid_view_to_sample_fill_cont;
static PyObject *__pyx_kp_s_diploid_view_to_sample_fill_cont_2;
static PyObject *__pyx_kp_s_diploid_view_to_sample_fill_cont_3;
static PyObject *__pyx_kp_s_diploid_view_unequal_container_s;
static PyObject *__pyx_kp_s_diploid_view_unequal_container_s_2;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_donothing;
static PyObject *__pyx_n_s_dtype_is_object;
static PyObject *__pyx_n_s_dummy;
static PyObject *__pyx_n_s_e;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_end;
static PyObject *__pyx_kp_s_end_2;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_error;
static PyObject *__pyx_n_s_esize;
static PyObject *__pyx_n_s_estr;
static PyObject *__pyx_n_s_evolve_regions;
static PyObject *__pyx_kp_u_evolve_regions_line_29;
static PyObject *__pyx_n_s_evolve_regions_more;
static PyObject *__pyx_kp_u_evolve_regions_more_line_102;
static PyObject *__pyx_n_s_evolve_regions_sampler;
static PyObject *__pyx_n_s_evolve_regions_sampler_fitness;
static PyObject *__pyx_n_s_f;
static PyObject *__pyx_kp_s_f_0_will_be_treated_as_0;
static PyObject *__pyx_n_s_ffa;
static PyObject *__pyx_n_s_ffm;
static PyObject *__pyx_n_s_fitness;
static PyObject *__pyx_n_s_fitness_function;
static PyObject *__pyx_kp_s_fitness_must_be_either_multiplic;
static PyObject *__pyx_n_s_flags;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_fortran;
static PyObject *__pyx_n_u_fortran;
static PyObject *__pyx_n_s_fpio;
static PyObject *__pyx_n_s_freq;
static PyObject *__pyx_n_s_freqfilter;
static PyObject *__pyx_kp_u_freqfilter_line_208;
static PyObject *__pyx_n_s_from_Spop;
static PyObject *__pyx_n_s_ftime;
static PyObject *__pyx_n_s_fwdpy;
static PyObject *__pyx_kp_s_fwdpy_ConstantS_s_not_a_number;
static PyObject *__pyx_kp_s_fwdpy_ConstantS_s_not_finite;
static PyObject *__pyx_kp_s_fwdpy_ExpS_mean_not_a_number;
static PyObject *__pyx_kp_s_fwdpy_ExpS_mean_not_finite;
static PyObject *__pyx_kp_s_fwdpy_GammaS_mean_not_a_number;
static PyObject *__pyx_kp_s_fwdpy_GammaS_mean_not_finite;
static PyObject *__pyx_kp_s_fwdpy_GammaS_shape_not_a_number;
static PyObject *__pyx_kp_s_fwdpy_GammaS_shape_not_finite;
static PyObject *__pyx_kp_s_fwdpy_GaussianS_sd_not_a_number;
static PyObject *__pyx_kp_s_fwdpy_GaussianS_sd_not_finite;
static PyObject *__pyx_kp_s_fwdpy_Region_beg_not_a_number;
static PyObject *__pyx_kp_s_fwdpy_Region_beg_not_finite;
static PyObject *__pyx_kp_s_fwdpy_Region_end_not_a_number;
static PyObject *__pyx_kp_s_fwdpy_Region_end_not_finite;
static PyObject *__pyx_kp_s_fwdpy_Region_weight_0_0;
static PyObject *__pyx_kp_s_fwdpy_Region_weight_not_a_number;
static PyObject *__pyx_kp_s_fwdpy_Region_weight_not_finite;
static PyObject *__pyx_kp_s_fwdpy_Segion_h_not_a_number;
static PyObject *__pyx_kp_s_fwdpy_Sregion_h_not_finite;
static PyObject *__pyx_kp_s_fwdpy_UniformS_hi_not_a_number;
static PyObject *__pyx_kp_s_fwdpy_UniformS_hi_not_finite;
static PyObject *__pyx_kp_s_fwdpy_UniformS_lo_not_a_number;
static PyObject *__pyx_kp_s_fwdpy_UniformS_lo_not_finite;
static PyObject *__pyx_kp_s_fwdpy_copypop_PopType;
static PyObject *__pyx_kp_s_fwdpy_copypopvec_popvec_type;
static PyObject *__pyx_n_s_fwdpy_fwdpy;
static PyObject *__pyx_n_s_fwdpyio;
static PyObject *__pyx_n_s_g;
static PyObject *__pyx_n_s_gams;
static PyObject *__pyx_n_s_gen;
static PyObject *__pyx_n_s_generation;
static PyObject *__pyx_n_s_get_sample_details;
static PyObject *__pyx_kp_u_get_sample_details_line_67;
static PyObject *__pyx_n_s_get_samples;
static PyObject *__pyx_kp_u_get_samples_line_30;
static PyObject *__pyx_n_s_getfreq;
static PyObject *__pyx_kp_u_getfreq_line_159;
static PyObject *__pyx_n_s_getfreqs;
static PyObject *__pyx_kp_u_getfreqs_line_187;
static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
static PyObject *__pyx_kp_b_gz;
static PyObject *__pyx_n_s_h;
static PyObject *__pyx_kp_s_h_2;
static PyObject *__pyx_n_s_hi;
static PyObject *__pyx_kp_s_hi_2;
static PyObject *__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_add;
static PyObject *__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_ages;
static PyObject *__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_copy;
static PyObject *__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_debu;
static PyObject *__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_evol;
static PyObject *__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_fwdp;
static PyObject *__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi;
static PyObject *__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_samp;
static PyObject *__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_temp;
static PyObject *__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view;
static PyObject *__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view_2;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_id;
static PyObject *__pyx_n_s_il;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_ind;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_kp_s_index_greater_than_deme_size;
static PyObject *__pyx_kp_s_index_greater_than_population_si;
static PyObject *__pyx_kp_s_index_out_of_range;
static PyObject *__pyx_n_s_indlist;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_internal;
static PyObject *__pyx_kp_s_is_not_supported;
static PyObject *__pyx_n_s_isinf;
static PyObject *__pyx_n_s_isnan;
static PyObject *__pyx_n_s_itemsize;
static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
static PyObject *__pyx_n_s_iter;
static PyObject *__pyx_n_s_l;
static PyObject *__pyx_n_s_label;
static PyObject *__pyx_kp_s_label_2;
static PyObject *__pyx_n_s_last_freq;
static PyObject *__pyx_n_s_listlen;
static PyObject *__pyx_n_s_lo;
static PyObject *__pyx_n_s_locus;
static PyObject *__pyx_n_s_locusBoundaries;
static PyObject *__pyx_n_s_locusID;
static PyObject *__pyx_n_s_lpds;
static PyObject *__pyx_n_s_m;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_make_region_manager;
static PyObject *__pyx_n_s_map_itr;
static PyObject *__pyx_n_s_math;
static PyObject *__pyx_n_s_max_freq;
static PyObject *__pyx_n_s_mean;
static PyObject *__pyx_n_s_memview;
static PyObject *__pyx_n_s_merge_trajectories;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_min_freq;
static PyObject *__pyx_n_s_min_sojourn;
static PyObject *__pyx_n_s_minfreq;
static PyObject *__pyx_n_s_minsojourn;
static PyObject *__pyx_n_s_mode;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_ms_sample;
static PyObject *__pyx_kp_u_ms_sample_line_6;
static PyObject *__pyx_kp_s_ms_sample_unsupported_type_of_po;
static PyObject *__pyx_n_s_mu_neutral;
static PyObject *__pyx_n_s_mu_selected;
static PyObject *__pyx_n_b_multiplicative;
static PyObject *__pyx_kp_s_mutation_rate_to_neutral_variant;
static PyObject *__pyx_kp_s_mutation_rate_to_selected_varian;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_n0;
static PyObject *__pyx_n_s_n1;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_ndemes;
static PyObject *__pyx_n_s_nderived;
static PyObject *__pyx_kp_u_nderived_line_142;
static PyObject *__pyx_n_s_nderived_site;
static PyObject *__pyx_kp_u_nderived_site_line_117;
static PyObject *__pyx_n_s_ndim;
static PyObject *__pyx_n_s_neutral;
static PyObject *__pyx_n_s_neutral_df;
static PyObject *__pyx_n_s_neutral_file;
static PyObject *__pyx_n_s_neutral_info;
static PyObject *__pyx_n_s_nlist;
static PyObject *__pyx_n_s_nloci;
static PyObject *__pyx_n_s_nmpops;
static PyObject *__pyx_kp_s_non_finite_value_encountered_for;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_n_s_npops;
static PyObject *__pyx_n_s_nregions;
static PyObject *__pyx_n_s_nsam;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_n_s_o;
static PyObject *__pyx_n_s_obj;
static PyObject *__pyx_n_s_object;
static PyObject *__pyx_kp_s_object_type_not_understood;
static PyObject *__pyx_n_s_optimum;
static PyObject *__pyx_n_s_origin;
static PyObject *__pyx_n_s_p;
static PyObject *__pyx_n_s_pack;
static PyObject *__pyx_n_s_pandas;
static PyObject *__pyx_n_s_pd;
static PyObject *__pyx_n_s_pds;
static PyObject *__pyx_n_s_pkg_version;
static PyObject *__pyx_n_s_pop;
static PyObject *__pyx_n_s_popdata_sane;
static PyObject *__pyx_n_s_pops;
static PyObject *__pyx_n_s_popsize;
static PyObject *__pyx_n_s_popsizes;
static PyObject *__pyx_n_s_pos;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_ps;
static PyObject *__pyx_n_s_psizes;
static PyObject *__pyx_n_s_pss;
static PyObject *__pyx_n_s_pyx_getbuffer;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_raf;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_kp_s_recombination_rate_must_be_0;
static PyObject *__pyx_n_s_recordDetails;
static PyObject *__pyx_n_s_recordSamples;
static PyObject *__pyx_n_s_recrate;
static PyObject *__pyx_n_s_recregions;
static PyObject *__pyx_n_s_removeFixed;
static PyObject *__pyx_n_s_remove_arose_after;
static PyObject *__pyx_n_s_remove_gone_before;
static PyObject *__pyx_n_s_rgb;
static PyObject *__pyx_n_s_rmgr;
static PyObject *__pyx_n_s_rng;
static PyObject *__pyx_n_s_rv;
static PyObject *__pyx_n_s_s;
static PyObject *__pyx_n_s_sample;
static PyObject *__pyx_kp_s_sample_must_be_0;
static PyObject *__pyx_n_s_sampler;
static PyObject *__pyx_n_s_sane;
static PyObject *__pyx_n_s_scaling;
static PyObject *__pyx_n_s_sd;
static PyObject *__pyx_n_s_seed;
static PyObject *__pyx_n_s_selected;
static PyObject *__pyx_n_s_selectedOnly;
static PyObject *__pyx_n_s_selected_df;
static PyObject *__pyx_n_s_selected_file;
static PyObject *__pyx_n_s_selected_info;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_serialize;
static PyObject *__pyx_n_s_set_index;
static PyObject *__pyx_n_s_sh0;
static PyObject *__pyx_n_s_sh1;
static PyObject *__pyx_n_s_shape;
static PyObject *__pyx_kp_s_shape_2;
static PyObject *__pyx_n_s_site;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_n_s_size_2;
static PyObject *__pyx_n_s_slist;
static PyObject *__pyx_n_s_sregions;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_stat;
static PyObject *__pyx_n_s_step;
static PyObject *__pyx_n_s_stop;
static PyObject *__pyx_n_s_str;
static PyObject *__pyx_kp_s_strided_and_direct;
static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
static PyObject *__pyx_kp_s_strided_and_indirect;
static PyObject *__pyx_n_s_struct;
static PyObject *__pyx_n_s_sum;
static PyObject *__pyx_n_s_super;
static PyObject *__pyx_n_s_temp1;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_kp_s_the_two_input_lists_must_be_the;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_tidy_trajectories;
static PyObject *__pyx_n_s_tidy_trajectories_details;
static PyObject *__pyx_n_s_tlen;
static PyObject *__pyx_n_s_trajectories;
static PyObject *__pyx_n_s_trajectories1;
static PyObject *__pyx_n_s_trajectories2;
static PyObject *__pyx_n_s_ttl_nsam;
static PyObject *__pyx_n_s_ul;
static PyObject *__pyx_n_s_umuts;
static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
static PyObject *__pyx_n_s_unique_gams;
static PyObject *__pyx_n_s_unpack;
static PyObject *__pyx_kp_s_unsupported_type;
static PyObject *__pyx_kp_s_unupported_PopType;
static PyObject *__pyx_kp_s_utf_8;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_kp_s_value_for_deme_out_of_range_len;
static PyObject *__pyx_kp_s_values_is_sample_must_be_tuples;
static PyObject *__pyx_n_s_view;
static PyObject *__pyx_n_s_view_diploids;
static PyObject *__pyx_kp_s_view_diploids_deme_index_out_of;
static PyObject *__pyx_kp_s_view_diploids_deme_index_require;
static PyObject *__pyx_kp_u_view_diploids_line_398;
static PyObject *__pyx_n_s_view_diploids_metapop;
static PyObject *__pyx_n_s_view_diploids_pd;
static PyObject *__pyx_n_s_view_diploids_pd_popvec;
static PyObject *__pyx_n_s_view_diploids_pd_singlepop;
static PyObject *__pyx_n_s_view_diploids_popvec;
static PyObject *__pyx_n_s_view_diploids_popvec_mloc;
static PyObject *__pyx_n_s_view_diploids_singlepop;
static PyObject *__pyx_n_s_view_diploids_singlepop_mloc;
static PyObject *__pyx_kp_s_view_diploids_unsupported_object;
static PyObject *__pyx_n_s_view_fixations;
static PyObject *__pyx_n_s_view_fixations_mlocuspopvec;
static PyObject *__pyx_n_s_view_fixations_popvec;
static PyObject *__pyx_n_s_view_gametes;
static PyObject *__pyx_kp_s_view_gametes_deme_cannot_be_None;
static PyObject *__pyx_kp_s_view_gametes_deme_index_out_of_r;
static PyObject *__pyx_kp_u_view_gametes_line_308;
static PyObject *__pyx_n_s_view_gametes_metapop;
static PyObject *__pyx_n_s_view_gametes_popvec;
static PyObject *__pyx_n_s_view_gametes_popvec_mloc;
static PyObject *__pyx_n_s_view_gametes_singlepop;
static PyObject *__pyx_n_s_view_gametes_singlepop_mloc;
static PyObject *__pyx_kp_s_view_gametes_unsupported_object;
static PyObject *__pyx_n_s_view_mutations;
static PyObject *__pyx_kp_s_view_mutations_deme_cannot_be_no;
static PyObject *__pyx_kp_s_view_mutations_deme_index_out_of;
static PyObject *__pyx_kp_u_view_mutations_line_218;
static PyObject *__pyx_n_s_view_mutations_metapop;
static PyObject *__pyx_n_s_view_mutations_popvec;
static PyObject *__pyx_n_s_view_mutations_popvec_mloc;
static PyObject *__pyx_n_s_view_mutations_singlepop;
static PyObject *__pyx_n_s_view_mutations_singlepop_mloc;
static PyObject *__pyx_kp_s_view_mutations_unsupported_objec;
static PyObject *__pyx_n_s_vneutral;
static PyObject *__pyx_n_s_vselected;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_warn;
static PyObject *__pyx_n_s_warnings;
static PyObject *__pyx_n_s_weight;
static PyObject *__pyx_kp_s_weight_2;
static PyObject *__pyx_n_s_wstr;
static void __pyx_pf_5fwdpy_5fwdpy_4Spop___dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_4Spop_2gen(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_4Spop_4popsize(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_4Spop_6sane(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_self); /* proto */
static void __pyx_pf_5fwdpy_5fwdpy_10SpopGenMut___dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_10SpopGenMut_2gen(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_10SpopGenMut_4popsize(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_10SpopGenMut_6sane(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_self); /* proto */
static void __pyx_pf_5fwdpy_5fwdpy_9MlocusPop___dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_9MlocusPop_2gen(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_9MlocusPop_4popsize(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_9MlocusPop_6sane(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_self); /* proto */
static int __pyx_pf_5fwdpy_5fwdpy_7SpopVec___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self, unsigned int __pyx_v_npops, unsigned int __pyx_v_N); /* proto */
static void __pyx_pf_5fwdpy_5fwdpy_7SpopVec_2__dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_7SpopVec_4__iter__(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_7SpopVec_7__next__(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_7SpopVec_9__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self, int __pyx_v_i); /* proto */
static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_7SpopVec_11__len__(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_7SpopVec_13__append_details__(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_7SpopVec_15append(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_7SpopVec_17size(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_7SpopVec_19clear(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self); /* proto */
static int __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self, unsigned int __pyx_v_npops, unsigned int __pyx_v_N, unsigned int __pyx_v_nloci); /* proto */
static void __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_2__dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_4__iter__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_7__next__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_9__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self, int __pyx_v_i); /* proto */
static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_11__len__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_13__append_details__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_15append(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_17size(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_19clear(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self); /* proto */
static int __pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self, unsigned int __pyx_v_npops, unsigned int __pyx_v_N); /* proto */
static void __pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_2__dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_4__iter__(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_7__next__(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_9__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self, int __pyx_v_i); /* proto */
static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_11__len__(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_13size(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_15clear(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self); /* proto */
static void __pyx_pf_5fwdpy_5fwdpy_7MetaPop___dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_7MetaPop_2__len__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_7MetaPop_4gen(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_7MetaPop_6popsizes(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_7MetaPop_8sane(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_7MetaPop_10from_Spop(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p); /* proto */
static int __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self, unsigned int __pyx_v_nmpops, std::vector<unsigned int>  __pyx_v_Ns); /* proto */
static void __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_2__dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_4__iter__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_7__next__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_9__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self, int __pyx_v_i); /* proto */
static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_11__len__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_13size(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_15__append_details__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_17append(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_19clear(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self); /* proto */
static int __pyx_pf_5fwdpy_5fwdpy_6GSLrng___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_self, int __pyx_v_seed); /* proto */
static void __pyx_pf_5fwdpy_5fwdpy_6GSLrng_2__dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_ms_sample(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng, struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_pop, int __pyx_v_nsam, int __pyx_v_removeFixed); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_2get_samples(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng, struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_pop, int __pyx_v_nsam, int __pyx_v_removeFixed, PyObject *__pyx_v_deme, PyObject *__pyx_v_locusBoundaries); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_4get_sample_details(CYTHON_UNUSED PyObject *__pyx_self, KTfwd::sample_t __pyx_v_ms_sample, struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_pop, PyObject *__pyx_v_locusID); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_6nderived_site(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_site); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_8nderived(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sample); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_10getfreq(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_site, int __pyx_v_derived); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_12getfreqs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sample, int __pyx_v_derived); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_14freqfilter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sample, float __pyx_v_minfreq, int __pyx_v_derived); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_16check_input_params(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_mu_neutral, double __pyx_v_mu_selected, double __pyx_v_recrate, PyObject *__pyx_v_nregions, PyObject *__pyx_v_sregions, PyObject *__pyx_v_recregions); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_18evolve_regions(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng, int __pyx_v_npops, int __pyx_v_N, __Pyx_memviewslice __pyx_v_nlist, double __pyx_v_mu_neutral, double __pyx_v_mu_selected, double __pyx_v_recrate, PyObject *__pyx_v_nregions, PyObject *__pyx_v_sregions, PyObject *__pyx_v_recregions, double __pyx_v_f, double __pyx_v_scaling, char const *__pyx_v_fitness); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_20evolve_regions_more(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_pops, __Pyx_memviewslice __pyx_v_nlist, double __pyx_v_mu_neutral, double __pyx_v_mu_selected, double __pyx_v_recrate, PyObject *__pyx_v_nregions, PyObject *__pyx_v_sregions, PyObject *__pyx_v_recregions, double __pyx_v_f, double __pyx_v_scaling, char const *__pyx_v_fitness); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_22evolve_regions_sampler(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_pops, struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_slist, __Pyx_memviewslice __pyx_v_nlist, double __pyx_v_mu_neutral, double __pyx_v_mu_selected, double __pyx_v_recrate, PyObject *__pyx_v_nregions, PyObject *__pyx_v_sregions, PyObject *__pyx_v_recregions, int __pyx_v_sample, double __pyx_v_f, double __pyx_v_scaling, char const *__pyx_v_fitness); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_24evolve_regions_sampler_fitness(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_pops, struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_slist, struct __pyx_obj_5fwdpy_7fitness_SpopFitness *__pyx_v_fitness_function, __Pyx_memviewslice __pyx_v_nlist, double __pyx_v_mu_neutral, double __pyx_v_mu_selected, double __pyx_v_recrate, PyObject *__pyx_v_nregions, PyObject *__pyx_v_sregions, PyObject *__pyx_v_recregions, int __pyx_v_sample, double __pyx_v_f); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_6Region___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, float __pyx_v_beg, float __pyx_v_end, float __pyx_v_weight, PyObject *__pyx_v_coupled, uint16_t __pyx_v_label); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_6Region_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_7Sregion___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, float __pyx_v_beg, float __pyx_v_end, float __pyx_v_weight, float __pyx_v_h, PyObject *__pyx_v_coupled, uint16_t __pyx_v_label); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_7Sregion_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_6GammaS___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, float __pyx_v_beg, float __pyx_v_end, float __pyx_v_weight, float __pyx_v_mean, float __pyx_v_shape, float __pyx_v_h, PyObject *__pyx_v_coupled, uint16_t __pyx_v_label); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_6GammaS_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_9ConstantS___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, float __pyx_v_beg, float __pyx_v_end, float __pyx_v_weight, float __pyx_v_s, float __pyx_v_h, PyObject *__pyx_v_coupled, uint16_t __pyx_v_label); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_9ConstantS_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_8UniformS___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, float __pyx_v_beg, float __pyx_v_end, float __pyx_v_weight, float __pyx_v_lo, float __pyx_v_hi, float __pyx_v_h, PyObject *__pyx_v_coupled); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_8UniformS_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_4ExpS___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, float __pyx_v_beg, float __pyx_v_end, float __pyx_v_weight, float __pyx_v_mean, float __pyx_v_h, PyObject *__pyx_v_coupled, uint16_t __pyx_v_label); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_4ExpS_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_9GaussianS___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, float __pyx_v_beg, float __pyx_v_end, float __pyx_v_weight, float __pyx_v_sd, float __pyx_v_h, PyObject *__pyx_v_coupled, uint16_t __pyx_v_label); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_9GaussianS_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_26copypop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_pop); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_28copypops(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_PopVec *__pyx_v_pops); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_30view_mutations_singlepop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_32view_mutations_singlepop_mloc(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_34view_mutations_popvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_36view_mutations_popvec_mloc(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_38view_mutations_metapop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_p, unsigned int __pyx_v_deme); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_40view_mutations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_deme); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_42view_gametes_singlepop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_44view_gametes_singlepop_mloc(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_46view_gametes_popvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_48view_gametes_popvec_mloc(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_50view_gametes_metapop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_p, unsigned int __pyx_v_deme); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_52view_gametes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_deme); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_54view_diploids_singlepop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p, PyObject *__pyx_v_indlist); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_56view_diploids_singlepop_mloc(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_p, PyObject *__pyx_v_indlist); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_58view_diploids_popvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p, PyObject *__pyx_v_indlist); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_60view_diploids_popvec_mloc(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p, PyObject *__pyx_v_indlist); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_62view_diploids_metapop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_p, PyObject *__pyx_v_indlist, unsigned int __pyx_v_deme); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_64view_diploids(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_indlist, PyObject *__pyx_v_deme); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_66diploid_view_to_sample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_view); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_68diploid_mloc_view_to_sample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_view); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_70view_diploids_pd_popvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p, std::vector<unsigned int>  __pyx_v_indlist, int __pyx_v_selectedOnly); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_72view_diploids_pd_singlepop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p, std::vector<unsigned int>  __pyx_v_indlist, int __pyx_v_selectedOnly); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_74view_diploids_pd(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_indlist, int __pyx_v_selectedOnly); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_76diploid_traits(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_deme); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_78view_fixations_popvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_80view_fixations_mlocuspopvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_82view_fixations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_84check_popdata_singlepop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_86check_popdata_metapop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_88check_popdata_popvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_90check_popdata_mpopvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_92check_popdata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_94allele_ages(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_trajectories, double __pyx_v_minfreq, unsigned int __pyx_v_minsojourn); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_96merge_trajectories(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_trajectories1, PyObject *__pyx_v_trajectories2); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_98tidy_trajectories_details(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_trajectories, unsigned int __pyx_v_min_sojourn, double __pyx_v_min_freq, unsigned int __pyx_v_remove_arose_after, unsigned int __pyx_v_remove_gone_before); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_100tidy_trajectories(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_trajectories, unsigned int __pyx_v_min_sojourn, double __pyx_v_min_freq, PyObject *__pyx_v_remove_arose_after, PyObject *__pyx_v_remove_gone_before); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_15TemporalSampler_size(struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_self); /* proto */
static void __pyx_pf_5fwdpy_5fwdpy_15TemporalSampler_2__dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_15TemporalSampler_4force_clear(struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_self); /* proto */
static int __pyx_pf_5fwdpy_5fwdpy_14NothingSampler___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler *__pyx_v_self, unsigned int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_14NothingSampler_2get(CYTHON_UNUSED struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler *__pyx_v_self); /* proto */
static int __pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *__pyx_v_self, unsigned int __pyx_v_n, double __pyx_v_optimum); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_2__iter__(struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_5__next__(struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_7__len__(struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_9__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *__pyx_v_self, PyObject *__pyx_v_i); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_11get(struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *__pyx_v_self); /* proto */
static int __pyx_pf_5fwdpy_5fwdpy_10PopSampler___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *__pyx_v_self, unsigned int __pyx_v_n, unsigned int __pyx_v_nsam, struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng, PyObject *__pyx_v_removeFixed, PyObject *__pyx_v_neutral_file, PyObject *__pyx_v_selected_file, PyObject *__pyx_v_boundaries, PyObject *__pyx_v_append, PyObject *__pyx_v_recordSamples, PyObject *__pyx_v_recordDetails); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_10PopSampler_2__iter__(struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_10PopSampler_5__next__(struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_10PopSampler_7__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *__pyx_v_self, int __pyx_v_i); /* proto */
static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_10PopSampler_9__len__(struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *__pyx_v_self); /* proto */
static int __pyx_pf_5fwdpy_5fwdpy_9VASampler___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_VASampler *__pyx_v_self, unsigned int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_9VASampler_2__iter__(struct __pyx_obj_5fwdpy_5fwdpy_VASampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_9VASampler_5__next__(struct __pyx_obj_5fwdpy_5fwdpy_VASampler *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_9VASampler_7__len__(struct __pyx_obj_5fwdpy_5fwdpy_VASampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_9VASampler_9__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_VASampler *__pyx_v_self, PyObject *__pyx_v_i); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_9VASampler_11get(struct __pyx_obj_5fwdpy_5fwdpy_VASampler *__pyx_v_self); /* proto */
static int __pyx_pf_5fwdpy_5fwdpy_11FreqSampler___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *__pyx_v_self, unsigned int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_11FreqSampler_2__iter__(struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_11FreqSampler_5__next__(struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_11FreqSampler_7__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *__pyx_v_self, PyObject *__pyx_v_i); /* proto */
static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_11FreqSampler_9__len__(struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_102apply_sampler(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_PopVec *__pyx_v_pops, struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_sampler); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_104apply_sampler_single(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_pop, struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_sampler); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_106add_mutation(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_p, std::vector<size_t>  __pyx_v_indlist, std::vector<short>  __pyx_v_clist, double __pyx_v_pos, double __pyx_v_s, double __pyx_v_h); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_108pkg_version(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5fwdpy_5fwdpy_110cite(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags); /* proto */
static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_PopType(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_Spop(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_MetaPop(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_MlocusPop(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_SpopGenMut(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_PopVec(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_SpopVec(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_SpopGenMutVec(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_MetaPopVec(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_MlocusPopVec(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_GSLrng(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_TemporalSampler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_NothingSampler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_QtraitStatsSampler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_PopSampler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_VASampler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_FreqSampler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_neg_1;
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;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_slice__98;
static PyObject *__pyx_slice__99;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__64;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__66;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_tuple__68;
static PyObject *__pyx_tuple__69;
static PyObject *__pyx_tuple__70;
static PyObject *__pyx_tuple__71;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__73;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__76;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_tuple__78;
static PyObject *__pyx_tuple__79;
static PyObject *__pyx_tuple__80;
static PyObject *__pyx_tuple__81;
static PyObject *__pyx_tuple__82;
static PyObject *__pyx_tuple__83;
static PyObject *__pyx_tuple__84;
static PyObject *__pyx_tuple__85;
static PyObject *__pyx_tuple__86;
static PyObject *__pyx_tuple__87;
static PyObject *__pyx_tuple__88;
static PyObject *__pyx_tuple__89;
static PyObject *__pyx_tuple__90;
static PyObject *__pyx_tuple__91;
static PyObject *__pyx_tuple__92;
static PyObject *__pyx_tuple__93;
static PyObject *__pyx_tuple__94;
static PyObject *__pyx_tuple__95;
static PyObject *__pyx_tuple__96;
static PyObject *__pyx_tuple__97;
static PyObject *__pyx_slice__100;
static PyObject *__pyx_tuple__101;
static PyObject *__pyx_tuple__102;
static PyObject *__pyx_tuple__104;
static PyObject *__pyx_tuple__106;
static PyObject *__pyx_tuple__108;
static PyObject *__pyx_tuple__110;
static PyObject *__pyx_tuple__112;
static PyObject *__pyx_tuple__114;
static PyObject *__pyx_tuple__116;
static PyObject *__pyx_tuple__118;
static PyObject *__pyx_tuple__120;
static PyObject *__pyx_tuple__122;
static PyObject *__pyx_tuple__124;
static PyObject *__pyx_tuple__126;
static PyObject *__pyx_tuple__128;
static PyObject *__pyx_tuple__130;
static PyObject *__pyx_tuple__132;
static PyObject *__pyx_tuple__134;
static PyObject *__pyx_tuple__136;
static PyObject *__pyx_tuple__138;
static PyObject *__pyx_tuple__140;
static PyObject *__pyx_tuple__142;
static PyObject *__pyx_tuple__144;
static PyObject *__pyx_tuple__146;
static PyObject *__pyx_tuple__148;
static PyObject *__pyx_tuple__150;
static PyObject *__pyx_tuple__152;
static PyObject *__pyx_tuple__154;
static PyObject *__pyx_tuple__156;
static PyObject *__pyx_tuple__158;
static PyObject *__pyx_tuple__160;
static PyObject *__pyx_tuple__162;
static PyObject *__pyx_tuple__164;
static PyObject *__pyx_tuple__166;
static PyObject *__pyx_tuple__168;
static PyObject *__pyx_tuple__170;
static PyObject *__pyx_tuple__172;
static PyObject *__pyx_tuple__174;
static PyObject *__pyx_tuple__176;
static PyObject *__pyx_tuple__178;
static PyObject *__pyx_tuple__180;
static PyObject *__pyx_tuple__182;
static PyObject *__pyx_tuple__184;
static PyObject *__pyx_tuple__186;
static PyObject *__pyx_tuple__188;
static PyObject *__pyx_tuple__190;
static PyObject *__pyx_tuple__192;
static PyObject *__pyx_tuple__194;
static PyObject *__pyx_tuple__196;
static PyObject *__pyx_tuple__198;
static PyObject *__pyx_tuple__200;
static PyObject *__pyx_tuple__202;
static PyObject *__pyx_tuple__204;
static PyObject *__pyx_tuple__206;
static PyObject *__pyx_tuple__208;
static PyObject *__pyx_tuple__210;
static PyObject *__pyx_tuple__212;
static PyObject *__pyx_tuple__214;
static PyObject *__pyx_tuple__216;
static PyObject *__pyx_tuple__218;
static PyObject *__pyx_tuple__220;
static PyObject *__pyx_tuple__222;
static PyObject *__pyx_tuple__224;
static PyObject *__pyx_tuple__226;
static PyObject *__pyx_tuple__228;
static PyObject *__pyx_tuple__230;
static PyObject *__pyx_tuple__232;
static PyObject *__pyx_tuple__234;
static PyObject *__pyx_tuple__236;
static PyObject *__pyx_tuple__238;
static PyObject *__pyx_tuple__241;
static PyObject *__pyx_tuple__242;
static PyObject *__pyx_tuple__243;
static PyObject *__pyx_tuple__244;
static PyObject *__pyx_tuple__245;
static PyObject *__pyx_codeobj__103;
static PyObject *__pyx_codeobj__105;
static PyObject *__pyx_codeobj__107;
static PyObject *__pyx_codeobj__109;
static PyObject *__pyx_codeobj__111;
static PyObject *__pyx_codeobj__113;
static PyObject *__pyx_codeobj__115;
static PyObject *__pyx_codeobj__117;
static PyObject *__pyx_codeobj__119;
static PyObject *__pyx_codeobj__121;
static PyObject *__pyx_codeobj__123;
static PyObject *__pyx_codeobj__125;
static PyObject *__pyx_codeobj__127;
static PyObject *__pyx_codeobj__129;
static PyObject *__pyx_codeobj__131;
static PyObject *__pyx_codeobj__133;
static PyObject *__pyx_codeobj__135;
static PyObject *__pyx_codeobj__137;
static PyObject *__pyx_codeobj__139;
static PyObject *__pyx_codeobj__141;
static PyObject *__pyx_codeobj__143;
static PyObject *__pyx_codeobj__145;
static PyObject *__pyx_codeobj__147;
static PyObject *__pyx_codeobj__149;
static PyObject *__pyx_codeobj__151;
static PyObject *__pyx_codeobj__153;
static PyObject *__pyx_codeobj__155;
static PyObject *__pyx_codeobj__157;
static PyObject *__pyx_codeobj__159;
static PyObject *__pyx_codeobj__161;
static PyObject *__pyx_codeobj__163;
static PyObject *__pyx_codeobj__165;
static PyObject *__pyx_codeobj__167;
static PyObject *__pyx_codeobj__169;
static PyObject *__pyx_codeobj__171;
static PyObject *__pyx_codeobj__173;
static PyObject *__pyx_codeobj__175;
static PyObject *__pyx_codeobj__177;
static PyObject *__pyx_codeobj__179;
static PyObject *__pyx_codeobj__181;
static PyObject *__pyx_codeobj__183;
static PyObject *__pyx_codeobj__185;
static PyObject *__pyx_codeobj__187;
static PyObject *__pyx_codeobj__189;
static PyObject *__pyx_codeobj__191;
static PyObject *__pyx_codeobj__193;
static PyObject *__pyx_codeobj__195;
static PyObject *__pyx_codeobj__197;
static PyObject *__pyx_codeobj__199;
static PyObject *__pyx_codeobj__201;
static PyObject *__pyx_codeobj__203;
static PyObject *__pyx_codeobj__205;
static PyObject *__pyx_codeobj__207;
static PyObject *__pyx_codeobj__209;
static PyObject *__pyx_codeobj__211;
static PyObject *__pyx_codeobj__213;
static PyObject *__pyx_codeobj__215;
static PyObject *__pyx_codeobj__217;
static PyObject *__pyx_codeobj__219;
static PyObject *__pyx_codeobj__221;
static PyObject *__pyx_codeobj__223;
static PyObject *__pyx_codeobj__225;
static PyObject *__pyx_codeobj__227;
static PyObject *__pyx_codeobj__229;
static PyObject *__pyx_codeobj__231;
static PyObject *__pyx_codeobj__233;
static PyObject *__pyx_codeobj__235;
static PyObject *__pyx_codeobj__237;
static PyObject *__pyx_codeobj__239;
static PyObject *__pyx_codeobj__240;

/* "fwdpy/classes.pyx":13
 *     the output of iterating through a :class:`SpopVec`.
 *     """
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *        self.pop.reset()
 *     cpdef gen(self):
 */

/* Python wrapper */
static void __pyx_pw_5fwdpy_5fwdpy_4Spop_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5fwdpy_5fwdpy_4Spop_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5fwdpy_5fwdpy_4Spop___dealloc__(((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5fwdpy_5fwdpy_4Spop___dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "fwdpy/classes.pyx":14
 *     """
 *     def __dealloc__(self):
 *        self.pop.reset()             # <<<<<<<<<<<<<<
 *     cpdef gen(self):
 *         """
 */
  __pyx_v_self->pop.reset();

  /* "fwdpy/classes.pyx":13
 *     the output of iterating through a :class:`SpopVec`.
 *     """
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *        self.pop.reset()
 *     cpdef gen(self):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "fwdpy/classes.pyx":15
 *     def __dealloc__(self):
 *        self.pop.reset()
 *     cpdef gen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the generation that the population is currently evolved to
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_4Spop_3gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_4Spop_gen(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("gen", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_gen); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_4Spop_3gen)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":19
 *         Returns the generation that the population is currently evolved to
 *         """
 *         return self.pop.get().generation             # <<<<<<<<<<<<<<
 *     cpdef popsize(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->pop.get()->generation); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":15
 *     def __dealloc__(self):
 *        self.pop.reset()
 *     cpdef gen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the generation that the population is currently evolved to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.Spop.gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_4Spop_3gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_4Spop_2gen[] = "\n        Returns the generation that the population is currently evolved to\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_4Spop_3gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gen (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_4Spop_2gen(((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_4Spop_2gen(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("gen", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_4Spop_gen(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __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("fwdpy.fwdpy.Spop.gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":20
 *         """
 *         return self.pop.get().generation
 *     cpdef popsize(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the size of the population
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_4Spop_5popsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_4Spop_popsize(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("popsize", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_popsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 20, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_4Spop_5popsize)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 20, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 20, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":24
 *         Returns the size of the population
 *         """
 *         return self.pop.get().N             # <<<<<<<<<<<<<<
 *     cpdef sane(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->pop.get()->N); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":20
 *         """
 *         return self.pop.get().generation
 *     cpdef popsize(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the size of the population
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.Spop.popsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_4Spop_5popsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_4Spop_4popsize[] = "\n        Returns the size of the population\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_4Spop_5popsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("popsize (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_4Spop_4popsize(((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_4Spop_4popsize(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("popsize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_4Spop_popsize(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 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);
  __Pyx_AddTraceback("fwdpy.fwdpy.Spop.popsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":25
 *         """
 *         return self.pop.get().N
 *     cpdef sane(self):             # <<<<<<<<<<<<<<
 *         """
 *         Makes sure that the population is in a sane state.
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_4Spop_7sane(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_4Spop_sane(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("sane", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_sane); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 25, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_4Spop_7sane)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 25, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 25, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":34
 * 
 *         """
 *         return self.pop.get().sane()             # <<<<<<<<<<<<<<
 * 
 * cdef class SpopGenMut(PopType):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->pop.get()->sane()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":25
 *         """
 *         return self.pop.get().N
 *     cpdef sane(self):             # <<<<<<<<<<<<<<
 *         """
 *         Makes sure that the population is in a sane state.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.Spop.sane", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_4Spop_7sane(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_4Spop_6sane[] = "\n        Makes sure that the population is in a sane state.\n\n        Internally, this checks that pop.N == pop.diploids.size(),\n        which it should be if the C++ code behind this all is properly updating\n        the data structures!\n\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_4Spop_7sane(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sane (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_4Spop_6sane(((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_4Spop_6sane(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("sane", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_4Spop_sane(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 25, __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("fwdpy.fwdpy.Spop.sane", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":47
 *     ..note:: Currently, there are no functions in fwdpy using this type!  See :class:`fwdpy.fwdpy.Spop` instead.
 *     """
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.pop.reset()
 *     cpdef gen(self):
 */

/* Python wrapper */
static void __pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5fwdpy_5fwdpy_10SpopGenMut___dealloc__(((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5fwdpy_5fwdpy_10SpopGenMut___dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "fwdpy/classes.pyx":48
 *     """
 *     def __dealloc__(self):
 *         self.pop.reset()             # <<<<<<<<<<<<<<
 *     cpdef gen(self):
 *         """
 */
  __pyx_v_self->pop.reset();

  /* "fwdpy/classes.pyx":47
 *     ..note:: Currently, there are no functions in fwdpy using this type!  See :class:`fwdpy.fwdpy.Spop` instead.
 *     """
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.pop.reset()
 *     cpdef gen(self):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "fwdpy/classes.pyx":49
 *     def __dealloc__(self):
 *         self.pop.reset()
 *     cpdef gen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the generation that the population is currently evolved to
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_3gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_10SpopGenMut_gen(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("gen", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_gen); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 49, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_3gen)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 49, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 49, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":53
 *         Returns the generation that the population is currently evolved to
 *         """
 *         return self.pop.get().generation             # <<<<<<<<<<<<<<
 *     cpdef popsize(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->pop.get()->generation); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":49
 *     def __dealloc__(self):
 *         self.pop.reset()
 *     cpdef gen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the generation that the population is currently evolved to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopGenMut.gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_3gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_10SpopGenMut_2gen[] = "\n        Returns the generation that the population is currently evolved to\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_3gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gen (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10SpopGenMut_2gen(((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_10SpopGenMut_2gen(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("gen", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_10SpopGenMut_gen(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 49, __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("fwdpy.fwdpy.SpopGenMut.gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":54
 *         """
 *         return self.pop.get().generation
 *     cpdef popsize(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the size of the population
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_5popsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_10SpopGenMut_popsize(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("popsize", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_popsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_5popsize)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 54, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 54, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":58
 *         Returns the size of the population
 *         """
 *         return self.pop.get().N             # <<<<<<<<<<<<<<
 *     cpdef sane(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->pop.get()->N); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":54
 *         """
 *         return self.pop.get().generation
 *     cpdef popsize(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the size of the population
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopGenMut.popsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_5popsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_10SpopGenMut_4popsize[] = "\n        Returns the size of the population\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_5popsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("popsize (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10SpopGenMut_4popsize(((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_10SpopGenMut_4popsize(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("popsize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_10SpopGenMut_popsize(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 54, __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("fwdpy.fwdpy.SpopGenMut.popsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":59
 *         """
 *         return self.pop.get().N
 *     cpdef sane(self):             # <<<<<<<<<<<<<<
 *         """
 *         Makes sure that the population is in a sane state.
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_7sane(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_10SpopGenMut_sane(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("sane", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_sane); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_7sane)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 59, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 59, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":68
 * 
 *         """
 *         return self.pop.get().sane()             # <<<<<<<<<<<<<<
 * 
 * cdef class MlocusPop(PopType):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->pop.get()->sane()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":59
 *         """
 *         return self.pop.get().N
 *     cpdef sane(self):             # <<<<<<<<<<<<<<
 *         """
 *         Makes sure that the population is in a sane state.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopGenMut.sane", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_7sane(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_10SpopGenMut_6sane[] = "\n        Makes sure that the population is in a sane state.\n\n        Internally, this checks that pop.N == pop.diploids.size(),\n        which it should be if the C++ code behind this all is properly updating\n        the data structures!\n\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_7sane(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sane (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10SpopGenMut_6sane(((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_10SpopGenMut_6sane(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("sane", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_10SpopGenMut_sane(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 59, __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("fwdpy.fwdpy.SpopGenMut.sane", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":79
 *     the output of iterating through a :class:`MlocusPopVec`.
 *     """
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.pop.reset()
 *     cpdef gen(self):
 */

/* Python wrapper */
static void __pyx_pw_5fwdpy_5fwdpy_9MlocusPop_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5fwdpy_5fwdpy_9MlocusPop_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5fwdpy_5fwdpy_9MlocusPop___dealloc__(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5fwdpy_5fwdpy_9MlocusPop___dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "fwdpy/classes.pyx":80
 *     """
 *     def __dealloc__(self):
 *         self.pop.reset()             # <<<<<<<<<<<<<<
 *     cpdef gen(self):
 *         """
 */
  __pyx_v_self->pop.reset();

  /* "fwdpy/classes.pyx":79
 *     the output of iterating through a :class:`MlocusPopVec`.
 *     """
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.pop.reset()
 *     cpdef gen(self):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "fwdpy/classes.pyx":81
 *     def __dealloc__(self):
 *         self.pop.reset()
 *     cpdef gen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the generation that the population is currently evolved to
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_3gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_9MlocusPop_gen(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("gen", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_gen); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 81, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_3gen)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 81, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 81, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":85
 *         Returns the generation that the population is currently evolved to
 *         """
 *         return self.pop.get().generation             # <<<<<<<<<<<<<<
 *     cpdef popsize(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->pop.get()->generation); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":81
 *     def __dealloc__(self):
 *         self.pop.reset()
 *     cpdef gen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the generation that the population is currently evolved to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.MlocusPop.gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_3gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_9MlocusPop_2gen[] = "\n        Returns the generation that the population is currently evolved to\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_3gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gen (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_9MlocusPop_2gen(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_9MlocusPop_2gen(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("gen", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_9MlocusPop_gen(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 81, __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("fwdpy.fwdpy.MlocusPop.gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":86
 *         """
 *         return self.pop.get().generation
 *     cpdef popsize(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the size of the population
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_5popsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_9MlocusPop_popsize(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("popsize", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_popsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_5popsize)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 86, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 86, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":90
 *         Returns the size of the population
 *         """
 *         return self.pop.get().N             # <<<<<<<<<<<<<<
 *     cpdef sane(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->pop.get()->N); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":86
 *         """
 *         return self.pop.get().generation
 *     cpdef popsize(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the size of the population
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.MlocusPop.popsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_5popsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_9MlocusPop_4popsize[] = "\n        Returns the size of the population\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_5popsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("popsize (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_9MlocusPop_4popsize(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_9MlocusPop_4popsize(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("popsize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_9MlocusPop_popsize(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 86, __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("fwdpy.fwdpy.MlocusPop.popsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":91
 *         """
 *         return self.pop.get().N
 *     cpdef sane(self):             # <<<<<<<<<<<<<<
 *         """
 *         Makes sure that the population is in a sane state.
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_7sane(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_9MlocusPop_sane(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("sane", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_sane); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_7sane)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 91, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 91, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":100
 * 
 *         """
 *         return self.pop.get().sane()             # <<<<<<<<<<<<<<
 * 
 * cdef class SpopVec(PopVec):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->pop.get()->sane()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":91
 *         """
 *         return self.pop.get().N
 *     cpdef sane(self):             # <<<<<<<<<<<<<<
 *         """
 *         Makes sure that the population is in a sane state.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.MlocusPop.sane", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_7sane(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_9MlocusPop_6sane[] = "\n        Makes sure that the population is in a sane state.\n\n        Internally, this checks that pop.N == pop.diploids.size(),\n        which it should be if the C++ code behind this all is properly updating\n        the data structures!\n\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_7sane(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sane (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_9MlocusPop_6sane(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_9MlocusPop_6sane(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("sane", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_9MlocusPop_sane(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 91, __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("fwdpy.fwdpy.MlocusPop.sane", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":112
 *     See :func:`evolve_regions` for use cases.
 *     """
 *     def __cinit__(self,unsigned npops,unsigned N):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor:
 */

/* Python wrapper */
static int __pyx_pw_5fwdpy_5fwdpy_7SpopVec_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5fwdpy_5fwdpy_7SpopVec_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_npops;
  unsigned int __pyx_v_N;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_npops,&__pyx_n_s_N,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_npops)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_N)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(1, 112, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 112, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_npops = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_npops == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 112, __pyx_L3_error)
    __pyx_v_N = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_N == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 112, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 112, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopVec.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7SpopVec___cinit__(((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_self), __pyx_v_npops, __pyx_v_N);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5fwdpy_5fwdpy_7SpopVec___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self, unsigned int __pyx_v_npops, unsigned int __pyx_v_N) {
  CYTHON_UNUSED unsigned int __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  unsigned int __pyx_t_1;
  unsigned int __pyx_t_2;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "fwdpy/classes.pyx":119
 *         :param N: Initial population number for each population
 *         """
 *         for i in range(npops):             # <<<<<<<<<<<<<<
 *             self.pops.push_back(shared_ptr[singlepop_t](new singlepop_t(N)))
 *     def __dealloc__(self):
 */
  __pyx_t_1 = __pyx_v_npops;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/classes.pyx":120
 *         """
 *         for i in range(npops):
 *             self.pops.push_back(shared_ptr[singlepop_t](new singlepop_t(N)))             # <<<<<<<<<<<<<<
 *     def __dealloc__(self):
 *         self.pops.clear()
 */
    try {
      __pyx_v_self->pops.push_back(std::shared_ptr<fwdpy::singlepop_t> (new fwdpy::singlepop_t(__pyx_v_N)));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(1, 120, __pyx_L1_error)
    }
  }

  /* "fwdpy/classes.pyx":112
 *     See :func:`evolve_regions` for use cases.
 *     """
 *     def __cinit__(self,unsigned npops,unsigned N):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopVec.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":121
 *         for i in range(npops):
 *             self.pops.push_back(shared_ptr[singlepop_t](new singlepop_t(N)))
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.pops.clear()
 *     def __iter__(self):
 */

/* Python wrapper */
static void __pyx_pw_5fwdpy_5fwdpy_7SpopVec_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5fwdpy_5fwdpy_7SpopVec_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5fwdpy_5fwdpy_7SpopVec_2__dealloc__(((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5fwdpy_5fwdpy_7SpopVec_2__dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "fwdpy/classes.pyx":122
 *             self.pops.push_back(shared_ptr[singlepop_t](new singlepop_t(N)))
 *     def __dealloc__(self):
 *         self.pops.clear()             # <<<<<<<<<<<<<<
 *     def __iter__(self):
 *         for i in range(self.pops.size()):
 */
  __pyx_v_self->pops.clear();

  /* "fwdpy/classes.pyx":121
 *         for i in range(npops):
 *             self.pops.push_back(shared_ptr[singlepop_t](new singlepop_t(N)))
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.pops.clear()
 *     def __iter__(self):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
static PyObject *__pyx_gb_5fwdpy_5fwdpy_7SpopVec_6generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "fwdpy/classes.pyx":123
 *     def __dealloc__(self):
 *         self.pops.clear()
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.pops.size()):
 *             x = Spop()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_5__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_5__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7SpopVec_4__iter__(((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_7SpopVec_4__iter__(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__ *)__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct____iter__(__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 123, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5fwdpy_5fwdpy_7SpopVec_6generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_SpopVec___iter, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!gen)) __PYX_ERR(1, 123, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopVec.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5fwdpy_5fwdpy_7SpopVec_6generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 123, __pyx_L1_error)

  /* "fwdpy/classes.pyx":124
 *         self.pops.clear()
 *     def __iter__(self):
 *         for i in range(self.pops.size()):             # <<<<<<<<<<<<<<
 *             x = Spop()
 *             x.pop=self.pops[i]
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->pops.size();
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_2;

    /* "fwdpy/classes.pyx":125
 *     def __iter__(self):
 *         for i in range(self.pops.size()):
 *             x = Spop()             # <<<<<<<<<<<<<<
 *             x.pop=self.pops[i]
 *             yield x
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5fwdpy_5fwdpy_Spop), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_x));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x, ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/classes.pyx":126
 *         for i in range(self.pops.size()):
 *             x = Spop()
 *             x.pop=self.pops[i]             # <<<<<<<<<<<<<<
 *             yield x
 *     def __next__(self):
 */
    __pyx_cur_scope->__pyx_v_x->pop = (__pyx_cur_scope->__pyx_v_self->pops[__pyx_cur_scope->__pyx_v_i]);

    /* "fwdpy/classes.pyx":127
 *             x = Spop()
 *             x.pop=self.pops[i]
 *             yield x             # <<<<<<<<<<<<<<
 *     def __next__(self):
 *         return next(self)
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_x));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_x);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 127, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "fwdpy/classes.pyx":123
 *     def __dealloc__(self):
 *         self.pops.clear()
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.pops.size()):
 *             x = Spop()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":128
 *             x.pop=self.pops[i]
 *             yield x
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __getitem__(self, int i):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_8__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_8__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7SpopVec_7__next__(((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_7SpopVec_7__next__(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "fwdpy/classes.pyx":129
 *             yield x
 *     def __next__(self):
 *         return next(self)             # <<<<<<<<<<<<<<
 *     def __getitem__(self, int i):
 *         x = Spop()
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyIter_Next(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":128
 *             x.pop=self.pops[i]
 *             yield x
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __getitem__(self, int i):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopVec.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":130
 *     def __next__(self):
 *         return next(self)
 *     def __getitem__(self, int i):             # <<<<<<<<<<<<<<
 *         x = Spop()
 *         x.pop=self.pops[i]
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) {
  int __pyx_v_i;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  assert(__pyx_arg_i); {
    __pyx_v_i = __Pyx_PyInt_As_int(__pyx_arg_i); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 130, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopVec.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7SpopVec_9__getitem__(((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_self), ((int)__pyx_v_i));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_7SpopVec_9__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self, int __pyx_v_i) {
  struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "fwdpy/classes.pyx":131
 *         return next(self)
 *     def __getitem__(self, int i):
 *         x = Spop()             # <<<<<<<<<<<<<<
 *         x.pop=self.pops[i]
 *         return x
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5fwdpy_5fwdpy_Spop), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_x = ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/classes.pyx":132
 *     def __getitem__(self, int i):
 *         x = Spop()
 *         x.pop=self.pops[i]             # <<<<<<<<<<<<<<
 *         return x
 *     def __len__(self):
 */
  __pyx_v_x->pop = (__pyx_v_self->pops[__pyx_v_i]);

  /* "fwdpy/classes.pyx":133
 *         x = Spop()
 *         x.pop=self.pops[i]
 *         return x             # <<<<<<<<<<<<<<
 *     def __len__(self):
 *         return self.pops.size()
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_x));
  __pyx_r = ((PyObject *)__pyx_v_x);
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":130
 *     def __next__(self):
 *         return next(self)
 *     def __getitem__(self, int i):             # <<<<<<<<<<<<<<
 *         x = Spop()
 *         x.pop=self.pops[i]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopVec.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":134
 *         x.pop=self.pops[i]
 *         return x
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[singlepop_t]] & newpops):
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_7SpopVec_12__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_7SpopVec_12__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7SpopVec_11__len__(((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_7SpopVec_11__len__(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "fwdpy/classes.pyx":135
 *         return x
 *     def __len__(self):
 *         return self.pops.size()             # <<<<<<<<<<<<<<
 *     cdef reset(self,const vector[shared_ptr[singlepop_t]] & newpops):
 *         self.pops=newpops
 */
  __pyx_r = __pyx_v_self->pops.size();
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":134
 *         x.pop=self.pops[i]
 *         return x
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[singlepop_t]] & newpops):
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":136
 *     def __len__(self):
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[singlepop_t]] & newpops):             # <<<<<<<<<<<<<<
 *         self.pops=newpops
 *     def __append_details__(self,SpopVec p):
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_7SpopVec_reset(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self, std::vector<std::shared_ptr<fwdpy::singlepop_t> >  const &__pyx_v_newpops) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset", 0);

  /* "fwdpy/classes.pyx":137
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[singlepop_t]] & newpops):
 *         self.pops=newpops             # <<<<<<<<<<<<<<
 *     def __append_details__(self,SpopVec p):
 *         for i in range(p.pops.size()):
 */
  __pyx_v_self->pops = __pyx_v_newpops;

  /* "fwdpy/classes.pyx":136
 *     def __len__(self):
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[singlepop_t]] & newpops):             # <<<<<<<<<<<<<<
 *         self.pops=newpops
 *     def __append_details__(self,SpopVec p):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":138
 *     cdef reset(self,const vector[shared_ptr[singlepop_t]] & newpops):
 *         self.pops=newpops
 *     def __append_details__(self,SpopVec p):             # <<<<<<<<<<<<<<
 *         for i in range(p.pops.size()):
 *             self.pops.push_back(p.pops[i])
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_14__append_details__(PyObject *__pyx_v_self, PyObject *__pyx_v_p); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_14__append_details__(PyObject *__pyx_v_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__append_details__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_SpopVec, 1, "p", 0))) __PYX_ERR(1, 138, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7SpopVec_13__append_details__(((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_self), ((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_7SpopVec_13__append_details__(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  __Pyx_RefNannySetupContext("__append_details__", 0);

  /* "fwdpy/classes.pyx":139
 *         self.pops=newpops
 *     def __append_details__(self,SpopVec p):
 *         for i in range(p.pops.size()):             # <<<<<<<<<<<<<<
 *             self.pops.push_back(p.pops[i])
 *     cpdef append(self,SpopVec p):
 */
  __pyx_t_1 = __pyx_v_p->pops.size();
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/classes.pyx":140
 *     def __append_details__(self,SpopVec p):
 *         for i in range(p.pops.size()):
 *             self.pops.push_back(p.pops[i])             # <<<<<<<<<<<<<<
 *     cpdef append(self,SpopVec p):
 *         """
 */
    try {
      __pyx_v_self->pops.push_back((__pyx_v_p->pops[__pyx_v_i]));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(1, 140, __pyx_L1_error)
    }
  }

  /* "fwdpy/classes.pyx":138
 *     cdef reset(self,const vector[shared_ptr[singlepop_t]] & newpops):
 *         self.pops=newpops
 *     def __append_details__(self,SpopVec p):             # <<<<<<<<<<<<<<
 *         for i in range(p.pops.size()):
 *             self.pops.push_back(p.pops[i])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopVec.__append_details__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":141
 *         for i in range(p.pops.size()):
 *             self.pops.push_back(p.pops[i])
 *     cpdef append(self,SpopVec p):             # <<<<<<<<<<<<<<
 *         """
 *         Append 'p' into this object.
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_16append(PyObject *__pyx_v_self, PyObject *__pyx_v_p); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_7SpopVec_append(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("append", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 141, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7SpopVec_16append)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (!__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_p)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 141, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_p)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 141, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_p)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 141, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 141, __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 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_p));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 141, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":148
 *         this object and p will not share any pointers
 *         """
 *         self.__append_details__(copypops(p))             # <<<<<<<<<<<<<<
 *     cpdef size(self):
 *         """
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append_details); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_copypops); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_p)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_p)};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_p)};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_p));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, ((PyObject *)__pyx_v_p));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 148, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 148, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 148, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/classes.pyx":141
 *         for i in range(p.pops.size()):
 *             self.pops.push_back(p.pops[i])
 *     cpdef append(self,SpopVec p):             # <<<<<<<<<<<<<<
 *         """
 *         Append 'p' into this 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopVec.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_16append(PyObject *__pyx_v_self, PyObject *__pyx_v_p); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_7SpopVec_15append[] = "\n        Append 'p' into this object.\n\n        This is done via a serialized copy, meaning that \n        this object and p will not share any pointers\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_16append(PyObject *__pyx_v_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_SpopVec, 1, "p", 0))) __PYX_ERR(1, 141, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7SpopVec_15append(((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_self), ((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_7SpopVec_15append(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("append", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_7SpopVec_append(__pyx_v_self, __pyx_v_p, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 141, __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("fwdpy.fwdpy.SpopVec.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":149
 *         """
 *         self.__append_details__(copypops(p))
 *     cpdef size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns number of populations (size of underlying C++ vector)
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_18size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_7SpopVec_size(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("size", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7SpopVec_18size)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 149, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 149, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":153
 *         Returns number of populations (size of underlying C++ vector)
 *         """
 *         return self.pops.size()             # <<<<<<<<<<<<<<
 *     def clear(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->pops.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":149
 *         """
 *         self.__append_details__(copypops(p))
 *     cpdef size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns number of populations (size of underlying C++ vector)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopVec.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_18size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_7SpopVec_17size[] = "\n        Returns number of populations (size of underlying C++ vector)\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_18size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("size (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7SpopVec_17size(((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_7SpopVec_17size(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("size", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_7SpopVec_size(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 149, __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("fwdpy.fwdpy.SpopVec.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":154
 *         """
 *         return self.pops.size()
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """
 *         Frees the memory allocated by each simulated population.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_20clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_7SpopVec_19clear[] = "\n        Frees the memory allocated by each simulated population.\n\n        Result is an empty object.\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7SpopVec_20clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7SpopVec_19clear(((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_7SpopVec_19clear(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear", 0);

  /* "fwdpy/classes.pyx":160
 *         Result is an empty object.
 *         """
 *         self.pops.clear()             # <<<<<<<<<<<<<<
 * 
 * cdef class MlocusPopVec(PopVec):
 */
  __pyx_v_self->pops.clear();

  /* "fwdpy/classes.pyx":154
 *         """
 *         return self.pops.size()
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """
 *         Frees the memory allocated by each simulated population.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":172
 *     See :func:`evolve_regions` for use cases.
 *     """
 *     def __cinit__(self,unsigned npops,unsigned N,unsigned nloci):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor:
 */

/* Python wrapper */
static int __pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_npops;
  unsigned int __pyx_v_N;
  unsigned int __pyx_v_nloci;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_npops,&__pyx_n_s_N,&__pyx_n_s_nloci,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_npops)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_N)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(1, 172, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nloci)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(1, 172, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 172, __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_npops = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_npops == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 172, __pyx_L3_error)
    __pyx_v_N = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_N == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 172, __pyx_L3_error)
    __pyx_v_nloci = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_nloci == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 172, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 172, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.MlocusPopVec.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec___cinit__(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_self), __pyx_v_npops, __pyx_v_N, __pyx_v_nloci);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self, unsigned int __pyx_v_npops, unsigned int __pyx_v_N, unsigned int __pyx_v_nloci) {
  CYTHON_UNUSED unsigned int __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  unsigned int __pyx_t_1;
  unsigned int __pyx_t_2;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "fwdpy/classes.pyx":180
 *         :param nloci: Number of loci/regions
 *         """
 *         for i in range(npops):             # <<<<<<<<<<<<<<
 *             self.pops.push_back(shared_ptr[multilocus_t](new multilocus_t(N,nloci)))
 *     def __dealloc__(self):
 */
  __pyx_t_1 = __pyx_v_npops;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/classes.pyx":181
 *         """
 *         for i in range(npops):
 *             self.pops.push_back(shared_ptr[multilocus_t](new multilocus_t(N,nloci)))             # <<<<<<<<<<<<<<
 *     def __dealloc__(self):
 *         self.pops.clear()
 */
    try {
      __pyx_v_self->pops.push_back(std::shared_ptr<fwdpy::multilocus_t> (new fwdpy::multilocus_t(__pyx_v_N, __pyx_v_nloci)));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(1, 181, __pyx_L1_error)
    }
  }

  /* "fwdpy/classes.pyx":172
 *     See :func:`evolve_regions` for use cases.
 *     """
 *     def __cinit__(self,unsigned npops,unsigned N,unsigned nloci):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.MlocusPopVec.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":182
 *         for i in range(npops):
 *             self.pops.push_back(shared_ptr[multilocus_t](new multilocus_t(N,nloci)))
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.pops.clear()
 *     def __iter__(self):
 */

/* Python wrapper */
static void __pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_2__dealloc__(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_2__dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "fwdpy/classes.pyx":183
 *             self.pops.push_back(shared_ptr[multilocus_t](new multilocus_t(N,nloci)))
 *     def __dealloc__(self):
 *         self.pops.clear()             # <<<<<<<<<<<<<<
 *     def __iter__(self):
 *         for i in range(self.pops.size()):
 */
  __pyx_v_self->pops.clear();

  /* "fwdpy/classes.pyx":182
 *         for i in range(npops):
 *             self.pops.push_back(shared_ptr[multilocus_t](new multilocus_t(N,nloci)))
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.pops.clear()
 *     def __iter__(self):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
static PyObject *__pyx_gb_5fwdpy_5fwdpy_12MlocusPopVec_6generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "fwdpy/classes.pyx":184
 *     def __dealloc__(self):
 *         self.pops.clear()
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.pops.size()):
 *             pi = MlocusPop()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_5__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_5__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_4__iter__(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_4__iter__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ *)__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__(__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 184, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5fwdpy_5fwdpy_12MlocusPopVec_6generator1, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_MlocusPopVec___iter, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!gen)) __PYX_ERR(1, 184, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.MlocusPopVec.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5fwdpy_5fwdpy_12MlocusPopVec_6generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 184, __pyx_L1_error)

  /* "fwdpy/classes.pyx":185
 *         self.pops.clear()
 *     def __iter__(self):
 *         for i in range(self.pops.size()):             # <<<<<<<<<<<<<<
 *             pi = MlocusPop()
 *             pi.pop = self.pops[i]
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->pops.size();
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_2;

    /* "fwdpy/classes.pyx":186
 *     def __iter__(self):
 *         for i in range(self.pops.size()):
 *             pi = MlocusPop()             # <<<<<<<<<<<<<<
 *             pi.pop = self.pops[i]
 *             yield pi
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5fwdpy_5fwdpy_MlocusPop), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pi));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pi, ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/classes.pyx":187
 *         for i in range(self.pops.size()):
 *             pi = MlocusPop()
 *             pi.pop = self.pops[i]             # <<<<<<<<<<<<<<
 *             yield pi
 *     def __next__(self):
 */
    __pyx_cur_scope->__pyx_v_pi->pop = (__pyx_cur_scope->__pyx_v_self->pops[__pyx_cur_scope->__pyx_v_i]);

    /* "fwdpy/classes.pyx":188
 *             pi = MlocusPop()
 *             pi.pop = self.pops[i]
 *             yield pi             # <<<<<<<<<<<<<<
 *     def __next__(self):
 *         return next(self)
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pi));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pi);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 188, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "fwdpy/classes.pyx":184
 *     def __dealloc__(self):
 *         self.pops.clear()
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.pops.size()):
 *             pi = MlocusPop()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":189
 *             pi.pop = self.pops[i]
 *             yield pi
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __getitem__(self, int i):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_8__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_8__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_7__next__(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_7__next__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "fwdpy/classes.pyx":190
 *             yield pi
 *     def __next__(self):
 *         return next(self)             # <<<<<<<<<<<<<<
 *     def __getitem__(self, int i):
 *         pi = MlocusPop()
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyIter_Next(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":189
 *             pi.pop = self.pops[i]
 *             yield pi
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __getitem__(self, int i):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.MlocusPopVec.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":191
 *     def __next__(self):
 *         return next(self)
 *     def __getitem__(self, int i):             # <<<<<<<<<<<<<<
 *         pi = MlocusPop()
 *         pi.pop = self.pops[i]
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) {
  int __pyx_v_i;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  assert(__pyx_arg_i); {
    __pyx_v_i = __Pyx_PyInt_As_int(__pyx_arg_i); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 191, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.MlocusPopVec.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_9__getitem__(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_self), ((int)__pyx_v_i));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_9__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self, int __pyx_v_i) {
  struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_pi = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "fwdpy/classes.pyx":192
 *         return next(self)
 *     def __getitem__(self, int i):
 *         pi = MlocusPop()             # <<<<<<<<<<<<<<
 *         pi.pop = self.pops[i]
 *         return pi
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5fwdpy_5fwdpy_MlocusPop), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pi = ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/classes.pyx":193
 *     def __getitem__(self, int i):
 *         pi = MlocusPop()
 *         pi.pop = self.pops[i]             # <<<<<<<<<<<<<<
 *         return pi
 *     def __len__(self):
 */
  __pyx_v_pi->pop = (__pyx_v_self->pops[__pyx_v_i]);

  /* "fwdpy/classes.pyx":194
 *         pi = MlocusPop()
 *         pi.pop = self.pops[i]
 *         return pi             # <<<<<<<<<<<<<<
 *     def __len__(self):
 *         return self.pops.size()
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_pi));
  __pyx_r = ((PyObject *)__pyx_v_pi);
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":191
 *     def __next__(self):
 *         return next(self)
 *     def __getitem__(self, int i):             # <<<<<<<<<<<<<<
 *         pi = MlocusPop()
 *         pi.pop = self.pops[i]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.MlocusPopVec.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":195
 *         pi.pop = self.pops[i]
 *         return pi
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[multilocus_t]] & newpops):
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_12__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_12__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_11__len__(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_11__len__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "fwdpy/classes.pyx":196
 *         return pi
 *     def __len__(self):
 *         return self.pops.size()             # <<<<<<<<<<<<<<
 *     cdef reset(self,const vector[shared_ptr[multilocus_t]] & newpops):
 *         self.pops=newpops
 */
  __pyx_r = __pyx_v_self->pops.size();
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":195
 *         pi.pop = self.pops[i]
 *         return pi
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[multilocus_t]] & newpops):
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":197
 *     def __len__(self):
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[multilocus_t]] & newpops):             # <<<<<<<<<<<<<<
 *         self.pops=newpops
 *     def __append_details__(self,MlocusPopVec p):
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_12MlocusPopVec_reset(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self, std::vector<std::shared_ptr<fwdpy::multilocus_t> >  const &__pyx_v_newpops) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset", 0);

  /* "fwdpy/classes.pyx":198
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[multilocus_t]] & newpops):
 *         self.pops=newpops             # <<<<<<<<<<<<<<
 *     def __append_details__(self,MlocusPopVec p):
 *         for i in range(len(p)):
 */
  __pyx_v_self->pops = __pyx_v_newpops;

  /* "fwdpy/classes.pyx":197
 *     def __len__(self):
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[multilocus_t]] & newpops):             # <<<<<<<<<<<<<<
 *         self.pops=newpops
 *     def __append_details__(self,MlocusPopVec p):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":199
 *     cdef reset(self,const vector[shared_ptr[multilocus_t]] & newpops):
 *         self.pops=newpops
 *     def __append_details__(self,MlocusPopVec p):             # <<<<<<<<<<<<<<
 *         for i in range(len(p)):
 *             self.pops.push_back(p.pops[i])
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_14__append_details__(PyObject *__pyx_v_self, PyObject *__pyx_v_p); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_14__append_details__(PyObject *__pyx_v_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__append_details__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec, 1, "p", 0))) __PYX_ERR(1, 199, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_13__append_details__(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_self), ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_13__append_details__(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p) {
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  __Pyx_RefNannySetupContext("__append_details__", 0);

  /* "fwdpy/classes.pyx":200
 *         self.pops=newpops
 *     def __append_details__(self,MlocusPopVec p):
 *         for i in range(len(p)):             # <<<<<<<<<<<<<<
 *             self.pops.push_back(p.pops[i])
 *     cpdef append(self,MlocusPopVec p):
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_p)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(1, 200, __pyx_L1_error)
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/classes.pyx":201
 *     def __append_details__(self,MlocusPopVec p):
 *         for i in range(len(p)):
 *             self.pops.push_back(p.pops[i])             # <<<<<<<<<<<<<<
 *     cpdef append(self,MlocusPopVec p):
 *         """
 */
    try {
      __pyx_v_self->pops.push_back((__pyx_v_p->pops[__pyx_v_i]));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(1, 201, __pyx_L1_error)
    }
  }

  /* "fwdpy/classes.pyx":199
 *     cdef reset(self,const vector[shared_ptr[multilocus_t]] & newpops):
 *         self.pops=newpops
 *     def __append_details__(self,MlocusPopVec p):             # <<<<<<<<<<<<<<
 *         for i in range(len(p)):
 *             self.pops.push_back(p.pops[i])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.MlocusPopVec.__append_details__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":202
 *         for i in range(len(p)):
 *             self.pops.push_back(p.pops[i])
 *     cpdef append(self,MlocusPopVec p):             # <<<<<<<<<<<<<<
 *         """
 *         Append 'p' into this object.
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_16append(PyObject *__pyx_v_self, PyObject *__pyx_v_p); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_12MlocusPopVec_append(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("append", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_16append)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (!__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_p)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 202, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_p)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 202, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_p)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 202, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 202, __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 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_p));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 202, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":209
 *         this object and p will not share any pointers
 *         """
 *         self.__append_details__(copypops(p))             # <<<<<<<<<<<<<<
 * 
 *     cpdef size(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append_details); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_copypops); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_p)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_p)};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 209, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_p)};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 209, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 209, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_p));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, ((PyObject *)__pyx_v_p));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 209, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 209, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 209, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 209, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 209, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 209, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/classes.pyx":202
 *         for i in range(len(p)):
 *             self.pops.push_back(p.pops[i])
 *     cpdef append(self,MlocusPopVec p):             # <<<<<<<<<<<<<<
 *         """
 *         Append 'p' into this 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("fwdpy.fwdpy.MlocusPopVec.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_16append(PyObject *__pyx_v_self, PyObject *__pyx_v_p); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_12MlocusPopVec_15append[] = "\n        Append 'p' into this object.\n\n        This is done via a serialized copy, meaning that \n        this object and p will not share any pointers\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_16append(PyObject *__pyx_v_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec, 1, "p", 0))) __PYX_ERR(1, 202, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_15append(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_self), ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_15append(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("append", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_12MlocusPopVec_append(__pyx_v_self, __pyx_v_p, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 202, __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("fwdpy.fwdpy.MlocusPopVec.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":211
 *         self.__append_details__(copypops(p))
 * 
 *     cpdef size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns number of populations (size of underlying C++ vector)
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_18size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_12MlocusPopVec_size(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("size", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_18size)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 211, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 211, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":215
 *         Returns number of populations (size of underlying C++ vector)
 *         """
 *         return self.pops.size()             # <<<<<<<<<<<<<<
 *     def clear(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->pops.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":211
 *         self.__append_details__(copypops(p))
 * 
 *     cpdef size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns number of populations (size of underlying C++ vector)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.MlocusPopVec.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_18size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_12MlocusPopVec_17size[] = "\n        Returns number of populations (size of underlying C++ vector)\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_18size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("size (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_17size(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_17size(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("size", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_12MlocusPopVec_size(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 211, __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("fwdpy.fwdpy.MlocusPopVec.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":216
 *         """
 *         return self.pops.size()
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """
 *         Frees the memory allocated by each simulated population.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_20clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_12MlocusPopVec_19clear[] = "\n        Frees the memory allocated by each simulated population.\n\n        Result is an empty object.\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_20clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_19clear(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_12MlocusPopVec_19clear(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear", 0);

  /* "fwdpy/classes.pyx":222
 *         Result is an empty object.
 *         """
 *         self.pops.clear()             # <<<<<<<<<<<<<<
 * 
 * cdef class SpopGenMutVec(PopVec):
 */
  __pyx_v_self->pops.clear();

  /* "fwdpy/classes.pyx":216
 *         """
 *         return self.pops.size()
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """
 *         Frees the memory allocated by each simulated population.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":225
 * 
 * cdef class SpopGenMutVec(PopVec):
 *     def __cinit__(self,unsigned npops,unsigned N):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor:
 */

/* Python wrapper */
static int __pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_npops;
  unsigned int __pyx_v_N;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_npops,&__pyx_n_s_N,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_npops)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_N)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(1, 225, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 225, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_npops = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_npops == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 225, __pyx_L3_error)
    __pyx_v_N = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_N == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 225, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 225, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopGenMutVec.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec___cinit__(((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *)__pyx_v_self), __pyx_v_npops, __pyx_v_N);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self, unsigned int __pyx_v_npops, unsigned int __pyx_v_N) {
  CYTHON_UNUSED unsigned int __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  unsigned int __pyx_t_1;
  unsigned int __pyx_t_2;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "fwdpy/classes.pyx":232
 *         :param N: Initial population number for each population
 *         """
 *         for i in range(npops):             # <<<<<<<<<<<<<<
 *             self.pops.push_back(shared_ptr[singlepop_gm_vec_t](new singlepop_gm_vec_t(N)))
 *     def __dealloc__(self):
 */
  __pyx_t_1 = __pyx_v_npops;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/classes.pyx":233
 *         """
 *         for i in range(npops):
 *             self.pops.push_back(shared_ptr[singlepop_gm_vec_t](new singlepop_gm_vec_t(N)))             # <<<<<<<<<<<<<<
 *     def __dealloc__(self):
 *         self.pops.clear()
 */
    try {
      __pyx_v_self->pops.push_back(std::shared_ptr<fwdpy::singlepop_gm_vec_t> (new fwdpy::singlepop_gm_vec_t(__pyx_v_N)));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(1, 233, __pyx_L1_error)
    }
  }

  /* "fwdpy/classes.pyx":225
 * 
 * cdef class SpopGenMutVec(PopVec):
 *     def __cinit__(self,unsigned npops,unsigned N):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopGenMutVec.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":234
 *         for i in range(npops):
 *             self.pops.push_back(shared_ptr[singlepop_gm_vec_t](new singlepop_gm_vec_t(N)))
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.pops.clear()
 *     def __iter__(self):
 */

/* Python wrapper */
static void __pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_2__dealloc__(((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_2__dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "fwdpy/classes.pyx":235
 *             self.pops.push_back(shared_ptr[singlepop_gm_vec_t](new singlepop_gm_vec_t(N)))
 *     def __dealloc__(self):
 *         self.pops.clear()             # <<<<<<<<<<<<<<
 *     def __iter__(self):
 *         for i in range(self.pops.size()):
 */
  __pyx_v_self->pops.clear();

  /* "fwdpy/classes.pyx":234
 *         for i in range(npops):
 *             self.pops.push_back(shared_ptr[singlepop_gm_vec_t](new singlepop_gm_vec_t(N)))
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.pops.clear()
 *     def __iter__(self):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
static PyObject *__pyx_gb_5fwdpy_5fwdpy_13SpopGenMutVec_6generator2(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "fwdpy/classes.pyx":236
 *     def __dealloc__(self):
 *         self.pops.clear()
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.pops.size()):
 *             pi = SpopGenMut()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_5__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_5__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_4__iter__(((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_4__iter__(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ *)__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__(__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 236, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5fwdpy_5fwdpy_13SpopGenMutVec_6generator2, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_SpopGenMutVec___iter, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!gen)) __PYX_ERR(1, 236, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopGenMutVec.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5fwdpy_5fwdpy_13SpopGenMutVec_6generator2(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 236, __pyx_L1_error)

  /* "fwdpy/classes.pyx":237
 *         self.pops.clear()
 *     def __iter__(self):
 *         for i in range(self.pops.size()):             # <<<<<<<<<<<<<<
 *             pi = SpopGenMut()
 *             pi.pop = self.pops[i]
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->pops.size();
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_2;

    /* "fwdpy/classes.pyx":238
 *     def __iter__(self):
 *         for i in range(self.pops.size()):
 *             pi = SpopGenMut()             # <<<<<<<<<<<<<<
 *             pi.pop = self.pops[i]
 *             yield pi
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5fwdpy_5fwdpy_SpopGenMut), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pi));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pi, ((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/classes.pyx":239
 *         for i in range(self.pops.size()):
 *             pi = SpopGenMut()
 *             pi.pop = self.pops[i]             # <<<<<<<<<<<<<<
 *             yield pi
 *     def __next__(self):
 */
    __pyx_cur_scope->__pyx_v_pi->pop = (__pyx_cur_scope->__pyx_v_self->pops[__pyx_cur_scope->__pyx_v_i]);

    /* "fwdpy/classes.pyx":240
 *             pi = SpopGenMut()
 *             pi.pop = self.pops[i]
 *             yield pi             # <<<<<<<<<<<<<<
 *     def __next__(self):
 *         return next(self)
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pi));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pi);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 240, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "fwdpy/classes.pyx":236
 *     def __dealloc__(self):
 *         self.pops.clear()
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.pops.size()):
 *             pi = SpopGenMut()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":241
 *             pi.pop = self.pops[i]
 *             yield pi
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __getitem__(self, int i):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_8__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_8__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_7__next__(((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_7__next__(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "fwdpy/classes.pyx":242
 *             yield pi
 *     def __next__(self):
 *         return next(self)             # <<<<<<<<<<<<<<
 *     def __getitem__(self, int i):
 *         pi = SpopGenMut()
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyIter_Next(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":241
 *             pi.pop = self.pops[i]
 *             yield pi
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __getitem__(self, int i):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopGenMutVec.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":243
 *     def __next__(self):
 *         return next(self)
 *     def __getitem__(self, int i):             # <<<<<<<<<<<<<<
 *         pi = SpopGenMut()
 *         pi.pop = self.pops[i]
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) {
  int __pyx_v_i;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  assert(__pyx_arg_i); {
    __pyx_v_i = __Pyx_PyInt_As_int(__pyx_arg_i); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 243, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopGenMutVec.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_9__getitem__(((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *)__pyx_v_self), ((int)__pyx_v_i));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_9__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self, int __pyx_v_i) {
  struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *__pyx_v_pi = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "fwdpy/classes.pyx":244
 *         return next(self)
 *     def __getitem__(self, int i):
 *         pi = SpopGenMut()             # <<<<<<<<<<<<<<
 *         pi.pop = self.pops[i]
 *         return pi
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5fwdpy_5fwdpy_SpopGenMut), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pi = ((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/classes.pyx":245
 *     def __getitem__(self, int i):
 *         pi = SpopGenMut()
 *         pi.pop = self.pops[i]             # <<<<<<<<<<<<<<
 *         return pi
 *     def __len__(self):
 */
  __pyx_v_pi->pop = (__pyx_v_self->pops[__pyx_v_i]);

  /* "fwdpy/classes.pyx":246
 *         pi = SpopGenMut()
 *         pi.pop = self.pops[i]
 *         return pi             # <<<<<<<<<<<<<<
 *     def __len__(self):
 *         return self.pops.size()
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_pi));
  __pyx_r = ((PyObject *)__pyx_v_pi);
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":243
 *     def __next__(self):
 *         return next(self)
 *     def __getitem__(self, int i):             # <<<<<<<<<<<<<<
 *         pi = SpopGenMut()
 *         pi.pop = self.pops[i]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopGenMutVec.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":247
 *         pi.pop = self.pops[i]
 *         return pi
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[singlepop_gm_vec_t]] & newpops):
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_12__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_12__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_11__len__(((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_11__len__(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "fwdpy/classes.pyx":248
 *         return pi
 *     def __len__(self):
 *         return self.pops.size()             # <<<<<<<<<<<<<<
 *     cdef reset(self,const vector[shared_ptr[singlepop_gm_vec_t]] & newpops):
 *         self.pops=newpops
 */
  __pyx_r = __pyx_v_self->pops.size();
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":247
 *         pi.pop = self.pops[i]
 *         return pi
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[singlepop_gm_vec_t]] & newpops):
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":249
 *     def __len__(self):
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[singlepop_gm_vec_t]] & newpops):             # <<<<<<<<<<<<<<
 *         self.pops=newpops
 *     cpdef size(self):
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_13SpopGenMutVec_reset(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self, std::vector<std::shared_ptr<fwdpy::singlepop_gm_vec_t> >  const &__pyx_v_newpops) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset", 0);

  /* "fwdpy/classes.pyx":250
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[singlepop_gm_vec_t]] & newpops):
 *         self.pops=newpops             # <<<<<<<<<<<<<<
 *     cpdef size(self):
 *         """
 */
  __pyx_v_self->pops = __pyx_v_newpops;

  /* "fwdpy/classes.pyx":249
 *     def __len__(self):
 *         return self.pops.size()
 *     cdef reset(self,const vector[shared_ptr[singlepop_gm_vec_t]] & newpops):             # <<<<<<<<<<<<<<
 *         self.pops=newpops
 *     cpdef size(self):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":251
 *     cdef reset(self,const vector[shared_ptr[singlepop_gm_vec_t]] & newpops):
 *         self.pops=newpops
 *     cpdef size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns number of populations (size of underlying C++ vector)
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_14size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_13SpopGenMutVec_size(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("size", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_14size)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 251, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 251, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":257
 *         Result is an empty object.
 *         """
 *         return self.pops.size()             # <<<<<<<<<<<<<<
 *     def clear(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->pops.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":251
 *     cdef reset(self,const vector[shared_ptr[singlepop_gm_vec_t]] & newpops):
 *         self.pops=newpops
 *     cpdef size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns number of populations (size of underlying C++ vector)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.SpopGenMutVec.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_14size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_13SpopGenMutVec_13size[] = "\n        Returns number of populations (size of underlying C++ vector)\n\n        Result is an empty object.\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_14size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("size (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_13size(((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_13size(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("size", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_13SpopGenMutVec_size(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 251, __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("fwdpy.fwdpy.SpopGenMutVec.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":258
 *         """
 *         return self.pops.size()
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """
 *         Frees the memory allocated by each simulated population.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_16clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_13SpopGenMutVec_15clear[] = "\n        Frees the memory allocated by each simulated population.\n\n        Result is an empty object.\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_16clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_15clear(((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_13SpopGenMutVec_15clear(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear", 0);

  /* "fwdpy/classes.pyx":264
 *         Result is an empty object.
 *         """
 *         self.pops.clear()             # <<<<<<<<<<<<<<
 * 
 * cdef class MetaPop(PopType):
 */
  __pyx_v_self->pops.clear();

  /* "fwdpy/classes.pyx":258
 *         """
 *         return self.pops.size()
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """
 *         Frees the memory allocated by each simulated population.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":274
 *     the output of iterating through a :class:`MetaPopVec`.
 *     """
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *        self.mpop.reset()
 *     def __len__(self):
 */

/* Python wrapper */
static void __pyx_pw_5fwdpy_5fwdpy_7MetaPop_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5fwdpy_5fwdpy_7MetaPop_1__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5fwdpy_5fwdpy_7MetaPop___dealloc__(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5fwdpy_5fwdpy_7MetaPop___dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "fwdpy/classes.pyx":275
 *     """
 *     def __dealloc__(self):
 *        self.mpop.reset()             # <<<<<<<<<<<<<<
 *     def __len__(self):
 *         return self.mpop.get().size()
 */
  __pyx_v_self->mpop.reset();

  /* "fwdpy/classes.pyx":274
 *     the output of iterating through a :class:`MetaPopVec`.
 *     """
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *        self.mpop.reset()
 *     def __len__(self):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "fwdpy/classes.pyx":276
 *     def __dealloc__(self):
 *        self.mpop.reset()
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.mpop.get().size()
 *     cpdef gen(self):
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_7MetaPop_3__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_7MetaPop_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7MetaPop_2__len__(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_7MetaPop_2__len__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "fwdpy/classes.pyx":277
 *        self.mpop.reset()
 *     def __len__(self):
 *         return self.mpop.get().size()             # <<<<<<<<<<<<<<
 *     cpdef gen(self):
 *         """
 */
  __pyx_r = __pyx_v_self->mpop.get()->size();
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":276
 *     def __dealloc__(self):
 *        self.mpop.reset()
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.mpop.get().size()
 *     cpdef gen(self):
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":278
 *     def __len__(self):
 *         return self.mpop.get().size()
 *     cpdef gen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the generation that the population is currently evolved to
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_7MetaPop_5gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_7MetaPop_gen(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("gen", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_gen); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7MetaPop_5gen)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 278, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 278, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":282
 *         Returns the generation that the population is currently evolved to
 *         """
 *         return self.mpop.get().generation             # <<<<<<<<<<<<<<
 *     cpdef popsizes(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->mpop.get()->generation); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":278
 *     def __len__(self):
 *         return self.mpop.get().size()
 *     cpdef gen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the generation that the population is currently evolved to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.MetaPop.gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7MetaPop_5gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_7MetaPop_4gen[] = "\n        Returns the generation that the population is currently evolved to\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7MetaPop_5gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gen (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7MetaPop_4gen(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_7MetaPop_4gen(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("gen", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_7MetaPop_gen(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 278, __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("fwdpy.fwdpy.MetaPop.gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":283
 *         """
 *         return self.mpop.get().generation
 *     cpdef popsizes(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the size of the population
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_7MetaPop_7popsizes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_7MetaPop_popsizes(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("popsizes", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_popsizes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 283, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7MetaPop_7popsizes)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 283, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 283, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":287
 *         Returns the size of the population
 *         """
 *         return self.mpop.get().Ns             # <<<<<<<<<<<<<<
 *     cpdef sane(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_to_py_unsigned_int(__pyx_v_self->mpop.get()->Ns); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":283
 *         """
 *         return self.mpop.get().generation
 *     cpdef popsizes(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the size of the population
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.MetaPop.popsizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7MetaPop_7popsizes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_7MetaPop_6popsizes[] = "\n        Returns the size of the population\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7MetaPop_7popsizes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("popsizes (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7MetaPop_6popsizes(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_7MetaPop_6popsizes(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("popsizes", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_7MetaPop_popsizes(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 283, __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("fwdpy.fwdpy.MetaPop.popsizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":288
 *         """
 *         return self.mpop.get().Ns
 *     cpdef sane(self):             # <<<<<<<<<<<<<<
 *         """
 *         Makes sure that the population is in a sane state.
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_7MetaPop_9sane(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_7MetaPop_sane(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("sane", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_sane); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7MetaPop_9sane)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 288, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 288, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":297
 * 
 *         """
 *         return self.mpop.get().sane()             # <<<<<<<<<<<<<<
 *     cpdef from_Spop(self,Spop p):
 *          self.mpop.reset(new metapop_t(deref(p.pop.get())))
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->mpop.get()->sane()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":288
 *         """
 *         return self.mpop.get().Ns
 *     cpdef sane(self):             # <<<<<<<<<<<<<<
 *         """
 *         Makes sure that the population is in a sane state.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.MetaPop.sane", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7MetaPop_9sane(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_7MetaPop_8sane[] = "\n        Makes sure that the population is in a sane state.\n\n        Internally, this checks that pop.N == pop.diploids.size(),\n        which it should be if the C++ code behind this all is properly updating\n        the data structures!\n\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7MetaPop_9sane(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sane (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7MetaPop_8sane(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_7MetaPop_8sane(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("sane", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_7MetaPop_sane(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 288, __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("fwdpy.fwdpy.MetaPop.sane", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":298
 *         """
 *         return self.mpop.get().sane()
 *     cpdef from_Spop(self,Spop p):             # <<<<<<<<<<<<<<
 *          self.mpop.reset(new metapop_t(deref(p.pop.get())))
 * 
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_7MetaPop_11from_Spop(PyObject *__pyx_v_self, PyObject *__pyx_v_p); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_7MetaPop_from_Spop(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("from_Spop", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_from_Spop); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7MetaPop_11from_Spop)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (!__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_p)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 298, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_p)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 298, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_p)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 298, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 298, __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 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_p));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 298, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":299
 *         return self.mpop.get().sane()
 *     cpdef from_Spop(self,Spop p):
 *          self.mpop.reset(new metapop_t(deref(p.pop.get())))             # <<<<<<<<<<<<<<
 * 
 * cdef class MetaPopVec(PopVec):
 */
  __pyx_v_self->mpop.reset(new fwdpy::metapop_t((*__pyx_v_p->pop.get())));

  /* "fwdpy/classes.pyx":298
 *         """
 *         return self.mpop.get().sane()
 *     cpdef from_Spop(self,Spop p):             # <<<<<<<<<<<<<<
 *          self.mpop.reset(new metapop_t(deref(p.pop.get())))
 * 
 */

  /* 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_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.MetaPop.from_Spop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7MetaPop_11from_Spop(PyObject *__pyx_v_self, PyObject *__pyx_v_p); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7MetaPop_11from_Spop(PyObject *__pyx_v_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("from_Spop (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_Spop, 1, "p", 0))) __PYX_ERR(1, 298, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7MetaPop_10from_Spop(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_self), ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_7MetaPop_10from_Spop(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("from_Spop", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_7MetaPop_from_Spop(__pyx_v_self, __pyx_v_p, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 298, __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("fwdpy.fwdpy.MetaPop.from_Spop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":310
 * 
 *     """
 *     def __cinit__(self,unsigned nmpops,vector[unsigned] Ns):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor:
 */

/* Python wrapper */
static int __pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_nmpops;
  std::vector<unsigned int>  __pyx_v_Ns;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nmpops,&__pyx_n_s_Ns,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nmpops)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Ns)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(1, 310, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 310, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_nmpops = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_nmpops == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 310, __pyx_L3_error)
    __pyx_v_Ns = __pyx_convert_vector_from_py_unsigned_int(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 310, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 310, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.MetaPopVec.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec___cinit__(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_self), __pyx_v_nmpops, __pyx_v_Ns);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self, unsigned int __pyx_v_nmpops, std::vector<unsigned int>  __pyx_v_Ns) {
  Py_ssize_t __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  unsigned int __pyx_t_5;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "fwdpy/classes.pyx":317
 *         :param Ns: A list of population sizes.  The length of this list is the number of demes in each metapopulation
 *         """
 *         for i in range(len(Ns)):             # <<<<<<<<<<<<<<
 *             if Ns[i] < 0:
 *                 raise ValueError("MetaPopVec: deme size < 0 encountered")
 */
  __pyx_t_1 = __pyx_convert_vector_to_py_unsigned_int(__pyx_v_Ns); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(1, 317, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "fwdpy/classes.pyx":318
 *         """
 *         for i in range(len(Ns)):
 *             if Ns[i] < 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError("MetaPopVec: deme size < 0 encountered")
 *         for i in range(nmpops):
 */
    __pyx_t_4 = (((__pyx_v_Ns[__pyx_v_i]) < 0) != 0);
    if (__pyx_t_4) {

      /* "fwdpy/classes.pyx":319
 *         for i in range(len(Ns)):
 *             if Ns[i] < 0:
 *                 raise ValueError("MetaPopVec: deme size < 0 encountered")             # <<<<<<<<<<<<<<
 *         for i in range(nmpops):
 *             self.mpops.push_back(shared_ptr[metapop_t](new metapop_t(Ns)))
 */
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(1, 319, __pyx_L1_error)

      /* "fwdpy/classes.pyx":318
 *         """
 *         for i in range(len(Ns)):
 *             if Ns[i] < 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError("MetaPopVec: deme size < 0 encountered")
 *         for i in range(nmpops):
 */
    }
  }

  /* "fwdpy/classes.pyx":320
 *             if Ns[i] < 0:
 *                 raise ValueError("MetaPopVec: deme size < 0 encountered")
 *         for i in range(nmpops):             # <<<<<<<<<<<<<<
 *             self.mpops.push_back(shared_ptr[metapop_t](new metapop_t(Ns)))
 *     def __dealloc__(self):
 */
  __pyx_t_5 = __pyx_v_nmpops;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_5; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/classes.pyx":321
 *                 raise ValueError("MetaPopVec: deme size < 0 encountered")
 *         for i in range(nmpops):
 *             self.mpops.push_back(shared_ptr[metapop_t](new metapop_t(Ns)))             # <<<<<<<<<<<<<<
 *     def __dealloc__(self):
 *         self.mpops.clear()
 */
    try {
      __pyx_v_self->mpops.push_back(std::shared_ptr<fwdpy::metapop_t> (new fwdpy::metapop_t(__pyx_v_Ns)));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(1, 321, __pyx_L1_error)
    }
  }

  /* "fwdpy/classes.pyx":310
 * 
 *     """
 *     def __cinit__(self,unsigned nmpops,vector[unsigned] Ns):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.MetaPopVec.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":322
 *         for i in range(nmpops):
 *             self.mpops.push_back(shared_ptr[metapop_t](new metapop_t(Ns)))
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.mpops.clear()
 *     def __iter__(self):
 */

/* Python wrapper */
static void __pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_2__dealloc__(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_2__dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "fwdpy/classes.pyx":323
 *             self.mpops.push_back(shared_ptr[metapop_t](new metapop_t(Ns)))
 *     def __dealloc__(self):
 *         self.mpops.clear()             # <<<<<<<<<<<<<<
 *     def __iter__(self):
 *         for i in range(self.mpops.size()):
 */
  __pyx_v_self->mpops.clear();

  /* "fwdpy/classes.pyx":322
 *         for i in range(nmpops):
 *             self.mpops.push_back(shared_ptr[metapop_t](new metapop_t(Ns)))
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.mpops.clear()
 *     def __iter__(self):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
static PyObject *__pyx_gb_5fwdpy_5fwdpy_10MetaPopVec_6generator3(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "fwdpy/classes.pyx":324
 *     def __dealloc__(self):
 *         self.mpops.clear()
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.mpops.size()):
 *             pi = MetaPop()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_5__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_5__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_4__iter__(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_4__iter__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ *)__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__(__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(1, 324, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5fwdpy_5fwdpy_10MetaPopVec_6generator3, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_MetaPopVec___iter, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!gen)) __PYX_ERR(1, 324, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.MetaPopVec.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5fwdpy_5fwdpy_10MetaPopVec_6generator3(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 324, __pyx_L1_error)

  /* "fwdpy/classes.pyx":325
 *         self.mpops.clear()
 *     def __iter__(self):
 *         for i in range(self.mpops.size()):             # <<<<<<<<<<<<<<
 *             pi = MetaPop()
 *             pi.mpop = self.mpops[i]
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->mpops.size();
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_2;

    /* "fwdpy/classes.pyx":326
 *     def __iter__(self):
 *         for i in range(self.mpops.size()):
 *             pi = MetaPop()             # <<<<<<<<<<<<<<
 *             pi.mpop = self.mpops[i]
 *             yield pi
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5fwdpy_5fwdpy_MetaPop), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_pi));
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pi, ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/classes.pyx":327
 *         for i in range(self.mpops.size()):
 *             pi = MetaPop()
 *             pi.mpop = self.mpops[i]             # <<<<<<<<<<<<<<
 *             yield pi
 *     def __next__(self):
 */
    __pyx_cur_scope->__pyx_v_pi->mpop = (__pyx_cur_scope->__pyx_v_self->mpops[__pyx_cur_scope->__pyx_v_i]);

    /* "fwdpy/classes.pyx":328
 *             pi = MetaPop()
 *             pi.mpop = self.mpops[i]
 *             yield pi             # <<<<<<<<<<<<<<
 *     def __next__(self):
 *         return next(self)
 */
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_pi));
    __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_pi);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(1, 328, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "fwdpy/classes.pyx":324
 *     def __dealloc__(self):
 *         self.mpops.clear()
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.mpops.size()):
 *             pi = MetaPop()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":329
 *             pi.mpop = self.mpops[i]
 *             yield pi
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __getitem__(self, int i):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_8__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_8__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_7__next__(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_7__next__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "fwdpy/classes.pyx":330
 *             yield pi
 *     def __next__(self):
 *         return next(self)             # <<<<<<<<<<<<<<
 *     def __getitem__(self, int i):
 *         pi = MetaPop()
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyIter_Next(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":329
 *             pi.mpop = self.mpops[i]
 *             yield pi
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __getitem__(self, int i):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.MetaPopVec.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":331
 *     def __next__(self):
 *         return next(self)
 *     def __getitem__(self, int i):             # <<<<<<<<<<<<<<
 *         pi = MetaPop()
 *         pi.mpop = self.mpops[i]
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) {
  int __pyx_v_i;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  assert(__pyx_arg_i); {
    __pyx_v_i = __Pyx_PyInt_As_int(__pyx_arg_i); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 331, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.MetaPopVec.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_9__getitem__(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_self), ((int)__pyx_v_i));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_9__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self, int __pyx_v_i) {
  struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_pi = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "fwdpy/classes.pyx":332
 *         return next(self)
 *     def __getitem__(self, int i):
 *         pi = MetaPop()             # <<<<<<<<<<<<<<
 *         pi.mpop = self.mpops[i]
 *         return pi
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5fwdpy_5fwdpy_MetaPop), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pi = ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/classes.pyx":333
 *     def __getitem__(self, int i):
 *         pi = MetaPop()
 *         pi.mpop = self.mpops[i]             # <<<<<<<<<<<<<<
 *         return pi
 *     def __len__(self):
 */
  __pyx_v_pi->mpop = (__pyx_v_self->mpops[__pyx_v_i]);

  /* "fwdpy/classes.pyx":334
 *         pi = MetaPop()
 *         pi.mpop = self.mpops[i]
 *         return pi             # <<<<<<<<<<<<<<
 *     def __len__(self):
 *         return self.mpops.size()
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_pi));
  __pyx_r = ((PyObject *)__pyx_v_pi);
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":331
 *     def __next__(self):
 *         return next(self)
 *     def __getitem__(self, int i):             # <<<<<<<<<<<<<<
 *         pi = MetaPop()
 *         pi.mpop = self.mpops[i]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.MetaPopVec.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":335
 *         pi.mpop = self.mpops[i]
 *         return pi
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.mpops.size()
 *     cpdef size(self):
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_12__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_12__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_11__len__(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_11__len__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "fwdpy/classes.pyx":336
 *         return pi
 *     def __len__(self):
 *         return self.mpops.size()             # <<<<<<<<<<<<<<
 *     cpdef size(self):
 *         """
 */
  __pyx_r = __pyx_v_self->mpops.size();
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":335
 *         pi.mpop = self.mpops[i]
 *         return pi
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.mpops.size()
 *     cpdef size(self):
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":337
 *     def __len__(self):
 *         return self.mpops.size()
 *     cpdef size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns number of populations (size of underlying C++ vector)
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_14size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_10MetaPopVec_size(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self, int __pyx_skip_dispatch) {
  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;
  __Pyx_RefNannySetupContext("size", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_14size)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 337, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 337, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":341
 *         Returns number of populations (size of underlying C++ vector)
 *         """
 *         return self.mpops.size()             # <<<<<<<<<<<<<<
 *     cdef reset(self,const vector[shared_ptr[metapop_t]] & mpops):
 *         self.mpops = mpops
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->mpops.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/classes.pyx":337
 *     def __len__(self):
 *         return self.mpops.size()
 *     cpdef size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns number of populations (size of underlying C++ vector)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.MetaPopVec.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_14size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_10MetaPopVec_13size[] = "\n        Returns number of populations (size of underlying C++ vector)\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_14size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("size (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_13size(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_13size(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("size", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_10MetaPopVec_size(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 337, __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("fwdpy.fwdpy.MetaPopVec.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":342
 *         """
 *         return self.mpops.size()
 *     cdef reset(self,const vector[shared_ptr[metapop_t]] & mpops):             # <<<<<<<<<<<<<<
 *         self.mpops = mpops
 *     def __append_details__(self,MetaPopVec p):
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_10MetaPopVec_reset(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self, std::vector<std::shared_ptr<fwdpy::metapop_t> >  const &__pyx_v_mpops) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reset", 0);

  /* "fwdpy/classes.pyx":343
 *         return self.mpops.size()
 *     cdef reset(self,const vector[shared_ptr[metapop_t]] & mpops):
 *         self.mpops = mpops             # <<<<<<<<<<<<<<
 *     def __append_details__(self,MetaPopVec p):
 *         for i in range(len(p)):
 */
  __pyx_v_self->mpops = __pyx_v_mpops;

  /* "fwdpy/classes.pyx":342
 *         """
 *         return self.mpops.size()
 *     cdef reset(self,const vector[shared_ptr[metapop_t]] & mpops):             # <<<<<<<<<<<<<<
 *         self.mpops = mpops
 *     def __append_details__(self,MetaPopVec p):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":344
 *     cdef reset(self,const vector[shared_ptr[metapop_t]] & mpops):
 *         self.mpops = mpops
 *     def __append_details__(self,MetaPopVec p):             # <<<<<<<<<<<<<<
 *         for i in range(len(p)):
 *             self.mpops.push_back(p.mpops[i])
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_16__append_details__(PyObject *__pyx_v_self, PyObject *__pyx_v_p); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_16__append_details__(PyObject *__pyx_v_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__append_details__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MetaPopVec, 1, "p", 0))) __PYX_ERR(1, 344, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_15__append_details__(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_self), ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_15__append_details__(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_p) {
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  __Pyx_RefNannySetupContext("__append_details__", 0);

  /* "fwdpy/classes.pyx":345
 *         self.mpops = mpops
 *     def __append_details__(self,MetaPopVec p):
 *         for i in range(len(p)):             # <<<<<<<<<<<<<<
 *             self.mpops.push_back(p.mpops[i])
 *     cpdef append(self,MetaPopVec p):
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_p)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(1, 345, __pyx_L1_error)
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/classes.pyx":346
 *     def __append_details__(self,MetaPopVec p):
 *         for i in range(len(p)):
 *             self.mpops.push_back(p.mpops[i])             # <<<<<<<<<<<<<<
 *     cpdef append(self,MetaPopVec p):
 *         """
 */
    try {
      __pyx_v_self->mpops.push_back((__pyx_v_p->mpops[__pyx_v_i]));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(1, 346, __pyx_L1_error)
    }
  }

  /* "fwdpy/classes.pyx":344
 *     cdef reset(self,const vector[shared_ptr[metapop_t]] & mpops):
 *         self.mpops = mpops
 *     def __append_details__(self,MetaPopVec p):             # <<<<<<<<<<<<<<
 *         for i in range(len(p)):
 *             self.mpops.push_back(p.mpops[i])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.MetaPopVec.__append_details__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":347
 *         for i in range(len(p)):
 *             self.mpops.push_back(p.mpops[i])
 *     cpdef append(self,MetaPopVec p):             # <<<<<<<<<<<<<<
 *         """
 *         Append 'p' into this object.
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_18append(PyObject *__pyx_v_self, PyObject *__pyx_v_p); /*proto*/
static PyObject *__pyx_f_5fwdpy_5fwdpy_10MetaPopVec_append(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_p, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("append", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_18append)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (!__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_p)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 347, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_p)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 347, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_p)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 347, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 347, __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 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_p));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_p));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 347, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/classes.pyx":354
 *         this object and p will not share any pointers
 *         """
 *         self.__append_details__(copypops(p))             # <<<<<<<<<<<<<<
 *     def clear(self):
 *         """
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_append_details); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_copypops); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_p)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_p)};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 354, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_p)};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 354, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 354, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_p));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, ((PyObject *)__pyx_v_p));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 354, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 354, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 354, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 354, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 354, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 354, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/classes.pyx":347
 *         for i in range(len(p)):
 *             self.mpops.push_back(p.mpops[i])
 *     cpdef append(self,MetaPopVec p):             # <<<<<<<<<<<<<<
 *         """
 *         Append 'p' into this 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("fwdpy.fwdpy.MetaPopVec.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_18append(PyObject *__pyx_v_self, PyObject *__pyx_v_p); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_10MetaPopVec_17append[] = "\n        Append 'p' into this object.\n\n        This is done via a serialized copy, meaning that \n        this object and p will not share any pointers\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_18append(PyObject *__pyx_v_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MetaPopVec, 1, "p", 0))) __PYX_ERR(1, 347, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_17append(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_self), ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_17append(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("append", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5fwdpy_5fwdpy_10MetaPopVec_append(__pyx_v_self, __pyx_v_p, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 347, __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("fwdpy.fwdpy.MetaPopVec.append", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":355
 *         """
 *         self.__append_details__(copypops(p))
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """
 *         Frees the memory allocated by each simulated population.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_20clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_10MetaPopVec_19clear[] = "\n        Frees the memory allocated by each simulated population.\n\n        Result is an empty object.\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_20clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_19clear(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_10MetaPopVec_19clear(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear", 0);

  /* "fwdpy/classes.pyx":361
 *         Result is an empty object.
 *         """
 *         self.mpops.clear()             # <<<<<<<<<<<<<<
 * 
 * cdef class GSLrng:
 */
  __pyx_v_self->mpops.clear();

  /* "fwdpy/classes.pyx":355
 *         """
 *         self.__append_details__(copypops(p))
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """
 *         Frees the memory allocated by each simulated population.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":375
 *     >>> rng = fwdpy.GSLrng(100)
 *     """
 *     def __cinit__(self, int seed):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor:
 */

/* Python wrapper */
static int __pyx_pw_5fwdpy_5fwdpy_6GSLrng_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5fwdpy_5fwdpy_6GSLrng_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_seed;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_seed,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_seed)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 375, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_seed = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_seed == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 375, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 375, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.GSLrng.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_6GSLrng___cinit__(((struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *)__pyx_v_self), __pyx_v_seed);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5fwdpy_5fwdpy_6GSLrng___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_self, int __pyx_v_seed) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "fwdpy/classes.pyx":381
 *         :param seed: The seed for the RNG
 *         """
 *         self.thisptr = new GSLrng_t(seed)             # <<<<<<<<<<<<<<
 *     def __dealloc__(self):
 *         del self.thisptr
 */
  __pyx_v_self->thisptr = new fwdpy::GSLrng_t(__pyx_v_seed);

  /* "fwdpy/classes.pyx":375
 *     >>> rng = fwdpy.GSLrng(100)
 *     """
 *     def __cinit__(self, int seed):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor:
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/classes.pyx":382
 *         """
 *         self.thisptr = new GSLrng_t(seed)
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         del self.thisptr
 */

/* Python wrapper */
static void __pyx_pw_5fwdpy_5fwdpy_6GSLrng_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5fwdpy_5fwdpy_6GSLrng_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5fwdpy_5fwdpy_6GSLrng_2__dealloc__(((struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5fwdpy_5fwdpy_6GSLrng_2__dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "fwdpy/classes.pyx":383
 *         self.thisptr = new GSLrng_t(seed)
 *     def __dealloc__(self):
 *         del self.thisptr             # <<<<<<<<<<<<<<
 */
  delete __pyx_v_self->thisptr;

  /* "fwdpy/classes.pyx":382
 *         """
 *         self.thisptr = new GSLrng_t(seed)
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         del self.thisptr
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "fwdpy/sampling.pyx":6
 * import pandas as pd
 * 
 * def ms_sample(GSLrng rng, PopType pop, int nsam, bint removeFixed = True):             # <<<<<<<<<<<<<<
 *     """
 *     Take a sample from a set of simulated populations.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_1ms_sample(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_ms_sample[] = "\n    Take a sample from a set of simulated populations.\n\n    :param rng: a :class:`GSLrng`\n    :param pops: An object inheriting from :class:`PopType`\n    :param nsam: List of sample sizes (no. chromosomes) to sample.\n    :param removeFixed: if True, only polymorphic sites are retained\n\n    Note: nsam will likely be changed to a list soon, to accomodate multi-deme simulations\n\n    Example:\n\n    >>> import fwdpy,array\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes=array.array('I',[1000]*1000)\n    >>> pop = fwdpy.evolve_regions(rng,3,1000,popsizes[0:],0.001,0,0.001,[fwdpy.Region(0,1,1)],[],[fwdpy.Region(0,1,1)])\n    >>> s = [fwdpy.ms_sample(rng,i,10) for i in pop]\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_1ms_sample = {"ms_sample", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_1ms_sample, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_ms_sample};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_1ms_sample(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng = 0;
  struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_pop = 0;
  int __pyx_v_nsam;
  int __pyx_v_removeFixed;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ms_sample (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rng,&__pyx_n_s_pop,&__pyx_n_s_nsam,&__pyx_n_s_removeFixed,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rng)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pop)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ms_sample", 0, 3, 4, 1); __PYX_ERR(2, 6, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nsam)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ms_sample", 0, 3, 4, 2); __PYX_ERR(2, 6, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_removeFixed);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ms_sample") < 0)) __PYX_ERR(2, 6, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_rng = ((struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *)values[0]);
    __pyx_v_pop = ((struct __pyx_obj_5fwdpy_5fwdpy_PopType *)values[1]);
    __pyx_v_nsam = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nsam == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 6, __pyx_L3_error)
    if (values[3]) {
      __pyx_v_removeFixed = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_removeFixed == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 6, __pyx_L3_error)
    } else {
      __pyx_v_removeFixed = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ms_sample", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 6, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.ms_sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rng), __pyx_ptype_5fwdpy_5fwdpy_GSLrng, 1, "rng", 0))) __PYX_ERR(2, 6, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_PopType, 1, "pop", 0))) __PYX_ERR(2, 6, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_ms_sample(__pyx_self, __pyx_v_rng, __pyx_v_pop, __pyx_v_nsam, __pyx_v_removeFixed);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_ms_sample(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng, struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_pop, int __pyx_v_nsam, int __pyx_v_removeFixed) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  KTfwd::sample_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("ms_sample", 0);

  /* "fwdpy/sampling.pyx":25
 *     >>> s = [fwdpy.ms_sample(rng,i,10) for i in pop]
 *     """
 *     if isinstance(pop,Spop):             # <<<<<<<<<<<<<<
 *         return sample_single[singlepop_t](rng.thisptr.get(),deref((<Spop>pop).pop.get()),nsam, int(removeFixed))
 *     else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_Spop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/sampling.pyx":26
 *     """
 *     if isinstance(pop,Spop):
 *         return sample_single[singlepop_t](rng.thisptr.get(),deref((<Spop>pop).pop.get()),nsam, int(removeFixed))             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError("ms_sample: unsupported type of popcontainer")
 */
    __Pyx_XDECREF(__pyx_r);
    try {
      __pyx_t_3 = fwdpy::sample_single<fwdpy::singlepop_t>(__pyx_v_rng->thisptr->get(), (*((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_pop)->pop.get()), __pyx_v_nsam, ((bool)__pyx_v_removeFixed));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(2, 26, __pyx_L1_error)
    }
    __pyx_t_4 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 26, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "fwdpy/sampling.pyx":25
 *     >>> s = [fwdpy.ms_sample(rng,i,10) for i in pop]
 *     """
 *     if isinstance(pop,Spop):             # <<<<<<<<<<<<<<
 *         return sample_single[singlepop_t](rng.thisptr.get(),deref((<Spop>pop).pop.get()),nsam, int(removeFixed))
 *     else:
 */
  }

  /* "fwdpy/sampling.pyx":28
 *         return sample_single[singlepop_t](rng.thisptr.get(),deref((<Spop>pop).pop.get()),nsam, int(removeFixed))
 *     else:
 *         raise ValueError("ms_sample: unsupported type of popcontainer")             # <<<<<<<<<<<<<<
 * 
 * def get_samples(GSLrng rng, PopType pop, int nsam, bint removeFixed = True, deme = None, locusBoundaries = None):
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 28, __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(2, 28, __pyx_L1_error)
  }

  /* "fwdpy/sampling.pyx":6
 * import pandas as pd
 * 
 * def ms_sample(GSLrng rng, PopType pop, int nsam, bint removeFixed = True):             # <<<<<<<<<<<<<<
 *     """
 *     Take a sample from a set of simulated populations.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.ms_sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/sampling.pyx":30
 *         raise ValueError("ms_sample: unsupported type of popcontainer")
 * 
 * def get_samples(GSLrng rng, PopType pop, int nsam, bint removeFixed = True, deme = None, locusBoundaries = None):             # <<<<<<<<<<<<<<
 *     """
 *     Take a sample from a set of simulated populations.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_3get_samples(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_2get_samples[] = "\n    Take a sample from a set of simulated populations.\n\n    :param rng: a :class:`GSLrng`\n    :param pop: An object inheriting from :class:`PopType`\n    :param nsam: The sample size to take.\n    :param removeFixed: if True, only polymorphic sites are retained\n    :param deme: Optional.  If 'pop' is a :class:`MetaPop`, deme is required and represents the sub-population to sample.\n\n    :return: A list. Element 0 is neutral mutations, and element 1 is selected mutations.  Within each list is a tuple of size 2.  The first element is the mutation position.  The second element is the genotype for each of the 'nsam' chromosomes.  Genotypes are coded as 0 = the ancestral state and 1 = the derived state.  For each site, each pair of genotypes constitutes a single diploid.  In other words, for nsam = 50, the data will represent the complete haplotypes of 25 diploids.\n\n    :raise: IndexError if 'deme' is out of range and pop is a :class:`fwdpy.fwdpy.MetaPop`\n\n    Please note that if you desire an odd 'nsam', you should input nsam+2 and randomly remove one haplotype to obtain your desired sample size.  This is due to an issue with how we are sampling chromosomes from the population.\n\n    Example:\n\n    >>> import fwdpy,array\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes=array.array('I',[1000]*1000)\n    >>> pop = fwdpy.evolve_regions(rng,3,1000,popsizes[0:],0.001,0,0.001,[fwdpy.Region(0,1,1)],[],[fwdpy.Region(0,1,1)])\n    >>> s = [fwdpy.get_samples(rng,i,10) for i in pop]\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_3get_samples = {"get_samples", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_3get_samples, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_2get_samples};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_3get_samples(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng = 0;
  struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_pop = 0;
  int __pyx_v_nsam;
  int __pyx_v_removeFixed;
  PyObject *__pyx_v_deme = 0;
  PyObject *__pyx_v_locusBoundaries = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_samples (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rng,&__pyx_n_s_pop,&__pyx_n_s_nsam,&__pyx_n_s_removeFixed,&__pyx_n_s_deme,&__pyx_n_s_locusBoundaries,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rng)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pop)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_samples", 0, 3, 6, 1); __PYX_ERR(2, 30, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nsam)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_samples", 0, 3, 6, 2); __PYX_ERR(2, 30, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_removeFixed);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_deme);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_locusBoundaries);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_samples") < 0)) __PYX_ERR(2, 30, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rng = ((struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *)values[0]);
    __pyx_v_pop = ((struct __pyx_obj_5fwdpy_5fwdpy_PopType *)values[1]);
    __pyx_v_nsam = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nsam == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 30, __pyx_L3_error)
    if (values[3]) {
      __pyx_v_removeFixed = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_removeFixed == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 30, __pyx_L3_error)
    } else {
      __pyx_v_removeFixed = ((int)1);
    }
    __pyx_v_deme = values[4];
    __pyx_v_locusBoundaries = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_samples", 0, 3, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 30, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.get_samples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rng), __pyx_ptype_5fwdpy_5fwdpy_GSLrng, 1, "rng", 0))) __PYX_ERR(2, 30, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_PopType, 1, "pop", 0))) __PYX_ERR(2, 30, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_2get_samples(__pyx_self, __pyx_v_rng, __pyx_v_pop, __pyx_v_nsam, __pyx_v_removeFixed, __pyx_v_deme, __pyx_v_locusBoundaries);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_2get_samples(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng, struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_pop, int __pyx_v_nsam, int __pyx_v_removeFixed, PyObject *__pyx_v_deme, PyObject *__pyx_v_locusBoundaries) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  KTfwd::sep_sample_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  unsigned int __pyx_t_8;
  KTfwd::sep_sample_t __pyx_t_9;
  std::vector<std::pair<double,double> >  __pyx_t_10;
  std::vector<KTfwd::sep_sample_t>  __pyx_t_11;
  __Pyx_RefNannySetupContext("get_samples", 0);

  /* "fwdpy/sampling.pyx":54
 *     >>> s = [fwdpy.get_samples(rng,i,10) for i in pop]
 *     """
 *     if isinstance(pop,Spop):             # <<<<<<<<<<<<<<
 *         return sample_sep_single[singlepop_t](rng.thisptr.get(),deref((<Spop>pop).pop.get()),nsam, int(removeFixed))
 *     elif isinstance(pop,MetaPop):
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_Spop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/sampling.pyx":55
 *     """
 *     if isinstance(pop,Spop):
 *         return sample_sep_single[singlepop_t](rng.thisptr.get(),deref((<Spop>pop).pop.get()),nsam, int(removeFixed))             # <<<<<<<<<<<<<<
 *     elif isinstance(pop,MetaPop):
 *         if deme is None:
 */
    __Pyx_XDECREF(__pyx_r);
    try {
      __pyx_t_3 = fwdpy::sample_sep_single<fwdpy::singlepop_t>(__pyx_v_rng->thisptr->get(), (*((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_pop)->pop.get()), __pyx_v_nsam, ((bool)__pyx_v_removeFixed));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(2, 55, __pyx_L1_error)
    }
    __pyx_t_4 = __pyx_convert_pair_to_py_KTfwd_3a__3a_sample_t____KTfwd_3a__3a_sample_t(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "fwdpy/sampling.pyx":54
 *     >>> s = [fwdpy.get_samples(rng,i,10) for i in pop]
 *     """
 *     if isinstance(pop,Spop):             # <<<<<<<<<<<<<<
 *         return sample_sep_single[singlepop_t](rng.thisptr.get(),deref((<Spop>pop).pop.get()),nsam, int(removeFixed))
 *     elif isinstance(pop,MetaPop):
 */
  }

  /* "fwdpy/sampling.pyx":56
 *     if isinstance(pop,Spop):
 *         return sample_sep_single[singlepop_t](rng.thisptr.get(),deref((<Spop>pop).pop.get()),nsam, int(removeFixed))
 *     elif isinstance(pop,MetaPop):             # <<<<<<<<<<<<<<
 *         if deme is None:
 *             raise RuntimeError("deme may not be set to None when sampling from a meta-population")
 */
  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_MetaPop); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/sampling.pyx":57
 *         return sample_sep_single[singlepop_t](rng.thisptr.get(),deref((<Spop>pop).pop.get()),nsam, int(removeFixed))
 *     elif isinstance(pop,MetaPop):
 *         if deme is None:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("deme may not be set to None when sampling from a meta-population")
 *         if deme >= len(pop):
 */
    __pyx_t_1 = (__pyx_v_deme == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "fwdpy/sampling.pyx":58
 *     elif isinstance(pop,MetaPop):
 *         if deme is None:
 *             raise RuntimeError("deme may not be set to None when sampling from a meta-population")             # <<<<<<<<<<<<<<
 *         if deme >= len(pop):
 *             raise RuntimeError("value for deme out of range. len(pop) = "+str(len(pop))+", but deme = "+str(deme))
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 58, __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(2, 58, __pyx_L1_error)

      /* "fwdpy/sampling.pyx":57
 *         return sample_sep_single[singlepop_t](rng.thisptr.get(),deref((<Spop>pop).pop.get()),nsam, int(removeFixed))
 *     elif isinstance(pop,MetaPop):
 *         if deme is None:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("deme may not be set to None when sampling from a meta-population")
 *         if deme >= len(pop):
 */
    }

    /* "fwdpy/sampling.pyx":59
 *         if deme is None:
 *             raise RuntimeError("deme may not be set to None when sampling from a meta-population")
 *         if deme >= len(pop):             # <<<<<<<<<<<<<<
 *             raise RuntimeError("value for deme out of range. len(pop) = "+str(len(pop))+", but deme = "+str(deme))
 *         return sample_separate[metapop_t](rng.thisptr.get(),deref((<MetaPop>pop).mpop.get()),deme,nsam,removeFixed)
 */
    __pyx_t_5 = PyObject_Length(((PyObject *)__pyx_v_pop)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(2, 59, __pyx_L1_error)
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_deme, __pyx_t_4, Py_GE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 59, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 59, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_2) {

      /* "fwdpy/sampling.pyx":60
 *             raise RuntimeError("deme may not be set to None when sampling from a meta-population")
 *         if deme >= len(pop):
 *             raise RuntimeError("value for deme out of range. len(pop) = "+str(len(pop))+", but deme = "+str(deme))             # <<<<<<<<<<<<<<
 *         return sample_separate[metapop_t](rng.thisptr.get(),deref((<MetaPop>pop).mpop.get()),deme,nsam,removeFixed)
 *     elif isinstance(pop,MlocusPop):
 */
      __pyx_t_5 = PyObject_Length(((PyObject *)__pyx_v_pop)); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(2, 60, __pyx_L1_error)
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Add(__pyx_kp_s_value_for_deme_out_of_range_len, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_Add(__pyx_t_4, __pyx_kp_s_but_deme); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_deme);
      __Pyx_GIVEREF(__pyx_v_deme);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_deme);
      __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Add(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(2, 60, __pyx_L1_error)

      /* "fwdpy/sampling.pyx":59
 *         if deme is None:
 *             raise RuntimeError("deme may not be set to None when sampling from a meta-population")
 *         if deme >= len(pop):             # <<<<<<<<<<<<<<
 *             raise RuntimeError("value for deme out of range. len(pop) = "+str(len(pop))+", but deme = "+str(deme))
 *         return sample_separate[metapop_t](rng.thisptr.get(),deref((<MetaPop>pop).mpop.get()),deme,nsam,removeFixed)
 */
    }

    /* "fwdpy/sampling.pyx":61
 *         if deme >= len(pop):
 *             raise RuntimeError("value for deme out of range. len(pop) = "+str(len(pop))+", but deme = "+str(deme))
 *         return sample_separate[metapop_t](rng.thisptr.get(),deref((<MetaPop>pop).mpop.get()),deme,nsam,removeFixed)             # <<<<<<<<<<<<<<
 *     elif isinstance(pop,MlocusPop):
 *         return sample_sep_single_mloc[multilocus_t](rng.thisptr.get(),deref((<MlocusPop>pop).pop.get()),nsam,removeFixed,locusBoundaries)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = __Pyx_PyInt_As_unsigned_int(__pyx_v_deme); if (unlikely((__pyx_t_8 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(2, 61, __pyx_L1_error)
    try {
      __pyx_t_9 = KTfwd::sample_separate<fwdpy::metapop_t>(__pyx_v_rng->thisptr->get(), (*((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_pop)->mpop.get()), __pyx_t_8, __pyx_v_nsam, __pyx_v_removeFixed);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(2, 61, __pyx_L1_error)
    }
    __pyx_t_4 = __pyx_convert_pair_to_py_KTfwd_3a__3a_sample_t____KTfwd_3a__3a_sample_t(__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "fwdpy/sampling.pyx":56
 *     if isinstance(pop,Spop):
 *         return sample_sep_single[singlepop_t](rng.thisptr.get(),deref((<Spop>pop).pop.get()),nsam, int(removeFixed))
 *     elif isinstance(pop,MetaPop):             # <<<<<<<<<<<<<<
 *         if deme is None:
 *             raise RuntimeError("deme may not be set to None when sampling from a meta-population")
 */
  }

  /* "fwdpy/sampling.pyx":62
 *             raise RuntimeError("value for deme out of range. len(pop) = "+str(len(pop))+", but deme = "+str(deme))
 *         return sample_separate[metapop_t](rng.thisptr.get(),deref((<MetaPop>pop).mpop.get()),deme,nsam,removeFixed)
 *     elif isinstance(pop,MlocusPop):             # <<<<<<<<<<<<<<
 *         return sample_sep_single_mloc[multilocus_t](rng.thisptr.get(),deref((<MlocusPop>pop).pop.get()),nsam,removeFixed,locusBoundaries)
 *     else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_MlocusPop); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/sampling.pyx":63
 *         return sample_separate[metapop_t](rng.thisptr.get(),deref((<MetaPop>pop).mpop.get()),deme,nsam,removeFixed)
 *     elif isinstance(pop,MlocusPop):
 *         return sample_sep_single_mloc[multilocus_t](rng.thisptr.get(),deref((<MlocusPop>pop).pop.get()),nsam,removeFixed,locusBoundaries)             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError("ms_sample: unsupported type of popcontainer")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_10 = __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_double_3e___(__pyx_v_locusBoundaries); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 63, __pyx_L1_error)
    try {
      __pyx_t_11 = fwdpy::sample_sep_single_mloc<fwdpy::multilocus_t>(__pyx_v_rng->thisptr->get(), (*((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_pop)->pop.get()), __pyx_v_nsam, __pyx_v_removeFixed, __pyx_t_10);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(2, 63, __pyx_L1_error)
    }
    __pyx_t_4 = __pyx_convert_vector_to_py_KTfwd_3a__3a_sep_sample_t(__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "fwdpy/sampling.pyx":62
 *             raise RuntimeError("value for deme out of range. len(pop) = "+str(len(pop))+", but deme = "+str(deme))
 *         return sample_separate[metapop_t](rng.thisptr.get(),deref((<MetaPop>pop).mpop.get()),deme,nsam,removeFixed)
 *     elif isinstance(pop,MlocusPop):             # <<<<<<<<<<<<<<
 *         return sample_sep_single_mloc[multilocus_t](rng.thisptr.get(),deref((<MlocusPop>pop).pop.get()),nsam,removeFixed,locusBoundaries)
 *     else:
 */
  }

  /* "fwdpy/sampling.pyx":65
 *         return sample_sep_single_mloc[multilocus_t](rng.thisptr.get(),deref((<MlocusPop>pop).pop.get()),nsam,removeFixed,locusBoundaries)
 *     else:
 *         raise ValueError("ms_sample: unsupported type of popcontainer")             # <<<<<<<<<<<<<<
 * 
 * def get_sample_details( sample_t ms_sample, PopType pop, locusID = None ):
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 65, __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(2, 65, __pyx_L1_error)
  }

  /* "fwdpy/sampling.pyx":30
 *         raise ValueError("ms_sample: unsupported type of popcontainer")
 * 
 * def get_samples(GSLrng rng, PopType pop, int nsam, bint removeFixed = True, deme = None, locusBoundaries = None):             # <<<<<<<<<<<<<<
 *     """
 *     Take a sample from a set of simulated populations.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("fwdpy.fwdpy.get_samples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/sampling.pyx":67
 *         raise ValueError("ms_sample: unsupported type of popcontainer")
 * 
 * def get_sample_details( sample_t ms_sample, PopType pop, locusID = None ):             # <<<<<<<<<<<<<<
 *     """
 *     Get additional details for population samples
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_5get_sample_details(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_4get_sample_details[] = "\n    Get additional details for population samples\n\n    :param ms_samples: A list returned by :func:`ms_sample`\n    :param pops: A :class:`PopType` \n    :params locusID: (None) A numerical label for a locus.  Only used/relevant if pop is :class:`fwdpy.fwdpy.MlocusPop`\n\n    :return: A dictionary of data for each mutation in the sample.\n\n    :rtype: dict\n    \n    Example:\n\n    >>> import fwdpy,array\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes=array.array('I',[1000]*1000)\n    >>> pop = fwdpy.evolve_regions(rng,3,1000,popsizes[0:],0.001,0,0.001,[fwdpy.Region(0,1,1)],[],[fwdpy.Region(0,1,1)])\n    >>> s = [fwdpy.ms_sample(rng,i,10) for i in pop]\n    >>> details = [fwdpy.get_sample_details(i,j) for i,j in zip(s,pop)]\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_5get_sample_details = {"get_sample_details", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_5get_sample_details, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_4get_sample_details};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_5get_sample_details(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  KTfwd::sample_t __pyx_v_ms_sample;
  struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_pop = 0;
  PyObject *__pyx_v_locusID = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sample_details (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ms_sample,&__pyx_n_s_pop,&__pyx_n_s_locusID,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ms_sample)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pop)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_sample_details", 0, 2, 3, 1); __PYX_ERR(2, 67, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_locusID);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_sample_details") < 0)) __PYX_ERR(2, 67, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_ms_sample = __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 67, __pyx_L3_error)
    __pyx_v_pop = ((struct __pyx_obj_5fwdpy_5fwdpy_PopType *)values[1]);
    __pyx_v_locusID = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_sample_details", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 67, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.get_sample_details", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_PopType, 1, "pop", 0))) __PYX_ERR(2, 67, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_4get_sample_details(__pyx_self, __pyx_v_ms_sample, __pyx_v_pop, __pyx_v_locusID);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_4get_sample_details(CYTHON_UNUSED PyObject *__pyx_self, KTfwd::sample_t __pyx_v_ms_sample, struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_pop, PyObject *__pyx_v_locusID) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  unsigned int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("get_sample_details", 0);

  /* "fwdpy/sampling.pyx":88
 *     >>> details = [fwdpy.get_sample_details(i,j) for i,j in zip(s,pop)]
 *     """
 *     if isinstance(pop,Spop):             # <<<<<<<<<<<<<<
 *         return get_sh(ms_sample,
 *                (<Spop>pop).pop.get().mutations,
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_Spop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/sampling.pyx":89
 *     """
 *     if isinstance(pop,Spop):
 *         return get_sh(ms_sample,             # <<<<<<<<<<<<<<
 *                (<Spop>pop).pop.get().mutations,
 *                (<Spop>pop).pop.get().fixations,
 */
    __Pyx_XDECREF(__pyx_r);

    /* "fwdpy/sampling.pyx":95
 *                (<Spop>pop).pop.get().mcounts,
 *                (<Spop>pop).pop.get().N,
 *                (<Spop>pop).pop.get().generation,0)             # <<<<<<<<<<<<<<
 *     elif isinstance(pop,MlocusPop):
 *         return get_sh(ms_sample,
 */
    __pyx_t_3 = __pyx_convert__to_py_struct__fwdpy_3a__3a_popsample_details(fwdpy::get_sh(__pyx_v_ms_sample, ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_pop)->pop.get()->mutations, ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_pop)->pop.get()->fixations, ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_pop)->pop.get()->fixation_times, ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_pop)->pop.get()->mcounts, ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_pop)->pop.get()->N, ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_pop)->pop.get()->generation, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/sampling.pyx":88
 *     >>> details = [fwdpy.get_sample_details(i,j) for i,j in zip(s,pop)]
 *     """
 *     if isinstance(pop,Spop):             # <<<<<<<<<<<<<<
 *         return get_sh(ms_sample,
 *                (<Spop>pop).pop.get().mutations,
 */
  }

  /* "fwdpy/sampling.pyx":96
 *                (<Spop>pop).pop.get().N,
 *                (<Spop>pop).pop.get().generation,0)
 *     elif isinstance(pop,MlocusPop):             # <<<<<<<<<<<<<<
 *         return get_sh(ms_sample,
 *                (<MlocusPop>pop).pop.get().mutations,
 */
  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_MlocusPop); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/sampling.pyx":97
 *                (<Spop>pop).pop.get().generation,0)
 *     elif isinstance(pop,MlocusPop):
 *         return get_sh(ms_sample,             # <<<<<<<<<<<<<<
 *                (<MlocusPop>pop).pop.get().mutations,
 *                (<MlocusPop>pop).pop.get().fixations,
 */
    __Pyx_XDECREF(__pyx_r);

    /* "fwdpy/sampling.pyx":103
 *                (<MlocusPop>pop).pop.get().mcounts,
 *                (<MlocusPop>pop).pop.get().N,
 *                (<MlocusPop>pop).pop.get().generation,locusID)             # <<<<<<<<<<<<<<
 *     elif isinstance(pop,MetaPop):
 *         return get_sh(ms_sample,
 */
    __pyx_t_4 = __Pyx_PyInt_As_unsigned_int(__pyx_v_locusID); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(2, 103, __pyx_L1_error)

    /* "fwdpy/sampling.pyx":97
 *                (<Spop>pop).pop.get().generation,0)
 *     elif isinstance(pop,MlocusPop):
 *         return get_sh(ms_sample,             # <<<<<<<<<<<<<<
 *                (<MlocusPop>pop).pop.get().mutations,
 *                (<MlocusPop>pop).pop.get().fixations,
 */
    __pyx_t_3 = __pyx_convert__to_py_struct__fwdpy_3a__3a_popsample_details(fwdpy::get_sh(__pyx_v_ms_sample, ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_pop)->pop.get()->mutations, ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_pop)->pop.get()->fixations, ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_pop)->pop.get()->fixation_times, ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_pop)->pop.get()->mcounts, ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_pop)->pop.get()->N, ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_pop)->pop.get()->generation, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 97, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/sampling.pyx":96
 *                (<Spop>pop).pop.get().N,
 *                (<Spop>pop).pop.get().generation,0)
 *     elif isinstance(pop,MlocusPop):             # <<<<<<<<<<<<<<
 *         return get_sh(ms_sample,
 *                (<MlocusPop>pop).pop.get().mutations,
 */
  }

  /* "fwdpy/sampling.pyx":104
 *                (<MlocusPop>pop).pop.get().N,
 *                (<MlocusPop>pop).pop.get().generation,locusID)
 *     elif isinstance(pop,MetaPop):             # <<<<<<<<<<<<<<
 *         return get_sh(ms_sample,
 *                (<MetaPop>pop).mpop.get().mutations,
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_MetaPop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/sampling.pyx":105
 *                (<MlocusPop>pop).pop.get().generation,locusID)
 *     elif isinstance(pop,MetaPop):
 *         return get_sh(ms_sample,             # <<<<<<<<<<<<<<
 *                (<MetaPop>pop).mpop.get().mutations,
 *                (<MetaPop>pop).mpop.get().fixations,
 */
    __Pyx_XDECREF(__pyx_r);

    /* "fwdpy/sampling.pyx":110
 *                (<MetaPop>pop).mpop.get().fixation_times,
 *                (<MetaPop>pop).mpop.get().mcounts,
 *                sum((<MetaPop>pop).mpop.get().mcounts.Ns),             # <<<<<<<<<<<<<<
 *                (<MetaPop>pop).mpop.get().generation,0)
 *     else:
 */
    __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_int(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_pop)->mpop.get()->mcounts); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Ns); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_sum, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyInt_As_unsigned_int(__pyx_t_5); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(2, 110, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "fwdpy/sampling.pyx":105
 *                (<MlocusPop>pop).pop.get().generation,locusID)
 *     elif isinstance(pop,MetaPop):
 *         return get_sh(ms_sample,             # <<<<<<<<<<<<<<
 *                (<MetaPop>pop).mpop.get().mutations,
 *                (<MetaPop>pop).mpop.get().fixations,
 */
    __pyx_t_5 = __pyx_convert__to_py_struct__fwdpy_3a__3a_popsample_details(fwdpy::get_sh(__pyx_v_ms_sample, ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_pop)->mpop.get()->mutations, ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_pop)->mpop.get()->fixations, ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_pop)->mpop.get()->fixation_times, ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_pop)->mpop.get()->mcounts, __pyx_t_4, ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_pop)->mpop.get()->generation, 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "fwdpy/sampling.pyx":104
 *                (<MlocusPop>pop).pop.get().N,
 *                (<MlocusPop>pop).pop.get().generation,locusID)
 *     elif isinstance(pop,MetaPop):             # <<<<<<<<<<<<<<
 *         return get_sh(ms_sample,
 *                (<MetaPop>pop).mpop.get().mutations,
 */
  }

  /* "fwdpy/sampling.pyx":113
 *                (<MetaPop>pop).mpop.get().generation,0)
 *     else:
 *         raise RuntimeError("unupported PopType")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(2, 113, __pyx_L1_error)
  }

  /* "fwdpy/sampling.pyx":67
 *         raise ValueError("ms_sample: unsupported type of popcontainer")
 * 
 * def get_sample_details( sample_t ms_sample, PopType pop, locusID = None ):             # <<<<<<<<<<<<<<
 *     """
 *     Get additional details for population samples
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.get_sample_details", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/sampling.pyx":117
 * 
 * ###### Functions for manipulating samples.
 * def nderived_site(tuple site):             # <<<<<<<<<<<<<<
 *     """
 *     Get the number of derived mutations at a site.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7nderived_site(PyObject *__pyx_self, PyObject *__pyx_v_site); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_6nderived_site[] = "\n    Get the number of derived mutations at a site.\n\n    :param site: A tuple.  See example\n\n    .. note:: In general, it will be more convenient to call :func:`fwdpy.fwdpy.nderived` on a list of tuples.\n\n    Example:\n\n    >>> import fwdpy\n    >>> #Create a site at position 0.1 with the\n    >>> #genotypes as the second element. 0/1 = ancestral/derived\n    >>> x = (0.1,'01100111')\n    >>> fwdpy.nderived_site(x)\n    5\n    >>> #Process simulation results:\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes=array.array('I',[1000]*1000)\n    >>> pop = fwdpy.evolve_regions(rng,3,1000,popsizes[0:],0.001,0,0.001,[fwdpy.Region(0,1,1)],[],[fwdpy.Region(0,1,1)])\n    >>> s = [fwdpy.ms_sample(rng,i,10) for i in pop]\n    >>> for i in s[0]: ndi = fwdpy.nderived_site(i)\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_7nderived_site = {"nderived_site", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7nderived_site, METH_O, __pyx_doc_5fwdpy_5fwdpy_6nderived_site};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7nderived_site(PyObject *__pyx_self, PyObject *__pyx_v_site) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nderived_site (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_site), (&PyTuple_Type), 1, "site", 1))) __PYX_ERR(2, 117, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_6nderived_site(__pyx_self, ((PyObject*)__pyx_v_site));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_6nderived_site(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_site) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("nderived_site", 0);

  /* "fwdpy/sampling.pyx":140
 *     >>> for i in s[0]: ndi = fwdpy.nderived_site(i)
 *     """
 *     return str(site[1]).count('1')             # <<<<<<<<<<<<<<
 * 
 * def nderived( list sample ):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_site == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 140, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_site, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/sampling.pyx":117
 * 
 * ###### Functions for manipulating samples.
 * def nderived_site(tuple site):             # <<<<<<<<<<<<<<
 *     """
 *     Get the number of derived mutations at a site.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("fwdpy.fwdpy.nderived_site", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/sampling.pyx":142
 *     return str(site[1]).count('1')
 * 
 * def nderived( list sample ):             # <<<<<<<<<<<<<<
 *     """
 *     Convenience wrapper around :func:`fwdpy.fwdpy.nderived`
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9nderived(PyObject *__pyx_self, PyObject *__pyx_v_sample); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_8nderived[] = "\n    Convenience wrapper around :func:`fwdpy.fwdpy.nderived`\n\n    :param sample: a sample from a population.  For example, the return value of :func:`fwdpy.fwdpy.ms_sample` or :func:`fwdpy.fwdpy.get_samples`\n\n    Example:\n\n    >>> import fwdpy,array\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes=array.array('I',[1000]*1000)\n    >>> pop = fwdpy.evolve_regions(rng,3,1000,popsizes[0:],0.001,0,0.001,[fwdpy.Region(0,1,1)],[],[fwdpy.Region(0,1,1)])\n    >>> s = [fwdpy.ms_sample(rng,i,10) for i in pop]\n    >>> nd = [fwdpy.nderived(i) for i in s]\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_9nderived = {"nderived", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_9nderived, METH_O, __pyx_doc_5fwdpy_5fwdpy_8nderived};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9nderived(PyObject *__pyx_self, PyObject *__pyx_v_sample) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nderived (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample), (&PyList_Type), 1, "sample", 1))) __PYX_ERR(2, 142, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_8nderived(__pyx_self, ((PyObject*)__pyx_v_sample));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_8nderived(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sample) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("nderived", 0);

  /* "fwdpy/sampling.pyx":157
 *     >>> nd = [fwdpy.nderived(i) for i in s]
 *     """
 *     return [nderived_site(i) for i in sample]             # <<<<<<<<<<<<<<
 * 
 * def getfreq(tuple site,bint derived = True):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(__pyx_v_sample == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(2, 157, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_sample; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 157, __pyx_L1_error)
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_nderived_site); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_i};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 157, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_i};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 157, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 157, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_i);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 157, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(2, 157, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/sampling.pyx":142
 *     return str(site[1]).count('1')
 * 
 * def nderived( list sample ):             # <<<<<<<<<<<<<<
 *     """
 *     Convenience wrapper around :func:`fwdpy.fwdpy.nderived`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("fwdpy.fwdpy.nderived", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/sampling.pyx":159
 *     return [nderived_site(i) for i in sample]
 * 
 * def getfreq(tuple site,bint derived = True):             # <<<<<<<<<<<<<<
 *     """
 *     Get mutation frequencies
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_11getfreq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_10getfreq[] = "\n    Get mutation frequencies\n\n    :param site: A tuple. See example\n    :param derived:  If True, report derived allele frequency (DAF).  If False, return minor allele freqency (MAF)\n\n    .. note:: Do **not** use this function to calculate :math:`\\pi` (a.k.a. :math:`\\hat\\theta_\\pi`, a.k.a. \"sum of site heterozygosity\").\n       :math:`\\pi` for a **sample** is not :math:`2\\sum_ip_iq_i`. because the sample is *finite*.\n       In general, it will be more convenient to call :func:`fwdpy.fwdpy.getfreqs` on a list of tuples.\n\n    Example:\n\n    >>> import fwdpy\n    >>> #DAF = 7/10\n    >>> #MAF = 3/10\n    >>> x = (0.1,'0111111100')\n    >>> round(fwdpy.getfreq(x,True),3)\n    0.7\n    >>> round(fwdpy.getfreq(x,False),3)\n    0.3\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_11getfreq = {"getfreq", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_11getfreq, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_10getfreq};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_11getfreq(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_site = 0;
  int __pyx_v_derived;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getfreq (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_site,&__pyx_n_s_derived,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_site)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_derived);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getfreq") < 0)) __PYX_ERR(2, 159, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_site = ((PyObject*)values[0]);
    if (values[1]) {
      __pyx_v_derived = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_derived == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 159, __pyx_L3_error)
    } else {
      __pyx_v_derived = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getfreq", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 159, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.getfreq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_site), (&PyTuple_Type), 1, "site", 1))) __PYX_ERR(2, 159, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10getfreq(__pyx_self, __pyx_v_site, __pyx_v_derived);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_10getfreq(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_site, int __pyx_v_derived) {
  PyObject *__pyx_v_o = NULL;
  double __pyx_v_dfreq;
  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;
  double __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  double __pyx_t_8;
  double __pyx_t_9;
  __Pyx_RefNannySetupContext("getfreq", 0);

  /* "fwdpy/sampling.pyx":181
 *     0.3
 *     """
 *     o = nderived_site(site)             # <<<<<<<<<<<<<<
 *     dfreq = float(o)/float(len(site[1]))
 *     if derived is True:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_nderived_site); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_site); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_site};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 181, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_site};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 181, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 181, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_site);
      __Pyx_GIVEREF(__pyx_v_site);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_site);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 181, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_o = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "fwdpy/sampling.pyx":182
 *     """
 *     o = nderived_site(site)
 *     dfreq = float(o)/float(len(site[1]))             # <<<<<<<<<<<<<<
 *     if derived is True:
 *         return dfreq
 */
  __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_v_o); if (unlikely(__pyx_t_5 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(2, 182, __pyx_L1_error)
  if (unlikely(__pyx_v_site == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 182, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_site, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(2, 182, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(((double)__pyx_t_6) == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(2, 182, __pyx_L1_error)
  }
  __pyx_v_dfreq = (__pyx_t_5 / ((double)__pyx_t_6));

  /* "fwdpy/sampling.pyx":183
 *     o = nderived_site(site)
 *     dfreq = float(o)/float(len(site[1]))
 *     if derived is True:             # <<<<<<<<<<<<<<
 *         return dfreq
 *     return min(dfreq,1.0-dfreq)
 */
  __pyx_t_7 = ((__pyx_v_derived == 1) != 0);
  if (__pyx_t_7) {

    /* "fwdpy/sampling.pyx":184
 *     dfreq = float(o)/float(len(site[1]))
 *     if derived is True:
 *         return dfreq             # <<<<<<<<<<<<<<
 *     return min(dfreq,1.0-dfreq)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_dfreq); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "fwdpy/sampling.pyx":183
 *     o = nderived_site(site)
 *     dfreq = float(o)/float(len(site[1]))
 *     if derived is True:             # <<<<<<<<<<<<<<
 *         return dfreq
 *     return min(dfreq,1.0-dfreq)
 */
  }

  /* "fwdpy/sampling.pyx":185
 *     if derived is True:
 *         return dfreq
 *     return min(dfreq,1.0-dfreq)             # <<<<<<<<<<<<<<
 * 
 * def getfreqs(list sample,bint derived = True):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = (1.0 - __pyx_v_dfreq);
  __pyx_t_8 = __pyx_v_dfreq;
  if (((__pyx_t_5 < __pyx_t_8) != 0)) {
    __pyx_t_9 = __pyx_t_5;
  } else {
    __pyx_t_9 = __pyx_t_8;
  }
  __pyx_t_1 = PyFloat_FromDouble(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/sampling.pyx":159
 *     return [nderived_site(i) for i in sample]
 * 
 * def getfreq(tuple site,bint derived = True):             # <<<<<<<<<<<<<<
 *     """
 *     Get mutation frequencies
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.getfreq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/sampling.pyx":187
 *     return min(dfreq,1.0-dfreq)
 * 
 * def getfreqs(list sample,bint derived = True):             # <<<<<<<<<<<<<<
 *     """
 *     Convenience wrapper around :func:`fwdpy.fwdpy.getfreq`
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_13getfreqs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_12getfreqs[] = "\n    Convenience wrapper around :func:`fwdpy.fwdpy.getfreq`\n\n    :param sample: a sample from a population.  For example, the return value of :func:`fwdpy.fwdpy.ms_sample` or :func:`fwdpy.fwdpy.get_samples`\n    :param derived: If True, report derived allele frequency (DAF).  If False, return minor allele freqency (MAF).\n\n    .. note:: Do **not** use this function to calculate :math:`\\pi` (a.k.a. :math:`\\hat\\theta_\\pi`, a.k.a. \"sum of site heterozygosity\").\n       :math:`\\pi` for a **sample** is not :math:`2\\sum_ip_iq_i`. because the sample is *finite*.\n\n    Example:\n\n    >>> import fwdpy,array\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes=array.array('I',[1000]*1000)\n    >>> pop = fwdpy.evolve_regions(rng,3,1000,popsizes[0:],0.001,0,0.001,[fwdpy.Region(0,1,1)],[],[fwdpy.Region(0,1,1)])\n    >>> s = [fwdpy.ms_sample(rng,i,10) for i in pop]\n    >>> freqs = [fwdpy.getfreqs(i) for i in s]\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_13getfreqs = {"getfreqs", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_13getfreqs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_12getfreqs};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_13getfreqs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sample = 0;
  int __pyx_v_derived;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getfreqs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sample,&__pyx_n_s_derived,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sample)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_derived);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getfreqs") < 0)) __PYX_ERR(2, 187, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sample = ((PyObject*)values[0]);
    if (values[1]) {
      __pyx_v_derived = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_derived == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 187, __pyx_L3_error)
    } else {
      __pyx_v_derived = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("getfreqs", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 187, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.getfreqs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample), (&PyList_Type), 1, "sample", 1))) __PYX_ERR(2, 187, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_12getfreqs(__pyx_self, __pyx_v_sample, __pyx_v_derived);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_12getfreqs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sample, int __pyx_v_derived) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("getfreqs", 0);

  /* "fwdpy/sampling.pyx":206
 *     >>> freqs = [fwdpy.getfreqs(i) for i in s]
 *     """
 *     return [getfreq(i,derived) for i in sample]             # <<<<<<<<<<<<<<
 * 
 * def freqfilter( list sample,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(__pyx_v_sample == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(2, 206, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_sample; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 206, __pyx_L1_error)
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_getfreq); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_derived); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_i, __pyx_t_6};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 206, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_i, __pyx_t_6};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 206, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 206, __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_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_i);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 206, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(2, 206, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/sampling.pyx":187
 *     return min(dfreq,1.0-dfreq)
 * 
 * def getfreqs(list sample,bint derived = True):             # <<<<<<<<<<<<<<
 *     """
 *     Convenience wrapper around :func:`fwdpy.fwdpy.getfreq`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("fwdpy.fwdpy.getfreqs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/sampling.pyx":208
 *     return [getfreq(i,derived) for i in sample]
 * 
 * def freqfilter( list sample,             # <<<<<<<<<<<<<<
 *                 float minfreq,
 *                 bint derived = True ):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_15freqfilter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_14freqfilter[] = "\n    Remove low-frequency variants from a sample.\n\n    :param sample: a sample from a population.  For example, the return value of :func:`fwdpy.fwdpy.ms_sample` or :func:`fwdpy.fwdpy.get_samples`\n    :param minfreq: Remove all sites with frequency < minfreq\n    :param derived: if True, filter on derived allele frequency.  If False, filter on minor allele frequency.\n\n    Example:\n\n    >>> import fwdpy,array\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes=array.array('I',[1000]*1000)\n    >>> pop = fwdpy.evolve_regions(rng,3,1000,popsizes[0:],0.001,0,0.001,[fwdpy.Region(0,1,1)],[],[fwdpy.Region(0,1,1)])\n    >>> s = [fwdpy.ms_sample(rng,i,10) for i in pop]\n    >>> s2 = [fwdpy.freqfilter(i,0.2) for i in s]\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_15freqfilter = {"freqfilter", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_15freqfilter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_14freqfilter};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_15freqfilter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sample = 0;
  float __pyx_v_minfreq;
  int __pyx_v_derived;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("freqfilter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sample,&__pyx_n_s_minfreq,&__pyx_n_s_derived,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sample)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_minfreq)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("freqfilter", 0, 2, 3, 1); __PYX_ERR(2, 208, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_derived);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "freqfilter") < 0)) __PYX_ERR(2, 208, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sample = ((PyObject*)values[0]);
    __pyx_v_minfreq = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_minfreq == (float)-1) && PyErr_Occurred())) __PYX_ERR(2, 209, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_derived = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_derived == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 210, __pyx_L3_error)
    } else {

      /* "fwdpy/sampling.pyx":210
 * def freqfilter( list sample,
 *                 float minfreq,
 *                 bint derived = True ):             # <<<<<<<<<<<<<<
 *     """
 *     Remove low-frequency variants from a sample.
 */
      __pyx_v_derived = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("freqfilter", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 208, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.freqfilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample), (&PyList_Type), 1, "sample", 1))) __PYX_ERR(2, 208, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_14freqfilter(__pyx_self, __pyx_v_sample, __pyx_v_minfreq, __pyx_v_derived);

  /* "fwdpy/sampling.pyx":208
 *     return [getfreq(i,derived) for i in sample]
 * 
 * def freqfilter( list sample,             # <<<<<<<<<<<<<<
 *                 float minfreq,
 *                 bint derived = True ):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_14freqfilter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sample, float __pyx_v_minfreq, int __pyx_v_derived) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("freqfilter", 0);

  /* "fwdpy/sampling.pyx":227
 *     >>> s2 = [fwdpy.freqfilter(i,0.2) for i in s]
 *     """
 *     rv=list()             # <<<<<<<<<<<<<<
 *     for i in sample:
 *         if type(i) is not tuple:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rv = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/sampling.pyx":228
 *     """
 *     rv=list()
 *     for i in sample:             # <<<<<<<<<<<<<<
 *         if type(i) is not tuple:
 *             raise RuntimeError("values is sample must be tuples, not"+str(type(i)))
 */
  if (unlikely(__pyx_v_sample == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(2, 228, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_sample; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 228, __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(2, 228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/sampling.pyx":229
 *     rv=list()
 *     for i in sample:
 *         if type(i) is not tuple:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("values is sample must be tuples, not"+str(type(i)))
 *         if getfreq(i,derived)>=minfreq:
 */
    __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_i)) != ((PyObject *)(&PyTuple_Type)));
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {

      /* "fwdpy/sampling.pyx":230
 *     for i in sample:
 *         if type(i) is not tuple:
 *             raise RuntimeError("values is sample must be tuples, not"+str(type(i)))             # <<<<<<<<<<<<<<
 *         if getfreq(i,derived)>=minfreq:
 *             rv.append(i)
 */
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_i)));
      __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_i)));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(__pyx_v_i)));
      __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Add(__pyx_kp_s_values_is_sample_must_be_tuples, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(2, 230, __pyx_L1_error)

      /* "fwdpy/sampling.pyx":229
 *     rv=list()
 *     for i in sample:
 *         if type(i) is not tuple:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("values is sample must be tuples, not"+str(type(i)))
 *         if getfreq(i,derived)>=minfreq:
 */
    }

    /* "fwdpy/sampling.pyx":231
 *         if type(i) is not tuple:
 *             raise RuntimeError("values is sample must be tuples, not"+str(type(i)))
 *         if getfreq(i,derived)>=minfreq:             # <<<<<<<<<<<<<<
 *             rv.append(i)
 *     return rv
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_getfreq); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 231, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_derived); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 231, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_i, __pyx_t_7};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 231, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_i, __pyx_t_7};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 231, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 231, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_i);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 231, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_minfreq); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 231, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_GE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 231, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(2, 231, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (__pyx_t_5) {

      /* "fwdpy/sampling.pyx":232
 *             raise RuntimeError("values is sample must be tuples, not"+str(type(i)))
 *         if getfreq(i,derived)>=minfreq:
 *             rv.append(i)             # <<<<<<<<<<<<<<
 *     return rv
 */
      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_rv, __pyx_v_i); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(2, 232, __pyx_L1_error)

      /* "fwdpy/sampling.pyx":231
 *         if type(i) is not tuple:
 *             raise RuntimeError("values is sample must be tuples, not"+str(type(i)))
 *         if getfreq(i,derived)>=minfreq:             # <<<<<<<<<<<<<<
 *             rv.append(i)
 *     return rv
 */
    }

    /* "fwdpy/sampling.pyx":228
 *     """
 *     rv=list()
 *     for i in sample:             # <<<<<<<<<<<<<<
 *         if type(i) is not tuple:
 *             raise RuntimeError("values is sample must be tuples, not"+str(type(i)))
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/sampling.pyx":233
 *         if getfreq(i,derived)>=minfreq:
 *             rv.append(i)
 *     return rv             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/sampling.pyx":208
 *     return [getfreq(i,derived) for i in sample]
 * 
 * def freqfilter( list sample,             # <<<<<<<<<<<<<<
 *                 float minfreq,
 *                 bint derived = True ):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("fwdpy.fwdpy.freqfilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/evolve_regions.pyx":10
 * from fitness cimport SpopAdditive,SpopMult,SpopFitness
 * 
 * def check_input_params(double mu_neutral, double mu_selected, double recrate,             # <<<<<<<<<<<<<<
 *                        list nregions, list sregions, list recregions) :
 *     for i in [mu_neutral,mu_selected,recrate]:
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_17check_input_params(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_17check_input_params = {"check_input_params", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_17check_input_params, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_17check_input_params(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_mu_neutral;
  double __pyx_v_mu_selected;
  double __pyx_v_recrate;
  PyObject *__pyx_v_nregions = 0;
  PyObject *__pyx_v_sregions = 0;
  PyObject *__pyx_v_recregions = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_input_params (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mu_neutral,&__pyx_n_s_mu_selected,&__pyx_n_s_recrate,&__pyx_n_s_nregions,&__pyx_n_s_sregions,&__pyx_n_s_recregions,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mu_neutral)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mu_selected)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("check_input_params", 1, 6, 6, 1); __PYX_ERR(5, 10, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_recrate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("check_input_params", 1, 6, 6, 2); __PYX_ERR(5, 10, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("check_input_params", 1, 6, 6, 3); __PYX_ERR(5, 10, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("check_input_params", 1, 6, 6, 4); __PYX_ERR(5, 10, __pyx_L3_error)
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_recregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("check_input_params", 1, 6, 6, 5); __PYX_ERR(5, 10, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "check_input_params") < 0)) __PYX_ERR(5, 10, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_mu_neutral = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mu_neutral == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 10, __pyx_L3_error)
    __pyx_v_mu_selected = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_mu_selected == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 10, __pyx_L3_error)
    __pyx_v_recrate = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_recrate == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 10, __pyx_L3_error)
    __pyx_v_nregions = ((PyObject*)values[3]);
    __pyx_v_sregions = ((PyObject*)values[4]);
    __pyx_v_recregions = ((PyObject*)values[5]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("check_input_params", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(5, 10, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.check_input_params", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nregions), (&PyList_Type), 1, "nregions", 1))) __PYX_ERR(5, 11, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sregions), (&PyList_Type), 1, "sregions", 1))) __PYX_ERR(5, 11, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_recregions), (&PyList_Type), 1, "recregions", 1))) __PYX_ERR(5, 11, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_16check_input_params(__pyx_self, __pyx_v_mu_neutral, __pyx_v_mu_selected, __pyx_v_recrate, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_16check_input_params(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_mu_neutral, double __pyx_v_mu_selected, double __pyx_v_recrate, PyObject *__pyx_v_nregions, PyObject *__pyx_v_sregions, PyObject *__pyx_v_recregions) {
  PyObject *__pyx_v_i = NULL;
  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;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("check_input_params", 0);

  /* "fwdpy/evolve_regions.pyx":12
 * def check_input_params(double mu_neutral, double mu_selected, double recrate,
 *                        list nregions, list sregions, list recregions) :
 *     for i in [mu_neutral,mu_selected,recrate]:             # <<<<<<<<<<<<<<
 *         if math.isnan(i) or math.isinf(i):
 *             raise RuntimeError("non-finite value encountered for mutation and/or recombination rates")
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_mu_neutral); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_mu_selected); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_recrate); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_5 >= 3) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(5, 12, __pyx_L1_error)
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "fwdpy/evolve_regions.pyx":13
 *                        list nregions, list sregions, list recregions) :
 *     for i in [mu_neutral,mu_selected,recrate]:
 *         if math.isnan(i) or math.isinf(i):             # <<<<<<<<<<<<<<
 *             raise RuntimeError("non-finite value encountered for mutation and/or recombination rates")
 *     if mu_neutral < 0:
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isnan); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 13, __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 && unlikely(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);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_i};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 13, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_i};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 13, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 13, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_i);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 13, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(5, 13, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!__pyx_t_8) {
    } else {
      __pyx_t_6 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_isinf); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __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);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_i};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 13, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_i};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 13, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 13, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_i);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 13, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(5, 13, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __pyx_t_8;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_6) {

      /* "fwdpy/evolve_regions.pyx":14
 *     for i in [mu_neutral,mu_selected,recrate]:
 *         if math.isnan(i) or math.isinf(i):
 *             raise RuntimeError("non-finite value encountered for mutation and/or recombination rates")             # <<<<<<<<<<<<<<
 *     if mu_neutral < 0:
 *         raise RuntimeError("mutation rate to neutral variants must be >= 0.")
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 14, __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(5, 14, __pyx_L1_error)

      /* "fwdpy/evolve_regions.pyx":13
 *                        list nregions, list sregions, list recregions) :
 *     for i in [mu_neutral,mu_selected,recrate]:
 *         if math.isnan(i) or math.isinf(i):             # <<<<<<<<<<<<<<
 *             raise RuntimeError("non-finite value encountered for mutation and/or recombination rates")
 *     if mu_neutral < 0:
 */
    }

    /* "fwdpy/evolve_regions.pyx":12
 * def check_input_params(double mu_neutral, double mu_selected, double recrate,
 *                        list nregions, list sregions, list recregions) :
 *     for i in [mu_neutral,mu_selected,recrate]:             # <<<<<<<<<<<<<<
 *         if math.isnan(i) or math.isinf(i):
 *             raise RuntimeError("non-finite value encountered for mutation and/or recombination rates")
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "fwdpy/evolve_regions.pyx":15
 *         if math.isnan(i) or math.isinf(i):
 *             raise RuntimeError("non-finite value encountered for mutation and/or recombination rates")
 *     if mu_neutral < 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("mutation rate to neutral variants must be >= 0.")
 *     if mu_selected < 0:
 */
  __pyx_t_6 = ((__pyx_v_mu_neutral < 0.0) != 0);
  if (__pyx_t_6) {

    /* "fwdpy/evolve_regions.pyx":16
 *             raise RuntimeError("non-finite value encountered for mutation and/or recombination rates")
 *     if mu_neutral < 0:
 *         raise RuntimeError("mutation rate to neutral variants must be >= 0.")             # <<<<<<<<<<<<<<
 *     if mu_selected < 0:
 *         raise RuntimeError("mutation rate to selected variants must be >= 0.")
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 16, __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(5, 16, __pyx_L1_error)

    /* "fwdpy/evolve_regions.pyx":15
 *         if math.isnan(i) or math.isinf(i):
 *             raise RuntimeError("non-finite value encountered for mutation and/or recombination rates")
 *     if mu_neutral < 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("mutation rate to neutral variants must be >= 0.")
 *     if mu_selected < 0:
 */
  }

  /* "fwdpy/evolve_regions.pyx":17
 *     if mu_neutral < 0:
 *         raise RuntimeError("mutation rate to neutral variants must be >= 0.")
 *     if mu_selected < 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("mutation rate to selected variants must be >= 0.")
 *     if recrate < 0:
 */
  __pyx_t_6 = ((__pyx_v_mu_selected < 0.0) != 0);
  if (__pyx_t_6) {

    /* "fwdpy/evolve_regions.pyx":18
 *         raise RuntimeError("mutation rate to neutral variants must be >= 0.")
 *     if mu_selected < 0:
 *         raise RuntimeError("mutation rate to selected variants must be >= 0.")             # <<<<<<<<<<<<<<
 *     if recrate < 0:
 *         raise RuntimeError("recombination rate must be >= 0.")
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 18, __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(5, 18, __pyx_L1_error)

    /* "fwdpy/evolve_regions.pyx":17
 *     if mu_neutral < 0:
 *         raise RuntimeError("mutation rate to neutral variants must be >= 0.")
 *     if mu_selected < 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("mutation rate to selected variants must be >= 0.")
 *     if recrate < 0:
 */
  }

  /* "fwdpy/evolve_regions.pyx":19
 *     if mu_selected < 0:
 *         raise RuntimeError("mutation rate to selected variants must be >= 0.")
 *     if recrate < 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("recombination rate must be >= 0.")
 *     if mu_neutral > 0 and len(nregions)==0:
 */
  __pyx_t_6 = ((__pyx_v_recrate < 0.0) != 0);
  if (__pyx_t_6) {

    /* "fwdpy/evolve_regions.pyx":20
 *         raise RuntimeError("mutation rate to selected variants must be >= 0.")
 *     if recrate < 0:
 *         raise RuntimeError("recombination rate must be >= 0.")             # <<<<<<<<<<<<<<
 *     if mu_neutral > 0 and len(nregions)==0:
 *         raise RuntimeError("Neutral regions must be defined when mutation rate > 0")
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 20, __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(5, 20, __pyx_L1_error)

    /* "fwdpy/evolve_regions.pyx":19
 *     if mu_selected < 0:
 *         raise RuntimeError("mutation rate to selected variants must be >= 0.")
 *     if recrate < 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("recombination rate must be >= 0.")
 *     if mu_neutral > 0 and len(nregions)==0:
 */
  }

  /* "fwdpy/evolve_regions.pyx":21
 *     if recrate < 0:
 *         raise RuntimeError("recombination rate must be >= 0.")
 *     if mu_neutral > 0 and len(nregions)==0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Neutral regions must be defined when mutation rate > 0")
 *     if mu_selected > 0 and len(sregions)==0:
 */
  __pyx_t_8 = ((__pyx_v_mu_neutral > 0.0) != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_6 = __pyx_t_8;
    goto __pyx_L12_bool_binop_done;
  }
  if (unlikely(__pyx_v_nregions == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(5, 21, __pyx_L1_error)
  }
  __pyx_t_5 = PyList_GET_SIZE(__pyx_v_nregions); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(5, 21, __pyx_L1_error)
  __pyx_t_8 = ((__pyx_t_5 == 0) != 0);
  __pyx_t_6 = __pyx_t_8;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_6) {

    /* "fwdpy/evolve_regions.pyx":22
 *         raise RuntimeError("recombination rate must be >= 0.")
 *     if mu_neutral > 0 and len(nregions)==0:
 *         raise RuntimeError("Neutral regions must be defined when mutation rate > 0")             # <<<<<<<<<<<<<<
 *     if mu_selected > 0 and len(sregions)==0:
 *         raise RuntimeError("Selected regions must be defined when mutation rate > 0")
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 22, __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(5, 22, __pyx_L1_error)

    /* "fwdpy/evolve_regions.pyx":21
 *     if recrate < 0:
 *         raise RuntimeError("recombination rate must be >= 0.")
 *     if mu_neutral > 0 and len(nregions)==0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Neutral regions must be defined when mutation rate > 0")
 *     if mu_selected > 0 and len(sregions)==0:
 */
  }

  /* "fwdpy/evolve_regions.pyx":23
 *     if mu_neutral > 0 and len(nregions)==0:
 *         raise RuntimeError("Neutral regions must be defined when mutation rate > 0")
 *     if mu_selected > 0 and len(sregions)==0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Selected regions must be defined when mutation rate > 0")
 *     if recrate > 0 and len(recregions)==0:
 */
  __pyx_t_8 = ((__pyx_v_mu_selected > 0.0) != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_6 = __pyx_t_8;
    goto __pyx_L15_bool_binop_done;
  }
  if (unlikely(__pyx_v_sregions == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(5, 23, __pyx_L1_error)
  }
  __pyx_t_5 = PyList_GET_SIZE(__pyx_v_sregions); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(5, 23, __pyx_L1_error)
  __pyx_t_8 = ((__pyx_t_5 == 0) != 0);
  __pyx_t_6 = __pyx_t_8;
  __pyx_L15_bool_binop_done:;
  if (__pyx_t_6) {

    /* "fwdpy/evolve_regions.pyx":24
 *         raise RuntimeError("Neutral regions must be defined when mutation rate > 0")
 *     if mu_selected > 0 and len(sregions)==0:
 *         raise RuntimeError("Selected regions must be defined when mutation rate > 0")             # <<<<<<<<<<<<<<
 *     if recrate > 0 and len(recregions)==0:
 *         raise RuntimeError("Recombination regions must be defined when recombination rate > 0")
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 24, __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(5, 24, __pyx_L1_error)

    /* "fwdpy/evolve_regions.pyx":23
 *     if mu_neutral > 0 and len(nregions)==0:
 *         raise RuntimeError("Neutral regions must be defined when mutation rate > 0")
 *     if mu_selected > 0 and len(sregions)==0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Selected regions must be defined when mutation rate > 0")
 *     if recrate > 0 and len(recregions)==0:
 */
  }

  /* "fwdpy/evolve_regions.pyx":25
 *     if mu_selected > 0 and len(sregions)==0:
 *         raise RuntimeError("Selected regions must be defined when mutation rate > 0")
 *     if recrate > 0 and len(recregions)==0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Recombination regions must be defined when recombination rate > 0")
 * 
 */
  __pyx_t_8 = ((__pyx_v_recrate > 0.0) != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_6 = __pyx_t_8;
    goto __pyx_L18_bool_binop_done;
  }
  if (unlikely(__pyx_v_recregions == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(5, 25, __pyx_L1_error)
  }
  __pyx_t_5 = PyList_GET_SIZE(__pyx_v_recregions); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(5, 25, __pyx_L1_error)
  __pyx_t_8 = ((__pyx_t_5 == 0) != 0);
  __pyx_t_6 = __pyx_t_8;
  __pyx_L18_bool_binop_done:;
  if (__pyx_t_6) {

    /* "fwdpy/evolve_regions.pyx":26
 *         raise RuntimeError("Selected regions must be defined when mutation rate > 0")
 *     if recrate > 0 and len(recregions)==0:
 *         raise RuntimeError("Recombination regions must be defined when recombination rate > 0")             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 26, __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(5, 26, __pyx_L1_error)

    /* "fwdpy/evolve_regions.pyx":25
 *     if mu_selected > 0 and len(sregions)==0:
 *         raise RuntimeError("Selected regions must be defined when mutation rate > 0")
 *     if recrate > 0 and len(recregions)==0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("Recombination regions must be defined when recombination rate > 0")
 * 
 */
  }

  /* "fwdpy/evolve_regions.pyx":10
 * from fitness cimport SpopAdditive,SpopMult,SpopFitness
 * 
 * def check_input_params(double mu_neutral, double mu_selected, double recrate,             # <<<<<<<<<<<<<<
 *                        list nregions, list sregions, list recregions) :
 *     for i in [mu_neutral,mu_selected,recrate]:
 */

  /* 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_7);
  __Pyx_AddTraceback("fwdpy.fwdpy.check_input_params", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/evolve_regions.pyx":29
 * 
 * @cython.boundscheck(False)
 * def evolve_regions(GSLrng rng,             # <<<<<<<<<<<<<<
 *                    int npops,
 *                    int N,
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_19evolve_regions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_18evolve_regions[] = "\n    Evolve a region with variable mutation, fitness effects, and recombination rates.\n\n    :param rng: a :class:`GSLrng`\n    :param npops: The number of populations to simulate.  This is equal to the number of threads that will be used!\n    :param N: The diploid population size to simulate\n    :param nlist: An array view of a NumPy array.  This represents the population sizes over time.  The length of this view is the length of the simulation in generations. The view must be of an array of 32 bit, unsigned integers (see example).\n    :param mu_neutral: The mutation rate to variants not affecting fitness (\"neutral\" mutations).  The unit is per gamete, per generation.\n    :param mu_selected: The mutation rate to variants affecting fitness (\"selected\" mutations).  The unit is per gamete, per generation.\n    :param recrate: The recombination rate in the regions (per diploid, per generation)\n    :param nregions: A list specifying where neutral mutations occur\n    :param sregions: A list specifying where selected mutations occur\n    :param recregions: A list specifying how the genetic map varies along the region\n    :param f: The selfing probabilty\n    :param scaling: For a single mutation, fitness is calculated as 1, 1+sh, and 1+scaling*s for genotypes AA, Aa, and aa, respectively.\n    :param fitness: The fitness model.  Must be either \"multiplicative\" or \"additive\".\n\n    :raises: RuntimeError if parameters do not pass checks\n\n    Example:\n\n    >>> import fwdpy\n    >>> import numpy as np\n    >>> #Our \"neutral\" regions will be from positions [0,1) and [2,3).\n    >>> #The regions will have equal weights, and thus will each get\n    >>> #1/2 of newly-arising, neutral mutations\n    >>> nregions = [fwdpy.Region(0,1,1),fwdpy.Region(2,3,1)]\n    >>> #Our \"selected\" mutations will have positions on the continuous\n    >>> #interval [1,2).  There will be two classes of such mutations,\n    >>> #each with exponentially-distrubted selection coe""fficients.\n    >>> #The first class will have a mean of s = -0.1 (deleterious), and the second\n    >>> #will have a mean of 1e-3 (adaptive).  The former will be 100x more common than\n    >>> #the latter, as the weights are 1 and 0.01, respectively.\n    >>> sregions = [fwdpy.ExpS(1,2,1,-0.1),fwdpy.ExpS(1,2,0.01,0.001)]\n    >>> #Recombination will be uniform along the interval [0,3).\n    >>> rregions = [fwdpy.Region(0,3,1)]\n    >>> rng = fwdpy.GSLrng(100)\n    >>> #popsizes are NumPy arrays of 32bit unsigned integers\n    >>> #Initial pop size will be N = 1,000, and\n    >>> #the type must be uint32 (32 bit unsigned integer)\n    >>> popsizes = np.array([1000],dtype=np.uint32)\n    >>> #The simulation will be for 10*N generations,\n    >>> #so we replicate that value in the array\n    >>> popsizes=np.tile(popsizes,100)\n    >>> #Simulate 1 deme under this model.\n    >>> #The total neutral mutation rate is 1e-3,\n    >>> #which is also the recombination rate.\n    >>> #The total mutation rate to selected variants is 0.1*(the neutral mutation rate).\n    >>> pops = fwdpy.evolve_regions(rng,1,1000,popsizes[0:],0.001,0.0001,0.001,nregions,sregions,rregions)\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_19evolve_regions = {"evolve_regions", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_19evolve_regions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_18evolve_regions};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_19evolve_regions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng = 0;
  int __pyx_v_npops;
  int __pyx_v_N;
  __Pyx_memviewslice __pyx_v_nlist = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_mu_neutral;
  double __pyx_v_mu_selected;
  double __pyx_v_recrate;
  PyObject *__pyx_v_nregions = 0;
  PyObject *__pyx_v_sregions = 0;
  PyObject *__pyx_v_recregions = 0;
  double __pyx_v_f;
  double __pyx_v_scaling;
  char const *__pyx_v_fitness;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evolve_regions (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rng,&__pyx_n_s_npops,&__pyx_n_s_N,&__pyx_n_s_nlist,&__pyx_n_s_mu_neutral,&__pyx_n_s_mu_selected,&__pyx_n_s_recrate,&__pyx_n_s_nregions,&__pyx_n_s_sregions,&__pyx_n_s_recregions,&__pyx_n_s_f,&__pyx_n_s_scaling,&__pyx_n_s_fitness,0};
    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rng)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_npops)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions", 0, 10, 13, 1); __PYX_ERR(5, 29, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_N)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions", 0, 10, 13, 2); __PYX_ERR(5, 29, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions", 0, 10, 13, 3); __PYX_ERR(5, 29, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mu_neutral)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions", 0, 10, 13, 4); __PYX_ERR(5, 29, __pyx_L3_error)
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mu_selected)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions", 0, 10, 13, 5); __PYX_ERR(5, 29, __pyx_L3_error)
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_recrate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions", 0, 10, 13, 6); __PYX_ERR(5, 29, __pyx_L3_error)
        }
        case  7:
        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions", 0, 10, 13, 7); __PYX_ERR(5, 29, __pyx_L3_error)
        }
        case  8:
        if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions", 0, 10, 13, 8); __PYX_ERR(5, 29, __pyx_L3_error)
        }
        case  9:
        if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_recregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions", 0, 10, 13, 9); __PYX_ERR(5, 29, __pyx_L3_error)
        }
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f);
          if (value) { values[10] = value; kw_args--; }
        }
        case 11:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scaling);
          if (value) { values[11] = value; kw_args--; }
        }
        case 12:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fitness);
          if (value) { values[12] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evolve_regions") < 0)) __PYX_ERR(5, 29, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rng = ((struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *)values[0]);
    __pyx_v_npops = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_npops == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 30, __pyx_L3_error)
    __pyx_v_N = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_N == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 31, __pyx_L3_error)
    __pyx_v_nlist = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_int(values[3]); if (unlikely(!__pyx_v_nlist.memview)) __PYX_ERR(5, 32, __pyx_L3_error)
    __pyx_v_mu_neutral = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_mu_neutral == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 33, __pyx_L3_error)
    __pyx_v_mu_selected = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_mu_selected == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 34, __pyx_L3_error)
    __pyx_v_recrate = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_recrate == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 35, __pyx_L3_error)
    __pyx_v_nregions = ((PyObject*)values[7]);
    __pyx_v_sregions = ((PyObject*)values[8]);
    __pyx_v_recregions = ((PyObject*)values[9]);
    if (values[10]) {
      __pyx_v_f = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_f == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 39, __pyx_L3_error)
    } else {
      __pyx_v_f = ((double)0.0);
    }
    if (values[11]) {
      __pyx_v_scaling = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_scaling == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 40, __pyx_L3_error)
    } else {
      __pyx_v_scaling = ((double)2.0);
    }
    if (values[12]) {
      __pyx_v_fitness = __Pyx_PyObject_AsString(values[12]); if (unlikely((!__pyx_v_fitness) && PyErr_Occurred())) __PYX_ERR(5, 41, __pyx_L3_error)
    } else {
      __pyx_v_fitness = ((char const *)((char const *)"multiplicative"));
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evolve_regions", 0, 10, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(5, 29, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.evolve_regions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rng), __pyx_ptype_5fwdpy_5fwdpy_GSLrng, 1, "rng", 0))) __PYX_ERR(5, 29, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nregions), (&PyList_Type), 1, "nregions", 1))) __PYX_ERR(5, 36, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sregions), (&PyList_Type), 1, "sregions", 1))) __PYX_ERR(5, 37, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_recregions), (&PyList_Type), 1, "recregions", 1))) __PYX_ERR(5, 38, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_18evolve_regions(__pyx_self, __pyx_v_rng, __pyx_v_npops, __pyx_v_N, __pyx_v_nlist, __pyx_v_mu_neutral, __pyx_v_mu_selected, __pyx_v_recrate, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions, __pyx_v_f, __pyx_v_scaling, __pyx_v_fitness);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_18evolve_regions(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng, int __pyx_v_npops, int __pyx_v_N, __Pyx_memviewslice __pyx_v_nlist, double __pyx_v_mu_neutral, double __pyx_v_mu_selected, double __pyx_v_recrate, PyObject *__pyx_v_nregions, PyObject *__pyx_v_sregions, PyObject *__pyx_v_recregions, double __pyx_v_f, double __pyx_v_scaling, char const *__pyx_v_fitness) {
  struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_pops = NULL;
  struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler *__pyx_v_donothing = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  __Pyx_RefNannySetupContext("evolve_regions", 0);

  /* "fwdpy/evolve_regions.pyx":92
 *     >>> pops = fwdpy.evolve_regions(rng,1,1000,popsizes[0:],0.001,0.0001,0.001,nregions,sregions,rregions)
 *     """
 *     check_input_params(mu_neutral,mu_selected,recrate,nregions,sregions,recregions)             # <<<<<<<<<<<<<<
 *     pops = SpopVec(npops,N)
 *     donothing = NothingSampler(npops)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_input_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_mu_neutral); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_mu_selected); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_recrate); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[7] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 92, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[7] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 92, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_nregions);
    __Pyx_GIVEREF(__pyx_v_nregions);
    PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_v_nregions);
    __Pyx_INCREF(__pyx_v_sregions);
    __Pyx_GIVEREF(__pyx_v_sregions);
    PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_7, __pyx_v_sregions);
    __Pyx_INCREF(__pyx_v_recregions);
    __Pyx_GIVEREF(__pyx_v_recregions);
    PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_7, __pyx_v_recregions);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/evolve_regions.pyx":93
 *     """
 *     check_input_params(mu_neutral,mu_selected,recrate,nregions,sregions,recregions)
 *     pops = SpopVec(npops,N)             # <<<<<<<<<<<<<<
 *     donothing = NothingSampler(npops)
 *     evolve_regions_sampler(rng,pops,donothing,nlist,
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_npops); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_N); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5fwdpy_5fwdpy_SpopVec), __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_pops = ((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "fwdpy/evolve_regions.pyx":94
 *     check_input_params(mu_neutral,mu_selected,recrate,nregions,sregions,recregions)
 *     pops = SpopVec(npops,N)
 *     donothing = NothingSampler(npops)             # <<<<<<<<<<<<<<
 *     evolve_regions_sampler(rng,pops,donothing,nlist,
 *                            mu_neutral,mu_selected,recrate,
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_npops); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5fwdpy_5fwdpy_NothingSampler), __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_donothing = ((struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "fwdpy/evolve_regions.pyx":95
 *     pops = SpopVec(npops,N)
 *     donothing = NothingSampler(npops)
 *     evolve_regions_sampler(rng,pops,donothing,nlist,             # <<<<<<<<<<<<<<
 *                            mu_neutral,mu_selected,recrate,
 *                            nregions,sregions,recregions,len(nlist),
 */
  __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_evolve_regions_sampler); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_nlist, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "fwdpy/evolve_regions.pyx":96
 *     donothing = NothingSampler(npops)
 *     evolve_regions_sampler(rng,pops,donothing,nlist,
 *                            mu_neutral,mu_selected,recrate,             # <<<<<<<<<<<<<<
 *                            nregions,sregions,recregions,len(nlist),
 *                            f,scaling,fitness)
 */
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_mu_neutral); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_mu_selected); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_recrate); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "fwdpy/evolve_regions.pyx":97
 *     evolve_regions_sampler(rng,pops,donothing,nlist,
 *                            mu_neutral,mu_selected,recrate,
 *                            nregions,sregions,recregions,len(nlist),             # <<<<<<<<<<<<<<
 *                            f,scaling,fitness)
 *     return pops
 */
  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_nlist, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_9 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(5, 97, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "fwdpy/evolve_regions.pyx":98
 *                            mu_neutral,mu_selected,recrate,
 *                            nregions,sregions,recregions,len(nlist),
 *                            f,scaling,fitness)             # <<<<<<<<<<<<<<
 *     return pops
 * 
 */
  __pyx_t_10 = PyFloat_FromDouble(__pyx_v_f); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyFloat_FromDouble(__pyx_v_scaling); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = __Pyx_PyBytes_FromString(__pyx_v_fitness); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_13)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[15] = {__pyx_t_13, ((PyObject *)__pyx_v_rng), ((PyObject *)__pyx_v_pops), ((PyObject *)__pyx_v_donothing), __pyx_t_1, __pyx_t_5, __pyx_t_4, __pyx_t_3, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions, __pyx_t_6, __pyx_t_10, __pyx_t_11, __pyx_t_12};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 14+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 95, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[15] = {__pyx_t_13, ((PyObject *)__pyx_v_rng), ((PyObject *)__pyx_v_pops), ((PyObject *)__pyx_v_donothing), __pyx_t_1, __pyx_t_5, __pyx_t_4, __pyx_t_3, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions, __pyx_t_6, __pyx_t_10, __pyx_t_11, __pyx_t_12};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 14+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 95, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  } else
  #endif
  {
    __pyx_t_14 = PyTuple_New(14+__pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 95, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    if (__pyx_t_13) {
      __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_rng));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_rng));
    PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_7, ((PyObject *)__pyx_v_rng));
    __Pyx_INCREF(((PyObject *)__pyx_v_pops));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_pops));
    PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_7, ((PyObject *)__pyx_v_pops));
    __Pyx_INCREF(((PyObject *)__pyx_v_donothing));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_donothing));
    PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_7, ((PyObject *)__pyx_v_donothing));
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_7, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_7, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_14, 5+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_14, 6+__pyx_t_7, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_nregions);
    __Pyx_GIVEREF(__pyx_v_nregions);
    PyTuple_SET_ITEM(__pyx_t_14, 7+__pyx_t_7, __pyx_v_nregions);
    __Pyx_INCREF(__pyx_v_sregions);
    __Pyx_GIVEREF(__pyx_v_sregions);
    PyTuple_SET_ITEM(__pyx_t_14, 8+__pyx_t_7, __pyx_v_sregions);
    __Pyx_INCREF(__pyx_v_recregions);
    __Pyx_GIVEREF(__pyx_v_recregions);
    PyTuple_SET_ITEM(__pyx_t_14, 9+__pyx_t_7, __pyx_v_recregions);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_14, 10+__pyx_t_7, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_14, 11+__pyx_t_7, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_14, 12+__pyx_t_7, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_14, 13+__pyx_t_7, __pyx_t_12);
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_3 = 0;
    __pyx_t_6 = 0;
    __pyx_t_10 = 0;
    __pyx_t_11 = 0;
    __pyx_t_12 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 95, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "fwdpy/evolve_regions.pyx":99
 *                            nregions,sregions,recregions,len(nlist),
 *                            f,scaling,fitness)
 *     return pops             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_pops));
  __pyx_r = ((PyObject *)__pyx_v_pops);
  goto __pyx_L0;

  /* "fwdpy/evolve_regions.pyx":29
 * 
 * @cython.boundscheck(False)
 * def evolve_regions(GSLrng rng,             # <<<<<<<<<<<<<<
 *                    int npops,
 *                    int N,
 */

  /* function exit code */
  __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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("fwdpy.fwdpy.evolve_regions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pops);
  __Pyx_XDECREF((PyObject *)__pyx_v_donothing);
  __PYX_XDEC_MEMVIEW(&__pyx_v_nlist, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/evolve_regions.pyx":102
 * 
 * @cython.boundscheck(False)
 * def evolve_regions_more(GSLrng rng,             # <<<<<<<<<<<<<<
 *                         SpopVec pops,
 *                         unsigned[:] nlist,
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_21evolve_regions_more(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_20evolve_regions_more[] = "\n    Continue to evolve a region with variable mutation, fitness effects, and recombination rates.\n\n    :param rng: a :class:`GSLrng`\n    :param pops: a :class:`SpopVec`\n    :param nlist: An array view of a NumPy array.  This represents the population sizes over time.  The length of this view is the length of the simulation in generations. The view must be of an array of 32 bit, unsigned integers (see example).\n    :param mu_neutral: The mutation rate to variants not affecting fitness (\"neutral\" mutations).  The unit is per gamete, per generation.\n    :param mu_selected: The mutation rate to variants affecting fitness (\"selected\" mutations).  The unit is per gamete, per generation.\n    :param recrate: The recombination rate in the regions (per diploid, per generation)\n    :param nregions: A list specifying where neutral mutations occur\n    :param sregions: A list specifying where selected mutations occur\n    :param recregions: A list specifying how the genetic map varies along the region\n    :param f: The selfing probabilty\n    :param scaling: For a single mutation, fitness is calculated as 1, 1+sh, and 1+scaling*s for genotypes AA, Aa, and aa, respectively.\n    :param fitness: The fitness model.  Must be either \"multiplicative\" or \"additive\".\n\n    :raises: RuntimeError if parameters do not pass checks\n\n    Example:\n\n    >>> # See docstring for fwdpy.evolve_regions for the gory details\n    >>> import fwdpy\n    >>> import numpy as np\n    >>> nregions = [fwdpy.Region(0,1,1),fwdpy.Region(2,3,1)]\n    >>> sregions = [fwdpy.ExpS(1,2,1,-0.1),fwdpy.ExpS(1,2,0.01,0.001)]\n    >>> rregions = [fwdpy.Region(0,3,1)]\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes = np.array([1000],dtype=np.uint32)\n    >>> # Evolve for 5N generations initially\n    >>> popsizes=np.tile(popsizes,5000)\n    >>> pops = fwdpy.evolve_regions(rng,1,1000,popsizes[0:],0.001,0.0001,0.001,nregions,sregions,rregions)\n    >>> # Evolve for another 5N generations\n    >>> f""wdpy.evolve_regions_more(rng,pops,popsizes[0:],0.001,0.0001,0.001,nregions,sregions,rregions)\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_21evolve_regions_more = {"evolve_regions_more", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_21evolve_regions_more, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_20evolve_regions_more};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_21evolve_regions_more(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng = 0;
  struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_pops = 0;
  __Pyx_memviewslice __pyx_v_nlist = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_mu_neutral;
  double __pyx_v_mu_selected;
  double __pyx_v_recrate;
  PyObject *__pyx_v_nregions = 0;
  PyObject *__pyx_v_sregions = 0;
  PyObject *__pyx_v_recregions = 0;
  double __pyx_v_f;
  double __pyx_v_scaling;
  char const *__pyx_v_fitness;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evolve_regions_more (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rng,&__pyx_n_s_pops,&__pyx_n_s_nlist,&__pyx_n_s_mu_neutral,&__pyx_n_s_mu_selected,&__pyx_n_s_recrate,&__pyx_n_s_nregions,&__pyx_n_s_sregions,&__pyx_n_s_recregions,&__pyx_n_s_f,&__pyx_n_s_scaling,&__pyx_n_s_fitness,0};
    PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rng)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pops)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_more", 0, 9, 12, 1); __PYX_ERR(5, 102, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_more", 0, 9, 12, 2); __PYX_ERR(5, 102, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mu_neutral)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_more", 0, 9, 12, 3); __PYX_ERR(5, 102, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mu_selected)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_more", 0, 9, 12, 4); __PYX_ERR(5, 102, __pyx_L3_error)
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_recrate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_more", 0, 9, 12, 5); __PYX_ERR(5, 102, __pyx_L3_error)
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_more", 0, 9, 12, 6); __PYX_ERR(5, 102, __pyx_L3_error)
        }
        case  7:
        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_more", 0, 9, 12, 7); __PYX_ERR(5, 102, __pyx_L3_error)
        }
        case  8:
        if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_recregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_more", 0, 9, 12, 8); __PYX_ERR(5, 102, __pyx_L3_error)
        }
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f);
          if (value) { values[9] = value; kw_args--; }
        }
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scaling);
          if (value) { values[10] = value; kw_args--; }
        }
        case 11:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fitness);
          if (value) { values[11] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evolve_regions_more") < 0)) __PYX_ERR(5, 102, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rng = ((struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *)values[0]);
    __pyx_v_pops = ((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)values[1]);
    __pyx_v_nlist = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_int(values[2]); if (unlikely(!__pyx_v_nlist.memview)) __PYX_ERR(5, 104, __pyx_L3_error)
    __pyx_v_mu_neutral = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_mu_neutral == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 105, __pyx_L3_error)
    __pyx_v_mu_selected = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_mu_selected == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 106, __pyx_L3_error)
    __pyx_v_recrate = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_recrate == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 107, __pyx_L3_error)
    __pyx_v_nregions = ((PyObject*)values[6]);
    __pyx_v_sregions = ((PyObject*)values[7]);
    __pyx_v_recregions = ((PyObject*)values[8]);
    if (values[9]) {
      __pyx_v_f = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_f == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 111, __pyx_L3_error)
    } else {
      __pyx_v_f = ((double)0.0);
    }
    if (values[10]) {
      __pyx_v_scaling = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_scaling == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 112, __pyx_L3_error)
    } else {
      __pyx_v_scaling = ((double)2.0);
    }
    if (values[11]) {
      __pyx_v_fitness = __Pyx_PyObject_AsString(values[11]); if (unlikely((!__pyx_v_fitness) && PyErr_Occurred())) __PYX_ERR(5, 113, __pyx_L3_error)
    } else {
      __pyx_v_fitness = ((char const *)((char const *)"multiplicative"));
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evolve_regions_more", 0, 9, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(5, 102, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.evolve_regions_more", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rng), __pyx_ptype_5fwdpy_5fwdpy_GSLrng, 1, "rng", 0))) __PYX_ERR(5, 102, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pops), __pyx_ptype_5fwdpy_5fwdpy_SpopVec, 1, "pops", 0))) __PYX_ERR(5, 103, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nregions), (&PyList_Type), 1, "nregions", 1))) __PYX_ERR(5, 108, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sregions), (&PyList_Type), 1, "sregions", 1))) __PYX_ERR(5, 109, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_recregions), (&PyList_Type), 1, "recregions", 1))) __PYX_ERR(5, 110, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_20evolve_regions_more(__pyx_self, __pyx_v_rng, __pyx_v_pops, __pyx_v_nlist, __pyx_v_mu_neutral, __pyx_v_mu_selected, __pyx_v_recrate, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions, __pyx_v_f, __pyx_v_scaling, __pyx_v_fitness);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_20evolve_regions_more(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_pops, __Pyx_memviewslice __pyx_v_nlist, double __pyx_v_mu_neutral, double __pyx_v_mu_selected, double __pyx_v_recrate, PyObject *__pyx_v_nregions, PyObject *__pyx_v_sregions, PyObject *__pyx_v_recregions, double __pyx_v_f, double __pyx_v_scaling, char const *__pyx_v_fitness) {
  struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler *__pyx_v_donothing = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  __Pyx_RefNannySetupContext("evolve_regions_more", 0);

  /* "fwdpy/evolve_regions.pyx":148
 *     >>> fwdpy.evolve_regions_more(rng,pops,popsizes[0:],0.001,0.0001,0.001,nregions,sregions,rregions)
 *     """
 *     donothing = NothingSampler(len(pops))             # <<<<<<<<<<<<<<
 *     evolve_regions_sampler(rng,pops,donothing,nlist,
 *                            mu_neutral,mu_selected,recrate,
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pops)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(5, 148, __pyx_L1_error)
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5fwdpy_5fwdpy_NothingSampler), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_donothing = ((struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "fwdpy/evolve_regions.pyx":149
 *     """
 *     donothing = NothingSampler(len(pops))
 *     evolve_regions_sampler(rng,pops,donothing,nlist,             # <<<<<<<<<<<<<<
 *                            mu_neutral,mu_selected,recrate,
 *                            nregions,sregions,recregions,int(len(nlist)),
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_evolve_regions_sampler); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_nlist, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "fwdpy/evolve_regions.pyx":150
 *     donothing = NothingSampler(len(pops))
 *     evolve_regions_sampler(rng,pops,donothing,nlist,
 *                            mu_neutral,mu_selected,recrate,             # <<<<<<<<<<<<<<
 *                            nregions,sregions,recregions,int(len(nlist)),
 *                            f,scaling,fitness)
 */
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_mu_neutral); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_mu_selected); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_recrate); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "fwdpy/evolve_regions.pyx":151
 *     evolve_regions_sampler(rng,pops,donothing,nlist,
 *                            mu_neutral,mu_selected,recrate,
 *                            nregions,sregions,recregions,int(len(nlist)),             # <<<<<<<<<<<<<<
 *                            f,scaling,fitness)
 * 
 */
  __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_nlist, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(5, 151, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)(&PyInt_Type)), __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "fwdpy/evolve_regions.pyx":152
 *                            mu_neutral,mu_selected,recrate,
 *                            nregions,sregions,recregions,int(len(nlist)),
 *                            f,scaling,fitness)             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_f); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyFloat_FromDouble(__pyx_v_scaling); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = __Pyx_PyBytes_FromString(__pyx_v_fitness); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = NULL;
  __pyx_t_13 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_13 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[15] = {__pyx_t_12, ((PyObject *)__pyx_v_rng), ((PyObject *)__pyx_v_pops), ((PyObject *)__pyx_v_donothing), __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_13, 14+__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 149, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[15] = {__pyx_t_12, ((PyObject *)__pyx_v_rng), ((PyObject *)__pyx_v_pops), ((PyObject *)__pyx_v_donothing), __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_13, 14+__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 149, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  } else
  #endif
  {
    __pyx_t_14 = PyTuple_New(14+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    if (__pyx_t_12) {
      __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12); __pyx_t_12 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_rng));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_rng));
    PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, ((PyObject *)__pyx_v_rng));
    __Pyx_INCREF(((PyObject *)__pyx_v_pops));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_pops));
    PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, ((PyObject *)__pyx_v_pops));
    __Pyx_INCREF(((PyObject *)__pyx_v_donothing));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_donothing));
    PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_13, ((PyObject *)__pyx_v_donothing));
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_13, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_13, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_14, 5+__pyx_t_13, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_14, 6+__pyx_t_13, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_nregions);
    __Pyx_GIVEREF(__pyx_v_nregions);
    PyTuple_SET_ITEM(__pyx_t_14, 7+__pyx_t_13, __pyx_v_nregions);
    __Pyx_INCREF(__pyx_v_sregions);
    __Pyx_GIVEREF(__pyx_v_sregions);
    PyTuple_SET_ITEM(__pyx_t_14, 8+__pyx_t_13, __pyx_v_sregions);
    __Pyx_INCREF(__pyx_v_recregions);
    __Pyx_GIVEREF(__pyx_v_recregions);
    PyTuple_SET_ITEM(__pyx_t_14, 9+__pyx_t_13, __pyx_v_recregions);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_14, 10+__pyx_t_13, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_14, 11+__pyx_t_13, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_14, 12+__pyx_t_13, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_14, 13+__pyx_t_13, __pyx_t_11);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_t_11 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "fwdpy/evolve_regions.pyx":102
 * 
 * @cython.boundscheck(False)
 * def evolve_regions_more(GSLrng rng,             # <<<<<<<<<<<<<<
 *                         SpopVec pops,
 *                         unsigned[:] nlist,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("fwdpy.fwdpy.evolve_regions_more", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_donothing);
  __PYX_XDEC_MEMVIEW(&__pyx_v_nlist, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/evolve_regions.pyx":155
 * 
 * @cython.boundscheck(False)
 * def evolve_regions_sampler(GSLrng rng,             # <<<<<<<<<<<<<<
 *                            SpopVec pops,
 *                            TemporalSampler slist,
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_23evolve_regions_sampler(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_22evolve_regions_sampler[] = "\n    Evolve a single population under standard population genetic fitness models and apply a \"sampler\" at regular intervals.\n    \n    :param rng: a :class:`GSLrng`\n    :param pops: A :class:`SpopVec`\n    :param slist: A :class:`TemporalSampler`.\n    :param nlist: An array view of a NumPy array.  This represents the population sizes over time.  The length of this view is the length of the simulation in generations. The view must be of an array of 32 bit, unsigned integers (see example).\n    :param mu_neutral: The mutation rate to variants not affecting fitness (\"neutral\" mutations).  The unit is per gamete, per generation.\n    :param mu_selected: The mutation rate to variants affecting fitness (\"selected\" mutations).  The unit is per gamete, per generation.\n    :param recrate: The recombination rate in the regions (per diploid, per generation)\n    :param nregions: A list specifying where neutral mutations occur\n    :param sregions: A list specifying where selected mutations occur\n    :param recregions: A list specifying how the genetic map varies along the region\n    :param sample: Apply the temporal sample every 'sample' generations during the simulation.\n    :param f: The selfing probabilty\n    :param scaling: For a single mutation, fitness is calculated as 1, 1+sh, and 1+scaling*s for genotypes AA, Aa, and aa, respectively.\n    :param fitness: The fitness model.  Must be either \"multiplicative\" or \"additive\".\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_23evolve_regions_sampler = {"evolve_regions_sampler", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_23evolve_regions_sampler, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_22evolve_regions_sampler};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_23evolve_regions_sampler(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng = 0;
  struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_pops = 0;
  struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_slist = 0;
  __Pyx_memviewslice __pyx_v_nlist = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_mu_neutral;
  double __pyx_v_mu_selected;
  double __pyx_v_recrate;
  PyObject *__pyx_v_nregions = 0;
  PyObject *__pyx_v_sregions = 0;
  PyObject *__pyx_v_recregions = 0;
  int __pyx_v_sample;
  double __pyx_v_f;
  double __pyx_v_scaling;
  char const *__pyx_v_fitness;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evolve_regions_sampler (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rng,&__pyx_n_s_pops,&__pyx_n_s_slist,&__pyx_n_s_nlist,&__pyx_n_s_mu_neutral,&__pyx_n_s_mu_selected,&__pyx_n_s_recrate,&__pyx_n_s_nregions,&__pyx_n_s_sregions,&__pyx_n_s_recregions,&__pyx_n_s_sample,&__pyx_n_s_f,&__pyx_n_s_scaling,&__pyx_n_s_fitness,0};
    PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rng)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pops)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler", 0, 11, 14, 1); __PYX_ERR(5, 155, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_slist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler", 0, 11, 14, 2); __PYX_ERR(5, 155, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler", 0, 11, 14, 3); __PYX_ERR(5, 155, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mu_neutral)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler", 0, 11, 14, 4); __PYX_ERR(5, 155, __pyx_L3_error)
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mu_selected)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler", 0, 11, 14, 5); __PYX_ERR(5, 155, __pyx_L3_error)
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_recrate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler", 0, 11, 14, 6); __PYX_ERR(5, 155, __pyx_L3_error)
        }
        case  7:
        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler", 0, 11, 14, 7); __PYX_ERR(5, 155, __pyx_L3_error)
        }
        case  8:
        if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler", 0, 11, 14, 8); __PYX_ERR(5, 155, __pyx_L3_error)
        }
        case  9:
        if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_recregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler", 0, 11, 14, 9); __PYX_ERR(5, 155, __pyx_L3_error)
        }
        case 10:
        if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sample)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler", 0, 11, 14, 10); __PYX_ERR(5, 155, __pyx_L3_error)
        }
        case 11:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f);
          if (value) { values[11] = value; kw_args--; }
        }
        case 12:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scaling);
          if (value) { values[12] = value; kw_args--; }
        }
        case 13:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fitness);
          if (value) { values[13] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evolve_regions_sampler") < 0)) __PYX_ERR(5, 155, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rng = ((struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *)values[0]);
    __pyx_v_pops = ((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)values[1]);
    __pyx_v_slist = ((struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *)values[2]);
    __pyx_v_nlist = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_int(values[3]); if (unlikely(!__pyx_v_nlist.memview)) __PYX_ERR(5, 158, __pyx_L3_error)
    __pyx_v_mu_neutral = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_mu_neutral == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 159, __pyx_L3_error)
    __pyx_v_mu_selected = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_mu_selected == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 160, __pyx_L3_error)
    __pyx_v_recrate = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_recrate == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 161, __pyx_L3_error)
    __pyx_v_nregions = ((PyObject*)values[7]);
    __pyx_v_sregions = ((PyObject*)values[8]);
    __pyx_v_recregions = ((PyObject*)values[9]);
    __pyx_v_sample = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_sample == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 165, __pyx_L3_error)
    if (values[11]) {
      __pyx_v_f = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_f == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 166, __pyx_L3_error)
    } else {
      __pyx_v_f = ((double)0.0);
    }
    if (values[12]) {
      __pyx_v_scaling = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_scaling == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 167, __pyx_L3_error)
    } else {
      __pyx_v_scaling = ((double)2.0);
    }
    if (values[13]) {
      __pyx_v_fitness = __Pyx_PyObject_AsString(values[13]); if (unlikely((!__pyx_v_fitness) && PyErr_Occurred())) __PYX_ERR(5, 168, __pyx_L3_error)
    } else {
      __pyx_v_fitness = ((char const *)((char const *)"multiplicative"));
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler", 0, 11, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(5, 155, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.evolve_regions_sampler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rng), __pyx_ptype_5fwdpy_5fwdpy_GSLrng, 1, "rng", 0))) __PYX_ERR(5, 155, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pops), __pyx_ptype_5fwdpy_5fwdpy_SpopVec, 1, "pops", 0))) __PYX_ERR(5, 156, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slist), __pyx_ptype_5fwdpy_5fwdpy_TemporalSampler, 1, "slist", 0))) __PYX_ERR(5, 157, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nregions), (&PyList_Type), 1, "nregions", 1))) __PYX_ERR(5, 162, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sregions), (&PyList_Type), 1, "sregions", 1))) __PYX_ERR(5, 163, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_recregions), (&PyList_Type), 1, "recregions", 1))) __PYX_ERR(5, 164, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_22evolve_regions_sampler(__pyx_self, __pyx_v_rng, __pyx_v_pops, __pyx_v_slist, __pyx_v_nlist, __pyx_v_mu_neutral, __pyx_v_mu_selected, __pyx_v_recrate, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions, __pyx_v_sample, __pyx_v_f, __pyx_v_scaling, __pyx_v_fitness);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_22evolve_regions_sampler(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_pops, struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_slist, __Pyx_memviewslice __pyx_v_nlist, double __pyx_v_mu_neutral, double __pyx_v_mu_selected, double __pyx_v_recrate, PyObject *__pyx_v_nregions, PyObject *__pyx_v_sregions, PyObject *__pyx_v_recregions, int __pyx_v_sample, double __pyx_v_f, double __pyx_v_scaling, char const *__pyx_v_fitness) {
  struct __pyx_obj_5fwdpy_7fitness_SpopMult *__pyx_v_ffm = NULL;
  struct __pyx_obj_5fwdpy_7fitness_SpopAdditive *__pyx_v_ffa = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("evolve_regions_sampler", 0);

  /* "fwdpy/evolve_regions.pyx":188
 *     """
 * 
 *     if fitness == b'multiplicative':             # <<<<<<<<<<<<<<
 *         ffm = SpopMult(scaling)
 *         evolve_regions_sampler_fitness(rng,pops,slist,ffm,nlist,
 */
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_fitness); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_n_b_multiplicative, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(5, 188, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "fwdpy/evolve_regions.pyx":189
 * 
 *     if fitness == b'multiplicative':
 *         ffm = SpopMult(scaling)             # <<<<<<<<<<<<<<
 *         evolve_regions_sampler_fitness(rng,pops,slist,ffm,nlist,
 *                                        mu_neutral,mu_selected,recrate,
 */
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_scaling); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5fwdpy_7fitness_SpopMult), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_ffm = ((struct __pyx_obj_5fwdpy_7fitness_SpopMult *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "fwdpy/evolve_regions.pyx":190
 *     if fitness == b'multiplicative':
 *         ffm = SpopMult(scaling)
 *         evolve_regions_sampler_fitness(rng,pops,slist,ffm,nlist,             # <<<<<<<<<<<<<<
 *                                        mu_neutral,mu_selected,recrate,
 *                                        nregions,sregions,recregions,
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_evolve_regions_sampler_fitness); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 190, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_nlist, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 190, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "fwdpy/evolve_regions.pyx":191
 *         ffm = SpopMult(scaling)
 *         evolve_regions_sampler_fitness(rng,pops,slist,ffm,nlist,
 *                                        mu_neutral,mu_selected,recrate,             # <<<<<<<<<<<<<<
 *                                        nregions,sregions,recregions,
 *                                        sample,f)
 */
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_mu_neutral); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_mu_selected); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_recrate); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "fwdpy/evolve_regions.pyx":193
 *                                        mu_neutral,mu_selected,recrate,
 *                                        nregions,sregions,recregions,
 *                                        sample,f)             # <<<<<<<<<<<<<<
 *     elif fitness == b'additive':
 *         ffa = SpopAdditive(scaling)
 */
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_sample); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_f); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[14] = {__pyx_t_10, ((PyObject *)__pyx_v_rng), ((PyObject *)__pyx_v_pops), ((PyObject *)__pyx_v_slist), ((PyObject *)__pyx_v_ffm), __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions, __pyx_t_8, __pyx_t_9};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 13+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 190, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[14] = {__pyx_t_10, ((PyObject *)__pyx_v_rng), ((PyObject *)__pyx_v_pops), ((PyObject *)__pyx_v_slist), ((PyObject *)__pyx_v_ffm), __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions, __pyx_t_8, __pyx_t_9};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 13+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 190, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(13+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_rng));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_rng));
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, ((PyObject *)__pyx_v_rng));
      __Pyx_INCREF(((PyObject *)__pyx_v_pops));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_pops));
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, ((PyObject *)__pyx_v_pops));
      __Pyx_INCREF(((PyObject *)__pyx_v_slist));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_slist));
      PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, ((PyObject *)__pyx_v_slist));
      __Pyx_INCREF(((PyObject *)__pyx_v_ffm));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_ffm));
      PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_11, ((PyObject *)__pyx_v_ffm));
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_12, 4+__pyx_t_11, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_12, 5+__pyx_t_11, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_12, 6+__pyx_t_11, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_12, 7+__pyx_t_11, __pyx_t_7);
      __Pyx_INCREF(__pyx_v_nregions);
      __Pyx_GIVEREF(__pyx_v_nregions);
      PyTuple_SET_ITEM(__pyx_t_12, 8+__pyx_t_11, __pyx_v_nregions);
      __Pyx_INCREF(__pyx_v_sregions);
      __Pyx_GIVEREF(__pyx_v_sregions);
      PyTuple_SET_ITEM(__pyx_t_12, 9+__pyx_t_11, __pyx_v_sregions);
      __Pyx_INCREF(__pyx_v_recregions);
      __Pyx_GIVEREF(__pyx_v_recregions);
      PyTuple_SET_ITEM(__pyx_t_12, 10+__pyx_t_11, __pyx_v_recregions);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_12, 11+__pyx_t_11, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_12, 12+__pyx_t_11, __pyx_t_9);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "fwdpy/evolve_regions.pyx":188
 *     """
 * 
 *     if fitness == b'multiplicative':             # <<<<<<<<<<<<<<
 *         ffm = SpopMult(scaling)
 *         evolve_regions_sampler_fitness(rng,pops,slist,ffm,nlist,
 */
    goto __pyx_L3;
  }

  /* "fwdpy/evolve_regions.pyx":194
 *                                        nregions,sregions,recregions,
 *                                        sample,f)
 *     elif fitness == b'additive':             # <<<<<<<<<<<<<<
 *         ffa = SpopAdditive(scaling)
 *         evolve_regions_sampler_fitness(rng,pops,slist,ffa,nlist,
 */
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_fitness); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_n_b_additive, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(5, 194, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "fwdpy/evolve_regions.pyx":195
 *                                        sample,f)
 *     elif fitness == b'additive':
 *         ffa = SpopAdditive(scaling)             # <<<<<<<<<<<<<<
 *         evolve_regions_sampler_fitness(rng,pops,slist,ffa,nlist,
 *                                        mu_neutral,mu_selected,recrate,
 */
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_scaling); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5fwdpy_7fitness_SpopAdditive), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_ffa = ((struct __pyx_obj_5fwdpy_7fitness_SpopAdditive *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "fwdpy/evolve_regions.pyx":196
 *     elif fitness == b'additive':
 *         ffa = SpopAdditive(scaling)
 *         evolve_regions_sampler_fitness(rng,pops,slist,ffa,nlist,             # <<<<<<<<<<<<<<
 *                                        mu_neutral,mu_selected,recrate,
 *                                        nregions,sregions,recregions,
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_evolve_regions_sampler_fitness); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_12 = __pyx_memoryview_fromslice(__pyx_v_nlist, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);

    /* "fwdpy/evolve_regions.pyx":197
 *         ffa = SpopAdditive(scaling)
 *         evolve_regions_sampler_fitness(rng,pops,slist,ffa,nlist,
 *                                        mu_neutral,mu_selected,recrate,             # <<<<<<<<<<<<<<
 *                                        nregions,sregions,recregions,
 *                                        sample,f)
 */
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_mu_neutral); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_mu_selected); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_recrate); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);

    /* "fwdpy/evolve_regions.pyx":199
 *                                        mu_neutral,mu_selected,recrate,
 *                                        nregions,sregions,recregions,
 *                                        sample,f)             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_sample); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_f); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = NULL;
    __pyx_t_11 = 0;
    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_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[14] = {__pyx_t_4, ((PyObject *)__pyx_v_rng), ((PyObject *)__pyx_v_pops), ((PyObject *)__pyx_v_slist), ((PyObject *)__pyx_v_ffa), __pyx_t_12, __pyx_t_9, __pyx_t_8, __pyx_t_7, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions, __pyx_t_6, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 13+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 196, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[14] = {__pyx_t_4, ((PyObject *)__pyx_v_rng), ((PyObject *)__pyx_v_pops), ((PyObject *)__pyx_v_slist), ((PyObject *)__pyx_v_ffa), __pyx_t_12, __pyx_t_9, __pyx_t_8, __pyx_t_7, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions, __pyx_t_6, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 13+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 196, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(13+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_rng));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_rng));
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_11, ((PyObject *)__pyx_v_rng));
      __Pyx_INCREF(((PyObject *)__pyx_v_pops));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_pops));
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_11, ((PyObject *)__pyx_v_pops));
      __Pyx_INCREF(((PyObject *)__pyx_v_slist));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_slist));
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_11, ((PyObject *)__pyx_v_slist));
      __Pyx_INCREF(((PyObject *)__pyx_v_ffa));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_ffa));
      PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_11, ((PyObject *)__pyx_v_ffa));
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_11, __pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_10, 5+__pyx_t_11, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_10, 6+__pyx_t_11, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 7+__pyx_t_11, __pyx_t_7);
      __Pyx_INCREF(__pyx_v_nregions);
      __Pyx_GIVEREF(__pyx_v_nregions);
      PyTuple_SET_ITEM(__pyx_t_10, 8+__pyx_t_11, __pyx_v_nregions);
      __Pyx_INCREF(__pyx_v_sregions);
      __Pyx_GIVEREF(__pyx_v_sregions);
      PyTuple_SET_ITEM(__pyx_t_10, 9+__pyx_t_11, __pyx_v_sregions);
      __Pyx_INCREF(__pyx_v_recregions);
      __Pyx_GIVEREF(__pyx_v_recregions);
      PyTuple_SET_ITEM(__pyx_t_10, 10+__pyx_t_11, __pyx_v_recregions);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 11+__pyx_t_11, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 12+__pyx_t_11, __pyx_t_5);
      __pyx_t_12 = 0;
      __pyx_t_9 = 0;
      __pyx_t_8 = 0;
      __pyx_t_7 = 0;
      __pyx_t_6 = 0;
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "fwdpy/evolve_regions.pyx":194
 *                                        nregions,sregions,recregions,
 *                                        sample,f)
 *     elif fitness == b'additive':             # <<<<<<<<<<<<<<
 *         ffa = SpopAdditive(scaling)
 *         evolve_regions_sampler_fitness(rng,pops,slist,ffa,nlist,
 */
    goto __pyx_L3;
  }

  /* "fwdpy/evolve_regions.pyx":202
 * 
 *     else:
 *         raise RuntimeError("fitness must be either multiplicative or additive")             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(5, 202, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "fwdpy/evolve_regions.pyx":155
 * 
 * @cython.boundscheck(False)
 * def evolve_regions_sampler(GSLrng rng,             # <<<<<<<<<<<<<<
 *                            SpopVec pops,
 *                            TemporalSampler slist,
 */

  /* 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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("fwdpy.fwdpy.evolve_regions_sampler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ffm);
  __Pyx_XDECREF((PyObject *)__pyx_v_ffa);
  __PYX_XDEC_MEMVIEW(&__pyx_v_nlist, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/evolve_regions.pyx":205
 * 
 * @cython.boundscheck(False)
 * def evolve_regions_sampler_fitness(GSLrng rng,             # <<<<<<<<<<<<<<
 *                                    SpopVec pops,
 *                                    TemporalSampler slist,
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_25evolve_regions_sampler_fitness(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_24evolve_regions_sampler_fitness[] = "\n    Evolve a single population under arbitrary fitness models and apply a \"sampler\" at regular intervals.\n    \n    :param rng: a :class:`GSLrng`\n    :param pops: A :class:`SpopVec`\n    :param slist: A :class:`TemporalSampler`.\n    :param fitness_function: A :class:`fwdpy.fitness.SpopFitness`\n    :param nlist: An array view of a NumPy array.  This represents the population sizes over time.  The length of this view is the length of the simulation in generations. The view must be of an array of 32 bit, unsigned integers (see example).\n    :param mu_neutral: The mutation rate to variants not affecting fitness (\"neutral\" mutations).  The unit is per gamete, per generation.\n    :param mu_selected: The mutation rate to variants affecting fitness (\"selected\" mutations).  The unit is per gamete, per generation.\n    :param recrate: The recombination rate in the regions (per diploid, per generation)\n    :param nregions: A list specifying where neutral mutations occur\n    :param sregions: A list specifying where selected mutations occur\n    :param recregions: A list specifying how the genetic map varies along the region\n    :param sample: Apply the temporal sampler every 'sample' generations during the simulation. 0 means it will never get applied, which may or may not be what you want.\n    :param f: The selfing probabilty\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_25evolve_regions_sampler_fitness = {"evolve_regions_sampler_fitness", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_25evolve_regions_sampler_fitness, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_24evolve_regions_sampler_fitness};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_25evolve_regions_sampler_fitness(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng = 0;
  struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_pops = 0;
  struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_slist = 0;
  struct __pyx_obj_5fwdpy_7fitness_SpopFitness *__pyx_v_fitness_function = 0;
  __Pyx_memviewslice __pyx_v_nlist = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_mu_neutral;
  double __pyx_v_mu_selected;
  double __pyx_v_recrate;
  PyObject *__pyx_v_nregions = 0;
  PyObject *__pyx_v_sregions = 0;
  PyObject *__pyx_v_recregions = 0;
  int __pyx_v_sample;
  double __pyx_v_f;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evolve_regions_sampler_fitness (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rng,&__pyx_n_s_pops,&__pyx_n_s_slist,&__pyx_n_s_fitness_function,&__pyx_n_s_nlist,&__pyx_n_s_mu_neutral,&__pyx_n_s_mu_selected,&__pyx_n_s_recrate,&__pyx_n_s_nregions,&__pyx_n_s_sregions,&__pyx_n_s_recregions,&__pyx_n_s_sample,&__pyx_n_s_f,0};
    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rng)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pops)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler_fitness", 0, 12, 13, 1); __PYX_ERR(5, 205, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_slist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler_fitness", 0, 12, 13, 2); __PYX_ERR(5, 205, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fitness_function)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler_fitness", 0, 12, 13, 3); __PYX_ERR(5, 205, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler_fitness", 0, 12, 13, 4); __PYX_ERR(5, 205, __pyx_L3_error)
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mu_neutral)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler_fitness", 0, 12, 13, 5); __PYX_ERR(5, 205, __pyx_L3_error)
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mu_selected)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler_fitness", 0, 12, 13, 6); __PYX_ERR(5, 205, __pyx_L3_error)
        }
        case  7:
        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_recrate)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler_fitness", 0, 12, 13, 7); __PYX_ERR(5, 205, __pyx_L3_error)
        }
        case  8:
        if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler_fitness", 0, 12, 13, 8); __PYX_ERR(5, 205, __pyx_L3_error)
        }
        case  9:
        if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler_fitness", 0, 12, 13, 9); __PYX_ERR(5, 205, __pyx_L3_error)
        }
        case 10:
        if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_recregions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler_fitness", 0, 12, 13, 10); __PYX_ERR(5, 205, __pyx_L3_error)
        }
        case 11:
        if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sample)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler_fitness", 0, 12, 13, 11); __PYX_ERR(5, 205, __pyx_L3_error)
        }
        case 12:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f);
          if (value) { values[12] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evolve_regions_sampler_fitness") < 0)) __PYX_ERR(5, 205, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rng = ((struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *)values[0]);
    __pyx_v_pops = ((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)values[1]);
    __pyx_v_slist = ((struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *)values[2]);
    __pyx_v_fitness_function = ((struct __pyx_obj_5fwdpy_7fitness_SpopFitness *)values[3]);
    __pyx_v_nlist = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_int(values[4]); if (unlikely(!__pyx_v_nlist.memview)) __PYX_ERR(5, 209, __pyx_L3_error)
    __pyx_v_mu_neutral = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_mu_neutral == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 210, __pyx_L3_error)
    __pyx_v_mu_selected = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_mu_selected == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 211, __pyx_L3_error)
    __pyx_v_recrate = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_recrate == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 212, __pyx_L3_error)
    __pyx_v_nregions = ((PyObject*)values[8]);
    __pyx_v_sregions = ((PyObject*)values[9]);
    __pyx_v_recregions = ((PyObject*)values[10]);
    __pyx_v_sample = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_sample == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 216, __pyx_L3_error)
    if (values[12]) {
      __pyx_v_f = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_f == (double)-1) && PyErr_Occurred())) __PYX_ERR(5, 217, __pyx_L3_error)
    } else {
      __pyx_v_f = ((double)0.0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evolve_regions_sampler_fitness", 0, 12, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(5, 205, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.evolve_regions_sampler_fitness", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rng), __pyx_ptype_5fwdpy_5fwdpy_GSLrng, 1, "rng", 0))) __PYX_ERR(5, 205, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pops), __pyx_ptype_5fwdpy_5fwdpy_SpopVec, 1, "pops", 0))) __PYX_ERR(5, 206, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slist), __pyx_ptype_5fwdpy_5fwdpy_TemporalSampler, 1, "slist", 0))) __PYX_ERR(5, 207, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fitness_function), __pyx_ptype_5fwdpy_7fitness_SpopFitness, 1, "fitness_function", 0))) __PYX_ERR(5, 208, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nregions), (&PyList_Type), 1, "nregions", 1))) __PYX_ERR(5, 213, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sregions), (&PyList_Type), 1, "sregions", 1))) __PYX_ERR(5, 214, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_recregions), (&PyList_Type), 1, "recregions", 1))) __PYX_ERR(5, 215, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_24evolve_regions_sampler_fitness(__pyx_self, __pyx_v_rng, __pyx_v_pops, __pyx_v_slist, __pyx_v_fitness_function, __pyx_v_nlist, __pyx_v_mu_neutral, __pyx_v_mu_selected, __pyx_v_recrate, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions, __pyx_v_sample, __pyx_v_f);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_24evolve_regions_sampler_fitness(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_pops, struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_slist, struct __pyx_obj_5fwdpy_7fitness_SpopFitness *__pyx_v_fitness_function, __Pyx_memviewslice __pyx_v_nlist, double __pyx_v_mu_neutral, double __pyx_v_mu_selected, double __pyx_v_recrate, PyObject *__pyx_v_nregions, PyObject *__pyx_v_sregions, PyObject *__pyx_v_recregions, int __pyx_v_sample, double __pyx_v_f) {
  struct __pyx_obj_5fwdpy_8internal_8internal_region_manager_wrapper *__pyx_v_rmgr = NULL;
  size_t __pyx_v_listlen;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  __Pyx_RefNannySetupContext("evolve_regions_sampler_fitness", 0);

  /* "fwdpy/evolve_regions.pyx":235
 *     :param f: The selfing probabilty
 *     """
 *     check_input_params(mu_neutral,mu_selected,recrate,nregions,sregions,recregions)             # <<<<<<<<<<<<<<
 *     if sample < 0:
 *         raise RuntimeError("sample must be >= 0")
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_input_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_mu_neutral); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_mu_selected); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_recrate); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[7] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 235, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[7] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 235, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_nregions);
    __Pyx_GIVEREF(__pyx_v_nregions);
    PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_v_nregions);
    __Pyx_INCREF(__pyx_v_sregions);
    __Pyx_GIVEREF(__pyx_v_sregions);
    PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_7, __pyx_v_sregions);
    __Pyx_INCREF(__pyx_v_recregions);
    __Pyx_GIVEREF(__pyx_v_recregions);
    PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_7, __pyx_v_recregions);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/evolve_regions.pyx":236
 *     """
 *     check_input_params(mu_neutral,mu_selected,recrate,nregions,sregions,recregions)
 *     if sample < 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("sample must be >= 0")
 *     if f < 0.:
 */
  __pyx_t_9 = ((__pyx_v_sample < 0) != 0);
  if (__pyx_t_9) {

    /* "fwdpy/evolve_regions.pyx":237
 *     check_input_params(mu_neutral,mu_selected,recrate,nregions,sregions,recregions)
 *     if sample < 0:
 *         raise RuntimeError("sample must be >= 0")             # <<<<<<<<<<<<<<
 *     if f < 0.:
 *         warnings.warn("f < 0 will be treated as 0")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(5, 237, __pyx_L1_error)

    /* "fwdpy/evolve_regions.pyx":236
 *     """
 *     check_input_params(mu_neutral,mu_selected,recrate,nregions,sregions,recregions)
 *     if sample < 0:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("sample must be >= 0")
 *     if f < 0.:
 */
  }

  /* "fwdpy/evolve_regions.pyx":238
 *     if sample < 0:
 *         raise RuntimeError("sample must be >= 0")
 *     if f < 0.:             # <<<<<<<<<<<<<<
 *         warnings.warn("f < 0 will be treated as 0")
 *         f=0
 */
  __pyx_t_9 = ((__pyx_v_f < 0.) != 0);
  if (__pyx_t_9) {

    /* "fwdpy/evolve_regions.pyx":239
 *         raise RuntimeError("sample must be >= 0")
 *     if f < 0.:
 *         warnings.warn("f < 0 will be treated as 0")             # <<<<<<<<<<<<<<
 *         f=0
 *     rmgr = region_manager_wrapper()
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_warnings); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "fwdpy/evolve_regions.pyx":240
 *     if f < 0.:
 *         warnings.warn("f < 0 will be treated as 0")
 *         f=0             # <<<<<<<<<<<<<<
 *     rmgr = region_manager_wrapper()
 *     internal.make_region_manager(rmgr,nregions,sregions,recregions)
 */
    __pyx_v_f = 0.0;

    /* "fwdpy/evolve_regions.pyx":238
 *     if sample < 0:
 *         raise RuntimeError("sample must be >= 0")
 *     if f < 0.:             # <<<<<<<<<<<<<<
 *         warnings.warn("f < 0 will be treated as 0")
 *         f=0
 */
  }

  /* "fwdpy/evolve_regions.pyx":241
 *         warnings.warn("f < 0 will be treated as 0")
 *         f=0
 *     rmgr = region_manager_wrapper()             # <<<<<<<<<<<<<<
 *     internal.make_region_manager(rmgr,nregions,sregions,recregions)
 *     cdef size_t listlen = len(nlist)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5fwdpy_8internal_8internal_region_manager_wrapper), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rmgr = ((struct __pyx_obj_5fwdpy_8internal_8internal_region_manager_wrapper *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/evolve_regions.pyx":242
 *         f=0
 *     rmgr = region_manager_wrapper()
 *     internal.make_region_manager(rmgr,nregions,sregions,recregions)             # <<<<<<<<<<<<<<
 *     cdef size_t listlen = len(nlist)
 *     evolve_regions_sampler_cpp(rng.thisptr,pops.pops,
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_internal); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_make_region_manager); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, ((PyObject *)__pyx_v_rmgr), __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 242, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[5] = {__pyx_t_2, ((PyObject *)__pyx_v_rmgr), __pyx_v_nregions, __pyx_v_sregions, __pyx_v_recregions};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 242, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_rmgr));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_rmgr));
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, ((PyObject *)__pyx_v_rmgr));
    __Pyx_INCREF(__pyx_v_nregions);
    __Pyx_GIVEREF(__pyx_v_nregions);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_nregions);
    __Pyx_INCREF(__pyx_v_sregions);
    __Pyx_GIVEREF(__pyx_v_sregions);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_7, __pyx_v_sregions);
    __Pyx_INCREF(__pyx_v_recregions);
    __Pyx_GIVEREF(__pyx_v_recregions);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_7, __pyx_v_recregions);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/evolve_regions.pyx":243
 *     rmgr = region_manager_wrapper()
 *     internal.make_region_manager(rmgr,nregions,sregions,recregions)
 *     cdef size_t listlen = len(nlist)             # <<<<<<<<<<<<<<
 *     evolve_regions_sampler_cpp(rng.thisptr,pops.pops,
 *                                slist.vec,&nlist[0],listlen,mu_neutral,mu_selected,recrate,f,sample,rmgr.thisptr,deref(fitness_function.wfxn.get()))
 */
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_nlist, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(5, 243, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_listlen = __pyx_t_10;

  /* "fwdpy/evolve_regions.pyx":245
 *     cdef size_t listlen = len(nlist)
 *     evolve_regions_sampler_cpp(rng.thisptr,pops.pops,
 *                                slist.vec,&nlist[0],listlen,mu_neutral,mu_selected,recrate,f,sample,rmgr.thisptr,deref(fitness_function.wfxn.get()))             # <<<<<<<<<<<<<<
 */
  __pyx_t_11 = 0;
  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nlist.shape[0];

  /* "fwdpy/evolve_regions.pyx":244
 *     internal.make_region_manager(rmgr,nregions,sregions,recregions)
 *     cdef size_t listlen = len(nlist)
 *     evolve_regions_sampler_cpp(rng.thisptr,pops.pops,             # <<<<<<<<<<<<<<
 *                                slist.vec,&nlist[0],listlen,mu_neutral,mu_selected,recrate,f,sample,rmgr.thisptr,deref(fitness_function.wfxn.get()))
 */
  try {
    fwdpy::evolve_regions_sampler_cpp(__pyx_v_rng->thisptr, __pyx_v_pops->pops, __pyx_v_slist->vec, (&(*((unsigned int *) ( /* dim=0 */ (__pyx_v_nlist.data + __pyx_t_11 * __pyx_v_nlist.strides[0]) )))), __pyx_v_listlen, __pyx_v_mu_neutral, __pyx_v_mu_selected, __pyx_v_recrate, __pyx_v_f, __pyx_v_sample, __pyx_v_rmgr->thisptr, (*__pyx_v_fitness_function->wfxn.get()));
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(5, 244, __pyx_L1_error)
  }

  /* "fwdpy/evolve_regions.pyx":205
 * 
 * @cython.boundscheck(False)
 * def evolve_regions_sampler_fitness(GSLrng rng,             # <<<<<<<<<<<<<<
 *                                    SpopVec pops,
 *                                    TemporalSampler slist,
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("fwdpy.fwdpy.evolve_regions_sampler_fitness", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rmgr);
  __PYX_XDEC_MEMVIEW(&__pyx_v_nlist, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/regions.pyx":18
 *         * :class:`fwdpy.fwdpy.Sregion`
 *     """
 *     def __init__(self,float beg,float end,float weight,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_6Region_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_6Region___init__[] = "\n        Constructor\n\n        :param beg: the beginning of the region\n        :param end: the end of the region\n        :param weight: the weight to assign\n        :param coupled: if True, the weight is converted to (end-beg)*weight\n        :param label: Not relevant to recombining regions.  Otherwise, this value will be used to take mutations from this region.\n\n        When coupled is True, the \"weight\" may be interpreted as a \"per base pair\"\n        (or per unit, generally speaking) term.\n\n        Example:\n\n        >>> #A simple case\n        >>> import fwdpy\n        >>> r = fwdpy.Region(0,1,1)\n        >>> #A more \"biological\" case:\n        >>> #  The region covers positions 1 through 1,000,\n        >>> #  and the per-base pair \"weight\" is 1e-5:\n        >>> r = fwdpy.Region(1,1000,1e-5,True)\n        ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_6Region_1__init__ = {"__init__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_6Region_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_6Region___init__};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_6Region_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  float __pyx_v_beg;
  float __pyx_v_end;
  float __pyx_v_weight;
  PyObject *__pyx_v_coupled = 0;
  uint16_t __pyx_v_label;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_beg,&__pyx_n_s_end,&__pyx_n_s_weight,&__pyx_n_s_coupled,&__pyx_n_s_label,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_beg)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 6, 1); __PYX_ERR(0, 18, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 6, 2); __PYX_ERR(0, 18, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_weight)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 6, 3); __PYX_ERR(0, 18, __pyx_L3_error)
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coupled);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_label);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 18, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_beg = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_beg == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error)
    __pyx_v_end = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_end == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error)
    __pyx_v_weight = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_weight == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error)
    __pyx_v_coupled = values[4];
    if (values[5]) {
      __pyx_v_label = __Pyx_PyInt_As_uint16_t(values[5]); if (unlikely((__pyx_v_label == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error)
    } else {
      __pyx_v_label = ((uint16_t)((uint16_t)0));
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 18, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.Region.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_6Region___init__(__pyx_self, __pyx_v_self, __pyx_v_beg, __pyx_v_end, __pyx_v_weight, __pyx_v_coupled, __pyx_v_label);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_6Region___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, float __pyx_v_beg, float __pyx_v_end, float __pyx_v_weight, PyObject *__pyx_v_coupled, uint16_t __pyx_v_label) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "fwdpy/regions.pyx":41
 *         >>> r = fwdpy.Region(1,1000,1e-5,True)
 *         """
 *         if math.isinf(beg):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Region: beg not finite")
 *         if math.isinf(end):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isinf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_beg); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":42
 *         """
 *         if math.isinf(beg):
 *             raise ValueError("fwdpy.Region: beg not finite")             # <<<<<<<<<<<<<<
 *         if math.isinf(end):
 *             raise ValueError("fwdpy.Region: end not finite")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 42, __pyx_L1_error)

    /* "fwdpy/regions.pyx":41
 *         >>> r = fwdpy.Region(1,1000,1e-5,True)
 *         """
 *         if math.isinf(beg):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Region: beg not finite")
 *         if math.isinf(end):
 */
  }

  /* "fwdpy/regions.pyx":43
 *         if math.isinf(beg):
 *             raise ValueError("fwdpy.Region: beg not finite")
 *         if math.isinf(end):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Region: end not finite")
 *         if math.isinf(weight):
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isinf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":44
 *             raise ValueError("fwdpy.Region: beg not finite")
 *         if math.isinf(end):
 *             raise ValueError("fwdpy.Region: end not finite")             # <<<<<<<<<<<<<<
 *         if math.isinf(weight):
 *             raise ValueError("fwdpy.Region: weight not finite")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 44, __pyx_L1_error)

    /* "fwdpy/regions.pyx":43
 *         if math.isinf(beg):
 *             raise ValueError("fwdpy.Region: beg not finite")
 *         if math.isinf(end):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Region: end not finite")
 *         if math.isinf(weight):
 */
  }

  /* "fwdpy/regions.pyx":45
 *         if math.isinf(end):
 *             raise ValueError("fwdpy.Region: end not finite")
 *         if math.isinf(weight):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Region: weight not finite")
 *         if math.isnan(beg):
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_isinf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_weight); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __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[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":46
 *             raise ValueError("fwdpy.Region: end not finite")
 *         if math.isinf(weight):
 *             raise ValueError("fwdpy.Region: weight not finite")             # <<<<<<<<<<<<<<
 *         if math.isnan(beg):
 *             raise ValueError("fwdpy.Region: beg not a number")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 46, __pyx_L1_error)

    /* "fwdpy/regions.pyx":45
 *         if math.isinf(end):
 *             raise ValueError("fwdpy.Region: end not finite")
 *         if math.isinf(weight):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Region: weight not finite")
 *         if math.isnan(beg):
 */
  }

  /* "fwdpy/regions.pyx":47
 *         if math.isinf(weight):
 *             raise ValueError("fwdpy.Region: weight not finite")
 *         if math.isnan(beg):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Region: beg not a number")
 *         if math.isnan(end):
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_isnan); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_beg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 47, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":48
 *             raise ValueError("fwdpy.Region: weight not finite")
 *         if math.isnan(beg):
 *             raise ValueError("fwdpy.Region: beg not a number")             # <<<<<<<<<<<<<<
 *         if math.isnan(end):
 *             raise ValueError("fwdpy.Region: end not a number")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 48, __pyx_L1_error)

    /* "fwdpy/regions.pyx":47
 *         if math.isinf(weight):
 *             raise ValueError("fwdpy.Region: weight not finite")
 *         if math.isnan(beg):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Region: beg not a number")
 *         if math.isnan(end):
 */
  }

  /* "fwdpy/regions.pyx":49
 *         if math.isnan(beg):
 *             raise ValueError("fwdpy.Region: beg not a number")
 *         if math.isnan(end):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Region: end not a number")
 *         if math.isnan(weight):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isnan); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_end); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":50
 *             raise ValueError("fwdpy.Region: beg not a number")
 *         if math.isnan(end):
 *             raise ValueError("fwdpy.Region: end not a number")             # <<<<<<<<<<<<<<
 *         if math.isnan(weight):
 *             raise ValueError("fwdpy.Region: weight not a number")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 50, __pyx_L1_error)

    /* "fwdpy/regions.pyx":49
 *         if math.isnan(beg):
 *             raise ValueError("fwdpy.Region: beg not a number")
 *         if math.isnan(end):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Region: end not a number")
 *         if math.isnan(weight):
 */
  }

  /* "fwdpy/regions.pyx":51
 *         if math.isnan(end):
 *             raise ValueError("fwdpy.Region: end not a number")
 *         if math.isnan(weight):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Region: weight not a number")
 *         if weight < 0.0:
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isnan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_weight); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":52
 *             raise ValueError("fwdpy.Region: end not a number")
 *         if math.isnan(weight):
 *             raise ValueError("fwdpy.Region: weight not a number")             # <<<<<<<<<<<<<<
 *         if weight < 0.0:
 *             raise ValueError("fwdpy.Region: weight < 0.0")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 52, __pyx_L1_error)

    /* "fwdpy/regions.pyx":51
 *         if math.isnan(end):
 *             raise ValueError("fwdpy.Region: end not a number")
 *         if math.isnan(weight):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Region: weight not a number")
 *         if weight < 0.0:
 */
  }

  /* "fwdpy/regions.pyx":53
 *         if math.isnan(weight):
 *             raise ValueError("fwdpy.Region: weight not a number")
 *         if weight < 0.0:             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Region: weight < 0.0")
 *         self.b=float(beg)
 */
  __pyx_t_6 = ((__pyx_v_weight < 0.0) != 0);
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":54
 *             raise ValueError("fwdpy.Region: weight not a number")
 *         if weight < 0.0:
 *             raise ValueError("fwdpy.Region: weight < 0.0")             # <<<<<<<<<<<<<<
 *         self.b=float(beg)
 *         self.e=float(end)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 54, __pyx_L1_error)

    /* "fwdpy/regions.pyx":53
 *         if math.isnan(weight):
 *             raise ValueError("fwdpy.Region: weight not a number")
 *         if weight < 0.0:             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Region: weight < 0.0")
 *         self.b=float(beg)
 */
  }

  /* "fwdpy/regions.pyx":55
 *         if weight < 0.0:
 *             raise ValueError("fwdpy.Region: weight < 0.0")
 *         self.b=float(beg)             # <<<<<<<<<<<<<<
 *         self.e=float(end)
 *         self.w=float(weight)
 */
  __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_beg)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_b, __pyx_t_1) < 0) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":56
 *             raise ValueError("fwdpy.Region: weight < 0.0")
 *         self.b=float(beg)
 *         self.e=float(end)             # <<<<<<<<<<<<<<
 *         self.w=float(weight)
 *         self.c=coupled
 */
  __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_end)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_e, __pyx_t_1) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":57
 *         self.b=float(beg)
 *         self.e=float(end)
 *         self.w=float(weight)             # <<<<<<<<<<<<<<
 *         self.c=coupled
 *         self.l=label
 */
  __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_weight)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_w, __pyx_t_1) < 0) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":58
 *         self.e=float(end)
 *         self.w=float(weight)
 *         self.c=coupled             # <<<<<<<<<<<<<<
 *         self.l=label
 *         if self.c is True:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_c, __pyx_v_coupled) < 0) __PYX_ERR(0, 58, __pyx_L1_error)

  /* "fwdpy/regions.pyx":59
 *         self.w=float(weight)
 *         self.c=coupled
 *         self.l=label             # <<<<<<<<<<<<<<
 *         if self.c is True:
 *             self.w = (self.e-self.b)*self.w
 */
  __pyx_t_1 = __Pyx_PyInt_From_uint16_t(__pyx_v_label); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_l, __pyx_t_1) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":60
 *         self.c=coupled
 *         self.l=label
 *         if self.c is True:             # <<<<<<<<<<<<<<
 *             self.w = (self.e-self.b)*self.w
 *     def __str__(self):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = (__pyx_t_1 == Py_True);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "fwdpy/regions.pyx":61
 *         self.l=label
 *         if self.c is True:
 *             self.w = (self.e-self.b)*self.w             # <<<<<<<<<<<<<<
 *     def __str__(self):
 *         bstr="{:.9f}".format(self.b)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_e); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_b); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_w); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_w, __pyx_t_1) < 0) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "fwdpy/regions.pyx":60
 *         self.c=coupled
 *         self.l=label
 *         if self.c is True:             # <<<<<<<<<<<<<<
 *             self.w = (self.e-self.b)*self.w
 *     def __str__(self):
 */
  }

  /* "fwdpy/regions.pyx":18
 *         * :class:`fwdpy.fwdpy.Sregion`
 *     """
 *     def __init__(self,float beg,float end,float weight,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

  /* 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_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.Region.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/regions.pyx":62
 *         if self.c is True:
 *             self.w = (self.e-self.b)*self.w
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         bstr="{:.9f}".format(self.b)
 *         estr="{:.9f}".format(self.e)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_6Region_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_6Region_3__str__ = {"__str__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_6Region_3__str__, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_6Region_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_6Region_2__str__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_6Region_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_bstr = NULL;
  PyObject *__pyx_v_estr = NULL;
  PyObject *__pyx_v_wstr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "fwdpy/regions.pyx":63
 *             self.w = (self.e-self.b)*self.w
 *     def __str__(self):
 *         bstr="{:.9f}".format(self.b)             # <<<<<<<<<<<<<<
 *         estr="{:.9f}".format(self.e)
 *         wstr="{:.9f}".format(self.w)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_9f, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 63, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_bstr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":64
 *     def __str__(self):
 *         bstr="{:.9f}".format(self.b)
 *         estr="{:.9f}".format(self.e)             # <<<<<<<<<<<<<<
 *         wstr="{:.9f}".format(self.w)
 *         return "beg = " +bstr+ ", end = " + estr+ ", weight = "+wstr+", label = "+format(self.l)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_9f, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_e); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_estr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":65
 *         bstr="{:.9f}".format(self.b)
 *         estr="{:.9f}".format(self.e)
 *         wstr="{:.9f}".format(self.w)             # <<<<<<<<<<<<<<
 *         return "beg = " +bstr+ ", end = " + estr+ ", weight = "+wstr+", label = "+format(self.l)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_9f, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_wstr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":66
 *         estr="{:.9f}".format(self.e)
 *         wstr="{:.9f}".format(self.w)
 *         return "beg = " +bstr+ ", end = " + estr+ ", weight = "+wstr+", label = "+format(self.l)             # <<<<<<<<<<<<<<
 * 
 * class Sregion(Region):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyNumber_Add(__pyx_kp_s_beg_2, __pyx_v_bstr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_kp_s_end_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_estr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_kp_s_weight_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_wstr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_kp_s_label_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_l); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_format, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "fwdpy/regions.pyx":62
 *         if self.c is True:
 *             self.w = (self.e-self.b)*self.w
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         bstr="{:.9f}".format(self.b)
 *         estr="{:.9f}".format(self.e)
 */

  /* function exit code */
  __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_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.Region.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bstr);
  __Pyx_XDECREF(__pyx_v_estr);
  __Pyx_XDECREF(__pyx_v_wstr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/regions.pyx":91
 *        :class:`fwdpy.fwdpy.GaussianS`
 *     """
 *     def __init__(self,float beg,float end,float weight,float h=1.0,coupled=True,uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7Sregion_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_7Sregion___init__[] = "\n        Constructor\n\n        :param beg: the beginning of the region\n        :param end: the end of the region\n        :param weight: the weight to assign\n        :param h: the dominance\n        :param coupled: if True, the weight is converted to (end-beg)*weight\n        :param label: Not relevant to recombining regions.  Otherwise, this value will be used to take mutations from this region.\n\n        When coupled is True, the \"weight\" may be interpreted as a \"per base pair\"\n        (or per unit, generally speaking) term.\n\n        Example:\n\n        >>> #A simple case\n        >>> import fwdpy\n        >>> #Examples for models where the 3 genotype fitnesses are\n        >>> #1, 1+sh, and 1+2s, respectively\n        >>> recessive = fwdpy.Sregion(0,1,1,0)\n        >>> additive = fwdpy.Sregion(0,1,1,1.0)\n        >>> dominant = fwdpy.Sregion(0,1,1,2.0)\n        ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_7Sregion_1__init__ = {"__init__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7Sregion_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_7Sregion___init__};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7Sregion_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  float __pyx_v_beg;
  float __pyx_v_end;
  float __pyx_v_weight;
  float __pyx_v_h;
  PyObject *__pyx_v_coupled = 0;
  uint16_t __pyx_v_label;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_beg,&__pyx_n_s_end,&__pyx_n_s_weight,&__pyx_n_s_h,&__pyx_n_s_coupled,&__pyx_n_s_label,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[5] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_beg)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 7, 1); __PYX_ERR(0, 91, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 7, 2); __PYX_ERR(0, 91, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_weight)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 7, 3); __PYX_ERR(0, 91, __pyx_L3_error)
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coupled);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_label);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 91, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_beg = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_beg == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error)
    __pyx_v_end = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_end == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error)
    __pyx_v_weight = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_weight == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error)
    if (values[4]) {
      __pyx_v_h = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_h == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error)
    } else {
      __pyx_v_h = ((float)((double)1.0));
    }
    __pyx_v_coupled = values[5];
    if (values[6]) {
      __pyx_v_label = __Pyx_PyInt_As_uint16_t(values[6]); if (unlikely((__pyx_v_label == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error)
    } else {
      __pyx_v_label = ((uint16_t)((uint16_t)0));
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.Sregion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7Sregion___init__(__pyx_self, __pyx_v_self, __pyx_v_beg, __pyx_v_end, __pyx_v_weight, __pyx_v_h, __pyx_v_coupled, __pyx_v_label);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_7Sregion___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, float __pyx_v_beg, float __pyx_v_end, float __pyx_v_weight, float __pyx_v_h, PyObject *__pyx_v_coupled, uint16_t __pyx_v_label) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "fwdpy/regions.pyx":115
 *         >>> dominant = fwdpy.Sregion(0,1,1,2.0)
 *         """
 *         if math.isinf(h):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Sregion: h not finite")
 *         if math.isnan(h):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isinf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 115, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 115, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":116
 *         """
 *         if math.isinf(h):
 *             raise ValueError("fwdpy.Sregion: h not finite")             # <<<<<<<<<<<<<<
 *         if math.isnan(h):
 *             raise ValueError("fwdpy.Segion: h not a number")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 116, __pyx_L1_error)

    /* "fwdpy/regions.pyx":115
 *         >>> dominant = fwdpy.Sregion(0,1,1,2.0)
 *         """
 *         if math.isinf(h):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Sregion: h not finite")
 *         if math.isnan(h):
 */
  }

  /* "fwdpy/regions.pyx":117
 *         if math.isinf(h):
 *             raise ValueError("fwdpy.Sregion: h not finite")
 *         if math.isnan(h):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Segion: h not a number")
 *         self.h=float(h)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isnan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":118
 *             raise ValueError("fwdpy.Sregion: h not finite")
 *         if math.isnan(h):
 *             raise ValueError("fwdpy.Segion: h not a number")             # <<<<<<<<<<<<<<
 *         self.h=float(h)
 *         super(Sregion,self).__init__(beg,end,weight,coupled,label)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 118, __pyx_L1_error)

    /* "fwdpy/regions.pyx":117
 *         if math.isinf(h):
 *             raise ValueError("fwdpy.Sregion: h not finite")
 *         if math.isnan(h):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.Segion: h not a number")
 *         self.h=float(h)
 */
  }

  /* "fwdpy/regions.pyx":119
 *         if math.isnan(h):
 *             raise ValueError("fwdpy.Segion: h not a number")
 *         self.h=float(h)             # <<<<<<<<<<<<<<
 *         super(Sregion,self).__init__(beg,end,weight,coupled,label)
 *     def __str__(self):
 */
  __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_h)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_h, __pyx_t_1) < 0) __PYX_ERR(0, 119, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":120
 *             raise ValueError("fwdpy.Segion: h not a number")
 *         self.h=float(h)
 *         super(Sregion,self).__init__(beg,end,weight,coupled,label)             # <<<<<<<<<<<<<<
 *     def __str__(self):
 *         return "h = "+"{:.9f}".format(self.h)+", "+super(Sregion,self).__str__()
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Sregion); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 120, __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_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_beg); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_weight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyInt_From_uint16_t(__pyx_v_label); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_t_5, __pyx_t_3, __pyx_t_2, __pyx_v_coupled, __pyx_t_7};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_t_5, __pyx_t_3, __pyx_t_2, __pyx_v_coupled, __pyx_t_7};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(5+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_2);
    __Pyx_INCREF(__pyx_v_coupled);
    __Pyx_GIVEREF(__pyx_v_coupled);
    PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_v_coupled);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_9, __pyx_t_7);
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_t_7 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":91
 *        :class:`fwdpy.fwdpy.GaussianS`
 *     """
 *     def __init__(self,float beg,float end,float weight,float h=1.0,coupled=True,uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("fwdpy.fwdpy.Sregion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/regions.pyx":121
 *         self.h=float(h)
 *         super(Sregion,self).__init__(beg,end,weight,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "h = "+"{:.9f}".format(self.h)+", "+super(Sregion,self).__str__()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7Sregion_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_7Sregion_3__str__ = {"__str__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7Sregion_3__str__, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_7Sregion_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_7Sregion_2__str__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_7Sregion_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "fwdpy/regions.pyx":122
 *         super(Sregion,self).__init__(beg,end,weight,coupled,label)
 *     def __str__(self):
 *         return "h = "+"{:.9f}".format(self.h)+", "+super(Sregion,self).__str__()             # <<<<<<<<<<<<<<
 * 
 * class GammaS(Sregion):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_9f, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 122, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_kp_s_h_2, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_kp_s__26); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Sregion); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "fwdpy/regions.pyx":121
 *         self.h=float(h)
 *         super(Sregion,self).__init__(beg,end,weight,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "h = "+"{:.9f}".format(self.h)+", "+super(Sregion,self).__str__()
 * 
 */

  /* function exit code */
  __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_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.Sregion.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/regions.pyx":139
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float mean,float shape,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_6GammaS_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_6GammaS___init__[] = "\n        Constructor\n\n        :param beg: the beginning of the region\n        :param end: the end of the region\n        :param weight: the weight to assign\n        :param mean: the mean selection coefficient\n        :param shape: the shape parameter of the distribution\n        :param h: the dominance\n        :param coupled: if True, the weight is converted to (end-beg)*weight\n        :param label: Not relevant to recombining regions.  Otherwise, this value will be used to take mutations from this region.\n\n        When coupled is True, the \"weight\" may be interpreted as a \"per base pair\"\n        (or per unit, generally speaking) term.\n\n        Example:\n\n        >>> #A simple case\n        >>> import fwdpy\n        >>> gdist = fwdpy.GammaS(0,1,1,-0.1,0.35)\n        ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_6GammaS_1__init__ = {"__init__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_6GammaS_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_6GammaS___init__};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_6GammaS_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  float __pyx_v_beg;
  float __pyx_v_end;
  float __pyx_v_weight;
  float __pyx_v_mean;
  float __pyx_v_shape;
  float __pyx_v_h;
  PyObject *__pyx_v_coupled = 0;
  uint16_t __pyx_v_label;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_beg,&__pyx_n_s_end,&__pyx_n_s_weight,&__pyx_n_s_mean,&__pyx_n_s_shape,&__pyx_n_s_h,&__pyx_n_s_coupled,&__pyx_n_s_label,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[7] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_beg)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 9, 1); __PYX_ERR(0, 139, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 9, 2); __PYX_ERR(0, 139, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_weight)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 9, 3); __PYX_ERR(0, 139, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mean)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 9, 4); __PYX_ERR(0, 139, __pyx_L3_error)
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 9, 5); __PYX_ERR(0, 139, __pyx_L3_error)
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coupled);
          if (value) { values[7] = value; kw_args--; }
        }
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_label);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 139, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_beg = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_beg == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
    __pyx_v_end = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_end == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
    __pyx_v_weight = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_weight == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
    __pyx_v_mean = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_mean == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
    __pyx_v_shape = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_shape == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
    if (values[6]) {
      __pyx_v_h = __pyx_PyFloat_AsFloat(values[6]); if (unlikely((__pyx_v_h == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
    } else {
      __pyx_v_h = ((float)((double)1.0));
    }
    __pyx_v_coupled = values[7];
    if (values[8]) {
      __pyx_v_label = __Pyx_PyInt_As_uint16_t(values[8]); if (unlikely((__pyx_v_label == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
    } else {
      __pyx_v_label = ((uint16_t)((uint16_t)0));
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 139, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.GammaS.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_6GammaS___init__(__pyx_self, __pyx_v_self, __pyx_v_beg, __pyx_v_end, __pyx_v_weight, __pyx_v_mean, __pyx_v_shape, __pyx_v_h, __pyx_v_coupled, __pyx_v_label);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_6GammaS___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, float __pyx_v_beg, float __pyx_v_end, float __pyx_v_weight, float __pyx_v_mean, float __pyx_v_shape, float __pyx_v_h, PyObject *__pyx_v_coupled, uint16_t __pyx_v_label) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "fwdpy/regions.pyx":161
 *         >>> gdist = fwdpy.GammaS(0,1,1,-0.1,0.35)
 *         """
 *         if math.isinf(mean):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.GammaS: mean not finite")
 *         if math.isinf(shape):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isinf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_mean); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 161, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 161, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":162
 *         """
 *         if math.isinf(mean):
 *             raise ValueError("fwdpy.GammaS: mean not finite")             # <<<<<<<<<<<<<<
 *         if math.isinf(shape):
 *             raise ValueError("fwdpy.GammaS: shape not finite")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 162, __pyx_L1_error)

    /* "fwdpy/regions.pyx":161
 *         >>> gdist = fwdpy.GammaS(0,1,1,-0.1,0.35)
 *         """
 *         if math.isinf(mean):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.GammaS: mean not finite")
 *         if math.isinf(shape):
 */
  }

  /* "fwdpy/regions.pyx":163
 *         if math.isinf(mean):
 *             raise ValueError("fwdpy.GammaS: mean not finite")
 *         if math.isinf(shape):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.GammaS: shape not finite")
 *         if math.isnan(mean):
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isinf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":164
 *             raise ValueError("fwdpy.GammaS: mean not finite")
 *         if math.isinf(shape):
 *             raise ValueError("fwdpy.GammaS: shape not finite")             # <<<<<<<<<<<<<<
 *         if math.isnan(mean):
 *             raise ValueError("fwdpy.GammaS: mean not a number")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 164, __pyx_L1_error)

    /* "fwdpy/regions.pyx":163
 *         if math.isinf(mean):
 *             raise ValueError("fwdpy.GammaS: mean not finite")
 *         if math.isinf(shape):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.GammaS: shape not finite")
 *         if math.isnan(mean):
 */
  }

  /* "fwdpy/regions.pyx":165
 *         if math.isinf(shape):
 *             raise ValueError("fwdpy.GammaS: shape not finite")
 *         if math.isnan(mean):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.GammaS: mean not a number")
 *         if math.isnan(shape):
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_isnan); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_mean); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __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[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 165, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":166
 *             raise ValueError("fwdpy.GammaS: shape not finite")
 *         if math.isnan(mean):
 *             raise ValueError("fwdpy.GammaS: mean not a number")             # <<<<<<<<<<<<<<
 *         if math.isnan(shape):
 *             raise ValueError("fwdpy.GammaS: shape not a number")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 166, __pyx_L1_error)

    /* "fwdpy/regions.pyx":165
 *         if math.isinf(shape):
 *             raise ValueError("fwdpy.GammaS: shape not finite")
 *         if math.isnan(mean):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.GammaS: mean not a number")
 *         if math.isnan(shape):
 */
  }

  /* "fwdpy/regions.pyx":167
 *         if math.isnan(mean):
 *             raise ValueError("fwdpy.GammaS: mean not a number")
 *         if math.isnan(shape):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.GammaS: shape not a number")
 *         self.mean=float(mean)
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_isnan); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":168
 *             raise ValueError("fwdpy.GammaS: mean not a number")
 *         if math.isnan(shape):
 *             raise ValueError("fwdpy.GammaS: shape not a number")             # <<<<<<<<<<<<<<
 *         self.mean=float(mean)
 *         self.shape=float(shape)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 168, __pyx_L1_error)

    /* "fwdpy/regions.pyx":167
 *         if math.isnan(mean):
 *             raise ValueError("fwdpy.GammaS: mean not a number")
 *         if math.isnan(shape):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.GammaS: shape not a number")
 *         self.mean=float(mean)
 */
  }

  /* "fwdpy/regions.pyx":169
 *         if math.isnan(shape):
 *             raise ValueError("fwdpy.GammaS: shape not a number")
 *         self.mean=float(mean)             # <<<<<<<<<<<<<<
 *         self.shape=float(shape)
 *         super(GammaS,self).__init__(beg,end,weight,h,coupled,label)
 */
  __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_mean)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_mean, __pyx_t_1) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":170
 *             raise ValueError("fwdpy.GammaS: shape not a number")
 *         self.mean=float(mean)
 *         self.shape=float(shape)             # <<<<<<<<<<<<<<
 *         super(GammaS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):
 */
  __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_shape)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_shape, __pyx_t_1) < 0) __PYX_ERR(0, 170, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":171
 *         self.mean=float(mean)
 *         self.shape=float(shape)
 *         super(GammaS,self).__init__(beg,end,weight,h,coupled,label)             # <<<<<<<<<<<<<<
 *     def __str__(self):
 *         return "Gamma DFE, mean = "+"{:.9f}".format(self.mean)+", shape = "+"{:.9f}".format(self.shape)+", "+super(GammaS,self).__str__()
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_GammaS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __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_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_beg); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_weight); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyInt_From_uint16_t(__pyx_v_label); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[7] = {__pyx_t_9, __pyx_t_2, __pyx_t_4, __pyx_t_5, __pyx_t_7, __pyx_v_coupled, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 6+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[7] = {__pyx_t_9, __pyx_t_2, __pyx_t_4, __pyx_t_5, __pyx_t_7, __pyx_v_coupled, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 6+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_11 = PyTuple_New(6+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_10, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_coupled);
    __Pyx_GIVEREF(__pyx_v_coupled);
    PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_10, __pyx_v_coupled);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_11, 5+__pyx_t_10, __pyx_t_8);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":139
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float mean,float shape,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("fwdpy.fwdpy.GammaS.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/regions.pyx":172
 *         self.shape=float(shape)
 *         super(GammaS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Gamma DFE, mean = "+"{:.9f}".format(self.mean)+", shape = "+"{:.9f}".format(self.shape)+", "+super(GammaS,self).__str__()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_6GammaS_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_6GammaS_3__str__ = {"__str__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_6GammaS_3__str__, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_6GammaS_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_6GammaS_2__str__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_6GammaS_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "fwdpy/regions.pyx":173
 *         super(GammaS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):
 *         return "Gamma DFE, mean = "+"{:.9f}".format(self.mean)+", shape = "+"{:.9f}".format(self.shape)+", "+super(GammaS,self).__str__()             # <<<<<<<<<<<<<<
 * 
 * class ConstantS(Sregion):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_9f, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_kp_s_Gamma_DFE_mean, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_kp_s_shape_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_9f, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 173, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_kp_s__26); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_GammaS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_self);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __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_str); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "fwdpy/regions.pyx":172
 *         self.shape=float(shape)
 *         super(GammaS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Gamma DFE, mean = "+"{:.9f}".format(self.mean)+", shape = "+"{:.9f}".format(self.shape)+", "+super(GammaS,self).__str__()
 * 
 */

  /* function exit code */
  __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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("fwdpy.fwdpy.GammaS.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/regions.pyx":189
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float s,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9ConstantS_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_9ConstantS___init__[] = "\n        Constructor\n\n        :param beg: the beginning of the region\n        :param end: the end of the region\n        :param weight: the weight to assign\n        :param s: the selection coefficient\n        :param h: the dominance\n        :param coupled: if True, the weight is converted to (end-beg)*weight\n        :param label: Not relevant to recombining regions.  Otherwise, this value will be used to take mutations from this region.\n\n        When coupled is True, the \"weight\" may be interpreted as a \"per base pair\"\n        (or per unit, generally speaking) term.\n\n        Example:\n\n        >>> #A simple case\n        >>> import fwdpy\n        >>> #s = -0.1 and h = 0\n        >>> constantS = fwdpy.ConstantS(0,1,1,-0.1,0)\n        ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_9ConstantS_1__init__ = {"__init__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_9ConstantS_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_9ConstantS___init__};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9ConstantS_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  float __pyx_v_beg;
  float __pyx_v_end;
  float __pyx_v_weight;
  float __pyx_v_s;
  float __pyx_v_h;
  PyObject *__pyx_v_coupled = 0;
  uint16_t __pyx_v_label;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_beg,&__pyx_n_s_end,&__pyx_n_s_weight,&__pyx_n_s_s,&__pyx_n_s_h,&__pyx_n_s_coupled,&__pyx_n_s_label,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    values[6] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_beg)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 1); __PYX_ERR(0, 189, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 2); __PYX_ERR(0, 189, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_weight)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 3); __PYX_ERR(0, 189, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 4); __PYX_ERR(0, 189, __pyx_L3_error)
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coupled);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_label);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 189, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_beg = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_beg == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L3_error)
    __pyx_v_end = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_end == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L3_error)
    __pyx_v_weight = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_weight == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L3_error)
    __pyx_v_s = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_s == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L3_error)
    if (values[5]) {
      __pyx_v_h = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_h == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L3_error)
    } else {
      __pyx_v_h = ((float)((double)1.0));
    }
    __pyx_v_coupled = values[6];
    if (values[7]) {
      __pyx_v_label = __Pyx_PyInt_As_uint16_t(values[7]); if (unlikely((__pyx_v_label == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L3_error)
    } else {
      __pyx_v_label = ((uint16_t)((uint16_t)0));
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 189, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.ConstantS.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_9ConstantS___init__(__pyx_self, __pyx_v_self, __pyx_v_beg, __pyx_v_end, __pyx_v_weight, __pyx_v_s, __pyx_v_h, __pyx_v_coupled, __pyx_v_label);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_9ConstantS___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, float __pyx_v_beg, float __pyx_v_end, float __pyx_v_weight, float __pyx_v_s, float __pyx_v_h, PyObject *__pyx_v_coupled, uint16_t __pyx_v_label) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "fwdpy/regions.pyx":211
 *         >>> constantS = fwdpy.ConstantS(0,1,1,-0.1,0)
 *         """
 *         if math.isinf(s):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.ConstantS: s not finite")
 *         if math.isnan(s):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isinf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 211, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":212
 *         """
 *         if math.isinf(s):
 *             raise ValueError("fwdpy.ConstantS: s not finite")             # <<<<<<<<<<<<<<
 *         if math.isnan(s):
 *             raise ValueError("fwdpy.ConstantS: s not a number")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 212, __pyx_L1_error)

    /* "fwdpy/regions.pyx":211
 *         >>> constantS = fwdpy.ConstantS(0,1,1,-0.1,0)
 *         """
 *         if math.isinf(s):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.ConstantS: s not finite")
 *         if math.isnan(s):
 */
  }

  /* "fwdpy/regions.pyx":213
 *         if math.isinf(s):
 *             raise ValueError("fwdpy.ConstantS: s not finite")
 *         if math.isnan(s):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.ConstantS: s not a number")
 *         self.s=float(s)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isnan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 213, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 213, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":214
 *             raise ValueError("fwdpy.ConstantS: s not finite")
 *         if math.isnan(s):
 *             raise ValueError("fwdpy.ConstantS: s not a number")             # <<<<<<<<<<<<<<
 *         self.s=float(s)
 *         super(ConstantS,self).__init__(beg,end,weight,h,coupled,label)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 214, __pyx_L1_error)

    /* "fwdpy/regions.pyx":213
 *         if math.isinf(s):
 *             raise ValueError("fwdpy.ConstantS: s not finite")
 *         if math.isnan(s):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.ConstantS: s not a number")
 *         self.s=float(s)
 */
  }

  /* "fwdpy/regions.pyx":215
 *         if math.isnan(s):
 *             raise ValueError("fwdpy.ConstantS: s not a number")
 *         self.s=float(s)             # <<<<<<<<<<<<<<
 *         super(ConstantS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):
 */
  __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_s)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_s, __pyx_t_1) < 0) __PYX_ERR(0, 215, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":216
 *             raise ValueError("fwdpy.ConstantS: s not a number")
 *         self.s=float(s)
 *         super(ConstantS,self).__init__(beg,end,weight,h,coupled,label)             # <<<<<<<<<<<<<<
 *     def __str__(self):
 *         return "Constant s DFE, s = "+"{:.9f}".format(self.s)+", "+super(ConstantS,self).__str__()
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConstantS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __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_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_beg); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_weight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyInt_From_uint16_t(__pyx_v_label); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[7] = {__pyx_t_9, __pyx_t_5, __pyx_t_3, __pyx_t_2, __pyx_t_7, __pyx_v_coupled, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 6+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[7] = {__pyx_t_9, __pyx_t_5, __pyx_t_3, __pyx_t_2, __pyx_t_7, __pyx_v_coupled, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 6+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_11 = PyTuple_New(6+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_10, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_coupled);
    __Pyx_GIVEREF(__pyx_v_coupled);
    PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_10, __pyx_v_coupled);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_11, 5+__pyx_t_10, __pyx_t_8);
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":189
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float s,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("fwdpy.fwdpy.ConstantS.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/regions.pyx":217
 *         self.s=float(s)
 *         super(ConstantS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Constant s DFE, s = "+"{:.9f}".format(self.s)+", "+super(ConstantS,self).__str__()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9ConstantS_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_9ConstantS_3__str__ = {"__str__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_9ConstantS_3__str__, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9ConstantS_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_9ConstantS_2__str__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_9ConstantS_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "fwdpy/regions.pyx":218
 *         super(ConstantS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):
 *         return "Constant s DFE, s = "+"{:.9f}".format(self.s)+", "+super(ConstantS,self).__str__()             # <<<<<<<<<<<<<<
 * 
 * class UniformS(Sregion):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_9f, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 218, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_kp_s_Constant_s_DFE_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_kp_s__26); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ConstantS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "fwdpy/regions.pyx":217
 *         self.s=float(s)
 *         super(ConstantS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Constant s DFE, s = "+"{:.9f}".format(self.s)+", "+super(ConstantS,self).__str__()
 * 
 */

  /* function exit code */
  __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_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.ConstantS.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/regions.pyx":235
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float lo,float hi,float h=1.0,coupled=True):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_8UniformS_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_8UniformS___init__[] = "\n        Constructor\n    \n        :param beg: the beginning of the region\n        :param end: the end of the region\n        :param weight: the weight to assign\n        :param lo: lower bound on s\n        :param hi: upper bound on s\n        :param h: the dominance\n        :param coupled: if True, the weight is converted to (end-beg)*weight\n        :param label: Not relevant to recombining regions.  Otherwise, this value will be used to take mutations from this region.\n\n        When coupled is True, the \"weight\" may be interpreted as a \"per base pair\"\n        (or per unit, generally speaking) term.\n\n        Example:\n\n        >>> #A simple case\n        >>> import fwdpy\n        >>> #s is uniform on [0,-1]\n        >>> constantS = fwdpy.UniformS(0,1,1,0,-1,0)\n        ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_8UniformS_1__init__ = {"__init__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_8UniformS_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_8UniformS___init__};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_8UniformS_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  float __pyx_v_beg;
  float __pyx_v_end;
  float __pyx_v_weight;
  float __pyx_v_lo;
  float __pyx_v_hi;
  float __pyx_v_h;
  PyObject *__pyx_v_coupled = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_beg,&__pyx_n_s_end,&__pyx_n_s_weight,&__pyx_n_s_lo,&__pyx_n_s_hi,&__pyx_n_s_h,&__pyx_n_s_coupled,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    values[7] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_beg)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 8, 1); __PYX_ERR(0, 235, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 8, 2); __PYX_ERR(0, 235, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_weight)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 8, 3); __PYX_ERR(0, 235, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 8, 4); __PYX_ERR(0, 235, __pyx_L3_error)
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 8, 5); __PYX_ERR(0, 235, __pyx_L3_error)
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coupled);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 235, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_beg = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_beg == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L3_error)
    __pyx_v_end = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_end == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L3_error)
    __pyx_v_weight = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_weight == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L3_error)
    __pyx_v_lo = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_lo == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L3_error)
    __pyx_v_hi = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_hi == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L3_error)
    if (values[6]) {
      __pyx_v_h = __pyx_PyFloat_AsFloat(values[6]); if (unlikely((__pyx_v_h == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L3_error)
    } else {
      __pyx_v_h = ((float)((double)1.0));
    }
    __pyx_v_coupled = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 6, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 235, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.UniformS.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_8UniformS___init__(__pyx_self, __pyx_v_self, __pyx_v_beg, __pyx_v_end, __pyx_v_weight, __pyx_v_lo, __pyx_v_hi, __pyx_v_h, __pyx_v_coupled);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_8UniformS___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, float __pyx_v_beg, float __pyx_v_end, float __pyx_v_weight, float __pyx_v_lo, float __pyx_v_hi, float __pyx_v_h, PyObject *__pyx_v_coupled) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "fwdpy/regions.pyx":258
 *         >>> constantS = fwdpy.UniformS(0,1,1,0,-1,0)
 *         """
 *         if math.isinf(lo):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.UniformS: lo not finite")
 *         if math.isinf(hi):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isinf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_lo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 258, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 258, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":259
 *         """
 *         if math.isinf(lo):
 *             raise ValueError("fwdpy.UniformS: lo not finite")             # <<<<<<<<<<<<<<
 *         if math.isinf(hi):
 *             raise ValueError("fwdpy.UniformS: hi not finite")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 259, __pyx_L1_error)

    /* "fwdpy/regions.pyx":258
 *         >>> constantS = fwdpy.UniformS(0,1,1,0,-1,0)
 *         """
 *         if math.isinf(lo):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.UniformS: lo not finite")
 *         if math.isinf(hi):
 */
  }

  /* "fwdpy/regions.pyx":260
 *         if math.isinf(lo):
 *             raise ValueError("fwdpy.UniformS: lo not finite")
 *         if math.isinf(hi):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.UniformS: hi not finite")
 *         if math.isnan(lo):
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isinf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_hi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":261
 *             raise ValueError("fwdpy.UniformS: lo not finite")
 *         if math.isinf(hi):
 *             raise ValueError("fwdpy.UniformS: hi not finite")             # <<<<<<<<<<<<<<
 *         if math.isnan(lo):
 *             raise ValueError("fwdpy.UniformS: lo not a number")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 261, __pyx_L1_error)

    /* "fwdpy/regions.pyx":260
 *         if math.isinf(lo):
 *             raise ValueError("fwdpy.UniformS: lo not finite")
 *         if math.isinf(hi):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.UniformS: hi not finite")
 *         if math.isnan(lo):
 */
  }

  /* "fwdpy/regions.pyx":262
 *         if math.isinf(hi):
 *             raise ValueError("fwdpy.UniformS: hi not finite")
 *         if math.isnan(lo):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.UniformS: lo not a number")
 *         if math.isnan(hi):
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_isnan); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_lo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __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[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 262, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":263
 *             raise ValueError("fwdpy.UniformS: hi not finite")
 *         if math.isnan(lo):
 *             raise ValueError("fwdpy.UniformS: lo not a number")             # <<<<<<<<<<<<<<
 *         if math.isnan(hi):
 *             raise ValueError("fwdpy.UniformS: hi not a number")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 263, __pyx_L1_error)

    /* "fwdpy/regions.pyx":262
 *         if math.isinf(hi):
 *             raise ValueError("fwdpy.UniformS: hi not finite")
 *         if math.isnan(lo):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.UniformS: lo not a number")
 *         if math.isnan(hi):
 */
  }

  /* "fwdpy/regions.pyx":264
 *         if math.isnan(lo):
 *             raise ValueError("fwdpy.UniformS: lo not a number")
 *         if math.isnan(hi):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.UniformS: hi not a number")
 *         self.lo=float(lo)
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_isnan); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_hi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 264, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":265
 *             raise ValueError("fwdpy.UniformS: lo not a number")
 *         if math.isnan(hi):
 *             raise ValueError("fwdpy.UniformS: hi not a number")             # <<<<<<<<<<<<<<
 *         self.lo=float(lo)
 *         self.hi=float(hi)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 265, __pyx_L1_error)

    /* "fwdpy/regions.pyx":264
 *         if math.isnan(lo):
 *             raise ValueError("fwdpy.UniformS: lo not a number")
 *         if math.isnan(hi):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.UniformS: hi not a number")
 *         self.lo=float(lo)
 */
  }

  /* "fwdpy/regions.pyx":266
 *         if math.isnan(hi):
 *             raise ValueError("fwdpy.UniformS: hi not a number")
 *         self.lo=float(lo)             # <<<<<<<<<<<<<<
 *         self.hi=float(hi)
 *         super(UniformS,self).__init__(beg,end,weight,h,coupled)
 */
  __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_lo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_lo, __pyx_t_1) < 0) __PYX_ERR(0, 266, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":267
 *             raise ValueError("fwdpy.UniformS: hi not a number")
 *         self.lo=float(lo)
 *         self.hi=float(hi)             # <<<<<<<<<<<<<<
 *         super(UniformS,self).__init__(beg,end,weight,h,coupled)
 *     def __str__(self):
 */
  __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_hi)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_hi, __pyx_t_1) < 0) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":268
 *         self.lo=float(lo)
 *         self.hi=float(hi)
 *         super(UniformS,self).__init__(beg,end,weight,h,coupled)             # <<<<<<<<<<<<<<
 *     def __str__(self):
 *         return "Uniform s DFE, lo = "+"{:.9f}".format(self.lo)+", hi = "+"{:.9f}".format(self.hi)+", "+super(UniformS,self).__str__()
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_UniformS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 268, __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_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_beg); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_weight); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_t_2, __pyx_t_4, __pyx_t_5, __pyx_t_7, __pyx_v_coupled};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[6] = {__pyx_t_8, __pyx_t_2, __pyx_t_4, __pyx_t_5, __pyx_t_7, __pyx_v_coupled};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(5+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 268, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_coupled);
    __Pyx_GIVEREF(__pyx_v_coupled);
    PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_9, __pyx_v_coupled);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_7 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":235
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float lo,float hi,float h=1.0,coupled=True):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("fwdpy.fwdpy.UniformS.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/regions.pyx":269
 *         self.hi=float(hi)
 *         super(UniformS,self).__init__(beg,end,weight,h,coupled)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Uniform s DFE, lo = "+"{:.9f}".format(self.lo)+", hi = "+"{:.9f}".format(self.hi)+", "+super(UniformS,self).__str__()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_8UniformS_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_8UniformS_3__str__ = {"__str__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_8UniformS_3__str__, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_8UniformS_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_8UniformS_2__str__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_8UniformS_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "fwdpy/regions.pyx":270
 *         super(UniformS,self).__init__(beg,end,weight,h,coupled)
 *     def __str__(self):
 *         return "Uniform s DFE, lo = "+"{:.9f}".format(self.lo)+", hi = "+"{:.9f}".format(self.hi)+", "+super(UniformS,self).__str__()             # <<<<<<<<<<<<<<
 * 
 * class ExpS(Sregion):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_9f, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_lo); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 270, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_kp_s_Uniform_s_DFE_lo, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_kp_s_hi_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_9f, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_hi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 270, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_kp_s__26); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_UniformS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_self);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __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_str); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 270, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 270, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "fwdpy/regions.pyx":269
 *         self.hi=float(hi)
 *         super(UniformS,self).__init__(beg,end,weight,h,coupled)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Uniform s DFE, lo = "+"{:.9f}".format(self.lo)+", hi = "+"{:.9f}".format(self.hi)+", "+super(UniformS,self).__str__()
 * 
 */

  /* function exit code */
  __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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("fwdpy.fwdpy.UniformS.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/regions.pyx":286
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float mean,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_4ExpS_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_4ExpS___init__[] = "\n        Constructor\n    \n        :param beg: the beginning of the region\n        :param end: the end of the region\n        :param weight: the weight to assign\n        :param mean: the mean selection coefficient\n        :param h: the dominance\n        :param coupled: if True, the weight is converted to (end-beg)*weight\n        :param label: Not relevant to recombining regions.  Otherwise, this value will be used to take mutations from this region.\n\n        When coupled is True, the \"weight\" may be interpreted as a \"per base pair\"\n        (or per unit, generally speaking) term.\n\n        Example:\n\n        >>> #A simple case\n        >>> import fwdpy\n        >>> #s is exp(-0.1) and recessive\n        >>> constantS = fwdpy.ExpS(0,1,1,0,-0.1,0)\n        ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_4ExpS_1__init__ = {"__init__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_4ExpS_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_4ExpS___init__};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_4ExpS_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  float __pyx_v_beg;
  float __pyx_v_end;
  float __pyx_v_weight;
  float __pyx_v_mean;
  float __pyx_v_h;
  PyObject *__pyx_v_coupled = 0;
  uint16_t __pyx_v_label;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_beg,&__pyx_n_s_end,&__pyx_n_s_weight,&__pyx_n_s_mean,&__pyx_n_s_h,&__pyx_n_s_coupled,&__pyx_n_s_label,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    values[6] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_beg)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 1); __PYX_ERR(0, 286, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 2); __PYX_ERR(0, 286, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_weight)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 3); __PYX_ERR(0, 286, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mean)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 4); __PYX_ERR(0, 286, __pyx_L3_error)
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coupled);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_label);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 286, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_beg = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_beg == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L3_error)
    __pyx_v_end = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_end == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L3_error)
    __pyx_v_weight = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_weight == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L3_error)
    __pyx_v_mean = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_mean == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L3_error)
    if (values[5]) {
      __pyx_v_h = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_h == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L3_error)
    } else {
      __pyx_v_h = ((float)((double)1.0));
    }
    __pyx_v_coupled = values[6];
    if (values[7]) {
      __pyx_v_label = __Pyx_PyInt_As_uint16_t(values[7]); if (unlikely((__pyx_v_label == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L3_error)
    } else {
      __pyx_v_label = ((uint16_t)((uint16_t)0));
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 286, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.ExpS.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_4ExpS___init__(__pyx_self, __pyx_v_self, __pyx_v_beg, __pyx_v_end, __pyx_v_weight, __pyx_v_mean, __pyx_v_h, __pyx_v_coupled, __pyx_v_label);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_4ExpS___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, float __pyx_v_beg, float __pyx_v_end, float __pyx_v_weight, float __pyx_v_mean, float __pyx_v_h, PyObject *__pyx_v_coupled, uint16_t __pyx_v_label) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "fwdpy/regions.pyx":308
 *         >>> constantS = fwdpy.ExpS(0,1,1,0,-0.1,0)
 *         """
 *         if math.isinf(mean):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.ExpS: mean not finite")
 *         if math.isnan(mean):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isinf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_mean); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 308, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 308, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":309
 *         """
 *         if math.isinf(mean):
 *             raise ValueError("fwdpy.ExpS: mean not finite")             # <<<<<<<<<<<<<<
 *         if math.isnan(mean):
 *             raise ValueError("fwdpy.ExpS: mean not a number")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 309, __pyx_L1_error)

    /* "fwdpy/regions.pyx":308
 *         >>> constantS = fwdpy.ExpS(0,1,1,0,-0.1,0)
 *         """
 *         if math.isinf(mean):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.ExpS: mean not finite")
 *         if math.isnan(mean):
 */
  }

  /* "fwdpy/regions.pyx":310
 *         if math.isinf(mean):
 *             raise ValueError("fwdpy.ExpS: mean not finite")
 *         if math.isnan(mean):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.ExpS: mean not a number")
 *         self.mean=float(mean)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isnan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":311
 *             raise ValueError("fwdpy.ExpS: mean not finite")
 *         if math.isnan(mean):
 *             raise ValueError("fwdpy.ExpS: mean not a number")             # <<<<<<<<<<<<<<
 *         self.mean=float(mean)
 *         super(ExpS,self).__init__(beg,end,weight,h,coupled,label)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 311, __pyx_L1_error)

    /* "fwdpy/regions.pyx":310
 *         if math.isinf(mean):
 *             raise ValueError("fwdpy.ExpS: mean not finite")
 *         if math.isnan(mean):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.ExpS: mean not a number")
 *         self.mean=float(mean)
 */
  }

  /* "fwdpy/regions.pyx":312
 *         if math.isnan(mean):
 *             raise ValueError("fwdpy.ExpS: mean not a number")
 *         self.mean=float(mean)             # <<<<<<<<<<<<<<
 *         super(ExpS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):
 */
  __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_mean)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_mean, __pyx_t_1) < 0) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":313
 *             raise ValueError("fwdpy.ExpS: mean not a number")
 *         self.mean=float(mean)
 *         super(ExpS,self).__init__(beg,end,weight,h,coupled,label)             # <<<<<<<<<<<<<<
 *     def __str__(self):
 *         return "Exponential DFE, mean = "+"{:.9f}".format(self.mean)+", "+super(ExpS,self).__str__()
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ExpS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 313, __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_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_beg); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_weight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyInt_From_uint16_t(__pyx_v_label); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[7] = {__pyx_t_9, __pyx_t_5, __pyx_t_3, __pyx_t_2, __pyx_t_7, __pyx_v_coupled, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 6+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[7] = {__pyx_t_9, __pyx_t_5, __pyx_t_3, __pyx_t_2, __pyx_t_7, __pyx_v_coupled, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 6+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_11 = PyTuple_New(6+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_10, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_coupled);
    __Pyx_GIVEREF(__pyx_v_coupled);
    PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_10, __pyx_v_coupled);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_11, 5+__pyx_t_10, __pyx_t_8);
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":286
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float mean,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("fwdpy.fwdpy.ExpS.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/regions.pyx":314
 *         self.mean=float(mean)
 *         super(ExpS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Exponential DFE, mean = "+"{:.9f}".format(self.mean)+", "+super(ExpS,self).__str__()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_4ExpS_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_4ExpS_3__str__ = {"__str__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_4ExpS_3__str__, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_4ExpS_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_4ExpS_2__str__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_4ExpS_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "fwdpy/regions.pyx":315
 *         super(ExpS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):
 *         return "Exponential DFE, mean = "+"{:.9f}".format(self.mean)+", "+super(ExpS,self).__str__()             # <<<<<<<<<<<<<<
 * 
 * class GaussianS(Sregion):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_9f, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 315, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_kp_s_Exponential_DFE_mean, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_kp_s__26); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ExpS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "fwdpy/regions.pyx":314
 *         self.mean=float(mean)
 *         super(ExpS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Exponential DFE, mean = "+"{:.9f}".format(self.mean)+", "+super(ExpS,self).__str__()
 * 
 */

  /* function exit code */
  __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_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.ExpS.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/regions.pyx":333
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float sd,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9GaussianS_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_9GaussianS___init__[] = "\n        Constructor\n    \n        :param beg: the beginning of the region\n        :param end: the end of the region\n        :param weight: the weight to assign\n        :param mean: the mean selection coefficient\n        :param h: the dominance\n        :param coupled: if True, the weight is converted to (end-beg)*weight\n        :param label: Not relevant to recombining regions.  Otherwise, this value will be used to take mutations from this region.\n\n        When coupled is True, the \"weight\" may be interpreted as a \"per base pair\"\n        (or per unit, generally speaking) term.\n\n        Example:\n\n        >>> #A simple case\n        >>> import fwdpy\n        >>> #s N(0,0.1) and co-dominant\n        >>> constantS = fwdpy.GaussianS(0,1,1,0,0.1,1)\n        ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_9GaussianS_1__init__ = {"__init__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_9GaussianS_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_9GaussianS___init__};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9GaussianS_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  float __pyx_v_beg;
  float __pyx_v_end;
  float __pyx_v_weight;
  float __pyx_v_sd;
  float __pyx_v_h;
  PyObject *__pyx_v_coupled = 0;
  uint16_t __pyx_v_label;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_beg,&__pyx_n_s_end,&__pyx_n_s_weight,&__pyx_n_s_sd,&__pyx_n_s_h,&__pyx_n_s_coupled,&__pyx_n_s_label,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    values[6] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_beg)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 1); __PYX_ERR(0, 333, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 2); __PYX_ERR(0, 333, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_weight)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 3); __PYX_ERR(0, 333, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sd)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, 4); __PYX_ERR(0, 333, __pyx_L3_error)
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coupled);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_label);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 333, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_beg = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_beg == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 333, __pyx_L3_error)
    __pyx_v_end = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_end == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 333, __pyx_L3_error)
    __pyx_v_weight = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_weight == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 333, __pyx_L3_error)
    __pyx_v_sd = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_sd == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 333, __pyx_L3_error)
    if (values[5]) {
      __pyx_v_h = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_h == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 333, __pyx_L3_error)
    } else {
      __pyx_v_h = ((float)((double)1.0));
    }
    __pyx_v_coupled = values[6];
    if (values[7]) {
      __pyx_v_label = __Pyx_PyInt_As_uint16_t(values[7]); if (unlikely((__pyx_v_label == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 333, __pyx_L3_error)
    } else {
      __pyx_v_label = ((uint16_t)((uint16_t)0));
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 333, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.GaussianS.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_9GaussianS___init__(__pyx_self, __pyx_v_self, __pyx_v_beg, __pyx_v_end, __pyx_v_weight, __pyx_v_sd, __pyx_v_h, __pyx_v_coupled, __pyx_v_label);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_9GaussianS___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, float __pyx_v_beg, float __pyx_v_end, float __pyx_v_weight, float __pyx_v_sd, float __pyx_v_h, PyObject *__pyx_v_coupled, uint16_t __pyx_v_label) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "fwdpy/regions.pyx":355
 *         >>> constantS = fwdpy.GaussianS(0,1,1,0,0.1,1)
 *         """
 *         if math.isinf(sd):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.GaussianS: sd not finite")
 *         if math.isnan(sd):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isinf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_sd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 355, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":356
 *         """
 *         if math.isinf(sd):
 *             raise ValueError("fwdpy.GaussianS: sd not finite")             # <<<<<<<<<<<<<<
 *         if math.isnan(sd):
 *             raise ValueError("fwdpy.GaussianS: sd not a number")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 356, __pyx_L1_error)

    /* "fwdpy/regions.pyx":355
 *         >>> constantS = fwdpy.GaussianS(0,1,1,0,0.1,1)
 *         """
 *         if math.isinf(sd):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.GaussianS: sd not finite")
 *         if math.isnan(sd):
 */
  }

  /* "fwdpy/regions.pyx":357
 *         if math.isinf(sd):
 *             raise ValueError("fwdpy.GaussianS: sd not finite")
 *         if math.isnan(sd):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.GaussianS: sd not a number")
 *         self.sd=float(sd)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isnan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_sd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 357, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "fwdpy/regions.pyx":358
 *             raise ValueError("fwdpy.GaussianS: sd not finite")
 *         if math.isnan(sd):
 *             raise ValueError("fwdpy.GaussianS: sd not a number")             # <<<<<<<<<<<<<<
 *         self.sd=float(sd)
 *         super(GaussianS,self).__init__(beg,end,weight,h,coupled,label)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 358, __pyx_L1_error)

    /* "fwdpy/regions.pyx":357
 *         if math.isinf(sd):
 *             raise ValueError("fwdpy.GaussianS: sd not finite")
 *         if math.isnan(sd):             # <<<<<<<<<<<<<<
 *             raise ValueError("fwdpy.GaussianS: sd not a number")
 *         self.sd=float(sd)
 */
  }

  /* "fwdpy/regions.pyx":359
 *         if math.isnan(sd):
 *             raise ValueError("fwdpy.GaussianS: sd not a number")
 *         self.sd=float(sd)             # <<<<<<<<<<<<<<
 *         super(GaussianS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):
 */
  __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_sd)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sd, __pyx_t_1) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":360
 *             raise ValueError("fwdpy.GaussianS: sd not a number")
 *         self.sd=float(sd)
 *         super(GaussianS,self).__init__(beg,end,weight,h,coupled,label)             # <<<<<<<<<<<<<<
 *     def __str__(self):
 *         return "Gaussian DFE, s.d. = "+"{:.9f}".format(self.sd)+", "+super(GaussianS,self).__str__()
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_GaussianS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 360, __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_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_beg); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_weight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_h); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyInt_From_uint16_t(__pyx_v_label); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[7] = {__pyx_t_9, __pyx_t_5, __pyx_t_3, __pyx_t_2, __pyx_t_7, __pyx_v_coupled, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 6+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[7] = {__pyx_t_9, __pyx_t_5, __pyx_t_3, __pyx_t_2, __pyx_t_7, __pyx_v_coupled, __pyx_t_8};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 6+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_11 = PyTuple_New(6+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_10, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_coupled);
    __Pyx_GIVEREF(__pyx_v_coupled);
    PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_10, __pyx_v_coupled);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_11, 5+__pyx_t_10, __pyx_t_8);
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":333
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float sd,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("fwdpy.fwdpy.GaussianS.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/regions.pyx":361
 *         self.sd=float(sd)
 *         super(GaussianS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Gaussian DFE, s.d. = "+"{:.9f}".format(self.sd)+", "+super(GaussianS,self).__str__()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9GaussianS_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_9GaussianS_3__str__ = {"__str__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_9GaussianS_3__str__, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9GaussianS_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_9GaussianS_2__str__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_9GaussianS_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "fwdpy/regions.pyx":362
 *         super(GaussianS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):
 *         return "Gaussian DFE, s.d. = "+"{:.9f}".format(self.sd)+", "+super(GaussianS,self).__str__()             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_9f, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 362, __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 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_kp_s_Gaussian_DFE_s_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_kp_s__26); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_GaussianS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "fwdpy/regions.pyx":361
 *         self.sd=float(sd)
 *         super(GaussianS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Gaussian DFE, s.d. = "+"{:.9f}".format(self.sd)+", "+super(GaussianS,self).__str__()
 */

  /* function exit code */
  __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_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.GaussianS.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/copy.pyx":3
 * import fwdpyio as fpio
 * 
 * def copypop(PopType pop):             # <<<<<<<<<<<<<<
 *     """
 *     Copy a population
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_27copypop(PyObject *__pyx_self, PyObject *__pyx_v_pop); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_26copypop[] = "\n    Copy a population\n\n    :param pop: the population to copy.\n\n    :rtype: A :class:`fwdpy.fwdpy.PopType` of the same (derived) type as pop\n\n    .. note:: The function is implemented in terms of the serialization routines in the fwdpy.fwdpyio module.  The return value can be evolved and not affect the input value.\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_27copypop = {"copypop", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_27copypop, METH_O, __pyx_doc_5fwdpy_5fwdpy_26copypop};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_27copypop(PyObject *__pyx_self, PyObject *__pyx_v_pop) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copypop (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_PopType, 1, "pop", 0))) __PYX_ERR(6, 3, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_26copypop(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_PopType *)__pyx_v_pop));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_26copypop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_pop) {
  PyObject *__pyx_v_s = NULL;
  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;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("copypop", 0);

  /* "fwdpy/copy.pyx":13
 *     .. note:: The function is implemented in terms of the serialization routines in the fwdpy.fwdpyio module.  The return value can be evolved and not affect the input value.
 *     """
 *     s = fpio.serialize(pop)             # <<<<<<<<<<<<<<
 *     if isinstance(pop,Spop):
 *         return fpio.deserialize_singlepops(list(s))
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_fpio); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_serialize); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 13, __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 && unlikely(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);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pop)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)__pyx_v_pop)};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 13, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)__pyx_v_pop)};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 13, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_pop));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_pop));
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_pop));
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_s = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "fwdpy/copy.pyx":14
 *     """
 *     s = fpio.serialize(pop)
 *     if isinstance(pop,Spop):             # <<<<<<<<<<<<<<
 *         return fpio.deserialize_singlepops(list(s))
 *     elif isinstance(pop,MetaPop):
 */
  __pyx_t_5 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_Spop); 
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "fwdpy/copy.pyx":15
 *     s = fpio.serialize(pop)
 *     if isinstance(pop,Spop):
 *         return fpio.deserialize_singlepops(list(s))             # <<<<<<<<<<<<<<
 *     elif isinstance(pop,MetaPop):
 *         return fpio.deserialize_metapops(list(s))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_fpio); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_deserialize_singlepops); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PySequence_List(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 15, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 15, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 15, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 15, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 15, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "fwdpy/copy.pyx":14
 *     """
 *     s = fpio.serialize(pop)
 *     if isinstance(pop,Spop):             # <<<<<<<<<<<<<<
 *         return fpio.deserialize_singlepops(list(s))
 *     elif isinstance(pop,MetaPop):
 */
  }

  /* "fwdpy/copy.pyx":16
 *     if isinstance(pop,Spop):
 *         return fpio.deserialize_singlepops(list(s))
 *     elif isinstance(pop,MetaPop):             # <<<<<<<<<<<<<<
 *         return fpio.deserialize_metapops(list(s))
 *     else:
 */
  __pyx_t_6 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_MetaPop); 
  __pyx_t_5 = (__pyx_t_6 != 0);
  if (__pyx_t_5) {

    /* "fwdpy/copy.pyx":17
 *         return fpio.deserialize_singlepops(list(s))
 *     elif isinstance(pop,MetaPop):
 *         return fpio.deserialize_metapops(list(s))             # <<<<<<<<<<<<<<
 *     else:
 *         raise RuntimeError("fwdpy.copypop: PopType "+str(type(pop))+" is not supported")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_fpio); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 17, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_deserialize_metapops); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 17, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PySequence_List(__pyx_v_s); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 17, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 17, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 17, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 17, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 17, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 17, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "fwdpy/copy.pyx":16
 *     if isinstance(pop,Spop):
 *         return fpio.deserialize_singlepops(list(s))
 *     elif isinstance(pop,MetaPop):             # <<<<<<<<<<<<<<
 *         return fpio.deserialize_metapops(list(s))
 *     else:
 */
  }

  /* "fwdpy/copy.pyx":19
 *         return fpio.deserialize_metapops(list(s))
 *     else:
 *         raise RuntimeError("fwdpy.copypop: PopType "+str(type(pop))+" is not supported")             # <<<<<<<<<<<<<<
 * 
 * def copypops(PopVec pops):
 */
  /*else*/ {
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 19, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_pop))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_pop))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_pop))));
    __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 19, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_kp_s_fwdpy_copypop_PopType, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 19, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_kp_s_is_not_supported); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 19, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 19, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 19, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(6, 19, __pyx_L1_error)
  }

  /* "fwdpy/copy.pyx":3
 * import fwdpyio as fpio
 * 
 * def copypop(PopType pop):             # <<<<<<<<<<<<<<
 *     """
 *     Copy a population
 */

  /* function exit code */
  __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_7);
  __Pyx_AddTraceback("fwdpy.fwdpy.copypop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/copy.pyx":21
 *         raise RuntimeError("fwdpy.copypop: PopType "+str(type(pop))+" is not supported")
 * 
 * def copypops(PopVec pops):             # <<<<<<<<<<<<<<
 *     """
 *     Copy a population
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_29copypops(PyObject *__pyx_self, PyObject *__pyx_v_pops); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_28copypops[] = "\n    Copy a population\n\n    :param pops: the list of population to copy.\n\n    :rtype: A :class:`fwdpy.fwdpy.PopVec` of the same (derived) type as pop\n\n    .. note:: The function is implemented in terms of the serialization routines in the fwdpy.fwdpyio module.  The return value can be evolved and not affect the input value.\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_29copypops = {"copypops", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_29copypops, METH_O, __pyx_doc_5fwdpy_5fwdpy_28copypops};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_29copypops(PyObject *__pyx_self, PyObject *__pyx_v_pops) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copypops (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pops), __pyx_ptype_5fwdpy_5fwdpy_PopVec, 1, "pops", 0))) __PYX_ERR(6, 21, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_28copypops(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_PopVec *)__pyx_v_pops));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_28copypops(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_PopVec *__pyx_v_pops) {
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_v_pop = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("copypops", 0);

  /* "fwdpy/copy.pyx":31
 *     .. note:: The function is implemented in terms of the serialization routines in the fwdpy.fwdpyio module.  The return value can be evolved and not affect the input value.
 *     """
 *     s = [fpio.serialize(pop) for pop in pops]             # <<<<<<<<<<<<<<
 *     if isinstance(pops,SpopVec):
 *         return fpio.deserialize_singlepops(s)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(((PyObject *)__pyx_v_pops))) || PyTuple_CheckExact(((PyObject *)__pyx_v_pops))) {
    __pyx_t_2 = ((PyObject *)__pyx_v_pops); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_pops)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 31, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 31, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(6, 31, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 31, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(6, 31, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 31, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(6, 31, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_pop, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_fpio); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 31, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_serialize); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 31, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_pop); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 31, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_pop};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 31, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_pop};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 31, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 31, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_pop);
        __Pyx_GIVEREF(__pyx_v_pop);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_pop);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 31, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(6, 31, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_s = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/copy.pyx":32
 *     """
 *     s = [fpio.serialize(pop) for pop in pops]
 *     if isinstance(pops,SpopVec):             # <<<<<<<<<<<<<<
 *         return fpio.deserialize_singlepops(s)
 *     elif isinstance(pops,MetaPopVec):
 */
  __pyx_t_9 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pops), __pyx_ptype_5fwdpy_5fwdpy_SpopVec); 
  __pyx_t_10 = (__pyx_t_9 != 0);
  if (__pyx_t_10) {

    /* "fwdpy/copy.pyx":33
 *     s = [fpio.serialize(pop) for pop in pops]
 *     if isinstance(pops,SpopVec):
 *         return fpio.deserialize_singlepops(s)             # <<<<<<<<<<<<<<
 *     elif isinstance(pops,MetaPopVec):
 *         return fpio.deserialize_metapops(s)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_fpio); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 33, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_deserialize_singlepops); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 33, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 33, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_s};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 33, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_s};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 33, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 33, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_INCREF(__pyx_v_s);
        __Pyx_GIVEREF(__pyx_v_s);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_s);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 33, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "fwdpy/copy.pyx":32
 *     """
 *     s = [fpio.serialize(pop) for pop in pops]
 *     if isinstance(pops,SpopVec):             # <<<<<<<<<<<<<<
 *         return fpio.deserialize_singlepops(s)
 *     elif isinstance(pops,MetaPopVec):
 */
  }

  /* "fwdpy/copy.pyx":34
 *     if isinstance(pops,SpopVec):
 *         return fpio.deserialize_singlepops(s)
 *     elif isinstance(pops,MetaPopVec):             # <<<<<<<<<<<<<<
 *         return fpio.deserialize_metapops(s)
 *     else:
 */
  __pyx_t_10 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pops), __pyx_ptype_5fwdpy_5fwdpy_MetaPopVec); 
  __pyx_t_9 = (__pyx_t_10 != 0);
  if (__pyx_t_9) {

    /* "fwdpy/copy.pyx":35
 *         return fpio.deserialize_singlepops(s)
 *     elif isinstance(pops,MetaPopVec):
 *         return fpio.deserialize_metapops(s)             # <<<<<<<<<<<<<<
 *     else:
 *         raise RuntimeError("fwdpy.copypopvec: popvec type "+str(type(pops))+" is not supported")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_fpio); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_deserialize_metapops); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 35, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_s};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 35, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_s};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 35, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 35, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_s);
        __Pyx_GIVEREF(__pyx_v_s);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_s);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 35, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "fwdpy/copy.pyx":34
 *     if isinstance(pops,SpopVec):
 *         return fpio.deserialize_singlepops(s)
 *     elif isinstance(pops,MetaPopVec):             # <<<<<<<<<<<<<<
 *         return fpio.deserialize_metapops(s)
 *     else:
 */
  }

  /* "fwdpy/copy.pyx":37
 *         return fpio.deserialize_metapops(s)
 *     else:
 *         raise RuntimeError("fwdpy.copypopvec: popvec type "+str(type(pops))+" is not supported")             # <<<<<<<<<<<<<<
 */
  /*else*/ {
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_pops))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_pops))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_pops))));
    __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_kp_s_fwdpy_copypopvec_popvec_type, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_kp_s_is_not_supported); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(6, 37, __pyx_L1_error)
  }

  /* "fwdpy/copy.pyx":21
 *         raise RuntimeError("fwdpy.copypop: PopType "+str(type(pop))+" is not supported")
 * 
 * def copypops(PopVec pops):             # <<<<<<<<<<<<<<
 *     """
 *     Copy a population
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("fwdpy.fwdpy.copypops", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_pop);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":18
 * 
 * 
 * cdef popgen_mut_data get_mutation(const popgenmut & m,             # <<<<<<<<<<<<<<
 *                                   size_t n) nogil:
 *     cdef popgen_mut_data rv
 */

static struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data __pyx_f_5fwdpy_5fwdpy_get_mutation(KTfwd::popgenmut const &__pyx_v_m, size_t __pyx_v_n) {
  struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data __pyx_v_rv;
  std::numeric_limits<unsigned int>  __pyx_v_ul;
  struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data __pyx_r;
  double __pyx_t_1;
  unsigned int __pyx_t_2;
  bool __pyx_t_3;
  uint16_t __pyx_t_4;

  /* "fwdpy/views.pyx":22
 *     cdef popgen_mut_data rv
 *     cdef numeric_limits[unsigned] ul
 *     rv.pos=m.pos             # <<<<<<<<<<<<<<
 *     rv.n=<unsigned>n
 *     rv.g=m.g
 */
  __pyx_t_1 = __pyx_v_m.pos;
  __pyx_v_rv.pos = __pyx_t_1;

  /* "fwdpy/views.pyx":23
 *     cdef numeric_limits[unsigned] ul
 *     rv.pos=m.pos
 *     rv.n=<unsigned>n             # <<<<<<<<<<<<<<
 *     rv.g=m.g
 *     rv.ftime=ul.max()
 */
  __pyx_v_rv.n = ((unsigned int)__pyx_v_n);

  /* "fwdpy/views.pyx":24
 *     rv.pos=m.pos
 *     rv.n=<unsigned>n
 *     rv.g=m.g             # <<<<<<<<<<<<<<
 *     rv.ftime=ul.max()
 *     rv.s=m.s
 */
  __pyx_t_2 = __pyx_v_m.g;
  __pyx_v_rv.g = __pyx_t_2;

  /* "fwdpy/views.pyx":25
 *     rv.n=<unsigned>n
 *     rv.g=m.g
 *     rv.ftime=ul.max()             # <<<<<<<<<<<<<<
 *     rv.s=m.s
 *     rv.h=m.h
 */
  __pyx_v_rv.ftime = __pyx_v_ul.max();

  /* "fwdpy/views.pyx":26
 *     rv.g=m.g
 *     rv.ftime=ul.max()
 *     rv.s=m.s             # <<<<<<<<<<<<<<
 *     rv.h=m.h
 *     rv.neutral=m.neutral
 */
  __pyx_t_1 = __pyx_v_m.s;
  __pyx_v_rv.s = __pyx_t_1;

  /* "fwdpy/views.pyx":27
 *     rv.ftime=ul.max()
 *     rv.s=m.s
 *     rv.h=m.h             # <<<<<<<<<<<<<<
 *     rv.neutral=m.neutral
 *     rv.label=m.xtra
 */
  __pyx_t_1 = __pyx_v_m.h;
  __pyx_v_rv.h = __pyx_t_1;

  /* "fwdpy/views.pyx":28
 *     rv.s=m.s
 *     rv.h=m.h
 *     rv.neutral=m.neutral             # <<<<<<<<<<<<<<
 *     rv.label=m.xtra
 *     return rv
 */
  __pyx_t_3 = __pyx_v_m.neutral;
  __pyx_v_rv.neutral = __pyx_t_3;

  /* "fwdpy/views.pyx":29
 *     rv.h=m.h
 *     rv.neutral=m.neutral
 *     rv.label=m.xtra             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
  __pyx_t_4 = __pyx_v_m.xtra;
  __pyx_v_rv.label = __pyx_t_4;

  /* "fwdpy/views.pyx":30
 *     rv.neutral=m.neutral
 *     rv.label=m.xtra
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * cdef gamete_data get_gamete(const gamete_t & g,
 */
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":18
 * 
 * 
 * cdef popgen_mut_data get_mutation(const popgenmut & m,             # <<<<<<<<<<<<<<
 *                                   size_t n) nogil:
 *     cdef popgen_mut_data rv
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/views.pyx":32
 *     return rv
 * 
 * cdef gamete_data get_gamete(const gamete_t & g,             # <<<<<<<<<<<<<<
 *                             const mcont_t & mutations,
 *                             const mcounts_cont_t & mcounts) nogil:
 */

static struct __pyx_t_5fwdpy_5fwdpy_gamete_data __pyx_f_5fwdpy_5fwdpy_get_gamete(fwdpy::gamete_t const &__pyx_v_g, fwdpy::mcont_t const &__pyx_v_mutations, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &__pyx_v_mcounts) {
  struct __pyx_t_5fwdpy_5fwdpy_gamete_data __pyx_v_rv;
  size_t __pyx_v_i;
  size_t __pyx_v_j;
  struct __pyx_t_5fwdpy_5fwdpy_gamete_data __pyx_r;
  int __pyx_t_1;
  unsigned int __pyx_t_2;

  /* "fwdpy/views.pyx":36
 *                             const mcounts_cont_t & mcounts) nogil:
 *     cdef gamete_data rv
 *     cdef size_t i=0,j=g.mutations.size()             # <<<<<<<<<<<<<<
 *     while i<j:
 *         rv.neutral.push_back(get_mutation(mutations[g.mutations[i]],mcounts[g.mutations[i]]))
 */
  __pyx_v_i = 0;
  __pyx_v_j = __pyx_v_g.mutations.size();

  /* "fwdpy/views.pyx":37
 *     cdef gamete_data rv
 *     cdef size_t i=0,j=g.mutations.size()
 *     while i<j:             # <<<<<<<<<<<<<<
 *         rv.neutral.push_back(get_mutation(mutations[g.mutations[i]],mcounts[g.mutations[i]]))
 *         i+=1
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_i < __pyx_v_j) != 0);
    if (!__pyx_t_1) break;

    /* "fwdpy/views.pyx":38
 *     cdef size_t i=0,j=g.mutations.size()
 *     while i<j:
 *         rv.neutral.push_back(get_mutation(mutations[g.mutations[i]],mcounts[g.mutations[i]]))             # <<<<<<<<<<<<<<
 *         i+=1
 * 
 */
    try {
      __pyx_v_rv.neutral.push_back(__pyx_f_5fwdpy_5fwdpy_get_mutation((__pyx_v_mutations[(__pyx_v_g.mutations[__pyx_v_i])]), (__pyx_v_mcounts[(__pyx_v_g.mutations[__pyx_v_i])])));
    } catch(...) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      __Pyx_CppExn2PyErr();
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(3, 38, __pyx_L1_error)
    }

    /* "fwdpy/views.pyx":39
 *     while i<j:
 *         rv.neutral.push_back(get_mutation(mutations[g.mutations[i]],mcounts[g.mutations[i]]))
 *         i+=1             # <<<<<<<<<<<<<<
 * 
 *     i=0
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "fwdpy/views.pyx":41
 *         i+=1
 * 
 *     i=0             # <<<<<<<<<<<<<<
 *     j=g.smutations.size()
 *     while i<j:
 */
  __pyx_v_i = 0;

  /* "fwdpy/views.pyx":42
 * 
 *     i=0
 *     j=g.smutations.size()             # <<<<<<<<<<<<<<
 *     while i<j:
 *         rv.selected.push_back(get_mutation(mutations[g.smutations[i]],mcounts[g.smutations[i]]))
 */
  __pyx_v_j = __pyx_v_g.smutations.size();

  /* "fwdpy/views.pyx":43
 *     i=0
 *     j=g.smutations.size()
 *     while i<j:             # <<<<<<<<<<<<<<
 *         rv.selected.push_back(get_mutation(mutations[g.smutations[i]],mcounts[g.smutations[i]]))
 *         i+=1
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_i < __pyx_v_j) != 0);
    if (!__pyx_t_1) break;

    /* "fwdpy/views.pyx":44
 *     j=g.smutations.size()
 *     while i<j:
 *         rv.selected.push_back(get_mutation(mutations[g.smutations[i]],mcounts[g.smutations[i]]))             # <<<<<<<<<<<<<<
 *         i+=1
 *     rv.n=g.n
 */
    try {
      __pyx_v_rv.selected.push_back(__pyx_f_5fwdpy_5fwdpy_get_mutation((__pyx_v_mutations[(__pyx_v_g.smutations[__pyx_v_i])]), (__pyx_v_mcounts[(__pyx_v_g.smutations[__pyx_v_i])])));
    } catch(...) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      __Pyx_CppExn2PyErr();
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(3, 44, __pyx_L1_error)
    }

    /* "fwdpy/views.pyx":45
 *     while i<j:
 *         rv.selected.push_back(get_mutation(mutations[g.smutations[i]],mcounts[g.smutations[i]]))
 *         i+=1             # <<<<<<<<<<<<<<
 *     rv.n=g.n
 *     return rv
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "fwdpy/views.pyx":46
 *         rv.selected.push_back(get_mutation(mutations[g.smutations[i]],mcounts[g.smutations[i]]))
 *         i+=1
 *     rv.n=g.n             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
  __pyx_t_2 = __pyx_v_g.n;
  __pyx_v_rv.n = __pyx_t_2;

  /* "fwdpy/views.pyx":47
 *         i+=1
 *     rv.n=g.n
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * cdef diploid_data get_diploid(const diploid_t & dip,
 */
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":32
 *     return rv
 * 
 * cdef gamete_data get_gamete(const gamete_t & g,             # <<<<<<<<<<<<<<
 *                             const mcont_t & mutations,
 *                             const mcounts_cont_t & mcounts) nogil:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("fwdpy.fwdpy.get_gamete", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/views.pyx":49
 *     return rv
 * 
 * cdef diploid_data get_diploid(const diploid_t & dip,             # <<<<<<<<<<<<<<
 *                               const gcont_t & gametes,
 *                               const mcont_t & mutations,
 */

static struct __pyx_t_5fwdpy_5fwdpy_diploid_data __pyx_f_5fwdpy_5fwdpy_get_diploid(fwdpy::diploid_t const &__pyx_v_dip, fwdpy::gcont_t const &__pyx_v_gametes, fwdpy::mcont_t const &__pyx_v_mutations, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &__pyx_v_mcounts) {
  struct __pyx_t_5fwdpy_5fwdpy_diploid_data __pyx_v_rv;
  size_t __pyx_v_i;
  struct __pyx_t_5fwdpy_5fwdpy_diploid_data __pyx_r;
  double __pyx_t_1;
  int __pyx_t_2;

  /* "fwdpy/views.pyx":54
 *                               const mcounts_cont_t & mcounts) nogil:
 *    cdef diploid_data rv
 *    rv.g=dip.g             # <<<<<<<<<<<<<<
 *    rv.e=dip.e
 *    rv.w=dip.w
 */
  __pyx_t_1 = __pyx_v_dip.g;
  __pyx_v_rv.g = __pyx_t_1;

  /* "fwdpy/views.pyx":55
 *    cdef diploid_data rv
 *    rv.g=dip.g
 *    rv.e=dip.e             # <<<<<<<<<<<<<<
 *    rv.w=dip.w
 *    rv.chrom0=get_gamete(gametes[dip.first],mutations,mcounts)
 */
  __pyx_t_1 = __pyx_v_dip.e;
  __pyx_v_rv.e = __pyx_t_1;

  /* "fwdpy/views.pyx":56
 *    rv.g=dip.g
 *    rv.e=dip.e
 *    rv.w=dip.w             # <<<<<<<<<<<<<<
 *    rv.chrom0=get_gamete(gametes[dip.first],mutations,mcounts)
 *    rv.chrom1=get_gamete(gametes[dip.second],mutations,mcounts)
 */
  __pyx_t_1 = __pyx_v_dip.w;
  __pyx_v_rv.w = __pyx_t_1;

  /* "fwdpy/views.pyx":57
 *    rv.e=dip.e
 *    rv.w=dip.w
 *    rv.chrom0=get_gamete(gametes[dip.first],mutations,mcounts)             # <<<<<<<<<<<<<<
 *    rv.chrom1=get_gamete(gametes[dip.second],mutations,mcounts)
 *    rv.n0 = <unsigned>rv.chrom0.selected.size()
 */
  __pyx_v_rv.chrom0 = __pyx_f_5fwdpy_5fwdpy_get_gamete((__pyx_v_gametes[__pyx_v_dip.first]), __pyx_v_mutations, __pyx_v_mcounts);

  /* "fwdpy/views.pyx":58
 *    rv.w=dip.w
 *    rv.chrom0=get_gamete(gametes[dip.first],mutations,mcounts)
 *    rv.chrom1=get_gamete(gametes[dip.second],mutations,mcounts)             # <<<<<<<<<<<<<<
 *    rv.n0 = <unsigned>rv.chrom0.selected.size()
 *    rv.n1 = <unsigned>rv.chrom1.selected.size()
 */
  __pyx_v_rv.chrom1 = __pyx_f_5fwdpy_5fwdpy_get_gamete((__pyx_v_gametes[__pyx_v_dip.second]), __pyx_v_mutations, __pyx_v_mcounts);

  /* "fwdpy/views.pyx":59
 *    rv.chrom0=get_gamete(gametes[dip.first],mutations,mcounts)
 *    rv.chrom1=get_gamete(gametes[dip.second],mutations,mcounts)
 *    rv.n0 = <unsigned>rv.chrom0.selected.size()             # <<<<<<<<<<<<<<
 *    rv.n1 = <unsigned>rv.chrom1.selected.size()
 *    rv.sh0=0.0
 */
  __pyx_v_rv.n0 = ((unsigned int)__pyx_v_rv.chrom0.selected.size());

  /* "fwdpy/views.pyx":60
 *    rv.chrom1=get_gamete(gametes[dip.second],mutations,mcounts)
 *    rv.n0 = <unsigned>rv.chrom0.selected.size()
 *    rv.n1 = <unsigned>rv.chrom1.selected.size()             # <<<<<<<<<<<<<<
 *    rv.sh0=0.0
 *    rv.sh1=0.0
 */
  __pyx_v_rv.n1 = ((unsigned int)__pyx_v_rv.chrom1.selected.size());

  /* "fwdpy/views.pyx":61
 *    rv.n0 = <unsigned>rv.chrom0.selected.size()
 *    rv.n1 = <unsigned>rv.chrom1.selected.size()
 *    rv.sh0=0.0             # <<<<<<<<<<<<<<
 *    rv.sh1=0.0
 *    cdef size_t i = 0
 */
  __pyx_v_rv.sh0 = 0.0;

  /* "fwdpy/views.pyx":62
 *    rv.n1 = <unsigned>rv.chrom1.selected.size()
 *    rv.sh0=0.0
 *    rv.sh1=0.0             # <<<<<<<<<<<<<<
 *    cdef size_t i = 0
 *    while i < rv.chrom0.selected.size():
 */
  __pyx_v_rv.sh1 = 0.0;

  /* "fwdpy/views.pyx":63
 *    rv.sh0=0.0
 *    rv.sh1=0.0
 *    cdef size_t i = 0             # <<<<<<<<<<<<<<
 *    while i < rv.chrom0.selected.size():
 *        rv.sh0+=(rv.chrom0.selected[i].s*rv.chrom0.selected[i].h)
 */
  __pyx_v_i = 0;

  /* "fwdpy/views.pyx":64
 *    rv.sh1=0.0
 *    cdef size_t i = 0
 *    while i < rv.chrom0.selected.size():             # <<<<<<<<<<<<<<
 *        rv.sh0+=(rv.chrom0.selected[i].s*rv.chrom0.selected[i].h)
 *        i+=1
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_i < __pyx_v_rv.chrom0.selected.size()) != 0);
    if (!__pyx_t_2) break;

    /* "fwdpy/views.pyx":65
 *    cdef size_t i = 0
 *    while i < rv.chrom0.selected.size():
 *        rv.sh0+=(rv.chrom0.selected[i].s*rv.chrom0.selected[i].h)             # <<<<<<<<<<<<<<
 *        i+=1
 *    i=0
 */
    __pyx_v_rv.sh0 = (__pyx_v_rv.sh0 + ((__pyx_v_rv.chrom0.selected[__pyx_v_i]).s * (__pyx_v_rv.chrom0.selected[__pyx_v_i]).h));

    /* "fwdpy/views.pyx":66
 *    while i < rv.chrom0.selected.size():
 *        rv.sh0+=(rv.chrom0.selected[i].s*rv.chrom0.selected[i].h)
 *        i+=1             # <<<<<<<<<<<<<<
 *    i=0
 *    while i < rv.chrom1.selected.size():
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "fwdpy/views.pyx":67
 *        rv.sh0+=(rv.chrom0.selected[i].s*rv.chrom0.selected[i].h)
 *        i+=1
 *    i=0             # <<<<<<<<<<<<<<
 *    while i < rv.chrom1.selected.size():
 *        rv.sh1+=(rv.chrom1.selected[i].s*rv.chrom1.selected[i].h)
 */
  __pyx_v_i = 0;

  /* "fwdpy/views.pyx":68
 *        i+=1
 *    i=0
 *    while i < rv.chrom1.selected.size():             # <<<<<<<<<<<<<<
 *        rv.sh1+=(rv.chrom1.selected[i].s*rv.chrom1.selected[i].h)
 *        i+=1
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_i < __pyx_v_rv.chrom1.selected.size()) != 0);
    if (!__pyx_t_2) break;

    /* "fwdpy/views.pyx":69
 *    i=0
 *    while i < rv.chrom1.selected.size():
 *        rv.sh1+=(rv.chrom1.selected[i].s*rv.chrom1.selected[i].h)             # <<<<<<<<<<<<<<
 *        i+=1
 *    return rv
 */
    __pyx_v_rv.sh1 = (__pyx_v_rv.sh1 + ((__pyx_v_rv.chrom1.selected[__pyx_v_i]).s * (__pyx_v_rv.chrom1.selected[__pyx_v_i]).h));

    /* "fwdpy/views.pyx":70
 *    while i < rv.chrom1.selected.size():
 *        rv.sh1+=(rv.chrom1.selected[i].s*rv.chrom1.selected[i].h)
 *        i+=1             # <<<<<<<<<<<<<<
 *    return rv
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "fwdpy/views.pyx":71
 *        rv.sh1+=(rv.chrom1.selected[i].s*rv.chrom1.selected[i].h)
 *        i+=1
 *    return rv             # <<<<<<<<<<<<<<
 * 
 * cdef diploid_mloc_data get_diploid_mloc (const dipvector_t & dip,
 */
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":49
 *     return rv
 * 
 * cdef diploid_data get_diploid(const diploid_t & dip,             # <<<<<<<<<<<<<<
 *                               const gcont_t & gametes,
 *                               const mcont_t & mutations,
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/views.pyx":73
 *    return rv
 * 
 * cdef diploid_mloc_data get_diploid_mloc (const dipvector_t & dip,             # <<<<<<<<<<<<<<
 *                                          const gcont_t & gametes,
 *                                          const mcont_t & mutations,
 */

static struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data __pyx_f_5fwdpy_5fwdpy_get_diploid_mloc(fwdpy::dipvector_t const &__pyx_v_dip, fwdpy::gcont_t const &__pyx_v_gametes, fwdpy::mcont_t const &__pyx_v_mutations, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &__pyx_v_mcounts) {
  struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data __pyx_v_rv;
  size_t __pyx_v_i;
  size_t __pyx_v_j;
  struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data __pyx_r;
  double __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  int __pyx_t_4;
  size_t __pyx_t_5;

  /* "fwdpy/views.pyx":79
 *     cdef diploid_mloc_data rv
 *     cdef gamete_data gd
 *     rv.g=dip[0].g             # <<<<<<<<<<<<<<
 *     rv.e=dip[0].e
 *     rv.w=dip[0].w
 */
  __pyx_t_1 = (__pyx_v_dip[0]).g;
  __pyx_v_rv.g = __pyx_t_1;

  /* "fwdpy/views.pyx":80
 *     cdef gamete_data gd
 *     rv.g=dip[0].g
 *     rv.e=dip[0].e             # <<<<<<<<<<<<<<
 *     rv.w=dip[0].w
 *     cdef size_t i = 0
 */
  __pyx_t_1 = (__pyx_v_dip[0]).e;
  __pyx_v_rv.e = __pyx_t_1;

  /* "fwdpy/views.pyx":81
 *     rv.g=dip[0].g
 *     rv.e=dip[0].e
 *     rv.w=dip[0].w             # <<<<<<<<<<<<<<
 *     cdef size_t i = 0
 *     for j in range(dip.size()):
 */
  __pyx_t_1 = (__pyx_v_dip[0]).w;
  __pyx_v_rv.w = __pyx_t_1;

  /* "fwdpy/views.pyx":82
 *     rv.e=dip[0].e
 *     rv.w=dip[0].w
 *     cdef size_t i = 0             # <<<<<<<<<<<<<<
 *     for j in range(dip.size()):
 *         rv.chrom0.push_back(get_gamete(gametes[dip[j].first],mutations,mcounts))
 */
  __pyx_v_i = 0;

  /* "fwdpy/views.pyx":83
 *     rv.w=dip[0].w
 *     cdef size_t i = 0
 *     for j in range(dip.size()):             # <<<<<<<<<<<<<<
 *         rv.chrom0.push_back(get_gamete(gametes[dip[j].first],mutations,mcounts))
 *         rv.chrom1.push_back(get_gamete(gametes[dip[j].second],mutations,mcounts))
 */
  __pyx_t_2 = __pyx_v_dip.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_j = __pyx_t_3;

    /* "fwdpy/views.pyx":84
 *     cdef size_t i = 0
 *     for j in range(dip.size()):
 *         rv.chrom0.push_back(get_gamete(gametes[dip[j].first],mutations,mcounts))             # <<<<<<<<<<<<<<
 *         rv.chrom1.push_back(get_gamete(gametes[dip[j].second],mutations,mcounts))
 *         rv.n1.push_back(<unsigned>rv.chrom0[j].selected.size())
 */
    try {
      __pyx_v_rv.chrom0.push_back(__pyx_f_5fwdpy_5fwdpy_get_gamete((__pyx_v_gametes[(__pyx_v_dip[__pyx_v_j]).first]), __pyx_v_mutations, __pyx_v_mcounts));
    } catch(...) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      __Pyx_CppExn2PyErr();
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(3, 84, __pyx_L1_error)
    }

    /* "fwdpy/views.pyx":85
 *     for j in range(dip.size()):
 *         rv.chrom0.push_back(get_gamete(gametes[dip[j].first],mutations,mcounts))
 *         rv.chrom1.push_back(get_gamete(gametes[dip[j].second],mutations,mcounts))             # <<<<<<<<<<<<<<
 *         rv.n1.push_back(<unsigned>rv.chrom0[j].selected.size())
 *         rv.n0.push_back(<unsigned>rv.chrom1[j].selected.size())
 */
    try {
      __pyx_v_rv.chrom1.push_back(__pyx_f_5fwdpy_5fwdpy_get_gamete((__pyx_v_gametes[(__pyx_v_dip[__pyx_v_j]).second]), __pyx_v_mutations, __pyx_v_mcounts));
    } catch(...) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      __Pyx_CppExn2PyErr();
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(3, 85, __pyx_L1_error)
    }

    /* "fwdpy/views.pyx":86
 *         rv.chrom0.push_back(get_gamete(gametes[dip[j].first],mutations,mcounts))
 *         rv.chrom1.push_back(get_gamete(gametes[dip[j].second],mutations,mcounts))
 *         rv.n1.push_back(<unsigned>rv.chrom0[j].selected.size())             # <<<<<<<<<<<<<<
 *         rv.n0.push_back(<unsigned>rv.chrom1[j].selected.size())
 *         rv.sh0.push_back(0.)
 */
    try {
      __pyx_v_rv.n1.push_back(((unsigned int)(__pyx_v_rv.chrom0[__pyx_v_j]).selected.size()));
    } catch(...) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      __Pyx_CppExn2PyErr();
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(3, 86, __pyx_L1_error)
    }

    /* "fwdpy/views.pyx":87
 *         rv.chrom1.push_back(get_gamete(gametes[dip[j].second],mutations,mcounts))
 *         rv.n1.push_back(<unsigned>rv.chrom0[j].selected.size())
 *         rv.n0.push_back(<unsigned>rv.chrom1[j].selected.size())             # <<<<<<<<<<<<<<
 *         rv.sh0.push_back(0.)
 *         rv.sh1.push_back(0.)
 */
    try {
      __pyx_v_rv.n0.push_back(((unsigned int)(__pyx_v_rv.chrom1[__pyx_v_j]).selected.size()));
    } catch(...) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      __Pyx_CppExn2PyErr();
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(3, 87, __pyx_L1_error)
    }

    /* "fwdpy/views.pyx":88
 *         rv.n1.push_back(<unsigned>rv.chrom0[j].selected.size())
 *         rv.n0.push_back(<unsigned>rv.chrom1[j].selected.size())
 *         rv.sh0.push_back(0.)             # <<<<<<<<<<<<<<
 *         rv.sh1.push_back(0.)
 *         while i < rv.chrom0[j].selected.size():
 */
    try {
      __pyx_v_rv.sh0.push_back(0.);
    } catch(...) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      __Pyx_CppExn2PyErr();
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(3, 88, __pyx_L1_error)
    }

    /* "fwdpy/views.pyx":89
 *         rv.n0.push_back(<unsigned>rv.chrom1[j].selected.size())
 *         rv.sh0.push_back(0.)
 *         rv.sh1.push_back(0.)             # <<<<<<<<<<<<<<
 *         while i < rv.chrom0[j].selected.size():
 *             rv.sh0[j]+=(rv.chrom0[j].selected[i].s*rv.chrom0[j].selected[i].h)
 */
    try {
      __pyx_v_rv.sh1.push_back(0.);
    } catch(...) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      __Pyx_CppExn2PyErr();
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(3, 89, __pyx_L1_error)
    }

    /* "fwdpy/views.pyx":90
 *         rv.sh0.push_back(0.)
 *         rv.sh1.push_back(0.)
 *         while i < rv.chrom0[j].selected.size():             # <<<<<<<<<<<<<<
 *             rv.sh0[j]+=(rv.chrom0[j].selected[i].s*rv.chrom0[j].selected[i].h)
 *             i+=1
 */
    while (1) {
      __pyx_t_4 = ((__pyx_v_i < (__pyx_v_rv.chrom0[__pyx_v_j]).selected.size()) != 0);
      if (!__pyx_t_4) break;

      /* "fwdpy/views.pyx":91
 *         rv.sh1.push_back(0.)
 *         while i < rv.chrom0[j].selected.size():
 *             rv.sh0[j]+=(rv.chrom0[j].selected[i].s*rv.chrom0[j].selected[i].h)             # <<<<<<<<<<<<<<
 *             i+=1
 *         i=0
 */
      __pyx_t_5 = __pyx_v_j;
      (__pyx_v_rv.sh0[__pyx_t_5]) = ((__pyx_v_rv.sh0[__pyx_t_5]) + (((__pyx_v_rv.chrom0[__pyx_v_j]).selected[__pyx_v_i]).s * ((__pyx_v_rv.chrom0[__pyx_v_j]).selected[__pyx_v_i]).h));

      /* "fwdpy/views.pyx":92
 *         while i < rv.chrom0[j].selected.size():
 *             rv.sh0[j]+=(rv.chrom0[j].selected[i].s*rv.chrom0[j].selected[i].h)
 *             i+=1             # <<<<<<<<<<<<<<
 *         i=0
 *         while i < rv.chrom1[j].selected.size():
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }

    /* "fwdpy/views.pyx":93
 *             rv.sh0[j]+=(rv.chrom0[j].selected[i].s*rv.chrom0[j].selected[i].h)
 *             i+=1
 *         i=0             # <<<<<<<<<<<<<<
 *         while i < rv.chrom1[j].selected.size():
 *             rv.sh1[j]+=(rv.chrom1[j].selected[i].s*rv.chrom1[j].selected[i].h)
 */
    __pyx_v_i = 0;

    /* "fwdpy/views.pyx":94
 *             i+=1
 *         i=0
 *         while i < rv.chrom1[j].selected.size():             # <<<<<<<<<<<<<<
 *             rv.sh1[j]+=(rv.chrom1[j].selected[i].s*rv.chrom1[j].selected[i].h)
 *             i+=1
 */
    while (1) {
      __pyx_t_4 = ((__pyx_v_i < (__pyx_v_rv.chrom1[__pyx_v_j]).selected.size()) != 0);
      if (!__pyx_t_4) break;

      /* "fwdpy/views.pyx":95
 *         i=0
 *         while i < rv.chrom1[j].selected.size():
 *             rv.sh1[j]+=(rv.chrom1[j].selected[i].s*rv.chrom1[j].selected[i].h)             # <<<<<<<<<<<<<<
 *             i+=1
 *     return rv
 */
      __pyx_t_5 = __pyx_v_j;
      (__pyx_v_rv.sh1[__pyx_t_5]) = ((__pyx_v_rv.sh1[__pyx_t_5]) + (((__pyx_v_rv.chrom1[__pyx_v_j]).selected[__pyx_v_i]).s * ((__pyx_v_rv.chrom1[__pyx_v_j]).selected[__pyx_v_i]).h));

      /* "fwdpy/views.pyx":96
 *         while i < rv.chrom1[j].selected.size():
 *             rv.sh1[j]+=(rv.chrom1[j].selected[i].s*rv.chrom1[j].selected[i].h)
 *             i+=1             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }
  }

  /* "fwdpy/views.pyx":97
 *             rv.sh1[j]+=(rv.chrom1[j].selected[i].s*rv.chrom1[j].selected[i].h)
 *             i+=1
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":73
 *    return rv
 * 
 * cdef diploid_mloc_data get_diploid_mloc (const dipvector_t & dip,             # <<<<<<<<<<<<<<
 *                                          const gcont_t & gametes,
 *                                          const mcont_t & mutations,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("fwdpy.fwdpy.get_diploid_mloc", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/views.pyx":100
 * 
 * 
 * cdef vector[popgen_mut_data] view_mutations_details(const mcont_t & mutations,             # <<<<<<<<<<<<<<
 *                                                     const mcounts_cont_t & mcounts) nogil:
 *     cdef vector[popgen_mut_data] rv
 */

static std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data>  __pyx_f_5fwdpy_5fwdpy_view_mutations_details(fwdpy::mcont_t const &__pyx_v_mutations, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &__pyx_v_mcounts) {
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data>  __pyx_v_rv;
  size_t __pyx_v_i;
  size_t __pyx_v_j;
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data>  __pyx_r;
  int __pyx_t_1;

  /* "fwdpy/views.pyx":103
 *                                                     const mcounts_cont_t & mcounts) nogil:
 *     cdef vector[popgen_mut_data] rv
 *     cdef size_t i=0,j=mutations.size()             # <<<<<<<<<<<<<<
 *     while i!=j:
 *         #skip extinct mutation
 */
  __pyx_v_i = 0;
  __pyx_v_j = __pyx_v_mutations.size();

  /* "fwdpy/views.pyx":104
 *     cdef vector[popgen_mut_data] rv
 *     cdef size_t i=0,j=mutations.size()
 *     while i!=j:             # <<<<<<<<<<<<<<
 *         #skip extinct mutation
 *         if mcounts[i]:
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_i != __pyx_v_j) != 0);
    if (!__pyx_t_1) break;

    /* "fwdpy/views.pyx":106
 *     while i!=j:
 *         #skip extinct mutation
 *         if mcounts[i]:             # <<<<<<<<<<<<<<
 *             rv.push_back(get_mutation(mutations[i],mcounts[i]))
 *         i+=1
 */
    __pyx_t_1 = ((__pyx_v_mcounts[__pyx_v_i]) != 0);
    if (__pyx_t_1) {

      /* "fwdpy/views.pyx":107
 *         #skip extinct mutation
 *         if mcounts[i]:
 *             rv.push_back(get_mutation(mutations[i],mcounts[i]))             # <<<<<<<<<<<<<<
 *         i+=1
 *     return rv
 */
      try {
        __pyx_v_rv.push_back(__pyx_f_5fwdpy_5fwdpy_get_mutation((__pyx_v_mutations[__pyx_v_i]), (__pyx_v_mcounts[__pyx_v_i])));
      } catch(...) {
        #ifdef WITH_THREAD
        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
        #endif
        __Pyx_CppExn2PyErr();
        #ifdef WITH_THREAD
        PyGILState_Release(__pyx_gilstate_save);
        #endif
        __PYX_ERR(3, 107, __pyx_L1_error)
      }

      /* "fwdpy/views.pyx":106
 *     while i!=j:
 *         #skip extinct mutation
 *         if mcounts[i]:             # <<<<<<<<<<<<<<
 *             rv.push_back(get_mutation(mutations[i],mcounts[i]))
 *         i+=1
 */
    }

    /* "fwdpy/views.pyx":108
 *         if mcounts[i]:
 *             rv.push_back(get_mutation(mutations[i],mcounts[i]))
 *         i+=1             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "fwdpy/views.pyx":109
 *             rv.push_back(get_mutation(mutations[i],mcounts[i]))
 *         i+=1
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * cdef vector[gamete_data] view_gametes_details(const singlepop_t * pop) nogil:
 */
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":100
 * 
 * 
 * cdef vector[popgen_mut_data] view_mutations_details(const mcont_t & mutations,             # <<<<<<<<<<<<<<
 *                                                     const mcounts_cont_t & mcounts) nogil:
 *     cdef vector[popgen_mut_data] rv
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("fwdpy.fwdpy.view_mutations_details", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/views.pyx":111
 *     return rv
 * 
 * cdef vector[gamete_data] view_gametes_details(const singlepop_t * pop) nogil:             # <<<<<<<<<<<<<<
 *     cdef vector[gamete_data] rv
 *     cdef size_t i = 0, j = pop.gametes.size()
 */

static std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data>  __pyx_f_5fwdpy_5fwdpy_view_gametes_details(fwdpy::singlepop_t const *__pyx_v_pop) {
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data>  __pyx_v_rv;
  size_t __pyx_v_i;
  size_t __pyx_v_j;
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data>  __pyx_r;
  int __pyx_t_1;

  /* "fwdpy/views.pyx":113
 * cdef vector[gamete_data] view_gametes_details(const singlepop_t * pop) nogil:
 *     cdef vector[gamete_data] rv
 *     cdef size_t i = 0, j = pop.gametes.size()             # <<<<<<<<<<<<<<
 *     while i!=j:
 *         #skip extinct gamets
 */
  __pyx_v_i = 0;
  __pyx_v_j = __pyx_v_pop->gametes.size();

  /* "fwdpy/views.pyx":114
 *     cdef vector[gamete_data] rv
 *     cdef size_t i = 0, j = pop.gametes.size()
 *     while i!=j:             # <<<<<<<<<<<<<<
 *         #skip extinct gamets
 *         if pop.gametes[i].n:
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_i != __pyx_v_j) != 0);
    if (!__pyx_t_1) break;

    /* "fwdpy/views.pyx":116
 *     while i!=j:
 *         #skip extinct gamets
 *         if pop.gametes[i].n:             # <<<<<<<<<<<<<<
 *             rv.push_back(get_gamete(pop.gametes[i],pop.mutations,pop.mcounts))
 *         i+=1
 */
    __pyx_t_1 = ((__pyx_v_pop->gametes[__pyx_v_i]).n != 0);
    if (__pyx_t_1) {

      /* "fwdpy/views.pyx":117
 *         #skip extinct gamets
 *         if pop.gametes[i].n:
 *             rv.push_back(get_gamete(pop.gametes[i],pop.mutations,pop.mcounts))             # <<<<<<<<<<<<<<
 *         i+=1
 *     return rv
 */
      try {
        __pyx_v_rv.push_back(__pyx_f_5fwdpy_5fwdpy_get_gamete((__pyx_v_pop->gametes[__pyx_v_i]), __pyx_v_pop->mutations, __pyx_v_pop->mcounts));
      } catch(...) {
        #ifdef WITH_THREAD
        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
        #endif
        __Pyx_CppExn2PyErr();
        #ifdef WITH_THREAD
        PyGILState_Release(__pyx_gilstate_save);
        #endif
        __PYX_ERR(3, 117, __pyx_L1_error)
      }

      /* "fwdpy/views.pyx":116
 *     while i!=j:
 *         #skip extinct gamets
 *         if pop.gametes[i].n:             # <<<<<<<<<<<<<<
 *             rv.push_back(get_gamete(pop.gametes[i],pop.mutations,pop.mcounts))
 *         i+=1
 */
    }

    /* "fwdpy/views.pyx":118
 *         if pop.gametes[i].n:
 *             rv.push_back(get_gamete(pop.gametes[i],pop.mutations,pop.mcounts))
 *         i+=1             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "fwdpy/views.pyx":119
 *             rv.push_back(get_gamete(pop.gametes[i],pop.mutations,pop.mcounts))
 *         i+=1
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * cdef vector[gamete_data] view_gametes_details_mloc(const multilocus_t * pop) nogil:
 */
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":111
 *     return rv
 * 
 * cdef vector[gamete_data] view_gametes_details(const singlepop_t * pop) nogil:             # <<<<<<<<<<<<<<
 *     cdef vector[gamete_data] rv
 *     cdef size_t i = 0, j = pop.gametes.size()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("fwdpy.fwdpy.view_gametes_details", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/views.pyx":121
 *     return rv
 * 
 * cdef vector[gamete_data] view_gametes_details_mloc(const multilocus_t * pop) nogil:             # <<<<<<<<<<<<<<
 *     cdef vector[gamete_data] rv
 *     cdef size_t i = 0, j = pop.gametes.size()
 */

static std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data>  __pyx_f_5fwdpy_5fwdpy_view_gametes_details_mloc(fwdpy::multilocus_t const *__pyx_v_pop) {
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data>  __pyx_v_rv;
  size_t __pyx_v_i;
  size_t __pyx_v_j;
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data>  __pyx_r;
  int __pyx_t_1;

  /* "fwdpy/views.pyx":123
 * cdef vector[gamete_data] view_gametes_details_mloc(const multilocus_t * pop) nogil:
 *     cdef vector[gamete_data] rv
 *     cdef size_t i = 0, j = pop.gametes.size()             # <<<<<<<<<<<<<<
 *     while i!=j:
 *         #skip extinct gamets
 */
  __pyx_v_i = 0;
  __pyx_v_j = __pyx_v_pop->gametes.size();

  /* "fwdpy/views.pyx":124
 *     cdef vector[gamete_data] rv
 *     cdef size_t i = 0, j = pop.gametes.size()
 *     while i!=j:             # <<<<<<<<<<<<<<
 *         #skip extinct gamets
 *         if pop.gametes[i].n:
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_i != __pyx_v_j) != 0);
    if (!__pyx_t_1) break;

    /* "fwdpy/views.pyx":126
 *     while i!=j:
 *         #skip extinct gamets
 *         if pop.gametes[i].n:             # <<<<<<<<<<<<<<
 *             rv.push_back(get_gamete(pop.gametes[i],pop.mutations,pop.mcounts))
 *         i+=1
 */
    __pyx_t_1 = ((__pyx_v_pop->gametes[__pyx_v_i]).n != 0);
    if (__pyx_t_1) {

      /* "fwdpy/views.pyx":127
 *         #skip extinct gamets
 *         if pop.gametes[i].n:
 *             rv.push_back(get_gamete(pop.gametes[i],pop.mutations,pop.mcounts))             # <<<<<<<<<<<<<<
 *         i+=1
 *     return rv
 */
      try {
        __pyx_v_rv.push_back(__pyx_f_5fwdpy_5fwdpy_get_gamete((__pyx_v_pop->gametes[__pyx_v_i]), __pyx_v_pop->mutations, __pyx_v_pop->mcounts));
      } catch(...) {
        #ifdef WITH_THREAD
        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
        #endif
        __Pyx_CppExn2PyErr();
        #ifdef WITH_THREAD
        PyGILState_Release(__pyx_gilstate_save);
        #endif
        __PYX_ERR(3, 127, __pyx_L1_error)
      }

      /* "fwdpy/views.pyx":126
 *     while i!=j:
 *         #skip extinct gamets
 *         if pop.gametes[i].n:             # <<<<<<<<<<<<<<
 *             rv.push_back(get_gamete(pop.gametes[i],pop.mutations,pop.mcounts))
 *         i+=1
 */
    }

    /* "fwdpy/views.pyx":128
 *         if pop.gametes[i].n:
 *             rv.push_back(get_gamete(pop.gametes[i],pop.mutations,pop.mcounts))
 *         i+=1             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "fwdpy/views.pyx":129
 *             rv.push_back(get_gamete(pop.gametes[i],pop.mutations,pop.mcounts))
 *         i+=1
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * cdef vector[diploid_data] view_diploids_details(const dipvector_t & diploids,
 */
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":121
 *     return rv
 * 
 * cdef vector[gamete_data] view_gametes_details_mloc(const multilocus_t * pop) nogil:             # <<<<<<<<<<<<<<
 *     cdef vector[gamete_data] rv
 *     cdef size_t i = 0, j = pop.gametes.size()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("fwdpy.fwdpy.view_gametes_details_mloc", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/views.pyx":131
 *     return rv
 * 
 * cdef vector[diploid_data] view_diploids_details(const dipvector_t & diploids,             # <<<<<<<<<<<<<<
 *                                                 const gcont_t & gametes,
 *                                                 const mcont_t & mutations,
 */

static std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_data>  __pyx_f_5fwdpy_5fwdpy_view_diploids_details(fwdpy::dipvector_t const &__pyx_v_diploids, fwdpy::gcont_t const &__pyx_v_gametes, fwdpy::mcont_t const &__pyx_v_mutations, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &__pyx_v_mcounts, std::vector<unsigned int>  const &__pyx_v_indlist) {
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_data>  __pyx_v_rv;
  size_t __pyx_v_i;
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_data>  __pyx_r;
  size_t __pyx_t_1;
  size_t __pyx_t_2;

  /* "fwdpy/views.pyx":137
 *                                                 const vector[unsigned] & indlist) nogil:
 *     cdef vector[diploid_data] rv
 *     for i in range(indlist.size()):             # <<<<<<<<<<<<<<
 *         rv.push_back(get_diploid(diploids[indlist[i]],gametes,mutations,mcounts))
 *     return rv
 */
  __pyx_t_1 = __pyx_v_indlist.size();
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/views.pyx":138
 *     cdef vector[diploid_data] rv
 *     for i in range(indlist.size()):
 *         rv.push_back(get_diploid(diploids[indlist[i]],gametes,mutations,mcounts))             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
    try {
      __pyx_v_rv.push_back(__pyx_f_5fwdpy_5fwdpy_get_diploid((__pyx_v_diploids[(__pyx_v_indlist[__pyx_v_i])]), __pyx_v_gametes, __pyx_v_mutations, __pyx_v_mcounts));
    } catch(...) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      __Pyx_CppExn2PyErr();
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(3, 138, __pyx_L1_error)
    }
  }

  /* "fwdpy/views.pyx":139
 *     for i in range(indlist.size()):
 *         rv.push_back(get_diploid(diploids[indlist[i]],gametes,mutations,mcounts))
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":131
 *     return rv
 * 
 * cdef vector[diploid_data] view_diploids_details(const dipvector_t & diploids,             # <<<<<<<<<<<<<<
 *                                                 const gcont_t & gametes,
 *                                                 const mcont_t & mutations,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("fwdpy.fwdpy.view_diploids_details", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/views.pyx":142
 * 
 * 
 * cdef vector[diploid_mloc_data] view_diploids_details_mloc(const vector[dipvector_t] & diploids,             # <<<<<<<<<<<<<<
 *                                                           const gcont_t & gametes,
 *                                                           const mcont_t & mutations,
 */

static std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data>  __pyx_f_5fwdpy_5fwdpy_view_diploids_details_mloc(std::vector<fwdpy::dipvector_t>  const &__pyx_v_diploids, fwdpy::gcont_t const &__pyx_v_gametes, fwdpy::mcont_t const &__pyx_v_mutations, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &__pyx_v_mcounts, std::vector<unsigned int>  const &__pyx_v_indlist) {
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data>  __pyx_v_rv;
  size_t __pyx_v_i;
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data>  __pyx_r;
  size_t __pyx_t_1;
  size_t __pyx_t_2;

  /* "fwdpy/views.pyx":148
 *                                                           const vector[unsigned] & indlist) nogil:
 *     cdef vector[diploid_mloc_data] rv
 *     for i in range(indlist.size()):             # <<<<<<<<<<<<<<
 *         rv.push_back(get_diploid_mloc(diploids[indlist[i]],gametes,mutations,mcounts))
 *     return rv
 */
  __pyx_t_1 = __pyx_v_indlist.size();
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/views.pyx":149
 *     cdef vector[diploid_mloc_data] rv
 *     for i in range(indlist.size()):
 *         rv.push_back(get_diploid_mloc(diploids[indlist[i]],gametes,mutations,mcounts))             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
    try {
      __pyx_v_rv.push_back(__pyx_f_5fwdpy_5fwdpy_get_diploid_mloc((__pyx_v_diploids[(__pyx_v_indlist[__pyx_v_i])]), __pyx_v_gametes, __pyx_v_mutations, __pyx_v_mcounts));
    } catch(...) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      __Pyx_CppExn2PyErr();
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(3, 149, __pyx_L1_error)
    }
  }

  /* "fwdpy/views.pyx":150
 *     for i in range(indlist.size()):
 *         rv.push_back(get_diploid_mloc(diploids[indlist[i]],gametes,mutations,mcounts))
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def view_mutations_singlepop(Spop p):
 */
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":142
 * 
 * 
 * cdef vector[diploid_mloc_data] view_diploids_details_mloc(const vector[dipvector_t] & diploids,             # <<<<<<<<<<<<<<
 *                                                           const gcont_t & gametes,
 *                                                           const mcont_t & mutations,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("fwdpy.fwdpy.view_diploids_details_mloc", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/views.pyx":152
 *     return rv
 * 
 * def view_mutations_singlepop(Spop p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg = p.pop.get().mutations.begin()
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_31view_mutations_singlepop(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_31view_mutations_singlepop = {"view_mutations_singlepop", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_31view_mutations_singlepop, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_31view_mutations_singlepop(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_mutations_singlepop (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_Spop, 1, "p", 0))) __PYX_ERR(3, 152, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_30view_mutations_singlepop(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_30view_mutations_singlepop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p) {
  CYTHON_UNUSED __pyx_t_5fwdpy_5fwdpy_mcont_t_itr __pyx_v_beg;
  CYTHON_UNUSED __pyx_t_5fwdpy_5fwdpy_mcont_t_itr __pyx_v_end;
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data>  __pyx_v_rv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("view_mutations_singlepop", 0);

  /* "fwdpy/views.pyx":153
 * 
 * def view_mutations_singlepop(Spop p):
 *     cdef mcont_t_itr beg = p.pop.get().mutations.begin()             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()
 *     cdef vector[popgen_mut_data] rv
 */
  __pyx_v_beg = __pyx_v_p->pop.get()->mutations.begin();

  /* "fwdpy/views.pyx":154
 * def view_mutations_singlepop(Spop p):
 *     cdef mcont_t_itr beg = p.pop.get().mutations.begin()
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()             # <<<<<<<<<<<<<<
 *     cdef vector[popgen_mut_data] rv
 *     with nogil:
 */
  __pyx_v_end = __pyx_v_p->pop.get()->mutations.end();

  /* "fwdpy/views.pyx":156
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()
 *     cdef vector[popgen_mut_data] rv
 *     with nogil:             # <<<<<<<<<<<<<<
 *         rv = view_mutations_details(p.pop.get().mutations,p.pop.get().mcounts)
 *     return rv
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "fwdpy/views.pyx":157
 *     cdef vector[popgen_mut_data] rv
 *     with nogil:
 *         rv = view_mutations_details(p.pop.get().mutations,p.pop.get().mcounts)             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
        __pyx_v_rv = __pyx_f_5fwdpy_5fwdpy_view_mutations_details(__pyx_v_p->pop.get()->mutations, __pyx_v_p->pop.get()->mcounts);
      }

      /* "fwdpy/views.pyx":156
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()
 *     cdef vector[popgen_mut_data] rv
 *     with nogil:             # <<<<<<<<<<<<<<
 *         rv = view_mutations_details(p.pop.get().mutations,p.pop.get().mcounts)
 *     return rv
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "fwdpy/views.pyx":158
 *     with nogil:
 *         rv = view_mutations_details(p.pop.get().mutations,p.pop.get().mcounts)
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def view_mutations_singlepop_mloc(MlocusPop p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":152
 *     return rv
 * 
 * def view_mutations_singlepop(Spop p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg = p.pop.get().mutations.begin()
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_mutations_singlepop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":160
 *     return rv
 * 
 * def view_mutations_singlepop_mloc(MlocusPop p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg = p.pop.get().mutations.begin()
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_33view_mutations_singlepop_mloc(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_33view_mutations_singlepop_mloc = {"view_mutations_singlepop_mloc", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_33view_mutations_singlepop_mloc, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_33view_mutations_singlepop_mloc(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_mutations_singlepop_mloc (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MlocusPop, 1, "p", 0))) __PYX_ERR(3, 160, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_32view_mutations_singlepop_mloc(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_32view_mutations_singlepop_mloc(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_p) {
  CYTHON_UNUSED __pyx_t_5fwdpy_5fwdpy_mcont_t_itr __pyx_v_beg;
  CYTHON_UNUSED __pyx_t_5fwdpy_5fwdpy_mcont_t_itr __pyx_v_end;
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data>  __pyx_v_rv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("view_mutations_singlepop_mloc", 0);

  /* "fwdpy/views.pyx":161
 * 
 * def view_mutations_singlepop_mloc(MlocusPop p):
 *     cdef mcont_t_itr beg = p.pop.get().mutations.begin()             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()
 *     cdef vector[popgen_mut_data] rv
 */
  __pyx_v_beg = __pyx_v_p->pop.get()->mutations.begin();

  /* "fwdpy/views.pyx":162
 * def view_mutations_singlepop_mloc(MlocusPop p):
 *     cdef mcont_t_itr beg = p.pop.get().mutations.begin()
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()             # <<<<<<<<<<<<<<
 *     cdef vector[popgen_mut_data] rv
 *     with nogil:
 */
  __pyx_v_end = __pyx_v_p->pop.get()->mutations.end();

  /* "fwdpy/views.pyx":164
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()
 *     cdef vector[popgen_mut_data] rv
 *     with nogil:             # <<<<<<<<<<<<<<
 *         rv = view_mutations_details(p.pop.get().mutations,p.pop.get().mcounts)
 *     return rv
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {

        /* "fwdpy/views.pyx":165
 *     cdef vector[popgen_mut_data] rv
 *     with nogil:
 *         rv = view_mutations_details(p.pop.get().mutations,p.pop.get().mcounts)             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
        __pyx_v_rv = __pyx_f_5fwdpy_5fwdpy_view_mutations_details(__pyx_v_p->pop.get()->mutations, __pyx_v_p->pop.get()->mcounts);
      }

      /* "fwdpy/views.pyx":164
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()
 *     cdef vector[popgen_mut_data] rv
 *     with nogil:             # <<<<<<<<<<<<<<
 *         rv = view_mutations_details(p.pop.get().mutations,p.pop.get().mcounts)
 *     return rv
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "fwdpy/views.pyx":166
 *     with nogil:
 *         rv = view_mutations_details(p.pop.get().mutations,p.pop.get().mcounts)
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def view_mutations_popvec(SpopVec p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":160
 *     return rv
 * 
 * def view_mutations_singlepop_mloc(MlocusPop p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg = p.pop.get().mutations.begin()
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_mutations_singlepop_mloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":168
 *     return rv
 * 
 * def view_mutations_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg,end
 *     cdef vector[vector[popgen_mut_data]] rv
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_35view_mutations_popvec(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_35view_mutations_popvec = {"view_mutations_popvec", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_35view_mutations_popvec, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_35view_mutations_popvec(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_mutations_popvec (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_SpopVec, 1, "p", 0))) __PYX_ERR(3, 168, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_34view_mutations_popvec(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_34view_mutations_popvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p) {
  std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data> >  __pyx_v_rv;
  size_t __pyx_v_npops;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("view_mutations_popvec", 0);

  /* "fwdpy/views.pyx":171
 *     cdef mcont_t_itr beg,end
 *     cdef vector[vector[popgen_mut_data]] rv
 *     cdef size_t npops = p.pops.size()             # <<<<<<<<<<<<<<
 *     cdef int i
 *     rv.resize(npops)
 */
  __pyx_v_npops = __pyx_v_p->pops.size();

  /* "fwdpy/views.pyx":173
 *     cdef size_t npops = p.pops.size()
 *     cdef int i
 *     rv.resize(npops)             # <<<<<<<<<<<<<<
 *     #for i in range(npops):
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 */
  try {
    __pyx_v_rv.resize(__pyx_v_npops);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(3, 173, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":175
 *     rv.resize(npops)
 *     #for i in range(npops):
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i] = view_mutations_details(p.pops[i].get().mutations,p.pops[i].get().mcounts)
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {
        __pyx_t_1 = __pyx_v_npops;
        if (1 == 0) abort();
        {
            __pyx_t_4 = 1;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_3 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static, __pyx_t_4)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_2);

                            /* "fwdpy/views.pyx":176
 *     #for i in range(npops):
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i] = view_mutations_details(p.pops[i].get().mutations,p.pops[i].get().mcounts)             # <<<<<<<<<<<<<<
 * 
 *     return rv
 */
                            (__pyx_v_rv[__pyx_v_i]) = __pyx_f_5fwdpy_5fwdpy_view_mutations_details((__pyx_v_p->pops[__pyx_v_i]).get()->mutations, (__pyx_v_p->pops[__pyx_v_i]).get()->mcounts);
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "fwdpy/views.pyx":175
 *     rv.resize(npops)
 *     #for i in range(npops):
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i] = view_mutations_details(p.pops[i].get().mutations,p.pops[i].get().mcounts)
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "fwdpy/views.pyx":178
 *         rv[i] = view_mutations_details(p.pops[i].get().mutations,p.pops[i].get().mcounts)
 * 
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def view_mutations_popvec_mloc(MlocusPopVec p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data_3e___(__pyx_v_rv); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":168
 *     return rv
 * 
 * def view_mutations_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg,end
 *     cdef vector[vector[popgen_mut_data]] rv
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_mutations_popvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":180
 *     return rv
 * 
 * def view_mutations_popvec_mloc(MlocusPopVec p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg,end
 *     cdef vector[vector[popgen_mut_data]] rv
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_37view_mutations_popvec_mloc(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_37view_mutations_popvec_mloc = {"view_mutations_popvec_mloc", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_37view_mutations_popvec_mloc, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_37view_mutations_popvec_mloc(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_mutations_popvec_mloc (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec, 1, "p", 0))) __PYX_ERR(3, 180, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_36view_mutations_popvec_mloc(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_36view_mutations_popvec_mloc(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p) {
  std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data> >  __pyx_v_rv;
  size_t __pyx_v_npops;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("view_mutations_popvec_mloc", 0);

  /* "fwdpy/views.pyx":183
 *     cdef mcont_t_itr beg,end
 *     cdef vector[vector[popgen_mut_data]] rv
 *     cdef size_t npops = p.pops.size()             # <<<<<<<<<<<<<<
 *     cdef int i
 *     rv.resize(npops)
 */
  __pyx_v_npops = __pyx_v_p->pops.size();

  /* "fwdpy/views.pyx":185
 *     cdef size_t npops = p.pops.size()
 *     cdef int i
 *     rv.resize(npops)             # <<<<<<<<<<<<<<
 *     #for i in range(npops):
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 */
  try {
    __pyx_v_rv.resize(__pyx_v_npops);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(3, 185, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":187
 *     rv.resize(npops)
 *     #for i in range(npops):
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i] = view_mutations_details(p.pops[i].get().mutations,p.pops[i].get().mcounts)
 * 
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {
        __pyx_t_1 = __pyx_v_npops;
        if (1 == 0) abort();
        {
            __pyx_t_4 = 1;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_3 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static, __pyx_t_4)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_2);

                            /* "fwdpy/views.pyx":188
 *     #for i in range(npops):
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i] = view_mutations_details(p.pops[i].get().mutations,p.pops[i].get().mcounts)             # <<<<<<<<<<<<<<
 * 
 *     return rv
 */
                            (__pyx_v_rv[__pyx_v_i]) = __pyx_f_5fwdpy_5fwdpy_view_mutations_details((__pyx_v_p->pops[__pyx_v_i]).get()->mutations, (__pyx_v_p->pops[__pyx_v_i]).get()->mcounts);
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "fwdpy/views.pyx":187
 *     rv.resize(npops)
 *     #for i in range(npops):
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i] = view_mutations_details(p.pops[i].get().mutations,p.pops[i].get().mcounts)
 * 
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "fwdpy/views.pyx":190
 *         rv[i] = view_mutations_details(p.pops[i].get().mutations,p.pops[i].get().mcounts)
 * 
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def view_mutations_metapop(MetaPop p,unsigned deme):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data_3e___(__pyx_v_rv); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":180
 *     return rv
 * 
 * def view_mutations_popvec_mloc(MlocusPopVec p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg,end
 *     cdef vector[vector[popgen_mut_data]] rv
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_mutations_popvec_mloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":192
 *     return rv
 * 
 * def view_mutations_metapop(MetaPop p,unsigned deme):             # <<<<<<<<<<<<<<
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_mutations: deme index out of range")
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_39view_mutations_metapop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_39view_mutations_metapop = {"view_mutations_metapop", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_39view_mutations_metapop, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_39view_mutations_metapop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_p = 0;
  unsigned int __pyx_v_deme;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_mutations_metapop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_deme,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_deme)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("view_mutations_metapop", 1, 2, 2, 1); __PYX_ERR(3, 192, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view_mutations_metapop") < 0)) __PYX_ERR(3, 192, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_p = ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)values[0]);
    __pyx_v_deme = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_deme == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(3, 192, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view_mutations_metapop", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 192, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.view_mutations_metapop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MetaPop, 1, "p", 0))) __PYX_ERR(3, 192, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_38view_mutations_metapop(__pyx_self, __pyx_v_p, __pyx_v_deme);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_38view_mutations_metapop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_p, unsigned int __pyx_v_deme) {
  PyObject *__pyx_v_gams = NULL;
  PyObject *__pyx_v_allmuts = NULL;
  PyObject *__pyx_v_umuts = NULL;
  PyObject *__pyx_v_g = NULL;
  PyObject *__pyx_v_m = NULL;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_v_dummy = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  Py_ssize_t __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  __Pyx_RefNannySetupContext("view_mutations_metapop", 0);

  /* "fwdpy/views.pyx":193
 * 
 * def view_mutations_metapop(MetaPop p,unsigned deme):
 *     if deme >= len(p.popsizes()):             # <<<<<<<<<<<<<<
 *         raise IndexError("view_mutations: deme index out of range")
 *     #get the gametes from this population
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_5fwdpy_5fwdpy_MetaPop *)__pyx_v_p->__pyx_vtab)->popsizes(__pyx_v_p, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(3, 193, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((__pyx_v_deme >= __pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "fwdpy/views.pyx":194
 * def view_mutations_metapop(MetaPop p,unsigned deme):
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_mutations: deme index out of range")             # <<<<<<<<<<<<<<
 *     #get the gametes from this population
 *     gams = view_gametes_metapop(p,deme)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 194, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(3, 194, __pyx_L1_error)

    /* "fwdpy/views.pyx":193
 * 
 * def view_mutations_metapop(MetaPop p,unsigned deme):
 *     if deme >= len(p.popsizes()):             # <<<<<<<<<<<<<<
 *         raise IndexError("view_mutations: deme index out of range")
 *     #get the gametes from this population
 */
  }

  /* "fwdpy/views.pyx":196
 *         raise IndexError("view_mutations: deme index out of range")
 *     #get the gametes from this population
 *     gams = view_gametes_metapop(p,deme)             # <<<<<<<<<<<<<<
 *     #extract the mutations from each gamete
 *     allmuts = []
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_gametes_metapop); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_deme); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(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_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, ((PyObject *)__pyx_v_p), __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 196, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __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, ((PyObject *)__pyx_v_p), __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 196, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_p));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_p));
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_gams = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":198
 *     gams = view_gametes_metapop(p,deme)
 *     #extract the mutations from each gamete
 *     allmuts = []             # <<<<<<<<<<<<<<
 *     umuts = []
 *     for g in gams:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_allmuts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":199
 *     #extract the mutations from each gamete
 *     allmuts = []
 *     umuts = []             # <<<<<<<<<<<<<<
 *     for g in gams:
 *         for m in g['neutral']:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_umuts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":200
 *     allmuts = []
 *     umuts = []
 *     for g in gams:             # <<<<<<<<<<<<<<
 *         for m in g['neutral']:
 *             allmuts.append(m)
 */
  if (likely(PyList_CheckExact(__pyx_v_gams)) || PyTuple_CheckExact(__pyx_v_gams)) {
    __pyx_t_1 = __pyx_v_gams; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_gams); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 200, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 200, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(3, 200, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 200, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(3, 200, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 200, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_9(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(3, 200, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_g, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":201
 *     umuts = []
 *     for g in gams:
 *         for m in g['neutral']:             # <<<<<<<<<<<<<<
 *             allmuts.append(m)
 *             if umuts.count(m) == 0:
 */
    __pyx_t_4 = PyObject_GetItem(__pyx_v_g, __pyx_n_s_neutral); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_8 = __pyx_t_4; __Pyx_INCREF(__pyx_t_8); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_10 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_11 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 201, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_8))) {
          if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_8)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(3, 201, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_8, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 201, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(3, 201, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_8, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 201, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_11(__pyx_t_8);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(3, 201, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_v_m, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "fwdpy/views.pyx":202
 *     for g in gams:
 *         for m in g['neutral']:
 *             allmuts.append(m)             # <<<<<<<<<<<<<<
 *             if umuts.count(m) == 0:
 *                 umuts.append(m)
 */
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_allmuts, __pyx_v_m); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(3, 202, __pyx_L1_error)

      /* "fwdpy/views.pyx":203
 *         for m in g['neutral']:
 *             allmuts.append(m)
 *             if umuts.count(m) == 0:             # <<<<<<<<<<<<<<
 *                 umuts.append(m)
 *         for m in g['selected']:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_umuts, __pyx_n_s_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_m); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 203, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_m};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 203, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_4);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_m};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 203, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_4);
        } else
        #endif
        {
          __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(3, 203, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_6); __pyx_t_6 = NULL;
          __Pyx_INCREF(__pyx_v_m);
          __Pyx_GIVEREF(__pyx_v_m);
          PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_m);
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 203, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyInt_EqObjC(__pyx_t_4, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(3, 203, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_3) {

        /* "fwdpy/views.pyx":204
 *             allmuts.append(m)
 *             if umuts.count(m) == 0:
 *                 umuts.append(m)             # <<<<<<<<<<<<<<
 *         for m in g['selected']:
 *             allmuts.append(m)
 */
        __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_umuts, __pyx_v_m); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(3, 204, __pyx_L1_error)

        /* "fwdpy/views.pyx":203
 *         for m in g['neutral']:
 *             allmuts.append(m)
 *             if umuts.count(m) == 0:             # <<<<<<<<<<<<<<
 *                 umuts.append(m)
 *         for m in g['selected']:
 */
      }

      /* "fwdpy/views.pyx":201
 *     umuts = []
 *     for g in gams:
 *         for m in g['neutral']:             # <<<<<<<<<<<<<<
 *             allmuts.append(m)
 *             if umuts.count(m) == 0:
 */
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "fwdpy/views.pyx":205
 *             if umuts.count(m) == 0:
 *                 umuts.append(m)
 *         for m in g['selected']:             # <<<<<<<<<<<<<<
 *             allmuts.append(m)
 *             if umuts.count(m) == 0:
 */
    __pyx_t_8 = PyObject_GetItem(__pyx_v_g, __pyx_n_s_selected); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
      __pyx_t_5 = __pyx_t_8; __Pyx_INCREF(__pyx_t_5); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_10 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 205, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 205, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_8); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(3, 205, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 205, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_8); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(3, 205, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 205, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_11(__pyx_t_5);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(3, 205, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_v_m, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "fwdpy/views.pyx":206
 *                 umuts.append(m)
 *         for m in g['selected']:
 *             allmuts.append(m)             # <<<<<<<<<<<<<<
 *             if umuts.count(m) == 0:
 *                 umuts.append(m)
 */
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_allmuts, __pyx_v_m); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(3, 206, __pyx_L1_error)

      /* "fwdpy/views.pyx":207
 *         for m in g['selected']:
 *             allmuts.append(m)
 *             if umuts.count(m) == 0:             # <<<<<<<<<<<<<<
 *                 umuts.append(m)
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_umuts, __pyx_n_s_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 207, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_13 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_13) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 207, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_v_m};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 207, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_GOTREF(__pyx_t_8);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_v_m};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 207, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_GOTREF(__pyx_t_8);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 207, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_13); __pyx_t_13 = NULL;
          __Pyx_INCREF(__pyx_v_m);
          __Pyx_GIVEREF(__pyx_v_m);
          PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_m);
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 207, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_8, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 207, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(3, 207, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_3) {

        /* "fwdpy/views.pyx":208
 *             allmuts.append(m)
 *             if umuts.count(m) == 0:
 *                 umuts.append(m)             # <<<<<<<<<<<<<<
 * 
 *     rv = []
 */
        __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_umuts, __pyx_v_m); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(3, 208, __pyx_L1_error)

        /* "fwdpy/views.pyx":207
 *         for m in g['selected']:
 *             allmuts.append(m)
 *             if umuts.count(m) == 0:             # <<<<<<<<<<<<<<
 *                 umuts.append(m)
 * 
 */
      }

      /* "fwdpy/views.pyx":205
 *             if umuts.count(m) == 0:
 *                 umuts.append(m)
 *         for m in g['selected']:             # <<<<<<<<<<<<<<
 *             allmuts.append(m)
 *             if umuts.count(m) == 0:
 */
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "fwdpy/views.pyx":200
 *     allmuts = []
 *     umuts = []
 *     for g in gams:             # <<<<<<<<<<<<<<
 *         for m in g['neutral']:
 *             allmuts.append(m)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":210
 *                 umuts.append(m)
 * 
 *     rv = []             # <<<<<<<<<<<<<<
 *     dummy=0
 *     for i in umuts:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rv = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":211
 * 
 *     rv = []
 *     dummy=0             # <<<<<<<<<<<<<<
 *     for i in umuts:
 *         rv.append(i)
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_dummy = __pyx_int_0;

  /* "fwdpy/views.pyx":212
 *     rv = []
 *     dummy=0
 *     for i in umuts:             # <<<<<<<<<<<<<<
 *         rv.append(i)
 *         rv[dummy]['n'] = allmuts.count(i)
 */
  __pyx_t_1 = __pyx_v_umuts; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(3, 212, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "fwdpy/views.pyx":213
 *     dummy=0
 *     for i in umuts:
 *         rv.append(i)             # <<<<<<<<<<<<<<
 *         rv[dummy]['n'] = allmuts.count(i)
 *         dummy+=1
 */
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_rv, __pyx_v_i); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(3, 213, __pyx_L1_error)

    /* "fwdpy/views.pyx":214
 *     for i in umuts:
 *         rv.append(i)
 *         rv[dummy]['n'] = allmuts.count(i)             # <<<<<<<<<<<<<<
 *         dummy+=1
 *     return rv
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_allmuts, __pyx_n_s_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 214, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_i};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 214, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_i};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 214, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 214, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_i);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 214, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_GetItem(__pyx_v_rv, __pyx_v_dummy); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_n_s_n, __pyx_t_5) < 0)) __PYX_ERR(3, 214, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "fwdpy/views.pyx":215
 *         rv.append(i)
 *         rv[dummy]['n'] = allmuts.count(i)
 *         dummy+=1             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
    __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_dummy, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_dummy, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "fwdpy/views.pyx":212
 *     rv = []
 *     dummy=0
 *     for i in umuts:             # <<<<<<<<<<<<<<
 *         rv.append(i)
 *         rv[dummy]['n'] = allmuts.count(i)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":216
 *         rv[dummy]['n'] = allmuts.count(i)
 *         dummy+=1
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def view_mutations(object p, deme = None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":192
 *     return rv
 * 
 * def view_mutations_metapop(MetaPop p,unsigned deme):             # <<<<<<<<<<<<<<
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_mutations: deme index out of range")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_mutations_metapop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gams);
  __Pyx_XDECREF(__pyx_v_allmuts);
  __Pyx_XDECREF(__pyx_v_umuts);
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XDECREF(__pyx_v_dummy);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":218
 *     return rv
 * 
 * def view_mutations(object p, deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Get detailed list of all mutations in the population
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_41view_mutations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_40view_mutations[] = "\n    Get detailed list of all mutations in the population\n\n    :param p: a :class:`fwdpy.fwdpy.PopType` or a :class:`fwdpy.fwdpy.PopVec`\n\n    :rtype: a list of dictionaries.  See Note.\n\n    Example:\n\n    >>> import fwdpy\n    >>> import numpy as np\n    >>> nregions = [fwdpy.Region(0,1,1),fwdpy.Region(2,3,1)]\n    >>> sregions = [fwdpy.ExpS(1,2,1,-0.1),fwdpy.ExpS(1,2,0.01,0.001)]\n    >>> rregions = [fwdpy.Region(0,3,1)]\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes = np.array([1000],dtype=np.uint32)\n    >>> popsizes=np.tile(popsizes,100)\n    >>> pops = fwdpy.evolve_regions(rng,1,1000,popsizes[0:],0.001,0.0001,0.001,nregions,sregions,rregions)\n    >>> #muts[0] will be a list and muts[0][0] will be a dict\n    >>> muts = [fwdpy.view_mutations(i) for i in pops]\n\n    .. note:: :class:`fwdpy.fwdpy.MetaPopVec` currently not supported\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_41view_mutations = {"view_mutations", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_41view_mutations, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_40view_mutations};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_41view_mutations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_deme = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_mutations (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_deme,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_deme);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view_mutations") < 0)) __PYX_ERR(3, 218, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
    __pyx_v_deme = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view_mutations", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 218, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.view_mutations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_40view_mutations(__pyx_self, __pyx_v_p, __pyx_v_deme);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_40view_mutations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_deme) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("view_mutations", 0);

  /* "fwdpy/views.pyx":242
 *     .. note:: :class:`fwdpy.fwdpy.MetaPopVec` currently not supported
 *     """
 *     if isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return view_mutations_singlepop(p)
 *     elif isinstance(p,MlocusPop):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_Spop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":243
 *     """
 *     if isinstance(p,Spop):
 *         return view_mutations_singlepop(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MlocusPop):
 *         return view_mutations_singlepop_mloc(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_mutations_singlepop); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 243, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 243, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 243, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 243, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 243, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_p);
        __Pyx_GIVEREF(__pyx_v_p);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_p);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 243, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":242
 *     .. note:: :class:`fwdpy.fwdpy.MetaPopVec` currently not supported
 *     """
 *     if isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return view_mutations_singlepop(p)
 *     elif isinstance(p,MlocusPop):
 */
  }

  /* "fwdpy/views.pyx":244
 *     if isinstance(p,Spop):
 *         return view_mutations_singlepop(p)
 *     elif isinstance(p,MlocusPop):             # <<<<<<<<<<<<<<
 *         return view_mutations_singlepop_mloc(p)
 *     elif isinstance(p,SpopVec):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MlocusPop); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/views.pyx":245
 *         return view_mutations_singlepop(p)
 *     elif isinstance(p,MlocusPop):
 *         return view_mutations_singlepop_mloc(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,SpopVec):
 *         return view_mutations_popvec(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_mutations_singlepop_mloc); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 245, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 245, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 245, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_p);
        __Pyx_GIVEREF(__pyx_v_p);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_p);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 245, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":244
 *     if isinstance(p,Spop):
 *         return view_mutations_singlepop(p)
 *     elif isinstance(p,MlocusPop):             # <<<<<<<<<<<<<<
 *         return view_mutations_singlepop_mloc(p)
 *     elif isinstance(p,SpopVec):
 */
  }

  /* "fwdpy/views.pyx":246
 *     elif isinstance(p,MlocusPop):
 *         return view_mutations_singlepop_mloc(p)
 *     elif isinstance(p,SpopVec):             # <<<<<<<<<<<<<<
 *         return view_mutations_popvec(p)
 *     elif isinstance(p,MlocusPopVec):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_SpopVec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":247
 *         return view_mutations_singlepop_mloc(p)
 *     elif isinstance(p,SpopVec):
 *         return view_mutations_popvec(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MlocusPopVec):
 *         return view_mutations_popvec_mloc(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_mutations_popvec); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 247, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 247, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 247, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_p);
        __Pyx_GIVEREF(__pyx_v_p);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_p);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 247, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":246
 *     elif isinstance(p,MlocusPop):
 *         return view_mutations_singlepop_mloc(p)
 *     elif isinstance(p,SpopVec):             # <<<<<<<<<<<<<<
 *         return view_mutations_popvec(p)
 *     elif isinstance(p,MlocusPopVec):
 */
  }

  /* "fwdpy/views.pyx":248
 *     elif isinstance(p,SpopVec):
 *         return view_mutations_popvec(p)
 *     elif isinstance(p,MlocusPopVec):             # <<<<<<<<<<<<<<
 *         return view_mutations_popvec_mloc(p)
 *     elif isinstance(p,MetaPop):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/views.pyx":249
 *         return view_mutations_popvec(p)
 *     elif isinstance(p,MlocusPopVec):
 *         return view_mutations_popvec_mloc(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MetaPop):
 *         if deme is None:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_mutations_popvec_mloc); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 249, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 249, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 249, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 249, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_p);
        __Pyx_GIVEREF(__pyx_v_p);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_p);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 249, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":248
 *     elif isinstance(p,SpopVec):
 *         return view_mutations_popvec(p)
 *     elif isinstance(p,MlocusPopVec):             # <<<<<<<<<<<<<<
 *         return view_mutations_popvec_mloc(p)
 *     elif isinstance(p,MetaPop):
 */
  }

  /* "fwdpy/views.pyx":250
 *     elif isinstance(p,MlocusPopVec):
 *         return view_mutations_popvec_mloc(p)
 *     elif isinstance(p,MetaPop):             # <<<<<<<<<<<<<<
 *         if deme is None:
 *             raise RuntimeError("view_mutations: deme cannot be none for metapops")
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MetaPop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":251
 *         return view_mutations_popvec_mloc(p)
 *     elif isinstance(p,MetaPop):
 *         if deme is None:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("view_mutations: deme cannot be none for metapops")
 *         return view_mutations_metapop(p,deme)
 */
    __pyx_t_2 = (__pyx_v_deme == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "fwdpy/views.pyx":252
 *     elif isinstance(p,MetaPop):
 *         if deme is None:
 *             raise RuntimeError("view_mutations: deme cannot be none for metapops")             # <<<<<<<<<<<<<<
 *         return view_mutations_metapop(p,deme)
 *     else:
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 252, __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(3, 252, __pyx_L1_error)

      /* "fwdpy/views.pyx":251
 *         return view_mutations_popvec_mloc(p)
 *     elif isinstance(p,MetaPop):
 *         if deme is None:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("view_mutations: deme cannot be none for metapops")
 *         return view_mutations_metapop(p,deme)
 */
    }

    /* "fwdpy/views.pyx":253
 *         if deme is None:
 *             raise RuntimeError("view_mutations: deme cannot be none for metapops")
 *         return view_mutations_metapop(p,deme)             # <<<<<<<<<<<<<<
 *     else:
 *         raise RuntimeError("view_mutations: unsupported object type")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_mutations_metapop); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_p, __pyx_v_deme};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 253, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_p, __pyx_v_deme};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 253, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_p);
      __Pyx_GIVEREF(__pyx_v_p);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_p);
      __Pyx_INCREF(__pyx_v_deme);
      __Pyx_GIVEREF(__pyx_v_deme);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_deme);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":250
 *     elif isinstance(p,MlocusPopVec):
 *         return view_mutations_popvec_mloc(p)
 *     elif isinstance(p,MetaPop):             # <<<<<<<<<<<<<<
 *         if deme is None:
 *             raise RuntimeError("view_mutations: deme cannot be none for metapops")
 */
  }

  /* "fwdpy/views.pyx":255
 *         return view_mutations_metapop(p,deme)
 *     else:
 *         raise RuntimeError("view_mutations: unsupported object type")             # <<<<<<<<<<<<<<
 * 
 * def view_gametes_singlepop(Spop p):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 255, __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(3, 255, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":218
 *     return rv
 * 
 * def view_mutations(object p, deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Get detailed list of all mutations in the population
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_mutations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":257
 *         raise RuntimeError("view_mutations: unsupported object type")
 * 
 * def view_gametes_singlepop(Spop p):             # <<<<<<<<<<<<<<
 *     return view_gametes_details(p.pop.get())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_43view_gametes_singlepop(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_43view_gametes_singlepop = {"view_gametes_singlepop", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_43view_gametes_singlepop, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_43view_gametes_singlepop(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_gametes_singlepop (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_Spop, 1, "p", 0))) __PYX_ERR(3, 257, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_42view_gametes_singlepop(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_42view_gametes_singlepop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("view_gametes_singlepop", 0);

  /* "fwdpy/views.pyx":258
 * 
 * def view_gametes_singlepop(Spop p):
 *     return view_gametes_details(p.pop.get())             # <<<<<<<<<<<<<<
 * 
 * def view_gametes_singlepop_mloc(MlocusPop p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data(__pyx_f_5fwdpy_5fwdpy_view_gametes_details(__pyx_v_p->pop.get())); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":257
 *         raise RuntimeError("view_mutations: unsupported object type")
 * 
 * def view_gametes_singlepop(Spop p):             # <<<<<<<<<<<<<<
 *     return view_gametes_details(p.pop.get())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_gametes_singlepop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":260
 *     return view_gametes_details(p.pop.get())
 * 
 * def view_gametes_singlepop_mloc(MlocusPop p):             # <<<<<<<<<<<<<<
 *     return view_gametes_details_mloc(p.pop.get())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_45view_gametes_singlepop_mloc(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_45view_gametes_singlepop_mloc = {"view_gametes_singlepop_mloc", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_45view_gametes_singlepop_mloc, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_45view_gametes_singlepop_mloc(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_gametes_singlepop_mloc (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MlocusPop, 1, "p", 0))) __PYX_ERR(3, 260, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_44view_gametes_singlepop_mloc(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_44view_gametes_singlepop_mloc(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("view_gametes_singlepop_mloc", 0);

  /* "fwdpy/views.pyx":261
 * 
 * def view_gametes_singlepop_mloc(MlocusPop p):
 *     return view_gametes_details_mloc(p.pop.get())             # <<<<<<<<<<<<<<
 * 
 * def view_gametes_popvec(SpopVec p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data(__pyx_f_5fwdpy_5fwdpy_view_gametes_details_mloc(__pyx_v_p->pop.get())); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":260
 *     return view_gametes_details(p.pop.get())
 * 
 * def view_gametes_singlepop_mloc(MlocusPop p):             # <<<<<<<<<<<<<<
 *     return view_gametes_details_mloc(p.pop.get())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_gametes_singlepop_mloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":263
 *     return view_gametes_details_mloc(p.pop.get())
 * 
 * def view_gametes_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     cdef:
 *         gcont_t_itr beg,end
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_47view_gametes_popvec(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_47view_gametes_popvec = {"view_gametes_popvec", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_47view_gametes_popvec, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_47view_gametes_popvec(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_gametes_popvec (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_SpopVec, 1, "p", 0))) __PYX_ERR(3, 263, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_46view_gametes_popvec(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_46view_gametes_popvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p) {
  size_t __pyx_v_npops;
  int __pyx_v_i;
  std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data> >  __pyx_v_rv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("view_gametes_popvec", 0);

  /* "fwdpy/views.pyx":266
 *     cdef:
 *         gcont_t_itr beg,end
 *         size_t npops = p.pops.size()             # <<<<<<<<<<<<<<
 *         int i
 *         vector[vector[gamete_data]] rv
 */
  __pyx_v_npops = __pyx_v_p->pops.size();

  /* "fwdpy/views.pyx":269
 *         int i
 *         vector[vector[gamete_data]] rv
 *     rv.resize(npops)             # <<<<<<<<<<<<<<
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i]=view_gametes_details(p.pops[i].get())
 */
  try {
    __pyx_v_rv.resize(__pyx_v_npops);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(3, 269, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":270
 *         vector[vector[gamete_data]] rv
 *     rv.resize(npops)
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i]=view_gametes_details(p.pops[i].get())
 *     return rv
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {
        __pyx_t_1 = __pyx_v_npops;
        if (1 == 0) abort();
        {
            __pyx_t_4 = 1;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_3 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static, __pyx_t_4)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_2);

                            /* "fwdpy/views.pyx":271
 *     rv.resize(npops)
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i]=view_gametes_details(p.pops[i].get())             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
                            (__pyx_v_rv[__pyx_v_i]) = __pyx_f_5fwdpy_5fwdpy_view_gametes_details((__pyx_v_p->pops[__pyx_v_i]).get());
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "fwdpy/views.pyx":270
 *         vector[vector[gamete_data]] rv
 *     rv.resize(npops)
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i]=view_gametes_details(p.pops[i].get())
 *     return rv
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "fwdpy/views.pyx":272
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i]=view_gametes_details(p.pops[i].get())
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def view_gametes_popvec_mloc(MlocusPopVec p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_gamete_data_3e___(__pyx_v_rv); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":263
 *     return view_gametes_details_mloc(p.pop.get())
 * 
 * def view_gametes_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     cdef:
 *         gcont_t_itr beg,end
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_gametes_popvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":274
 *     return rv
 * 
 * def view_gametes_popvec_mloc(MlocusPopVec p):             # <<<<<<<<<<<<<<
 *     cdef:
 *         gcont_t_itr beg,end
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_49view_gametes_popvec_mloc(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_49view_gametes_popvec_mloc = {"view_gametes_popvec_mloc", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_49view_gametes_popvec_mloc, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_49view_gametes_popvec_mloc(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_gametes_popvec_mloc (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec, 1, "p", 0))) __PYX_ERR(3, 274, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_48view_gametes_popvec_mloc(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_48view_gametes_popvec_mloc(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p) {
  size_t __pyx_v_npops;
  int __pyx_v_i;
  std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data> >  __pyx_v_rv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("view_gametes_popvec_mloc", 0);

  /* "fwdpy/views.pyx":277
 *     cdef:
 *         gcont_t_itr beg,end
 *         size_t npops = p.pops.size()             # <<<<<<<<<<<<<<
 *         int i
 *         vector[vector[gamete_data]] rv
 */
  __pyx_v_npops = __pyx_v_p->pops.size();

  /* "fwdpy/views.pyx":280
 *         int i
 *         vector[vector[gamete_data]] rv
 *     rv.resize(npops)             # <<<<<<<<<<<<<<
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i]=view_gametes_details_mloc(p.pops[i].get())
 */
  try {
    __pyx_v_rv.resize(__pyx_v_npops);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(3, 280, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":281
 *         vector[vector[gamete_data]] rv
 *     rv.resize(npops)
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i]=view_gametes_details_mloc(p.pops[i].get())
 *     return rv
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {
        __pyx_t_1 = __pyx_v_npops;
        if (1 == 0) abort();
        {
            __pyx_t_4 = 1;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_3 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static, __pyx_t_4)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_2);

                            /* "fwdpy/views.pyx":282
 *     rv.resize(npops)
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i]=view_gametes_details_mloc(p.pops[i].get())             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
                            (__pyx_v_rv[__pyx_v_i]) = __pyx_f_5fwdpy_5fwdpy_view_gametes_details_mloc((__pyx_v_p->pops[__pyx_v_i]).get());
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "fwdpy/views.pyx":281
 *         vector[vector[gamete_data]] rv
 *     rv.resize(npops)
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i]=view_gametes_details_mloc(p.pops[i].get())
 *     return rv
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "fwdpy/views.pyx":283
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i]=view_gametes_details_mloc(p.pops[i].get())
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def view_gametes_metapop(MetaPop p, unsigned deme):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_gamete_data_3e___(__pyx_v_rv); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":274
 *     return rv
 * 
 * def view_gametes_popvec_mloc(MlocusPopVec p):             # <<<<<<<<<<<<<<
 *     cdef:
 *         gcont_t_itr beg,end
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_gametes_popvec_mloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":285
 *     return rv
 * 
 * def view_gametes_metapop(MetaPop p, unsigned deme):             # <<<<<<<<<<<<<<
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_gametes: deme index out of range")
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_51view_gametes_metapop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_51view_gametes_metapop = {"view_gametes_metapop", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_51view_gametes_metapop, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_51view_gametes_metapop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_p = 0;
  unsigned int __pyx_v_deme;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_gametes_metapop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_deme,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_deme)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("view_gametes_metapop", 1, 2, 2, 1); __PYX_ERR(3, 285, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view_gametes_metapop") < 0)) __PYX_ERR(3, 285, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_p = ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)values[0]);
    __pyx_v_deme = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_deme == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(3, 285, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view_gametes_metapop", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 285, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.view_gametes_metapop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MetaPop, 1, "p", 0))) __PYX_ERR(3, 285, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_50view_gametes_metapop(__pyx_self, __pyx_v_p, __pyx_v_deme);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_50view_gametes_metapop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_p, unsigned int __pyx_v_deme) {
  PyObject *__pyx_v_temp1 = NULL;
  PyObject *__pyx_v_unique_gams = NULL;
  PyObject *__pyx_v_allgams = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_dummy = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("view_gametes_metapop", 0);

  /* "fwdpy/views.pyx":286
 * 
 * def view_gametes_metapop(MetaPop p, unsigned deme):
 *     if deme >= len(p.popsizes()):             # <<<<<<<<<<<<<<
 *         raise IndexError("view_gametes: deme index out of range")
 *     temp1 = view_diploids(p,list(range(p.mpop.get().diploids[deme].size())),deme)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_5fwdpy_5fwdpy_MetaPop *)__pyx_v_p->__pyx_vtab)->popsizes(__pyx_v_p, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(3, 286, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((__pyx_v_deme >= __pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "fwdpy/views.pyx":287
 * def view_gametes_metapop(MetaPop p, unsigned deme):
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_gametes: deme index out of range")             # <<<<<<<<<<<<<<
 *     temp1 = view_diploids(p,list(range(p.mpop.get().diploids[deme].size())),deme)
 *     #Get unique list of haplotypes
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(3, 287, __pyx_L1_error)

    /* "fwdpy/views.pyx":286
 * 
 * def view_gametes_metapop(MetaPop p, unsigned deme):
 *     if deme >= len(p.popsizes()):             # <<<<<<<<<<<<<<
 *         raise IndexError("view_gametes: deme index out of range")
 *     temp1 = view_diploids(p,list(range(p.mpop.get().diploids[deme].size())),deme)
 */
  }

  /* "fwdpy/views.pyx":288
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_gametes: deme index out of range")
 *     temp1 = view_diploids(p,list(range(p.mpop.get().diploids[deme].size())),deme)             # <<<<<<<<<<<<<<
 *     #Get unique list of haplotypes
 *     unique_gams = []
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_diploids); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_FromSize_t((__pyx_v_p->mpop.get()->diploids[__pyx_v_deme]).size()); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PySequence_List(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_deme); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      __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[4] = {__pyx_t_7, ((PyObject *)__pyx_v_p), __pyx_t_6, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 288, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __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[4] = {__pyx_t_7, ((PyObject *)__pyx_v_p), __pyx_t_6, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 288, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 288, __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_INCREF(((PyObject *)__pyx_v_p));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, ((PyObject *)__pyx_v_p));
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
    __pyx_t_6 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_temp1 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":290
 *     temp1 = view_diploids(p,list(range(p.mpop.get().diploids[deme].size())),deme)
 *     #Get unique list of haplotypes
 *     unique_gams = []             # <<<<<<<<<<<<<<
 *     allgams = []
 *     for i in temp1:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_unique_gams = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":291
 *     #Get unique list of haplotypes
 *     unique_gams = []
 *     allgams = []             # <<<<<<<<<<<<<<
 *     for i in temp1:
 *         if unique_gams.count(i['chrom0'])==0:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_allgams = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":292
 *     unique_gams = []
 *     allgams = []
 *     for i in temp1:             # <<<<<<<<<<<<<<
 *         if unique_gams.count(i['chrom0'])==0:
 *             unique_gams.append(i['chrom0'])
 */
  if (likely(PyList_CheckExact(__pyx_v_temp1)) || PyTuple_CheckExact(__pyx_v_temp1)) {
    __pyx_t_1 = __pyx_v_temp1; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_temp1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 292, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(3, 292, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 292, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(3, 292, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 292, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_10(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(3, 292, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":293
 *     allgams = []
 *     for i in temp1:
 *         if unique_gams.count(i['chrom0'])==0:             # <<<<<<<<<<<<<<
 *             unique_gams.append(i['chrom0'])
 *         if unique_gams.count(i['chrom1'])==0:
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_unique_gams, __pyx_n_s_count); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = PyObject_GetItem(__pyx_v_i, __pyx_n_s_chrom0); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 293, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 293, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 293, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 293, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
        __pyx_t_5 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 293, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyInt_EqObjC(__pyx_t_4, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(3, 293, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_3) {

      /* "fwdpy/views.pyx":294
 *     for i in temp1:
 *         if unique_gams.count(i['chrom0'])==0:
 *             unique_gams.append(i['chrom0'])             # <<<<<<<<<<<<<<
 *         if unique_gams.count(i['chrom1'])==0:
 *             unique_gams.append(i['chrom1'])
 */
      __pyx_t_9 = PyObject_GetItem(__pyx_v_i, __pyx_n_s_chrom0); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_unique_gams, __pyx_t_9); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(3, 294, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "fwdpy/views.pyx":293
 *     allgams = []
 *     for i in temp1:
 *         if unique_gams.count(i['chrom0'])==0:             # <<<<<<<<<<<<<<
 *             unique_gams.append(i['chrom0'])
 *         if unique_gams.count(i['chrom1'])==0:
 */
    }

    /* "fwdpy/views.pyx":295
 *         if unique_gams.count(i['chrom0'])==0:
 *             unique_gams.append(i['chrom0'])
 *         if unique_gams.count(i['chrom1'])==0:             # <<<<<<<<<<<<<<
 *             unique_gams.append(i['chrom1'])
 *         allgams.append(i['chrom0'])
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_unique_gams, __pyx_n_s_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyObject_GetItem(__pyx_v_i, __pyx_n_s_chrom1); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 295, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_9);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_7};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 295, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_7};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 295, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 295, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 295, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_t_9, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(3, 295, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "fwdpy/views.pyx":296
 *             unique_gams.append(i['chrom0'])
 *         if unique_gams.count(i['chrom1'])==0:
 *             unique_gams.append(i['chrom1'])             # <<<<<<<<<<<<<<
 *         allgams.append(i['chrom0'])
 *         allgams.append(i['chrom1'])
 */
      __pyx_t_4 = PyObject_GetItem(__pyx_v_i, __pyx_n_s_chrom1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_unique_gams, __pyx_t_4); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(3, 296, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "fwdpy/views.pyx":295
 *         if unique_gams.count(i['chrom0'])==0:
 *             unique_gams.append(i['chrom0'])
 *         if unique_gams.count(i['chrom1'])==0:             # <<<<<<<<<<<<<<
 *             unique_gams.append(i['chrom1'])
 *         allgams.append(i['chrom0'])
 */
    }

    /* "fwdpy/views.pyx":297
 *         if unique_gams.count(i['chrom1'])==0:
 *             unique_gams.append(i['chrom1'])
 *         allgams.append(i['chrom0'])             # <<<<<<<<<<<<<<
 *         allgams.append(i['chrom1'])
 *     #clear temp1 and fill it with unique gametes + their counts in this deme
 */
    __pyx_t_4 = PyObject_GetItem(__pyx_v_i, __pyx_n_s_chrom0); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_allgams, __pyx_t_4); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(3, 297, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":298
 *             unique_gams.append(i['chrom1'])
 *         allgams.append(i['chrom0'])
 *         allgams.append(i['chrom1'])             # <<<<<<<<<<<<<<
 *     #clear temp1 and fill it with unique gametes + their counts in this deme
 *     temp1=[]
 */
    __pyx_t_4 = PyObject_GetItem(__pyx_v_i, __pyx_n_s_chrom1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_allgams, __pyx_t_4); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(3, 298, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":292
 *     unique_gams = []
 *     allgams = []
 *     for i in temp1:             # <<<<<<<<<<<<<<
 *         if unique_gams.count(i['chrom0'])==0:
 *             unique_gams.append(i['chrom0'])
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":300
 *         allgams.append(i['chrom1'])
 *     #clear temp1 and fill it with unique gametes + their counts in this deme
 *     temp1=[]             # <<<<<<<<<<<<<<
 *     dummy=0
 *     for i in unique_gams:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_temp1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":301
 *     #clear temp1 and fill it with unique gametes + their counts in this deme
 *     temp1=[]
 *     dummy=0             # <<<<<<<<<<<<<<
 *     for i in unique_gams:
 *         temp1.append(i)
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_dummy = __pyx_int_0;

  /* "fwdpy/views.pyx":302
 *     temp1=[]
 *     dummy=0
 *     for i in unique_gams:             # <<<<<<<<<<<<<<
 *         temp1.append(i)
 *         temp1[dummy]['n'] = allgams.count(i)
 */
  __pyx_t_1 = __pyx_v_unique_gams; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(3, 302, __pyx_L1_error)
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":303
 *     dummy=0
 *     for i in unique_gams:
 *         temp1.append(i)             # <<<<<<<<<<<<<<
 *         temp1[dummy]['n'] = allgams.count(i)
 *         dummy+=1
 */
    __pyx_t_11 = __Pyx_PyObject_Append(__pyx_v_temp1, __pyx_v_i); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(3, 303, __pyx_L1_error)

    /* "fwdpy/views.pyx":304
 *     for i in unique_gams:
 *         temp1.append(i)
 *         temp1[dummy]['n'] = allgams.count(i)             # <<<<<<<<<<<<<<
 *         dummy+=1
 *     return temp1
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_allgams, __pyx_n_s_count); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_i};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 304, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_i};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 304, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 304, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_i);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 304, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyObject_GetItem(__pyx_v_temp1, __pyx_v_dummy); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (unlikely(PyObject_SetItem(__pyx_t_9, __pyx_n_s_n, __pyx_t_4) < 0)) __PYX_ERR(3, 304, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":305
 *         temp1.append(i)
 *         temp1[dummy]['n'] = allgams.count(i)
 *         dummy+=1             # <<<<<<<<<<<<<<
 *     return temp1
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_dummy, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_dummy, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":302
 *     temp1=[]
 *     dummy=0
 *     for i in unique_gams:             # <<<<<<<<<<<<<<
 *         temp1.append(i)
 *         temp1[dummy]['n'] = allgams.count(i)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":306
 *         temp1[dummy]['n'] = allgams.count(i)
 *         dummy+=1
 *     return temp1             # <<<<<<<<<<<<<<
 * 
 * def view_gametes(object p ,deme = None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_temp1);
  __pyx_r = __pyx_v_temp1;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":285
 *     return rv
 * 
 * def view_gametes_metapop(MetaPop p, unsigned deme):             # <<<<<<<<<<<<<<
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_gametes: deme index out of range")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_gametes_metapop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_temp1);
  __Pyx_XDECREF(__pyx_v_unique_gams);
  __Pyx_XDECREF(__pyx_v_allgams);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_dummy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":308
 *     return temp1
 * 
 * def view_gametes(object p ,deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Get detailed list of all gametes in the population
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_53view_gametes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_52view_gametes[] = "\n    Get detailed list of all gametes in the population\n\n    :param p: a :class:`fwdpy.fwdpy.PopType` or a :class:`fwdpy.fwdpy.PopVec`\n    :param deme: If p is a :class:`fwdpy.fwdpy.MetaPop`, deme is the index of the deme to view\n\n    :rtype: a list of dictionaries.  See note.\n\n    Example for a single deme:\n\n    >>> import fwdpy\n    >>> import numpy as np\n    >>> nregions = [fwdpy.Region(0,1,1),fwdpy.Region(2,3,1)]\n    >>> sregions = [fwdpy.ExpS(1,2,1,-0.1),fwdpy.ExpS(1,2,0.01,0.001)]\n    >>> rregions = [fwdpy.Region(0,3,1)]\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes = np.array([1000],dtype=np.uint32)\n    >>> popsizes=np.tile(popsizes,100)\n    >>> pops = fwdpy.evolve_regions(rng,1,1000,popsizes[0:],0.001,0.0001,0.001,nregions,sregions,rregions)\n    >>> dips = [fwdpy.view_gametes(i) for i in pops]\n\n    .. note:: :class:`fwdpy.fwdpy.MetaPopVec` currently not supported\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_53view_gametes = {"view_gametes", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_53view_gametes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_52view_gametes};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_53view_gametes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_deme = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_gametes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_deme,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_deme);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view_gametes") < 0)) __PYX_ERR(3, 308, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
    __pyx_v_deme = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view_gametes", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 308, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.view_gametes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_52view_gametes(__pyx_self, __pyx_v_p, __pyx_v_deme);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_52view_gametes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_deme) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("view_gametes", 0);

  /* "fwdpy/views.pyx":332
 *     .. note:: :class:`fwdpy.fwdpy.MetaPopVec` currently not supported
 *     """
 *     if isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return view_gametes_singlepop(p)
 *     elif isinstance(p,MlocusPop):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_Spop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":333
 *     """
 *     if isinstance(p,Spop):
 *         return view_gametes_singlepop(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MlocusPop):
 *         return view_gametes_singlepop_mloc(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_gametes_singlepop); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 333, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 333, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 333, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 333, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_p);
        __Pyx_GIVEREF(__pyx_v_p);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_p);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 333, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":332
 *     .. note:: :class:`fwdpy.fwdpy.MetaPopVec` currently not supported
 *     """
 *     if isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return view_gametes_singlepop(p)
 *     elif isinstance(p,MlocusPop):
 */
  }

  /* "fwdpy/views.pyx":334
 *     if isinstance(p,Spop):
 *         return view_gametes_singlepop(p)
 *     elif isinstance(p,MlocusPop):             # <<<<<<<<<<<<<<
 *         return view_gametes_singlepop_mloc(p)
 *     elif isinstance(p,SpopVec):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MlocusPop); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/views.pyx":335
 *         return view_gametes_singlepop(p)
 *     elif isinstance(p,MlocusPop):
 *         return view_gametes_singlepop_mloc(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,SpopVec):
 *         return view_gametes_popvec(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_gametes_singlepop_mloc); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 335, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 335, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 335, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 335, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_p);
        __Pyx_GIVEREF(__pyx_v_p);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_p);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 335, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":334
 *     if isinstance(p,Spop):
 *         return view_gametes_singlepop(p)
 *     elif isinstance(p,MlocusPop):             # <<<<<<<<<<<<<<
 *         return view_gametes_singlepop_mloc(p)
 *     elif isinstance(p,SpopVec):
 */
  }

  /* "fwdpy/views.pyx":336
 *     elif isinstance(p,MlocusPop):
 *         return view_gametes_singlepop_mloc(p)
 *     elif isinstance(p,SpopVec):             # <<<<<<<<<<<<<<
 *         return view_gametes_popvec(p)
 *     elif isinstance(p,MlocusPopVec):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_SpopVec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":337
 *         return view_gametes_singlepop_mloc(p)
 *     elif isinstance(p,SpopVec):
 *         return view_gametes_popvec(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MlocusPopVec):
 *         return view_gametes_popvec_mloc(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_gametes_popvec); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 337, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 337, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 337, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 337, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_p);
        __Pyx_GIVEREF(__pyx_v_p);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_p);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 337, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":336
 *     elif isinstance(p,MlocusPop):
 *         return view_gametes_singlepop_mloc(p)
 *     elif isinstance(p,SpopVec):             # <<<<<<<<<<<<<<
 *         return view_gametes_popvec(p)
 *     elif isinstance(p,MlocusPopVec):
 */
  }

  /* "fwdpy/views.pyx":338
 *     elif isinstance(p,SpopVec):
 *         return view_gametes_popvec(p)
 *     elif isinstance(p,MlocusPopVec):             # <<<<<<<<<<<<<<
 *         return view_gametes_popvec_mloc(p)
 *     elif isinstance(p,MetaPop):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/views.pyx":339
 *         return view_gametes_popvec(p)
 *     elif isinstance(p,MlocusPopVec):
 *         return view_gametes_popvec_mloc(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MetaPop):
 *         if deme is None:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_gametes_popvec_mloc); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 339, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 339, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 339, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 339, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 339, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_p);
        __Pyx_GIVEREF(__pyx_v_p);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_p);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 339, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":338
 *     elif isinstance(p,SpopVec):
 *         return view_gametes_popvec(p)
 *     elif isinstance(p,MlocusPopVec):             # <<<<<<<<<<<<<<
 *         return view_gametes_popvec_mloc(p)
 *     elif isinstance(p,MetaPop):
 */
  }

  /* "fwdpy/views.pyx":340
 *     elif isinstance(p,MlocusPopVec):
 *         return view_gametes_popvec_mloc(p)
 *     elif isinstance(p,MetaPop):             # <<<<<<<<<<<<<<
 *         if deme is None:
 *             raise RuntimeError("view_gametes: deme cannot be None when p is a MetaPop")
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MetaPop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":341
 *         return view_gametes_popvec_mloc(p)
 *     elif isinstance(p,MetaPop):
 *         if deme is None:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("view_gametes: deme cannot be None when p is a MetaPop")
 *         return view_gametes_metapop(p,deme)
 */
    __pyx_t_2 = (__pyx_v_deme == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "fwdpy/views.pyx":342
 *     elif isinstance(p,MetaPop):
 *         if deme is None:
 *             raise RuntimeError("view_gametes: deme cannot be None when p is a MetaPop")             # <<<<<<<<<<<<<<
 *         return view_gametes_metapop(p,deme)
 *     else:
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 342, __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(3, 342, __pyx_L1_error)

      /* "fwdpy/views.pyx":341
 *         return view_gametes_popvec_mloc(p)
 *     elif isinstance(p,MetaPop):
 *         if deme is None:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("view_gametes: deme cannot be None when p is a MetaPop")
 *         return view_gametes_metapop(p,deme)
 */
    }

    /* "fwdpy/views.pyx":343
 *         if deme is None:
 *             raise RuntimeError("view_gametes: deme cannot be None when p is a MetaPop")
 *         return view_gametes_metapop(p,deme)             # <<<<<<<<<<<<<<
 *     else:
 *         raise RuntimeError("view_gametes: unsupported object type")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_gametes_metapop); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_p, __pyx_v_deme};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 343, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_p, __pyx_v_deme};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 343, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_p);
      __Pyx_GIVEREF(__pyx_v_p);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_p);
      __Pyx_INCREF(__pyx_v_deme);
      __Pyx_GIVEREF(__pyx_v_deme);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_deme);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":340
 *     elif isinstance(p,MlocusPopVec):
 *         return view_gametes_popvec_mloc(p)
 *     elif isinstance(p,MetaPop):             # <<<<<<<<<<<<<<
 *         if deme is None:
 *             raise RuntimeError("view_gametes: deme cannot be None when p is a MetaPop")
 */
  }

  /* "fwdpy/views.pyx":345
 *         return view_gametes_metapop(p,deme)
 *     else:
 *         raise RuntimeError("view_gametes: unsupported object type")             # <<<<<<<<<<<<<<
 * 
 * def view_diploids_singlepop(Spop p, list indlist):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 345, __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(3, 345, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":308
 *     return temp1
 * 
 * def view_gametes(object p ,deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Get detailed list of all gametes in the population
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_gametes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":347
 *         raise RuntimeError("view_gametes: unsupported object type")
 * 
 * def view_diploids_singlepop(Spop p, list indlist):             # <<<<<<<<<<<<<<
 *     for i in indlist:
 *         if i >= p.popsize():
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_55view_diploids_singlepop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_55view_diploids_singlepop = {"view_diploids_singlepop", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_55view_diploids_singlepop, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_55view_diploids_singlepop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p = 0;
  PyObject *__pyx_v_indlist = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_diploids_singlepop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_indlist,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("view_diploids_singlepop", 1, 2, 2, 1); __PYX_ERR(3, 347, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view_diploids_singlepop") < 0)) __PYX_ERR(3, 347, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_p = ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)values[0]);
    __pyx_v_indlist = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view_diploids_singlepop", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 347, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_singlepop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_Spop, 1, "p", 0))) __PYX_ERR(3, 347, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indlist), (&PyList_Type), 1, "indlist", 1))) __PYX_ERR(3, 347, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_54view_diploids_singlepop(__pyx_self, __pyx_v_p, __pyx_v_indlist);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_54view_diploids_singlepop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p, PyObject *__pyx_v_indlist) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __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;
  std::vector<unsigned int>  __pyx_t_6;
  __Pyx_RefNannySetupContext("view_diploids_singlepop", 0);

  /* "fwdpy/views.pyx":348
 * 
 * def view_diploids_singlepop(Spop p, list indlist):
 *     for i in indlist:             # <<<<<<<<<<<<<<
 *         if i >= p.popsize():
 *             raise IndexError("index greater than population size")
 */
  if (unlikely(__pyx_v_indlist == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(3, 348, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_indlist; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(3, 348, __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(3, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":349
 * def view_diploids_singlepop(Spop p, list indlist):
 *     for i in indlist:
 *         if i >= p.popsize():             # <<<<<<<<<<<<<<
 *             raise IndexError("index greater than population size")
 *     return view_diploids_details(p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts,indlist)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_5fwdpy_5fwdpy_Spop *)__pyx_v_p->__pyx_vtab)->popsize(__pyx_v_p, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_i, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 349, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(3, 349, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {

      /* "fwdpy/views.pyx":350
 *     for i in indlist:
 *         if i >= p.popsize():
 *             raise IndexError("index greater than population size")             # <<<<<<<<<<<<<<
 *     return view_diploids_details(p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts,indlist)
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 350, __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(3, 350, __pyx_L1_error)

      /* "fwdpy/views.pyx":349
 * def view_diploids_singlepop(Spop p, list indlist):
 *     for i in indlist:
 *         if i >= p.popsize():             # <<<<<<<<<<<<<<
 *             raise IndexError("index greater than population size")
 *     return view_diploids_details(p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts,indlist)
 */
    }

    /* "fwdpy/views.pyx":348
 * 
 * def view_diploids_singlepop(Spop p, list indlist):
 *     for i in indlist:             # <<<<<<<<<<<<<<
 *         if i >= p.popsize():
 *             raise IndexError("index greater than population size")
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":351
 *         if i >= p.popsize():
 *             raise IndexError("index greater than population size")
 *     return view_diploids_details(p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts,indlist)             # <<<<<<<<<<<<<<
 * 
 * def view_diploids_singlepop_mloc(MlocusPop p, list indlist):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __pyx_convert_vector_from_py_unsigned_int(__pyx_v_indlist); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 351, __pyx_L1_error)
  __pyx_t_1 = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_data(__pyx_f_5fwdpy_5fwdpy_view_diploids_details(__pyx_v_p->pop.get()->diploids, __pyx_v_p->pop.get()->gametes, __pyx_v_p->pop.get()->mutations, __pyx_v_p->pop.get()->mcounts, __pyx_t_6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":347
 *         raise RuntimeError("view_gametes: unsupported object type")
 * 
 * def view_diploids_singlepop(Spop p, list indlist):             # <<<<<<<<<<<<<<
 *     for i in indlist:
 *         if i >= p.popsize():
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_singlepop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":353
 *     return view_diploids_details(p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts,indlist)
 * 
 * def view_diploids_singlepop_mloc(MlocusPop p, list indlist):             # <<<<<<<<<<<<<<
 *     for i in indlist:
 *         if i >= p.popsize():
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_57view_diploids_singlepop_mloc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_57view_diploids_singlepop_mloc = {"view_diploids_singlepop_mloc", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_57view_diploids_singlepop_mloc, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_57view_diploids_singlepop_mloc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_p = 0;
  PyObject *__pyx_v_indlist = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_diploids_singlepop_mloc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_indlist,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("view_diploids_singlepop_mloc", 1, 2, 2, 1); __PYX_ERR(3, 353, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view_diploids_singlepop_mloc") < 0)) __PYX_ERR(3, 353, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_p = ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)values[0]);
    __pyx_v_indlist = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view_diploids_singlepop_mloc", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 353, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_singlepop_mloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MlocusPop, 1, "p", 0))) __PYX_ERR(3, 353, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indlist), (&PyList_Type), 1, "indlist", 1))) __PYX_ERR(3, 353, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_56view_diploids_singlepop_mloc(__pyx_self, __pyx_v_p, __pyx_v_indlist);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_56view_diploids_singlepop_mloc(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_p, PyObject *__pyx_v_indlist) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __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;
  std::vector<unsigned int>  __pyx_t_6;
  __Pyx_RefNannySetupContext("view_diploids_singlepop_mloc", 0);

  /* "fwdpy/views.pyx":354
 * 
 * def view_diploids_singlepop_mloc(MlocusPop p, list indlist):
 *     for i in indlist:             # <<<<<<<<<<<<<<
 *         if i >= p.popsize():
 *             raise IndexError("index greater than population size")
 */
  if (unlikely(__pyx_v_indlist == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(3, 354, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_indlist; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(3, 354, __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(3, 354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":355
 * def view_diploids_singlepop_mloc(MlocusPop p, list indlist):
 *     for i in indlist:
 *         if i >= p.popsize():             # <<<<<<<<<<<<<<
 *             raise IndexError("index greater than population size")
 *     return view_diploids_details_mloc(p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts,indlist)
 */
    __pyx_t_3 = ((struct __pyx_vtabstruct_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_p->__pyx_vtab)->popsize(__pyx_v_p, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_i, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 355, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(3, 355, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {

      /* "fwdpy/views.pyx":356
 *     for i in indlist:
 *         if i >= p.popsize():
 *             raise IndexError("index greater than population size")             # <<<<<<<<<<<<<<
 *     return view_diploids_details_mloc(p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts,indlist)
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 356, __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(3, 356, __pyx_L1_error)

      /* "fwdpy/views.pyx":355
 * def view_diploids_singlepop_mloc(MlocusPop p, list indlist):
 *     for i in indlist:
 *         if i >= p.popsize():             # <<<<<<<<<<<<<<
 *             raise IndexError("index greater than population size")
 *     return view_diploids_details_mloc(p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts,indlist)
 */
    }

    /* "fwdpy/views.pyx":354
 * 
 * def view_diploids_singlepop_mloc(MlocusPop p, list indlist):
 *     for i in indlist:             # <<<<<<<<<<<<<<
 *         if i >= p.popsize():
 *             raise IndexError("index greater than population size")
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":357
 *         if i >= p.popsize():
 *             raise IndexError("index greater than population size")
 *     return view_diploids_details_mloc(p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts,indlist)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __pyx_convert_vector_from_py_unsigned_int(__pyx_v_indlist); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 357, __pyx_L1_error)
  __pyx_t_1 = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data(__pyx_f_5fwdpy_5fwdpy_view_diploids_details_mloc(__pyx_v_p->pop.get()->diploids, __pyx_v_p->pop.get()->gametes, __pyx_v_p->pop.get()->mutations, __pyx_v_p->pop.get()->mcounts, __pyx_t_6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":353
 *     return view_diploids_details(p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts,indlist)
 * 
 * def view_diploids_singlepop_mloc(MlocusPop p, list indlist):             # <<<<<<<<<<<<<<
 *     for i in indlist:
 *         if i >= p.popsize():
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_singlepop_mloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":360
 * 
 * 
 * def view_diploids_popvec(SpopVec p, list indlist):             # <<<<<<<<<<<<<<
 *     cdef size_t npops = len(p),i
 *     cdef vector[vector[diploid_data]] rv
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_59view_diploids_popvec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_59view_diploids_popvec = {"view_diploids_popvec", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_59view_diploids_popvec, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_59view_diploids_popvec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p = 0;
  PyObject *__pyx_v_indlist = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_diploids_popvec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_indlist,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("view_diploids_popvec", 1, 2, 2, 1); __PYX_ERR(3, 360, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view_diploids_popvec") < 0)) __PYX_ERR(3, 360, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_p = ((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)values[0]);
    __pyx_v_indlist = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view_diploids_popvec", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 360, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_popvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_SpopVec, 1, "p", 0))) __PYX_ERR(3, 360, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indlist), (&PyList_Type), 1, "indlist", 1))) __PYX_ERR(3, 360, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_58view_diploids_popvec(__pyx_self, __pyx_v_p, __pyx_v_indlist);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_58view_diploids_popvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p, PyObject *__pyx_v_indlist) {
  size_t __pyx_v_npops;
  size_t __pyx_v_i;
  std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_data> >  __pyx_v_rv;
  std::vector<unsigned int>  __pyx_v_il;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  size_t __pyx_t_5;
  size_t __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("view_diploids_popvec", 0);

  /* "fwdpy/views.pyx":361
 * 
 * def view_diploids_popvec(SpopVec p, list indlist):
 *     cdef size_t npops = len(p),i             # <<<<<<<<<<<<<<
 *     cdef vector[vector[diploid_data]] rv
 *     rv.resize(npops)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_p)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 361, __pyx_L1_error)
  __pyx_v_npops = __pyx_t_1;

  /* "fwdpy/views.pyx":363
 *     cdef size_t npops = len(p),i
 *     cdef vector[vector[diploid_data]] rv
 *     rv.resize(npops)             # <<<<<<<<<<<<<<
 *     cdef vector[unsigned] il
 *     for i in indlist:
 */
  try {
    __pyx_v_rv.resize(__pyx_v_npops);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(3, 363, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":365
 *     rv.resize(npops)
 *     cdef vector[unsigned] il
 *     for i in indlist:             # <<<<<<<<<<<<<<
 *         il.push_back(<unsigned>(i))
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 */
  if (unlikely(__pyx_v_indlist == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(3, 365, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_indlist; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 365, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 365, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_i = __pyx_t_4;

    /* "fwdpy/views.pyx":366
 *     cdef vector[unsigned] il
 *     for i in indlist:
 *         il.push_back(<unsigned>(i))             # <<<<<<<<<<<<<<
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i] = view_diploids_details(p.pops[i].get().diploids,
 */
    try {
      __pyx_v_il.push_back(((unsigned int)__pyx_v_i));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(3, 366, __pyx_L1_error)
    }

    /* "fwdpy/views.pyx":365
 *     rv.resize(npops)
 *     cdef vector[unsigned] il
 *     for i in indlist:             # <<<<<<<<<<<<<<
 *         il.push_back(<unsigned>(i))
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "fwdpy/views.pyx":367
 *     for i in indlist:
 *         il.push_back(<unsigned>(i))
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i] = view_diploids_details(p.pops[i].get().diploids,
 *                                       p.pops[i].get().gametes,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {
        __pyx_t_4 = __pyx_v_npops;
        if (1 == 0) abort();
        {
            __pyx_t_7 = 1;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_6 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_6 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static, __pyx_t_7)
                    #endif /* _OPENMP */
                    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_6; __pyx_t_5++){
                        {
                            __pyx_v_i = (size_t)(0 + 1 * __pyx_t_5);

                            /* "fwdpy/views.pyx":368
 *         il.push_back(<unsigned>(i))
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i] = view_diploids_details(p.pops[i].get().diploids,             # <<<<<<<<<<<<<<
 *                                       p.pops[i].get().gametes,
 *                                       p.pops[i].get().mutations,
 */
                            (__pyx_v_rv[__pyx_v_i]) = __pyx_f_5fwdpy_5fwdpy_view_diploids_details((__pyx_v_p->pops[__pyx_v_i]).get()->diploids, (__pyx_v_p->pops[__pyx_v_i]).get()->gametes, (__pyx_v_p->pops[__pyx_v_i]).get()->mutations, (__pyx_v_p->pops[__pyx_v_i]).get()->mcounts, __pyx_v_il);
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "fwdpy/views.pyx":367
 *     for i in indlist:
 *         il.push_back(<unsigned>(i))
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i] = view_diploids_details(p.pops[i].get().diploids,
 *                                       p.pops[i].get().gametes,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
  }

  /* "fwdpy/views.pyx":372
 *                                       p.pops[i].get().mutations,
 *                                       p.pops[i].get().mcounts,il)
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def view_diploids_popvec_mloc(MlocusPopVec p, list indlist):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_data_3e___(__pyx_v_rv); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":360
 * 
 * 
 * def view_diploids_popvec(SpopVec p, list indlist):             # <<<<<<<<<<<<<<
 *     cdef size_t npops = len(p),i
 *     cdef vector[vector[diploid_data]] rv
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_popvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":374
 *     return rv
 * 
 * def view_diploids_popvec_mloc(MlocusPopVec p, list indlist):             # <<<<<<<<<<<<<<
 *     cdef size_t npops = len(p),i
 *     cdef vector[vector[diploid_mloc_data]] rv
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_61view_diploids_popvec_mloc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_61view_diploids_popvec_mloc = {"view_diploids_popvec_mloc", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_61view_diploids_popvec_mloc, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_61view_diploids_popvec_mloc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p = 0;
  PyObject *__pyx_v_indlist = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_diploids_popvec_mloc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_indlist,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("view_diploids_popvec_mloc", 1, 2, 2, 1); __PYX_ERR(3, 374, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view_diploids_popvec_mloc") < 0)) __PYX_ERR(3, 374, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_p = ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)values[0]);
    __pyx_v_indlist = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view_diploids_popvec_mloc", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 374, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_popvec_mloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec, 1, "p", 0))) __PYX_ERR(3, 374, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indlist), (&PyList_Type), 1, "indlist", 1))) __PYX_ERR(3, 374, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_60view_diploids_popvec_mloc(__pyx_self, __pyx_v_p, __pyx_v_indlist);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_60view_diploids_popvec_mloc(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p, PyObject *__pyx_v_indlist) {
  size_t __pyx_v_npops;
  size_t __pyx_v_i;
  std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data> >  __pyx_v_rv;
  std::vector<unsigned int>  __pyx_v_il;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  size_t __pyx_t_5;
  size_t __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("view_diploids_popvec_mloc", 0);

  /* "fwdpy/views.pyx":375
 * 
 * def view_diploids_popvec_mloc(MlocusPopVec p, list indlist):
 *     cdef size_t npops = len(p),i             # <<<<<<<<<<<<<<
 *     cdef vector[vector[diploid_mloc_data]] rv
 *     rv.resize(npops)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_p)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 375, __pyx_L1_error)
  __pyx_v_npops = __pyx_t_1;

  /* "fwdpy/views.pyx":377
 *     cdef size_t npops = len(p),i
 *     cdef vector[vector[diploid_mloc_data]] rv
 *     rv.resize(npops)             # <<<<<<<<<<<<<<
 *     cdef vector[unsigned] il
 *     for i in indlist:
 */
  try {
    __pyx_v_rv.resize(__pyx_v_npops);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(3, 377, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":379
 *     rv.resize(npops)
 *     cdef vector[unsigned] il
 *     for i in indlist:             # <<<<<<<<<<<<<<
 *         il.push_back(<unsigned>(i))
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 */
  if (unlikely(__pyx_v_indlist == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(3, 379, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_indlist; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 379, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 379, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_i = __pyx_t_4;

    /* "fwdpy/views.pyx":380
 *     cdef vector[unsigned] il
 *     for i in indlist:
 *         il.push_back(<unsigned>(i))             # <<<<<<<<<<<<<<
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i] = view_diploids_details_mloc(p.pops[i].get().diploids,
 */
    try {
      __pyx_v_il.push_back(((unsigned int)__pyx_v_i));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(3, 380, __pyx_L1_error)
    }

    /* "fwdpy/views.pyx":379
 *     rv.resize(npops)
 *     cdef vector[unsigned] il
 *     for i in indlist:             # <<<<<<<<<<<<<<
 *         il.push_back(<unsigned>(i))
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "fwdpy/views.pyx":381
 *     for i in indlist:
 *         il.push_back(<unsigned>(i))
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i] = view_diploids_details_mloc(p.pops[i].get().diploids,
 *                                            p.pops[i].get().gametes,
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {
        __pyx_t_4 = __pyx_v_npops;
        if (1 == 0) abort();
        {
            __pyx_t_7 = 1;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_6 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_6 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static, __pyx_t_7)
                    #endif /* _OPENMP */
                    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_6; __pyx_t_5++){
                        {
                            __pyx_v_i = (size_t)(0 + 1 * __pyx_t_5);

                            /* "fwdpy/views.pyx":382
 *         il.push_back(<unsigned>(i))
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i] = view_diploids_details_mloc(p.pops[i].get().diploids,             # <<<<<<<<<<<<<<
 *                                            p.pops[i].get().gametes,
 *                                            p.pops[i].get().mutations,
 */
                            (__pyx_v_rv[__pyx_v_i]) = __pyx_f_5fwdpy_5fwdpy_view_diploids_details_mloc((__pyx_v_p->pops[__pyx_v_i]).get()->diploids, (__pyx_v_p->pops[__pyx_v_i]).get()->gametes, (__pyx_v_p->pops[__pyx_v_i]).get()->mutations, (__pyx_v_p->pops[__pyx_v_i]).get()->mcounts, __pyx_v_il);
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "fwdpy/views.pyx":381
 *     for i in indlist:
 *         il.push_back(<unsigned>(i))
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i] = view_diploids_details_mloc(p.pops[i].get().diploids,
 *                                            p.pops[i].get().gametes,
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
  }

  /* "fwdpy/views.pyx":386
 *                                            p.pops[i].get().mutations,
 *                                            p.pops[i].get().mcounts,il)
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def view_diploids_metapop(MetaPop p, list indlist, unsigned deme):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data_3e___(__pyx_v_rv); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":374
 *     return rv
 * 
 * def view_diploids_popvec_mloc(MlocusPopVec p, list indlist):             # <<<<<<<<<<<<<<
 *     cdef size_t npops = len(p),i
 *     cdef vector[vector[diploid_mloc_data]] rv
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_popvec_mloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":388
 *     return rv
 * 
 * def view_diploids_metapop(MetaPop p, list indlist, unsigned deme):             # <<<<<<<<<<<<<<
 *     psizes = p.popsizes()
 *     for i in indlist:
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_63view_diploids_metapop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_63view_diploids_metapop = {"view_diploids_metapop", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_63view_diploids_metapop, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_63view_diploids_metapop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_p = 0;
  PyObject *__pyx_v_indlist = 0;
  unsigned int __pyx_v_deme;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_diploids_metapop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_indlist,&__pyx_n_s_deme,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("view_diploids_metapop", 1, 3, 3, 1); __PYX_ERR(3, 388, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_deme)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("view_diploids_metapop", 1, 3, 3, 2); __PYX_ERR(3, 388, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view_diploids_metapop") < 0)) __PYX_ERR(3, 388, __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_p = ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)values[0]);
    __pyx_v_indlist = ((PyObject*)values[1]);
    __pyx_v_deme = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_deme == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(3, 388, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view_diploids_metapop", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 388, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_metapop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MetaPop, 1, "p", 0))) __PYX_ERR(3, 388, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indlist), (&PyList_Type), 1, "indlist", 1))) __PYX_ERR(3, 388, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_62view_diploids_metapop(__pyx_self, __pyx_v_p, __pyx_v_indlist, __pyx_v_deme);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_62view_diploids_metapop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_p, PyObject *__pyx_v_indlist, unsigned int __pyx_v_deme) {
  PyObject *__pyx_v_psizes = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_ps = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  std::vector<unsigned int>  __pyx_t_8;
  __Pyx_RefNannySetupContext("view_diploids_metapop", 0);

  /* "fwdpy/views.pyx":389
 * 
 * def view_diploids_metapop(MetaPop p, list indlist, unsigned deme):
 *     psizes = p.popsizes()             # <<<<<<<<<<<<<<
 *     for i in indlist:
 *         for ps in psizes:
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_5fwdpy_5fwdpy_MetaPop *)__pyx_v_p->__pyx_vtab)->popsizes(__pyx_v_p, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_psizes = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":390
 * def view_diploids_metapop(MetaPop p, list indlist, unsigned deme):
 *     psizes = p.popsizes()
 *     for i in indlist:             # <<<<<<<<<<<<<<
 *         for ps in psizes:
 *             if i >= ps:
 */
  if (unlikely(__pyx_v_indlist == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(3, 390, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_indlist; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(3, 390, __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(3, 390, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":391
 *     psizes = p.popsizes()
 *     for i in indlist:
 *         for ps in psizes:             # <<<<<<<<<<<<<<
 *             if i >= ps:
 *                 raise IndexError("index greater than deme size")
 */
    if (likely(PyList_CheckExact(__pyx_v_psizes)) || PyTuple_CheckExact(__pyx_v_psizes)) {
      __pyx_t_3 = __pyx_v_psizes; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_psizes); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 391, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 391, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(3, 391, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 391, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(3, 391, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 391, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(3, 391, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF_SET(__pyx_v_ps, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "fwdpy/views.pyx":392
 *     for i in indlist:
 *         for ps in psizes:
 *             if i >= ps:             # <<<<<<<<<<<<<<
 *                 raise IndexError("index greater than deme size")
 *     if deme >= len(p.popsizes()):
 */
      __pyx_t_6 = PyObject_RichCompare(__pyx_v_i, __pyx_v_ps, Py_GE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 392, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(3, 392, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_7) {

        /* "fwdpy/views.pyx":393
 *         for ps in psizes:
 *             if i >= ps:
 *                 raise IndexError("index greater than deme size")             # <<<<<<<<<<<<<<
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_diploids: deme index out of range")
 */
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 393, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_ERR(3, 393, __pyx_L1_error)

        /* "fwdpy/views.pyx":392
 *     for i in indlist:
 *         for ps in psizes:
 *             if i >= ps:             # <<<<<<<<<<<<<<
 *                 raise IndexError("index greater than deme size")
 *     if deme >= len(p.popsizes()):
 */
      }

      /* "fwdpy/views.pyx":391
 *     psizes = p.popsizes()
 *     for i in indlist:
 *         for ps in psizes:             # <<<<<<<<<<<<<<
 *             if i >= ps:
 *                 raise IndexError("index greater than deme size")
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":390
 * def view_diploids_metapop(MetaPop p, list indlist, unsigned deme):
 *     psizes = p.popsizes()
 *     for i in indlist:             # <<<<<<<<<<<<<<
 *         for ps in psizes:
 *             if i >= ps:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":394
 *             if i >= ps:
 *                 raise IndexError("index greater than deme size")
 *     if deme >= len(p.popsizes()):             # <<<<<<<<<<<<<<
 *         raise IndexError("view_diploids: deme index out of range")
 *     return view_diploids_details(p.mpop.get().diploids[deme],p.mpop.get().gametes,p.mpop.get().mutations,p.mpop.get().mcounts,indlist)
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_5fwdpy_5fwdpy_MetaPop *)__pyx_v_p->__pyx_vtab)->popsizes(__pyx_v_p, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(3, 394, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = ((__pyx_v_deme >= __pyx_t_2) != 0);
  if (__pyx_t_7) {

    /* "fwdpy/views.pyx":395
 *                 raise IndexError("index greater than deme size")
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_diploids: deme index out of range")             # <<<<<<<<<<<<<<
 *     return view_diploids_details(p.mpop.get().diploids[deme],p.mpop.get().gametes,p.mpop.get().mutations,p.mpop.get().mcounts,indlist)
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 395, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(3, 395, __pyx_L1_error)

    /* "fwdpy/views.pyx":394
 *             if i >= ps:
 *                 raise IndexError("index greater than deme size")
 *     if deme >= len(p.popsizes()):             # <<<<<<<<<<<<<<
 *         raise IndexError("view_diploids: deme index out of range")
 *     return view_diploids_details(p.mpop.get().diploids[deme],p.mpop.get().gametes,p.mpop.get().mutations,p.mpop.get().mcounts,indlist)
 */
  }

  /* "fwdpy/views.pyx":396
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_diploids: deme index out of range")
 *     return view_diploids_details(p.mpop.get().diploids[deme],p.mpop.get().gametes,p.mpop.get().mutations,p.mpop.get().mcounts,indlist)             # <<<<<<<<<<<<<<
 * 
 * def view_diploids(object p, list indlist, deme = None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = __pyx_convert_vector_from_py_unsigned_int(__pyx_v_indlist); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 396, __pyx_L1_error)
  __pyx_t_1 = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_data(__pyx_f_5fwdpy_5fwdpy_view_diploids_details((__pyx_v_p->mpop.get()->diploids[__pyx_v_deme]), __pyx_v_p->mpop.get()->gametes, __pyx_v_p->mpop.get()->mutations, __pyx_v_p->mpop.get()->mcounts, __pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":388
 *     return rv
 * 
 * def view_diploids_metapop(MetaPop p, list indlist, unsigned deme):             # <<<<<<<<<<<<<<
 *     psizes = p.popsizes()
 *     for i in indlist:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_metapop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_psizes);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_ps);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":398
 *     return view_diploids_details(p.mpop.get().diploids[deme],p.mpop.get().gametes,p.mpop.get().mutations,p.mpop.get().mcounts,indlist)
 * 
 * def view_diploids(object p, list indlist, deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Get detailed list of a set of diploids in the population
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_65view_diploids(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_64view_diploids[] = "\n    Get detailed list of a set of diploids in the population\n\n    :param p: a :class:`fwdpy.fwdpy.PopType` or a :class:`fwdpy.fwdpy.PopVec`\n    :param deme: if p is a :class`fwdpy.fwdpy.MetaPop`, deme is the index of the deme to sample\n    \n    :rtype: a list of dictionaries.  See Note.\n\n    Example:\n\n    >>> import fwdpy\n    >>> import numpy as np\n    >>> nregions = [fwdpy.Region(0,1,1),fwdpy.Region(2,3,1)]\n    >>> sregions = [fwdpy.ExpS(1,2,1,-0.1),fwdpy.ExpS(1,2,0.01,0.001)]\n    >>> rregions = [fwdpy.Region(0,3,1)]\n    >>> rng = fwdpy.GSLrng(100)\n    >>> popsizes = np.array([1000],dtype=np.uint32)\n    >>> popsizes=np.tile(popsizes,100)\n    >>> pops = fwdpy.evolve_regions(rng,1,1000,popsizes[0:],0.001,0.0001,0.001,nregions,sregions,rregions)\n    >>> dips = [fwdpy.view_diploids(i,[0,101,201,301]) for i in pops]\n\n    .. note:: :class:`fwdpy.fwdpy.MetaPopVec` currently not supported\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_65view_diploids = {"view_diploids", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_65view_diploids, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_64view_diploids};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_65view_diploids(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_indlist = 0;
  PyObject *__pyx_v_deme = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_diploids (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_indlist,&__pyx_n_s_deme,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("view_diploids", 0, 2, 3, 1); __PYX_ERR(3, 398, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_deme);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view_diploids") < 0)) __PYX_ERR(3, 398, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
    __pyx_v_indlist = ((PyObject*)values[1]);
    __pyx_v_deme = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view_diploids", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 398, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indlist), (&PyList_Type), 1, "indlist", 1))) __PYX_ERR(3, 398, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_64view_diploids(__pyx_self, __pyx_v_p, __pyx_v_indlist, __pyx_v_deme);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_64view_diploids(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_indlist, PyObject *__pyx_v_deme) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("view_diploids", 0);

  /* "fwdpy/views.pyx":422
 *     .. note:: :class:`fwdpy.fwdpy.MetaPopVec` currently not supported
 *     """
 *     if isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return view_diploids_singlepop(p,indlist)
 *     elif isinstance(p,MlocusPop):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_Spop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":423
 *     """
 *     if isinstance(p,Spop):
 *         return view_diploids_singlepop(p,indlist)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MlocusPop):
 *         return view_diploids_singlepop_mloc(p, indlist)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_diploids_singlepop); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 423, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_p, __pyx_v_indlist};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 423, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_p, __pyx_v_indlist};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 423, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_p);
      __Pyx_GIVEREF(__pyx_v_p);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_p);
      __Pyx_INCREF(__pyx_v_indlist);
      __Pyx_GIVEREF(__pyx_v_indlist);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_indlist);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":422
 *     .. note:: :class:`fwdpy.fwdpy.MetaPopVec` currently not supported
 *     """
 *     if isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return view_diploids_singlepop(p,indlist)
 *     elif isinstance(p,MlocusPop):
 */
  }

  /* "fwdpy/views.pyx":424
 *     if isinstance(p,Spop):
 *         return view_diploids_singlepop(p,indlist)
 *     elif isinstance(p,MlocusPop):             # <<<<<<<<<<<<<<
 *         return view_diploids_singlepop_mloc(p, indlist)
 *     elif isinstance(p,MetaPop):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MlocusPop); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/views.pyx":425
 *         return view_diploids_singlepop(p,indlist)
 *     elif isinstance(p,MlocusPop):
 *         return view_diploids_singlepop_mloc(p, indlist)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MetaPop):
 *         if deme is None:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_diploids_singlepop_mloc); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 425, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_p, __pyx_v_indlist};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 425, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_p, __pyx_v_indlist};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 425, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_v_p);
      __Pyx_GIVEREF(__pyx_v_p);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_p);
      __Pyx_INCREF(__pyx_v_indlist);
      __Pyx_GIVEREF(__pyx_v_indlist);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_indlist);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":424
 *     if isinstance(p,Spop):
 *         return view_diploids_singlepop(p,indlist)
 *     elif isinstance(p,MlocusPop):             # <<<<<<<<<<<<<<
 *         return view_diploids_singlepop_mloc(p, indlist)
 *     elif isinstance(p,MetaPop):
 */
  }

  /* "fwdpy/views.pyx":426
 *     elif isinstance(p,MlocusPop):
 *         return view_diploids_singlepop_mloc(p, indlist)
 *     elif isinstance(p,MetaPop):             # <<<<<<<<<<<<<<
 *         if deme is None:
 *             raise RuntimeError("view_diploids: deme index required for metapopulation")
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MetaPop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":427
 *         return view_diploids_singlepop_mloc(p, indlist)
 *     elif isinstance(p,MetaPop):
 *         if deme is None:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("view_diploids: deme index required for metapopulation")
 *         return view_diploids_metapop(p,indlist,deme)
 */
    __pyx_t_2 = (__pyx_v_deme == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "fwdpy/views.pyx":428
 *     elif isinstance(p,MetaPop):
 *         if deme is None:
 *             raise RuntimeError("view_diploids: deme index required for metapopulation")             # <<<<<<<<<<<<<<
 *         return view_diploids_metapop(p,indlist,deme)
 *     elif isinstance(p,SpopVec):
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 428, __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(3, 428, __pyx_L1_error)

      /* "fwdpy/views.pyx":427
 *         return view_diploids_singlepop_mloc(p, indlist)
 *     elif isinstance(p,MetaPop):
 *         if deme is None:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("view_diploids: deme index required for metapopulation")
 *         return view_diploids_metapop(p,indlist,deme)
 */
    }

    /* "fwdpy/views.pyx":429
 *         if deme is None:
 *             raise RuntimeError("view_diploids: deme index required for metapopulation")
 *         return view_diploids_metapop(p,indlist,deme)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,SpopVec):
 *         return view_diploids_popvec(p,indlist)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_diploids_metapop); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 429, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_p, __pyx_v_indlist, __pyx_v_deme};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 429, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_p, __pyx_v_indlist, __pyx_v_deme};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 429, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 429, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_p);
      __Pyx_GIVEREF(__pyx_v_p);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_p);
      __Pyx_INCREF(__pyx_v_indlist);
      __Pyx_GIVEREF(__pyx_v_indlist);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_indlist);
      __Pyx_INCREF(__pyx_v_deme);
      __Pyx_GIVEREF(__pyx_v_deme);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_deme);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 429, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":426
 *     elif isinstance(p,MlocusPop):
 *         return view_diploids_singlepop_mloc(p, indlist)
 *     elif isinstance(p,MetaPop):             # <<<<<<<<<<<<<<
 *         if deme is None:
 *             raise RuntimeError("view_diploids: deme index required for metapopulation")
 */
  }

  /* "fwdpy/views.pyx":430
 *             raise RuntimeError("view_diploids: deme index required for metapopulation")
 *         return view_diploids_metapop(p,indlist,deme)
 *     elif isinstance(p,SpopVec):             # <<<<<<<<<<<<<<
 *         return view_diploids_popvec(p,indlist)
 *     elif isinstance(p,MlocusPopVec):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_SpopVec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":431
 *         return view_diploids_metapop(p,indlist,deme)
 *     elif isinstance(p,SpopVec):
 *         return view_diploids_popvec(p,indlist)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MlocusPopVec):
 *         return view_diploids_popvec_mloc(p,indlist)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_diploids_popvec); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 431, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_p, __pyx_v_indlist};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 431, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_p, __pyx_v_indlist};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 431, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_v_p);
      __Pyx_GIVEREF(__pyx_v_p);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_p);
      __Pyx_INCREF(__pyx_v_indlist);
      __Pyx_GIVEREF(__pyx_v_indlist);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_indlist);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":430
 *             raise RuntimeError("view_diploids: deme index required for metapopulation")
 *         return view_diploids_metapop(p,indlist,deme)
 *     elif isinstance(p,SpopVec):             # <<<<<<<<<<<<<<
 *         return view_diploids_popvec(p,indlist)
 *     elif isinstance(p,MlocusPopVec):
 */
  }

  /* "fwdpy/views.pyx":432
 *     elif isinstance(p,SpopVec):
 *         return view_diploids_popvec(p,indlist)
 *     elif isinstance(p,MlocusPopVec):             # <<<<<<<<<<<<<<
 *         return view_diploids_popvec_mloc(p,indlist)
 *     else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/views.pyx":433
 *         return view_diploids_popvec(p,indlist)
 *     elif isinstance(p,MlocusPopVec):
 *         return view_diploids_popvec_mloc(p,indlist)             # <<<<<<<<<<<<<<
 *     else:
 *         raise RuntimeError("view_diploids: unsupported object type")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_diploids_popvec_mloc); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_p, __pyx_v_indlist};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 433, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_p, __pyx_v_indlist};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 433, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 433, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_p);
      __Pyx_GIVEREF(__pyx_v_p);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_p);
      __Pyx_INCREF(__pyx_v_indlist);
      __Pyx_GIVEREF(__pyx_v_indlist);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_indlist);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 433, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":432
 *     elif isinstance(p,SpopVec):
 *         return view_diploids_popvec(p,indlist)
 *     elif isinstance(p,MlocusPopVec):             # <<<<<<<<<<<<<<
 *         return view_diploids_popvec_mloc(p,indlist)
 *     else:
 */
  }

  /* "fwdpy/views.pyx":435
 *         return view_diploids_popvec_mloc(p,indlist)
 *     else:
 *         raise RuntimeError("view_diploids: unsupported object type")             # <<<<<<<<<<<<<<
 * 
 * cdef diploid_view_to_sample_init_containers(list mutations, map[double,string] * rmap, list info, const size_t ttl_nsam):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 435, __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(3, 435, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":398
 *     return view_diploids_details(p.mpop.get().diploids[deme],p.mpop.get().gametes,p.mpop.get().mutations,p.mpop.get().mcounts,indlist)
 * 
 * def view_diploids(object p, list indlist, deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Get detailed list of a set of diploids in the population
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":437
 *         raise RuntimeError("view_diploids: unsupported object type")
 * 
 * cdef diploid_view_to_sample_init_containers(list mutations, map[double,string] * rmap, list info, const size_t ttl_nsam):             # <<<<<<<<<<<<<<
 *     cdef map[double,string].iterator map_itr
 *     cdef char ancestral = '0'
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_init_containers(PyObject *__pyx_v_mutations, std::map<double,std::string>  *__pyx_v_rmap, PyObject *__pyx_v_info, size_t const __pyx_v_ttl_nsam) {
  std::map<double,std::string> ::iterator __pyx_v_map_itr;
  char __pyx_v_ancestral;
  CYTHON_UNUSED PyObject *__pyx_v_rmap_info = NULL;
  PyObject *__pyx_v_mut = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  double __pyx_t_4;
  int __pyx_t_5;
  std::string __pyx_t_6;
  std::pair<double,std::string>  __pyx_t_7;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("diploid_view_to_sample_init_containers", 0);

  /* "fwdpy/views.pyx":439
 * cdef diploid_view_to_sample_init_containers(list mutations, map[double,string] * rmap, list info, const size_t ttl_nsam):
 *     cdef map[double,string].iterator map_itr
 *     cdef char ancestral = '0'             # <<<<<<<<<<<<<<
 *     rmap_info = []
 *     for mut in mutations:
 */
  __pyx_v_ancestral = '0';

  /* "fwdpy/views.pyx":440
 *     cdef map[double,string].iterator map_itr
 *     cdef char ancestral = '0'
 *     rmap_info = []             # <<<<<<<<<<<<<<
 *     for mut in mutations:
 *         map_itr = rmap.find(mut['pos'])
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rmap_info = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":441
 *     cdef char ancestral = '0'
 *     rmap_info = []
 *     for mut in mutations:             # <<<<<<<<<<<<<<
 *         map_itr = rmap.find(mut['pos'])
 *         if map_itr == rmap.end():
 */
  if (unlikely(__pyx_v_mutations == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(3, 441, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_mutations; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(3, 441, __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(3, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_mut, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":442
 *     rmap_info = []
 *     for mut in mutations:
 *         map_itr = rmap.find(mut['pos'])             # <<<<<<<<<<<<<<
 *         if map_itr == rmap.end():
 *             rmap.insert(pair[double,string](mut['pos'],string(ttl_nsam,ancestral)))
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_mut, __pyx_n_s_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(3, 442, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_map_itr = __pyx_v_rmap->find(__pyx_t_4);

    /* "fwdpy/views.pyx":443
 *     for mut in mutations:
 *         map_itr = rmap.find(mut['pos'])
 *         if map_itr == rmap.end():             # <<<<<<<<<<<<<<
 *             rmap.insert(pair[double,string](mut['pos'],string(ttl_nsam,ancestral)))
 *             info.append(mut)
 */
    __pyx_t_5 = ((__pyx_v_map_itr == __pyx_v_rmap->end()) != 0);
    if (__pyx_t_5) {

      /* "fwdpy/views.pyx":444
 *         map_itr = rmap.find(mut['pos'])
 *         if map_itr == rmap.end():
 *             rmap.insert(pair[double,string](mut['pos'],string(ttl_nsam,ancestral)))             # <<<<<<<<<<<<<<
 *             info.append(mut)
 *     return info
 */
      __pyx_t_3 = PyObject_GetItem(__pyx_v_mut, __pyx_n_s_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(3, 444, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      try {
        __pyx_t_6 = std::string(__pyx_v_ttl_nsam, __pyx_v_ancestral);
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(3, 444, __pyx_L1_error)
      }
      try {
        __pyx_t_7 = std::pair<double,std::string> (__pyx_t_4, __pyx_t_6);
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(3, 444, __pyx_L1_error)
      }
      try {
        __pyx_v_rmap->insert(__pyx_t_7);
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(3, 444, __pyx_L1_error)
      }

      /* "fwdpy/views.pyx":445
 *         if map_itr == rmap.end():
 *             rmap.insert(pair[double,string](mut['pos'],string(ttl_nsam,ancestral)))
 *             info.append(mut)             # <<<<<<<<<<<<<<
 *     return info
 * 
 */
      if (unlikely(__pyx_v_info == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        __PYX_ERR(3, 445, __pyx_L1_error)
      }
      __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_info, __pyx_v_mut); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(3, 445, __pyx_L1_error)

      /* "fwdpy/views.pyx":443
 *     for mut in mutations:
 *         map_itr = rmap.find(mut['pos'])
 *         if map_itr == rmap.end():             # <<<<<<<<<<<<<<
 *             rmap.insert(pair[double,string](mut['pos'],string(ttl_nsam,ancestral)))
 *             info.append(mut)
 */
    }

    /* "fwdpy/views.pyx":441
 *     cdef char ancestral = '0'
 *     rmap_info = []
 *     for mut in mutations:             # <<<<<<<<<<<<<<
 *         map_itr = rmap.find(mut['pos'])
 *         if map_itr == rmap.end():
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":446
 *             rmap.insert(pair[double,string](mut['pos'],string(ttl_nsam,ancestral)))
 *             info.append(mut)
 *     return info             # <<<<<<<<<<<<<<
 * 
 * cdef diploid_view_to_sample_fill_containers_details(list mutations, map[double,string] * data, const unsigned offset):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_info);
  __pyx_r = __pyx_v_info;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":437
 *         raise RuntimeError("view_diploids: unsupported object type")
 * 
 * cdef diploid_view_to_sample_init_containers(list mutations, map[double,string] * rmap, list info, const size_t ttl_nsam):             # <<<<<<<<<<<<<<
 *     cdef map[double,string].iterator map_itr
 *     cdef char ancestral = '0'
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("fwdpy.fwdpy.diploid_view_to_sample_init_containers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rmap_info);
  __Pyx_XDECREF(__pyx_v_mut);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":448
 *     return info
 * 
 * cdef diploid_view_to_sample_fill_containers_details(list mutations, map[double,string] * data, const unsigned offset):             # <<<<<<<<<<<<<<
 *     cdef char derived = '1'
 *     cdef map[double,string].iterator map_itr
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_fill_containers_details(PyObject *__pyx_v_mutations, std::map<double,std::string>  *__pyx_v_data, unsigned int const __pyx_v_offset) {
  char __pyx_v_derived;
  std::map<double,std::string> ::iterator __pyx_v_map_itr;
  PyObject *__pyx_v_mut = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  double __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("diploid_view_to_sample_fill_containers_details", 0);

  /* "fwdpy/views.pyx":449
 * 
 * cdef diploid_view_to_sample_fill_containers_details(list mutations, map[double,string] * data, const unsigned offset):
 *     cdef char derived = '1'             # <<<<<<<<<<<<<<
 *     cdef map[double,string].iterator map_itr
 *     for mut in mutations:
 */
  __pyx_v_derived = '1';

  /* "fwdpy/views.pyx":451
 *     cdef char derived = '1'
 *     cdef map[double,string].iterator map_itr
 *     for mut in mutations:             # <<<<<<<<<<<<<<
 *         map_itr = data.find(mut['pos'])
 *         if map_itr == data.end():
 */
  if (unlikely(__pyx_v_mutations == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(3, 451, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_mutations; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(3, 451, __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(3, 451, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_mut, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":452
 *     cdef map[double,string].iterator map_itr
 *     for mut in mutations:
 *         map_itr = data.find(mut['pos'])             # <<<<<<<<<<<<<<
 *         if map_itr == data.end():
 *             raise RuntimeError("diploid_view_to_sample_fill_containers_details: fatal error due to mutation position not being found")
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_mut, __pyx_n_s_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 452, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(3, 452, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_map_itr = __pyx_v_data->find(__pyx_t_4);

    /* "fwdpy/views.pyx":453
 *     for mut in mutations:
 *         map_itr = data.find(mut['pos'])
 *         if map_itr == data.end():             # <<<<<<<<<<<<<<
 *             raise RuntimeError("diploid_view_to_sample_fill_containers_details: fatal error due to mutation position not being found")
 *         if offset >= deref(map_itr).second.size():
 */
    __pyx_t_5 = ((__pyx_v_map_itr == __pyx_v_data->end()) != 0);
    if (__pyx_t_5) {

      /* "fwdpy/views.pyx":454
 *         map_itr = data.find(mut['pos'])
 *         if map_itr == data.end():
 *             raise RuntimeError("diploid_view_to_sample_fill_containers_details: fatal error due to mutation position not being found")             # <<<<<<<<<<<<<<
 *         if offset >= deref(map_itr).second.size():
 *             raise IndexError("diploid_view_to_sample_fill_containers_details: offset out of range")
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 454, __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(3, 454, __pyx_L1_error)

      /* "fwdpy/views.pyx":453
 *     for mut in mutations:
 *         map_itr = data.find(mut['pos'])
 *         if map_itr == data.end():             # <<<<<<<<<<<<<<
 *             raise RuntimeError("diploid_view_to_sample_fill_containers_details: fatal error due to mutation position not being found")
 *         if offset >= deref(map_itr).second.size():
 */
    }

    /* "fwdpy/views.pyx":455
 *         if map_itr == data.end():
 *             raise RuntimeError("diploid_view_to_sample_fill_containers_details: fatal error due to mutation position not being found")
 *         if offset >= deref(map_itr).second.size():             # <<<<<<<<<<<<<<
 *             raise IndexError("diploid_view_to_sample_fill_containers_details: offset out of range")
 *         deref(map_itr).second[offset]=derived
 */
    __pyx_t_5 = ((__pyx_v_offset >= (*__pyx_v_map_itr).second.size()) != 0);
    if (__pyx_t_5) {

      /* "fwdpy/views.pyx":456
 *             raise RuntimeError("diploid_view_to_sample_fill_containers_details: fatal error due to mutation position not being found")
 *         if offset >= deref(map_itr).second.size():
 *             raise IndexError("diploid_view_to_sample_fill_containers_details: offset out of range")             # <<<<<<<<<<<<<<
 *         deref(map_itr).second[offset]=derived
 * 
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 456, __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(3, 456, __pyx_L1_error)

      /* "fwdpy/views.pyx":455
 *         if map_itr == data.end():
 *             raise RuntimeError("diploid_view_to_sample_fill_containers_details: fatal error due to mutation position not being found")
 *         if offset >= deref(map_itr).second.size():             # <<<<<<<<<<<<<<
 *             raise IndexError("diploid_view_to_sample_fill_containers_details: offset out of range")
 *         deref(map_itr).second[offset]=derived
 */
    }

    /* "fwdpy/views.pyx":457
 *         if offset >= deref(map_itr).second.size():
 *             raise IndexError("diploid_view_to_sample_fill_containers_details: offset out of range")
 *         deref(map_itr).second[offset]=derived             # <<<<<<<<<<<<<<
 * 
 * cdef diploid_view_to_sample_fill_containers(list view, map[double,string] * neutral, map[double,string] * selected):
 */
    ((*__pyx_v_map_itr).second[__pyx_v_offset]) = __pyx_v_derived;

    /* "fwdpy/views.pyx":451
 *     cdef char derived = '1'
 *     cdef map[double,string].iterator map_itr
 *     for mut in mutations:             # <<<<<<<<<<<<<<
 *         map_itr = data.find(mut['pos'])
 *         if map_itr == data.end():
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":448
 *     return info
 * 
 * cdef diploid_view_to_sample_fill_containers_details(list mutations, map[double,string] * data, const unsigned offset):             # <<<<<<<<<<<<<<
 *     cdef char derived = '1'
 *     cdef map[double,string].iterator map_itr
 */

  /* 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_3);
  __Pyx_AddTraceback("fwdpy.fwdpy.diploid_view_to_sample_fill_containers_details", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mut);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":459
 *         deref(map_itr).second[offset]=derived
 * 
 * cdef diploid_view_to_sample_fill_containers(list view, map[double,string] * neutral, map[double,string] * selected):             # <<<<<<<<<<<<<<
 *     cdef unsigned I = 0
 *     cdef size_t ttl_nsam = 2*len(view)
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_fill_containers(PyObject *__pyx_v_view, std::map<double,std::string>  *__pyx_v_neutral, std::map<double,std::string>  *__pyx_v_selected) {
  unsigned int __pyx_v_I;
  CYTHON_UNUSED size_t __pyx_v_ttl_nsam;
  PyObject *__pyx_v_dip = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("diploid_view_to_sample_fill_containers", 0);

  /* "fwdpy/views.pyx":460
 * 
 * cdef diploid_view_to_sample_fill_containers(list view, map[double,string] * neutral, map[double,string] * selected):
 *     cdef unsigned I = 0             # <<<<<<<<<<<<<<
 *     cdef size_t ttl_nsam = 2*len(view)
 *     for dip in view:
 */
  __pyx_v_I = 0;

  /* "fwdpy/views.pyx":461
 * cdef diploid_view_to_sample_fill_containers(list view, map[double,string] * neutral, map[double,string] * selected):
 *     cdef unsigned I = 0
 *     cdef size_t ttl_nsam = 2*len(view)             # <<<<<<<<<<<<<<
 *     for dip in view:
 *         diploid_view_to_sample_fill_containers_details(dip['chrom0']['neutral'],neutral,2*I)
 */
  if (unlikely(__pyx_v_view == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(3, 461, __pyx_L1_error)
  }
  __pyx_t_1 = PyList_GET_SIZE(__pyx_v_view); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 461, __pyx_L1_error)
  __pyx_v_ttl_nsam = (2 * __pyx_t_1);

  /* "fwdpy/views.pyx":462
 *     cdef unsigned I = 0
 *     cdef size_t ttl_nsam = 2*len(view)
 *     for dip in view:             # <<<<<<<<<<<<<<
 *         diploid_view_to_sample_fill_containers_details(dip['chrom0']['neutral'],neutral,2*I)
 *         diploid_view_to_sample_fill_containers_details(dip['chrom1']['neutral'],neutral,2*I+1)
 */
  if (unlikely(__pyx_v_view == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(3, 462, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_view; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 462, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_dip, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":463
 *     cdef size_t ttl_nsam = 2*len(view)
 *     for dip in view:
 *         diploid_view_to_sample_fill_containers_details(dip['chrom0']['neutral'],neutral,2*I)             # <<<<<<<<<<<<<<
 *         diploid_view_to_sample_fill_containers_details(dip['chrom1']['neutral'],neutral,2*I+1)
 *         diploid_view_to_sample_fill_containers_details(dip['chrom0']['selected'],selected,2*I)
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_neutral); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(3, 463, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_fill_containers_details(((PyObject*)__pyx_t_4), __pyx_v_neutral, (2 * __pyx_v_I)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":464
 *     for dip in view:
 *         diploid_view_to_sample_fill_containers_details(dip['chrom0']['neutral'],neutral,2*I)
 *         diploid_view_to_sample_fill_containers_details(dip['chrom1']['neutral'],neutral,2*I+1)             # <<<<<<<<<<<<<<
 *         diploid_view_to_sample_fill_containers_details(dip['chrom0']['selected'],selected,2*I)
 *         diploid_view_to_sample_fill_containers_details(dip['chrom1']['selected'],selected,2*I+1)
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_neutral); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(3, 464, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_fill_containers_details(((PyObject*)__pyx_t_4), __pyx_v_neutral, ((2 * __pyx_v_I) + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":465
 *         diploid_view_to_sample_fill_containers_details(dip['chrom0']['neutral'],neutral,2*I)
 *         diploid_view_to_sample_fill_containers_details(dip['chrom1']['neutral'],neutral,2*I+1)
 *         diploid_view_to_sample_fill_containers_details(dip['chrom0']['selected'],selected,2*I)             # <<<<<<<<<<<<<<
 *         diploid_view_to_sample_fill_containers_details(dip['chrom1']['selected'],selected,2*I+1)
 *         I+=1
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 465, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_selected); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 465, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(3, 465, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_fill_containers_details(((PyObject*)__pyx_t_4), __pyx_v_selected, (2 * __pyx_v_I)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 465, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":466
 *         diploid_view_to_sample_fill_containers_details(dip['chrom1']['neutral'],neutral,2*I+1)
 *         diploid_view_to_sample_fill_containers_details(dip['chrom0']['selected'],selected,2*I)
 *         diploid_view_to_sample_fill_containers_details(dip['chrom1']['selected'],selected,2*I+1)             # <<<<<<<<<<<<<<
 *         I+=1
 *     if <size_t>I != len(view):
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_selected); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(3, 466, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_fill_containers_details(((PyObject*)__pyx_t_4), __pyx_v_selected, ((2 * __pyx_v_I) + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":467
 *         diploid_view_to_sample_fill_containers_details(dip['chrom0']['selected'],selected,2*I)
 *         diploid_view_to_sample_fill_containers_details(dip['chrom1']['selected'],selected,2*I+1)
 *         I+=1             # <<<<<<<<<<<<<<
 *     if <size_t>I != len(view):
 *         raise RuntimeError("diploid_view_to_sample_fill_containers: indexing incorrect")
 */
    __pyx_v_I = (__pyx_v_I + 1);

    /* "fwdpy/views.pyx":462
 *     cdef unsigned I = 0
 *     cdef size_t ttl_nsam = 2*len(view)
 *     for dip in view:             # <<<<<<<<<<<<<<
 *         diploid_view_to_sample_fill_containers_details(dip['chrom0']['neutral'],neutral,2*I)
 *         diploid_view_to_sample_fill_containers_details(dip['chrom1']['neutral'],neutral,2*I+1)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "fwdpy/views.pyx":468
 *         diploid_view_to_sample_fill_containers_details(dip['chrom1']['selected'],selected,2*I+1)
 *         I+=1
 *     if <size_t>I != len(view):             # <<<<<<<<<<<<<<
 *         raise RuntimeError("diploid_view_to_sample_fill_containers: indexing incorrect")
 * 
 */
  if (unlikely(__pyx_v_view == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(3, 468, __pyx_L1_error)
  }
  __pyx_t_1 = PyList_GET_SIZE(__pyx_v_view); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 468, __pyx_L1_error)
  __pyx_t_5 = ((((size_t)__pyx_v_I) != __pyx_t_1) != 0);
  if (__pyx_t_5) {

    /* "fwdpy/views.pyx":469
 *         I+=1
 *     if <size_t>I != len(view):
 *         raise RuntimeError("diploid_view_to_sample_fill_containers: indexing incorrect")             # <<<<<<<<<<<<<<
 * 
 * cdef diploid_mloc_view_to_sample_fill_containers(list view, map[double,string] * neutral, map[double,string] * selected):
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(3, 469, __pyx_L1_error)

    /* "fwdpy/views.pyx":468
 *         diploid_view_to_sample_fill_containers_details(dip['chrom1']['selected'],selected,2*I+1)
 *         I+=1
 *     if <size_t>I != len(view):             # <<<<<<<<<<<<<<
 *         raise RuntimeError("diploid_view_to_sample_fill_containers: indexing incorrect")
 * 
 */
  }

  /* "fwdpy/views.pyx":459
 *         deref(map_itr).second[offset]=derived
 * 
 * cdef diploid_view_to_sample_fill_containers(list view, map[double,string] * neutral, map[double,string] * selected):             # <<<<<<<<<<<<<<
 *     cdef unsigned I = 0
 *     cdef size_t ttl_nsam = 2*len(view)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.diploid_view_to_sample_fill_containers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dip);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":471
 *         raise RuntimeError("diploid_view_to_sample_fill_containers: indexing incorrect")
 * 
 * cdef diploid_mloc_view_to_sample_fill_containers(list view, map[double,string] * neutral, map[double,string] * selected):             # <<<<<<<<<<<<<<
 *     cdef unsigned I = 0
 *     cdef size_t ttl_nsam = 2*len(view)
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_mloc_view_to_sample_fill_containers(PyObject *__pyx_v_view, std::map<double,std::string>  *__pyx_v_neutral, std::map<double,std::string>  *__pyx_v_selected) {
  unsigned int __pyx_v_I;
  CYTHON_UNUSED size_t __pyx_v_ttl_nsam;
  PyObject *__pyx_v_dip = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("diploid_mloc_view_to_sample_fill_containers", 0);

  /* "fwdpy/views.pyx":472
 * 
 * cdef diploid_mloc_view_to_sample_fill_containers(list view, map[double,string] * neutral, map[double,string] * selected):
 *     cdef unsigned I = 0             # <<<<<<<<<<<<<<
 *     cdef size_t ttl_nsam = 2*len(view)
 *     for dip in view:
 */
  __pyx_v_I = 0;

  /* "fwdpy/views.pyx":473
 * cdef diploid_mloc_view_to_sample_fill_containers(list view, map[double,string] * neutral, map[double,string] * selected):
 *     cdef unsigned I = 0
 *     cdef size_t ttl_nsam = 2*len(view)             # <<<<<<<<<<<<<<
 *     for dip in view:
 *         for i in range(len(dip['chrom0'])):
 */
  if (unlikely(__pyx_v_view == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(3, 473, __pyx_L1_error)
  }
  __pyx_t_1 = PyList_GET_SIZE(__pyx_v_view); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 473, __pyx_L1_error)
  __pyx_v_ttl_nsam = (2 * __pyx_t_1);

  /* "fwdpy/views.pyx":474
 *     cdef unsigned I = 0
 *     cdef size_t ttl_nsam = 2*len(view)
 *     for dip in view:             # <<<<<<<<<<<<<<
 *         for i in range(len(dip['chrom0'])):
 *             diploid_view_to_sample_fill_containers_details(dip['chrom0'][i]['neutral'],neutral,2*I)
 */
  if (unlikely(__pyx_v_view == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(3, 474, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_view; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 474, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_dip, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":475
 *     cdef size_t ttl_nsam = 2*len(view)
 *     for dip in view:
 *         for i in range(len(dip['chrom0'])):             # <<<<<<<<<<<<<<
 *             diploid_view_to_sample_fill_containers_details(dip['chrom0'][i]['neutral'],neutral,2*I)
 *             diploid_view_to_sample_fill_containers_details(dip['chrom1'][i]['neutral'],neutral,2*I+1)
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 475, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(3, 475, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "fwdpy/views.pyx":476
 *     for dip in view:
 *         for i in range(len(dip['chrom0'])):
 *             diploid_view_to_sample_fill_containers_details(dip['chrom0'][i]['neutral'],neutral,2*I)             # <<<<<<<<<<<<<<
 *             diploid_view_to_sample_fill_containers_details(dip['chrom1'][i]['neutral'],neutral,2*I+1)
 *             diploid_view_to_sample_fill_containers_details(dip['chrom0'][i]['selected'],selected,2*I)
 */
      __pyx_t_3 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_GetItem(__pyx_t_6, __pyx_n_s_neutral); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(3, 476, __pyx_L1_error)
      __pyx_t_6 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_fill_containers_details(((PyObject*)__pyx_t_3), __pyx_v_neutral, (2 * __pyx_v_I)); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "fwdpy/views.pyx":477
 *         for i in range(len(dip['chrom0'])):
 *             diploid_view_to_sample_fill_containers_details(dip['chrom0'][i]['neutral'],neutral,2*I)
 *             diploid_view_to_sample_fill_containers_details(dip['chrom1'][i]['neutral'],neutral,2*I+1)             # <<<<<<<<<<<<<<
 *             diploid_view_to_sample_fill_containers_details(dip['chrom0'][i]['selected'],selected,2*I)
 *             diploid_view_to_sample_fill_containers_details(dip['chrom1'][i]['selected'],selected,2*I+1)
 */
      __pyx_t_6 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_6, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_neutral); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(PyList_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(3, 477, __pyx_L1_error)
      __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_fill_containers_details(((PyObject*)__pyx_t_6), __pyx_v_neutral, ((2 * __pyx_v_I) + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "fwdpy/views.pyx":478
 *             diploid_view_to_sample_fill_containers_details(dip['chrom0'][i]['neutral'],neutral,2*I)
 *             diploid_view_to_sample_fill_containers_details(dip['chrom1'][i]['neutral'],neutral,2*I+1)
 *             diploid_view_to_sample_fill_containers_details(dip['chrom0'][i]['selected'],selected,2*I)             # <<<<<<<<<<<<<<
 *             diploid_view_to_sample_fill_containers_details(dip['chrom1'][i]['selected'],selected,2*I+1)
 *         I+=1
 */
      __pyx_t_3 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_GetItem(__pyx_t_6, __pyx_n_s_selected); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(3, 478, __pyx_L1_error)
      __pyx_t_6 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_fill_containers_details(((PyObject*)__pyx_t_3), __pyx_v_selected, (2 * __pyx_v_I)); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "fwdpy/views.pyx":479
 *             diploid_view_to_sample_fill_containers_details(dip['chrom1'][i]['neutral'],neutral,2*I+1)
 *             diploid_view_to_sample_fill_containers_details(dip['chrom0'][i]['selected'],selected,2*I)
 *             diploid_view_to_sample_fill_containers_details(dip['chrom1'][i]['selected'],selected,2*I+1)             # <<<<<<<<<<<<<<
 *         I+=1
 *     if <size_t>I != len(view):
 */
      __pyx_t_6 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_6, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_n_s_selected); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(PyList_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(3, 479, __pyx_L1_error)
      __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_fill_containers_details(((PyObject*)__pyx_t_6), __pyx_v_selected, ((2 * __pyx_v_I) + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }

    /* "fwdpy/views.pyx":480
 *             diploid_view_to_sample_fill_containers_details(dip['chrom0'][i]['selected'],selected,2*I)
 *             diploid_view_to_sample_fill_containers_details(dip['chrom1'][i]['selected'],selected,2*I+1)
 *         I+=1             # <<<<<<<<<<<<<<
 *     if <size_t>I != len(view):
 *         raise RuntimeError("diploid_mloc_view_to_sample_fill_containers: indexing incorrect")
 */
    __pyx_v_I = (__pyx_v_I + 1);

    /* "fwdpy/views.pyx":474
 *     cdef unsigned I = 0
 *     cdef size_t ttl_nsam = 2*len(view)
 *     for dip in view:             # <<<<<<<<<<<<<<
 *         for i in range(len(dip['chrom0'])):
 *             diploid_view_to_sample_fill_containers_details(dip['chrom0'][i]['neutral'],neutral,2*I)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "fwdpy/views.pyx":481
 *             diploid_view_to_sample_fill_containers_details(dip['chrom1'][i]['selected'],selected,2*I+1)
 *         I+=1
 *     if <size_t>I != len(view):             # <<<<<<<<<<<<<<
 *         raise RuntimeError("diploid_mloc_view_to_sample_fill_containers: indexing incorrect")
 * 
 */
  if (unlikely(__pyx_v_view == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(3, 481, __pyx_L1_error)
  }
  __pyx_t_1 = PyList_GET_SIZE(__pyx_v_view); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 481, __pyx_L1_error)
  __pyx_t_7 = ((((size_t)__pyx_v_I) != __pyx_t_1) != 0);
  if (__pyx_t_7) {

    /* "fwdpy/views.pyx":482
 *         I+=1
 *     if <size_t>I != len(view):
 *         raise RuntimeError("diploid_mloc_view_to_sample_fill_containers: indexing incorrect")             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(3, 482, __pyx_L1_error)

    /* "fwdpy/views.pyx":481
 *             diploid_view_to_sample_fill_containers_details(dip['chrom1'][i]['selected'],selected,2*I+1)
 *         I+=1
 *     if <size_t>I != len(view):             # <<<<<<<<<<<<<<
 *         raise RuntimeError("diploid_mloc_view_to_sample_fill_containers: indexing incorrect")
 * 
 */
  }

  /* "fwdpy/views.pyx":471
 *         raise RuntimeError("diploid_view_to_sample_fill_containers: indexing incorrect")
 * 
 * cdef diploid_mloc_view_to_sample_fill_containers(list view, map[double,string] * neutral, map[double,string] * selected):             # <<<<<<<<<<<<<<
 *     cdef unsigned I = 0
 *     cdef size_t ttl_nsam = 2*len(view)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("fwdpy.fwdpy.diploid_mloc_view_to_sample_fill_containers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dip);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":490
 * 
 * #This doesn't appear to actually move, but it is cool that it compiles!
 * cdef copy_map(map[double,string] & m, vector[pair[double,string]] & v):             # <<<<<<<<<<<<<<
 *     move[map[double,string].iterator,back_insert_itr](m.begin(),m.end(),back_inserter[fwdpy_sample_t](v))
 * 
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_copy_map(std::map<double,std::string>  &__pyx_v_m, std::vector<std::pair<double,std::string> >  &__pyx_v_v) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_map", 0);

  /* "fwdpy/views.pyx":491
 * #This doesn't appear to actually move, but it is cool that it compiles!
 * cdef copy_map(map[double,string] & m, vector[pair[double,string]] & v):
 *     move[map[double,string].iterator,back_insert_itr](m.begin(),m.end(),back_inserter[fwdpy_sample_t](v))             # <<<<<<<<<<<<<<
 * 
 * def diploid_view_to_sample(list view):
 */
  std::move<std::map<double,std::string> ::iterator,__pyx_t_5fwdpy_5fwdpy_back_insert_itr>(__pyx_v_m.begin(), __pyx_v_m.end(), std::back_inserter<__pyx_t_5fwdpy_5fwdpy_fwdpy_sample_t>(__pyx_v_v));

  /* "fwdpy/views.pyx":490
 * 
 * #This doesn't appear to actually move, but it is cool that it compiles!
 * cdef copy_map(map[double,string] & m, vector[pair[double,string]] & v):             # <<<<<<<<<<<<<<
 *     move[map[double,string].iterator,back_insert_itr](m.begin(),m.end(),back_inserter[fwdpy_sample_t](v))
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":493
 *     move[map[double,string].iterator,back_insert_itr](m.begin(),m.end(),back_inserter[fwdpy_sample_t](v))
 * 
 * def diploid_view_to_sample(list view):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a "view" of diploids into the data types returned from :func:`fwdpy.fwdpy.get_samples`
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_67diploid_view_to_sample(PyObject *__pyx_self, PyObject *__pyx_v_view); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_66diploid_view_to_sample[] = "\n    Convert a \"view\" of diploids into the data types returned from :func:`fwdpy.fwdpy.get_samples`\n    \n    :param view: An object returned by :func:`fwdpy.fwdpy.view_diploids`\n\n    :return: A dict.  See Note\n\n    :rtype: dict\n\n    .. note:: The return value is a dict containing two lists of tuples ('neutral', and 'selected')  These lists are the same format \n       as objects returned by :func:`fwdpy.fwdpy.get_samples`.  The dict also contains 'neutral_info' and 'selected_info', which are\n       pandas.DataFrame objects with the information about the mutations present in the other two lists.\n\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_67diploid_view_to_sample = {"diploid_view_to_sample", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_67diploid_view_to_sample, METH_O, __pyx_doc_5fwdpy_5fwdpy_66diploid_view_to_sample};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_67diploid_view_to_sample(PyObject *__pyx_self, PyObject *__pyx_v_view) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("diploid_view_to_sample (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_view), (&PyList_Type), 1, "view", 1))) __PYX_ERR(3, 493, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_66diploid_view_to_sample(__pyx_self, ((PyObject*)__pyx_v_view));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_66diploid_view_to_sample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_view) {
  size_t __pyx_v_ttl_nsam;
  std::map<double,std::string>  __pyx_v_neutral;
  std::map<double,std::string>  __pyx_v_selected;
  PyObject *__pyx_v_neutral_info = NULL;
  PyObject *__pyx_v_selected_info = NULL;
  CYTHON_UNUSED char __pyx_v_ancestral;
  CYTHON_UNUSED char __pyx_v_derived;
  PyObject *__pyx_v_dip = NULL;
  size_t __pyx_v_size_;
  std::vector<std::pair<double,std::string> >  __pyx_v_vneutral;
  std::vector<std::pair<double,std::string> >  __pyx_v_vselected;
  PyObject *__pyx_v_neutral_df = NULL;
  PyObject *__pyx_v_selected_df = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("diploid_view_to_sample", 0);

  /* "fwdpy/views.pyx":508
 * 
 *     """
 *     cdef size_t ttl_nsam = 2*len(view)             # <<<<<<<<<<<<<<
 *     if ttl_nsam == 0:
 *         return []
 */
  if (unlikely(__pyx_v_view == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(3, 508, __pyx_L1_error)
  }
  __pyx_t_1 = PyList_GET_SIZE(__pyx_v_view); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 508, __pyx_L1_error)
  __pyx_v_ttl_nsam = (2 * __pyx_t_1);

  /* "fwdpy/views.pyx":509
 *     """
 *     cdef size_t ttl_nsam = 2*len(view)
 *     if ttl_nsam == 0:             # <<<<<<<<<<<<<<
 *         return []
 * 
 */
  __pyx_t_2 = ((__pyx_v_ttl_nsam == 0) != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":510
 *     cdef size_t ttl_nsam = 2*len(view)
 *     if ttl_nsam == 0:
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     cdef map[double,string] neutral
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":509
 *     """
 *     cdef size_t ttl_nsam = 2*len(view)
 *     if ttl_nsam == 0:             # <<<<<<<<<<<<<<
 *         return []
 * 
 */
  }

  /* "fwdpy/views.pyx":515
 *     cdef map[double,string] selected
 *     cdef map[double,string].iterator map_itr
 *     neutral_info = []             # <<<<<<<<<<<<<<
 *     selected_info = []
 *     cdef char ancestral = '0'
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_neutral_info = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":516
 *     cdef map[double,string].iterator map_itr
 *     neutral_info = []
 *     selected_info = []             # <<<<<<<<<<<<<<
 *     cdef char ancestral = '0'
 *     cdef char derived = '0'
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_selected_info = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":517
 *     neutral_info = []
 *     selected_info = []
 *     cdef char ancestral = '0'             # <<<<<<<<<<<<<<
 *     cdef char derived = '0'
 *     for dip in view:
 */
  __pyx_v_ancestral = '0';

  /* "fwdpy/views.pyx":518
 *     selected_info = []
 *     cdef char ancestral = '0'
 *     cdef char derived = '0'             # <<<<<<<<<<<<<<
 *     for dip in view:
 *         neutral_info = diploid_view_to_sample_init_containers(dip['chrom0']['neutral'],&neutral,neutral_info,ttl_nsam)
 */
  __pyx_v_derived = '0';

  /* "fwdpy/views.pyx":519
 *     cdef char ancestral = '0'
 *     cdef char derived = '0'
 *     for dip in view:             # <<<<<<<<<<<<<<
 *         neutral_info = diploid_view_to_sample_init_containers(dip['chrom0']['neutral'],&neutral,neutral_info,ttl_nsam)
 *         neutral_info = diploid_view_to_sample_init_containers(dip['chrom1']['neutral'],&neutral,neutral_info,ttl_nsam)
 */
  if (unlikely(__pyx_v_view == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(3, 519, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_v_view; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 519, __pyx_L1_error)
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_dip, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":520
 *     cdef char derived = '0'
 *     for dip in view:
 *         neutral_info = diploid_view_to_sample_init_containers(dip['chrom0']['neutral'],&neutral,neutral_info,ttl_nsam)             # <<<<<<<<<<<<<<
 *         neutral_info = diploid_view_to_sample_init_containers(dip['chrom1']['neutral'],&neutral,neutral_info,ttl_nsam)
 *         selected_info = diploid_view_to_sample_init_containers(dip['chrom0']['selected'],&selected,selected_info,ttl_nsam)
 */
    __pyx_t_4 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom0); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_neutral); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(3, 520, __pyx_L1_error)
    if (!(likely(PyList_CheckExact(__pyx_v_neutral_info))||((__pyx_v_neutral_info) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_neutral_info)->tp_name), 0))) __PYX_ERR(3, 520, __pyx_L1_error)
    __pyx_t_4 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_init_containers(((PyObject*)__pyx_t_5), (&__pyx_v_neutral), ((PyObject*)__pyx_v_neutral_info), __pyx_v_ttl_nsam); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_neutral_info, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":521
 *     for dip in view:
 *         neutral_info = diploid_view_to_sample_init_containers(dip['chrom0']['neutral'],&neutral,neutral_info,ttl_nsam)
 *         neutral_info = diploid_view_to_sample_init_containers(dip['chrom1']['neutral'],&neutral,neutral_info,ttl_nsam)             # <<<<<<<<<<<<<<
 *         selected_info = diploid_view_to_sample_init_containers(dip['chrom0']['selected'],&selected,selected_info,ttl_nsam)
 *         selected_info = diploid_view_to_sample_init_containers(dip['chrom1']['selected'],&selected,selected_info,ttl_nsam)
 */
    __pyx_t_4 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_neutral); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(3, 521, __pyx_L1_error)
    if (!(likely(PyList_CheckExact(__pyx_v_neutral_info))||((__pyx_v_neutral_info) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_neutral_info)->tp_name), 0))) __PYX_ERR(3, 521, __pyx_L1_error)
    __pyx_t_4 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_init_containers(((PyObject*)__pyx_t_5), (&__pyx_v_neutral), ((PyObject*)__pyx_v_neutral_info), __pyx_v_ttl_nsam); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_neutral_info, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":522
 *         neutral_info = diploid_view_to_sample_init_containers(dip['chrom0']['neutral'],&neutral,neutral_info,ttl_nsam)
 *         neutral_info = diploid_view_to_sample_init_containers(dip['chrom1']['neutral'],&neutral,neutral_info,ttl_nsam)
 *         selected_info = diploid_view_to_sample_init_containers(dip['chrom0']['selected'],&selected,selected_info,ttl_nsam)             # <<<<<<<<<<<<<<
 *         selected_info = diploid_view_to_sample_init_containers(dip['chrom1']['selected'],&selected,selected_info,ttl_nsam)
 *     cdef size_t size_ = len(neutral_info)
 */
    __pyx_t_4 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom0); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_selected); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(3, 522, __pyx_L1_error)
    if (!(likely(PyList_CheckExact(__pyx_v_selected_info))||((__pyx_v_selected_info) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_selected_info)->tp_name), 0))) __PYX_ERR(3, 522, __pyx_L1_error)
    __pyx_t_4 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_init_containers(((PyObject*)__pyx_t_5), (&__pyx_v_selected), ((PyObject*)__pyx_v_selected_info), __pyx_v_ttl_nsam); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_selected_info, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":523
 *         neutral_info = diploid_view_to_sample_init_containers(dip['chrom1']['neutral'],&neutral,neutral_info,ttl_nsam)
 *         selected_info = diploid_view_to_sample_init_containers(dip['chrom0']['selected'],&selected,selected_info,ttl_nsam)
 *         selected_info = diploid_view_to_sample_init_containers(dip['chrom1']['selected'],&selected,selected_info,ttl_nsam)             # <<<<<<<<<<<<<<
 *     cdef size_t size_ = len(neutral_info)
 *     if neutral.size() != size_:
 */
    __pyx_t_4 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_selected); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(3, 523, __pyx_L1_error)
    if (!(likely(PyList_CheckExact(__pyx_v_selected_info))||((__pyx_v_selected_info) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_selected_info)->tp_name), 0))) __PYX_ERR(3, 523, __pyx_L1_error)
    __pyx_t_4 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_init_containers(((PyObject*)__pyx_t_5), (&__pyx_v_selected), ((PyObject*)__pyx_v_selected_info), __pyx_v_ttl_nsam); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_selected_info, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":519
 *     cdef char ancestral = '0'
 *     cdef char derived = '0'
 *     for dip in view:             # <<<<<<<<<<<<<<
 *         neutral_info = diploid_view_to_sample_init_containers(dip['chrom0']['neutral'],&neutral,neutral_info,ttl_nsam)
 *         neutral_info = diploid_view_to_sample_init_containers(dip['chrom1']['neutral'],&neutral,neutral_info,ttl_nsam)
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":524
 *         selected_info = diploid_view_to_sample_init_containers(dip['chrom0']['selected'],&selected,selected_info,ttl_nsam)
 *         selected_info = diploid_view_to_sample_init_containers(dip['chrom1']['selected'],&selected,selected_info,ttl_nsam)
 *     cdef size_t size_ = len(neutral_info)             # <<<<<<<<<<<<<<
 *     if neutral.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_neutral_info); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 524, __pyx_L1_error)
  __pyx_v_size_ = __pyx_t_1;

  /* "fwdpy/views.pyx":525
 *         selected_info = diploid_view_to_sample_init_containers(dip['chrom1']['selected'],&selected,selected_info,ttl_nsam)
 *     cdef size_t size_ = len(neutral_info)
 *     if neutral.size() != size_:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")
 *     size_ = len(selected_info)
 */
  __pyx_t_2 = ((__pyx_v_neutral.size() != __pyx_v_size_) != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":526
 *     cdef size_t size_ = len(neutral_info)
 *     if neutral.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")             # <<<<<<<<<<<<<<
 *     size_ = len(selected_info)
 *     if selected.size() != size_:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 526, __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(3, 526, __pyx_L1_error)

    /* "fwdpy/views.pyx":525
 *         selected_info = diploid_view_to_sample_init_containers(dip['chrom1']['selected'],&selected,selected_info,ttl_nsam)
 *     cdef size_t size_ = len(neutral_info)
 *     if neutral.size() != size_:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")
 *     size_ = len(selected_info)
 */
  }

  /* "fwdpy/views.pyx":527
 *     if neutral.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")
 *     size_ = len(selected_info)             # <<<<<<<<<<<<<<
 *     if selected.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for selected mutations")
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_selected_info); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 527, __pyx_L1_error)
  __pyx_v_size_ = __pyx_t_1;

  /* "fwdpy/views.pyx":528
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")
 *     size_ = len(selected_info)
 *     if selected.size() != size_:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("diploid_view: unequal container sizes for selected mutations")
 *     diploid_view_to_sample_fill_containers(view,&neutral,&selected)
 */
  __pyx_t_2 = ((__pyx_v_selected.size() != __pyx_v_size_) != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":529
 *     size_ = len(selected_info)
 *     if selected.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for selected mutations")             # <<<<<<<<<<<<<<
 *     diploid_view_to_sample_fill_containers(view,&neutral,&selected)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 529, __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(3, 529, __pyx_L1_error)

    /* "fwdpy/views.pyx":528
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")
 *     size_ = len(selected_info)
 *     if selected.size() != size_:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("diploid_view: unequal container sizes for selected mutations")
 *     diploid_view_to_sample_fill_containers(view,&neutral,&selected)
 */
  }

  /* "fwdpy/views.pyx":530
 *     if selected.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for selected mutations")
 *     diploid_view_to_sample_fill_containers(view,&neutral,&selected)             # <<<<<<<<<<<<<<
 * 
 *     ##Now, we convert from maps to vectors.
 */
  __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_fill_containers(__pyx_v_view, (&__pyx_v_neutral), (&__pyx_v_selected)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":536
 *     cdef vector[pair[double,string]] vneutral
 *     cdef vector[pair[double,string]] vselected
 *     copy_map(neutral,vneutral)             # <<<<<<<<<<<<<<
 *     copy_map(selected,vselected)
 * 
 */
  __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_copy_map(__pyx_v_neutral, __pyx_v_vneutral); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":537
 *     cdef vector[pair[double,string]] vselected
 *     copy_map(neutral,vneutral)
 *     copy_map(selected,vselected)             # <<<<<<<<<<<<<<
 * 
 *     neutral_df = pd.DataFrame()
 */
  __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_copy_map(__pyx_v_selected, __pyx_v_vselected); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":539
 *     copy_map(selected,vselected)
 * 
 *     neutral_df = pd.DataFrame()             # <<<<<<<<<<<<<<
 *     if len(neutral_info)>0:
 *         neutral_df = pd.concat([pd.DataFrame(i,index=[0]) for i in neutral_info])
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 539, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 539, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_neutral_df = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":540
 * 
 *     neutral_df = pd.DataFrame()
 *     if len(neutral_info)>0:             # <<<<<<<<<<<<<<
 *         neutral_df = pd.concat([pd.DataFrame(i,index=[0]) for i in neutral_info])
 *         neutral_df['index']=list(range(len(neutral_df.index)))
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_neutral_info); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 540, __pyx_L1_error)
  __pyx_t_2 = ((__pyx_t_1 > 0) != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":541
 *     neutral_df = pd.DataFrame()
 *     if len(neutral_info)>0:
 *         neutral_df = pd.concat([pd.DataFrame(i,index=[0]) for i in neutral_info])             # <<<<<<<<<<<<<<
 *         neutral_df['index']=list(range(len(neutral_df.index)))
 *         neutral_df = neutral_df.set_index('index')
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 541, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_concat); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 541, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 541, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (likely(PyList_CheckExact(__pyx_v_neutral_info)) || PyTuple_CheckExact(__pyx_v_neutral_info)) {
      __pyx_t_6 = __pyx_v_neutral_info; __Pyx_INCREF(__pyx_t_6); __pyx_t_1 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_1 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_neutral_info); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 541, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 541, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 541, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_6, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 541, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 541, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_6, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 541, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_7(__pyx_t_6);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(3, 541, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 541, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 541, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 541, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_i);
      __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 541, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyList_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 541, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_11, 0, __pyx_int_0);
      if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_index, __pyx_t_11) < 0) __PYX_ERR(3, 541, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 541, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_11))) __PYX_ERR(3, 541, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 541, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 541, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __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[2] = {__pyx_t_6, __pyx_t_5};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 541, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 541, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_5);
        __pyx_t_5 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 541, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_neutral_df, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":542
 *     if len(neutral_info)>0:
 *         neutral_df = pd.concat([pd.DataFrame(i,index=[0]) for i in neutral_info])
 *         neutral_df['index']=list(range(len(neutral_df.index)))             # <<<<<<<<<<<<<<
 *         neutral_df = neutral_df.set_index('index')
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_neutral_df, __pyx_n_s_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 542, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_neutral_df, __pyx_n_s_index, __pyx_t_4) < 0)) __PYX_ERR(3, 542, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":543
 *         neutral_df = pd.concat([pd.DataFrame(i,index=[0]) for i in neutral_info])
 *         neutral_df['index']=list(range(len(neutral_df.index)))
 *         neutral_df = neutral_df.set_index('index')             # <<<<<<<<<<<<<<
 * 
 *     selected_df = pd.DataFrame()
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_neutral_df, __pyx_n_s_set_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_neutral_df, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":540
 * 
 *     neutral_df = pd.DataFrame()
 *     if len(neutral_info)>0:             # <<<<<<<<<<<<<<
 *         neutral_df = pd.concat([pd.DataFrame(i,index=[0]) for i in neutral_info])
 *         neutral_df['index']=list(range(len(neutral_df.index)))
 */
  }

  /* "fwdpy/views.pyx":545
 *         neutral_df = neutral_df.set_index('index')
 * 
 *     selected_df = pd.DataFrame()             # <<<<<<<<<<<<<<
 *     if len(selected_info)>0:
 *         selected_df = pd.concat([pd.DataFrame(i,index=[0]) for i in selected_info])
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 545, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 545, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_v_selected_df = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":546
 * 
 *     selected_df = pd.DataFrame()
 *     if len(selected_info)>0:             # <<<<<<<<<<<<<<
 *         selected_df = pd.concat([pd.DataFrame(i,index=[0]) for i in selected_info])
 *         selected_df['index']=list(range(len(selected_df.index)))
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_selected_info); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 546, __pyx_L1_error)
  __pyx_t_2 = ((__pyx_t_1 > 0) != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":547
 *     selected_df = pd.DataFrame()
 *     if len(selected_info)>0:
 *         selected_df = pd.concat([pd.DataFrame(i,index=[0]) for i in selected_info])             # <<<<<<<<<<<<<<
 *         selected_df['index']=list(range(len(selected_df.index)))
 *         selected_df = selected_df.set_index('index')
 */
    __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 547, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_concat); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 547, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyList_New(0); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 547, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (likely(PyList_CheckExact(__pyx_v_selected_info)) || PyTuple_CheckExact(__pyx_v_selected_info)) {
      __pyx_t_5 = __pyx_v_selected_info; __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_1 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_selected_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 547, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 547, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 547, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 547, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        } else {
          if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 547, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 547, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_7(__pyx_t_5);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(3, 547, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 547, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 547, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 547, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_i);
      __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 547, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 547, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_9, 0, __pyx_int_0);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_index, __pyx_t_9) < 0) __PYX_ERR(3, 547, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 547, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_11, (PyObject*)__pyx_t_9))) __PYX_ERR(3, 547, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 547, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_11};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 547, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_11};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 547, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 547, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_11);
        __pyx_t_11 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 547, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_selected_df, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":548
 *     if len(selected_info)>0:
 *         selected_df = pd.concat([pd.DataFrame(i,index=[0]) for i in selected_info])
 *         selected_df['index']=list(range(len(selected_df.index)))             # <<<<<<<<<<<<<<
 *         selected_df = selected_df.set_index('index')
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_df, __pyx_n_s_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 548, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_selected_df, __pyx_n_s_index, __pyx_t_4) < 0)) __PYX_ERR(3, 548, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":549
 *         selected_df = pd.concat([pd.DataFrame(i,index=[0]) for i in selected_info])
 *         selected_df['index']=list(range(len(selected_df.index)))
 *         selected_df = selected_df.set_index('index')             # <<<<<<<<<<<<<<
 * 
 *     return {'neutral':vneutral,'selected':vselected,'neutral_info':neutral_df,'selected_info':selected_df}
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_df, __pyx_n_s_set_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__60, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_selected_df, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":546
 * 
 *     selected_df = pd.DataFrame()
 *     if len(selected_info)>0:             # <<<<<<<<<<<<<<
 *         selected_df = pd.concat([pd.DataFrame(i,index=[0]) for i in selected_info])
 *         selected_df['index']=list(range(len(selected_df.index)))
 */
  }

  /* "fwdpy/views.pyx":551
 *         selected_df = selected_df.set_index('index')
 * 
 *     return {'neutral':vneutral,'selected':vselected,'neutral_info':neutral_df,'selected_info':selected_df}             # <<<<<<<<<<<<<<
 * 
 * def diploid_mloc_view_to_sample(list view):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(__pyx_v_vneutral); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_neutral, __pyx_t_4) < 0) __PYX_ERR(3, 551, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(__pyx_v_vselected); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_selected, __pyx_t_4) < 0) __PYX_ERR(3, 551, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_neutral_info, __pyx_v_neutral_df) < 0) __PYX_ERR(3, 551, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_selected_info, __pyx_v_selected_df) < 0) __PYX_ERR(3, 551, __pyx_L1_error)
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":493
 *     move[map[double,string].iterator,back_insert_itr](m.begin(),m.end(),back_inserter[fwdpy_sample_t](v))
 * 
 * def diploid_view_to_sample(list view):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a "view" of diploids into the data types returned from :func:`fwdpy.fwdpy.get_samples`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("fwdpy.fwdpy.diploid_view_to_sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_neutral_info);
  __Pyx_XDECREF(__pyx_v_selected_info);
  __Pyx_XDECREF(__pyx_v_dip);
  __Pyx_XDECREF(__pyx_v_neutral_df);
  __Pyx_XDECREF(__pyx_v_selected_df);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":553
 *     return {'neutral':vneutral,'selected':vselected,'neutral_info':neutral_df,'selected_info':selected_df}
 * 
 * def diploid_mloc_view_to_sample(list view):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a "view" of diploids into the data types returned from :func:`fwdpy.fwdpy.get_samples`
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_69diploid_mloc_view_to_sample(PyObject *__pyx_self, PyObject *__pyx_v_view); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_68diploid_mloc_view_to_sample[] = "\n    Convert a \"view\" of diploids into the data types returned from :func:`fwdpy.fwdpy.get_samples`\n    \n    :param view: An object returned by :func:`fwdpy.fwdpy.view_diploids` from a multilocus population.\n\n    :return: A dict.  See Note\n\n    :rtype: dict\n\n    .. note:: The return value is a dict containing two lists of tuples ('neutral', and 'selected')  These lists are the same format \n       as objects returned by :func:`fwdpy.fwdpy.get_samples`.  The dict also contains 'neutral_info' and 'selected_info', which are\n       pandas.DataFrame objects with the information about the mutations present in the other two lists.\n\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_69diploid_mloc_view_to_sample = {"diploid_mloc_view_to_sample", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_69diploid_mloc_view_to_sample, METH_O, __pyx_doc_5fwdpy_5fwdpy_68diploid_mloc_view_to_sample};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_69diploid_mloc_view_to_sample(PyObject *__pyx_self, PyObject *__pyx_v_view) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("diploid_mloc_view_to_sample (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_view), (&PyList_Type), 1, "view", 1))) __PYX_ERR(3, 553, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_68diploid_mloc_view_to_sample(__pyx_self, ((PyObject*)__pyx_v_view));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_68diploid_mloc_view_to_sample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_view) {
  size_t __pyx_v_ttl_nsam;
  std::map<double,std::string>  __pyx_v_neutral;
  std::map<double,std::string>  __pyx_v_selected;
  PyObject *__pyx_v_neutral_info = NULL;
  PyObject *__pyx_v_selected_info = NULL;
  CYTHON_UNUSED char __pyx_v_ancestral;
  CYTHON_UNUSED char __pyx_v_derived;
  PyObject *__pyx_v_dip = NULL;
  PyObject *__pyx_v_i = NULL;
  size_t __pyx_v_size_;
  std::vector<std::pair<double,std::string> >  __pyx_v_vneutral;
  std::vector<std::pair<double,std::string> >  __pyx_v_vselected;
  PyObject *__pyx_v_neutral_df = NULL;
  PyObject *__pyx_v_selected_df = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("diploid_mloc_view_to_sample", 0);

  /* "fwdpy/views.pyx":568
 * 
 *     """
 *     cdef size_t ttl_nsam = 2*len(view)             # <<<<<<<<<<<<<<
 *     if ttl_nsam == 0:
 *         return []
 */
  if (unlikely(__pyx_v_view == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(3, 568, __pyx_L1_error)
  }
  __pyx_t_1 = PyList_GET_SIZE(__pyx_v_view); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 568, __pyx_L1_error)
  __pyx_v_ttl_nsam = (2 * __pyx_t_1);

  /* "fwdpy/views.pyx":569
 *     """
 *     cdef size_t ttl_nsam = 2*len(view)
 *     if ttl_nsam == 0:             # <<<<<<<<<<<<<<
 *         return []
 * 
 */
  __pyx_t_2 = ((__pyx_v_ttl_nsam == 0) != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":570
 *     cdef size_t ttl_nsam = 2*len(view)
 *     if ttl_nsam == 0:
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     cdef map[double,string] neutral
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 570, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":569
 *     """
 *     cdef size_t ttl_nsam = 2*len(view)
 *     if ttl_nsam == 0:             # <<<<<<<<<<<<<<
 *         return []
 * 
 */
  }

  /* "fwdpy/views.pyx":575
 *     cdef map[double,string] selected
 *     cdef map[double,string].iterator map_itr
 *     neutral_info = []             # <<<<<<<<<<<<<<
 *     selected_info = []
 *     cdef char ancestral = '0'
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_neutral_info = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":576
 *     cdef map[double,string].iterator map_itr
 *     neutral_info = []
 *     selected_info = []             # <<<<<<<<<<<<<<
 *     cdef char ancestral = '0'
 *     cdef char derived = '0'
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_selected_info = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":577
 *     neutral_info = []
 *     selected_info = []
 *     cdef char ancestral = '0'             # <<<<<<<<<<<<<<
 *     cdef char derived = '0'
 *     for dip in view:
 */
  __pyx_v_ancestral = '0';

  /* "fwdpy/views.pyx":578
 *     selected_info = []
 *     cdef char ancestral = '0'
 *     cdef char derived = '0'             # <<<<<<<<<<<<<<
 *     for dip in view:
 *         for i in range(len(dip['chrom0'])):
 */
  __pyx_v_derived = '0';

  /* "fwdpy/views.pyx":579
 *     cdef char ancestral = '0'
 *     cdef char derived = '0'
 *     for dip in view:             # <<<<<<<<<<<<<<
 *         for i in range(len(dip['chrom0'])):
 *             neutral_info = diploid_view_to_sample_init_containers(dip['chrom0'][i]['neutral'],&neutral,neutral_info,ttl_nsam)
 */
  if (unlikely(__pyx_v_view == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(3, 579, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_v_view; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 579, __pyx_L1_error)
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_dip, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":580
 *     cdef char derived = '0'
 *     for dip in view:
 *         for i in range(len(dip['chrom0'])):             # <<<<<<<<<<<<<<
 *             neutral_info = diploid_view_to_sample_init_containers(dip['chrom0'][i]['neutral'],&neutral,neutral_info,ttl_nsam)
 *             neutral_info = diploid_view_to_sample_init_containers(dip['chrom1'][i]['neutral'],&neutral,neutral_info,ttl_nsam)
 */
    __pyx_t_4 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom0); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(3, 580, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_6 = __pyx_t_4; __Pyx_INCREF(__pyx_t_6); __pyx_t_5 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 580, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 580, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(3, 580, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_6, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 580, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(3, 580, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_6, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 580, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_7(__pyx_t_6);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(3, 580, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "fwdpy/views.pyx":581
 *     for dip in view:
 *         for i in range(len(dip['chrom0'])):
 *             neutral_info = diploid_view_to_sample_init_containers(dip['chrom0'][i]['neutral'],&neutral,neutral_info,ttl_nsam)             # <<<<<<<<<<<<<<
 *             neutral_info = diploid_view_to_sample_init_containers(dip['chrom1'][i]['neutral'],&neutral,neutral_info,ttl_nsam)
 *             selected_info = diploid_view_to_sample_init_containers(dip['chrom0'][i]['selected'],&selected,selected_info,ttl_nsam)
 */
      __pyx_t_4 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom0); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_GetItem(__pyx_t_8, __pyx_n_s_neutral); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(3, 581, __pyx_L1_error)
      if (!(likely(PyList_CheckExact(__pyx_v_neutral_info))||((__pyx_v_neutral_info) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_neutral_info)->tp_name), 0))) __PYX_ERR(3, 581, __pyx_L1_error)
      __pyx_t_8 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_init_containers(((PyObject*)__pyx_t_4), (&__pyx_v_neutral), ((PyObject*)__pyx_v_neutral_info), __pyx_v_ttl_nsam); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_neutral_info, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "fwdpy/views.pyx":582
 *         for i in range(len(dip['chrom0'])):
 *             neutral_info = diploid_view_to_sample_init_containers(dip['chrom0'][i]['neutral'],&neutral,neutral_info,ttl_nsam)
 *             neutral_info = diploid_view_to_sample_init_containers(dip['chrom1'][i]['neutral'],&neutral,neutral_info,ttl_nsam)             # <<<<<<<<<<<<<<
 *             selected_info = diploid_view_to_sample_init_containers(dip['chrom0'][i]['selected'],&selected,selected_info,ttl_nsam)
 *             selected_info = diploid_view_to_sample_init_containers(dip['chrom1'][i]['selected'],&selected,selected_info,ttl_nsam)
 */
      __pyx_t_8 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom1); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = PyObject_GetItem(__pyx_t_8, __pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_neutral); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!(likely(PyList_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_8)->tp_name), 0))) __PYX_ERR(3, 582, __pyx_L1_error)
      if (!(likely(PyList_CheckExact(__pyx_v_neutral_info))||((__pyx_v_neutral_info) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_neutral_info)->tp_name), 0))) __PYX_ERR(3, 582, __pyx_L1_error)
      __pyx_t_4 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_init_containers(((PyObject*)__pyx_t_8), (&__pyx_v_neutral), ((PyObject*)__pyx_v_neutral_info), __pyx_v_ttl_nsam); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_neutral_info, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "fwdpy/views.pyx":583
 *             neutral_info = diploid_view_to_sample_init_containers(dip['chrom0'][i]['neutral'],&neutral,neutral_info,ttl_nsam)
 *             neutral_info = diploid_view_to_sample_init_containers(dip['chrom1'][i]['neutral'],&neutral,neutral_info,ttl_nsam)
 *             selected_info = diploid_view_to_sample_init_containers(dip['chrom0'][i]['selected'],&selected,selected_info,ttl_nsam)             # <<<<<<<<<<<<<<
 *             selected_info = diploid_view_to_sample_init_containers(dip['chrom1'][i]['selected'],&selected,selected_info,ttl_nsam)
 *     cdef size_t size_ = len(neutral_info)
 */
      __pyx_t_4 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom0); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 583, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 583, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_GetItem(__pyx_t_8, __pyx_n_s_selected); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 583, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(3, 583, __pyx_L1_error)
      if (!(likely(PyList_CheckExact(__pyx_v_selected_info))||((__pyx_v_selected_info) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_selected_info)->tp_name), 0))) __PYX_ERR(3, 583, __pyx_L1_error)
      __pyx_t_8 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_init_containers(((PyObject*)__pyx_t_4), (&__pyx_v_selected), ((PyObject*)__pyx_v_selected_info), __pyx_v_ttl_nsam); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 583, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_selected_info, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "fwdpy/views.pyx":584
 *             neutral_info = diploid_view_to_sample_init_containers(dip['chrom1'][i]['neutral'],&neutral,neutral_info,ttl_nsam)
 *             selected_info = diploid_view_to_sample_init_containers(dip['chrom0'][i]['selected'],&selected,selected_info,ttl_nsam)
 *             selected_info = diploid_view_to_sample_init_containers(dip['chrom1'][i]['selected'],&selected,selected_info,ttl_nsam)             # <<<<<<<<<<<<<<
 *     cdef size_t size_ = len(neutral_info)
 *     if neutral.size() != size_:
 */
      __pyx_t_8 = PyObject_GetItem(__pyx_v_dip, __pyx_n_s_chrom1); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = PyObject_GetItem(__pyx_t_8, __pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_selected); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!(likely(PyList_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_8)->tp_name), 0))) __PYX_ERR(3, 584, __pyx_L1_error)
      if (!(likely(PyList_CheckExact(__pyx_v_selected_info))||((__pyx_v_selected_info) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_selected_info)->tp_name), 0))) __PYX_ERR(3, 584, __pyx_L1_error)
      __pyx_t_4 = __pyx_f_5fwdpy_5fwdpy_diploid_view_to_sample_init_containers(((PyObject*)__pyx_t_8), (&__pyx_v_selected), ((PyObject*)__pyx_v_selected_info), __pyx_v_ttl_nsam); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_selected_info, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "fwdpy/views.pyx":580
 *     cdef char derived = '0'
 *     for dip in view:
 *         for i in range(len(dip['chrom0'])):             # <<<<<<<<<<<<<<
 *             neutral_info = diploid_view_to_sample_init_containers(dip['chrom0'][i]['neutral'],&neutral,neutral_info,ttl_nsam)
 *             neutral_info = diploid_view_to_sample_init_containers(dip['chrom1'][i]['neutral'],&neutral,neutral_info,ttl_nsam)
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "fwdpy/views.pyx":579
 *     cdef char ancestral = '0'
 *     cdef char derived = '0'
 *     for dip in view:             # <<<<<<<<<<<<<<
 *         for i in range(len(dip['chrom0'])):
 *             neutral_info = diploid_view_to_sample_init_containers(dip['chrom0'][i]['neutral'],&neutral,neutral_info,ttl_nsam)
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":585
 *             selected_info = diploid_view_to_sample_init_containers(dip['chrom0'][i]['selected'],&selected,selected_info,ttl_nsam)
 *             selected_info = diploid_view_to_sample_init_containers(dip['chrom1'][i]['selected'],&selected,selected_info,ttl_nsam)
 *     cdef size_t size_ = len(neutral_info)             # <<<<<<<<<<<<<<
 *     if neutral.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_neutral_info); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 585, __pyx_L1_error)
  __pyx_v_size_ = __pyx_t_1;

  /* "fwdpy/views.pyx":586
 *             selected_info = diploid_view_to_sample_init_containers(dip['chrom1'][i]['selected'],&selected,selected_info,ttl_nsam)
 *     cdef size_t size_ = len(neutral_info)
 *     if neutral.size() != size_:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")
 *     size_ = len(selected_info)
 */
  __pyx_t_2 = ((__pyx_v_neutral.size() != __pyx_v_size_) != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":587
 *     cdef size_t size_ = len(neutral_info)
 *     if neutral.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")             # <<<<<<<<<<<<<<
 *     size_ = len(selected_info)
 *     if selected.size() != size_:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__61, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 587, __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(3, 587, __pyx_L1_error)

    /* "fwdpy/views.pyx":586
 *             selected_info = diploid_view_to_sample_init_containers(dip['chrom1'][i]['selected'],&selected,selected_info,ttl_nsam)
 *     cdef size_t size_ = len(neutral_info)
 *     if neutral.size() != size_:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")
 *     size_ = len(selected_info)
 */
  }

  /* "fwdpy/views.pyx":588
 *     if neutral.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")
 *     size_ = len(selected_info)             # <<<<<<<<<<<<<<
 *     if selected.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for selected mutations")
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_selected_info); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 588, __pyx_L1_error)
  __pyx_v_size_ = __pyx_t_1;

  /* "fwdpy/views.pyx":589
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")
 *     size_ = len(selected_info)
 *     if selected.size() != size_:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("diploid_view: unequal container sizes for selected mutations")
 *     diploid_mloc_view_to_sample_fill_containers(view,&neutral,&selected)
 */
  __pyx_t_2 = ((__pyx_v_selected.size() != __pyx_v_size_) != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":590
 *     size_ = len(selected_info)
 *     if selected.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for selected mutations")             # <<<<<<<<<<<<<<
 *     diploid_mloc_view_to_sample_fill_containers(view,&neutral,&selected)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__62, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 590, __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(3, 590, __pyx_L1_error)

    /* "fwdpy/views.pyx":589
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")
 *     size_ = len(selected_info)
 *     if selected.size() != size_:             # <<<<<<<<<<<<<<
 *         raise RuntimeError("diploid_view: unequal container sizes for selected mutations")
 *     diploid_mloc_view_to_sample_fill_containers(view,&neutral,&selected)
 */
  }

  /* "fwdpy/views.pyx":591
 *     if selected.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for selected mutations")
 *     diploid_mloc_view_to_sample_fill_containers(view,&neutral,&selected)             # <<<<<<<<<<<<<<
 * 
 *     ##Now, we convert from maps to vectors.
 */
  __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_diploid_mloc_view_to_sample_fill_containers(__pyx_v_view, (&__pyx_v_neutral), (&__pyx_v_selected)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":597
 *     cdef vector[pair[double,string]] vneutral
 *     cdef vector[pair[double,string]] vselected
 *     copy_map(neutral,vneutral)             # <<<<<<<<<<<<<<
 *     copy_map(selected,vselected)
 * 
 */
  __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_copy_map(__pyx_v_neutral, __pyx_v_vneutral); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":598
 *     cdef vector[pair[double,string]] vselected
 *     copy_map(neutral,vneutral)
 *     copy_map(selected,vselected)             # <<<<<<<<<<<<<<
 * 
 *     neutral_df = pd.DataFrame()
 */
  __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_copy_map(__pyx_v_selected, __pyx_v_vselected); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":600
 *     copy_map(selected,vselected)
 * 
 *     neutral_df = pd.DataFrame()             # <<<<<<<<<<<<<<
 *     if len(neutral_info)>0:
 *         neutral_df = pd.concat([pd.DataFrame(i,index=[0]) for i in neutral_info])
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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);
    }
  }
  if (__pyx_t_6) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 600, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 600, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_neutral_df = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":601
 * 
 *     neutral_df = pd.DataFrame()
 *     if len(neutral_info)>0:             # <<<<<<<<<<<<<<
 *         neutral_df = pd.concat([pd.DataFrame(i,index=[0]) for i in neutral_info])
 *         neutral_df['index']=list(range(len(neutral_df.index)))
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_neutral_info); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 601, __pyx_L1_error)
  __pyx_t_2 = ((__pyx_t_1 > 0) != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":602
 *     neutral_df = pd.DataFrame()
 *     if len(neutral_info)>0:
 *         neutral_df = pd.concat([pd.DataFrame(i,index=[0]) for i in neutral_info])             # <<<<<<<<<<<<<<
 *         neutral_df['index']=list(range(len(neutral_df.index)))
 *         neutral_df = neutral_df.set_index('index')
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_concat); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(PyList_CheckExact(__pyx_v_neutral_info)) || PyTuple_CheckExact(__pyx_v_neutral_info)) {
      __pyx_t_8 = __pyx_v_neutral_info; __Pyx_INCREF(__pyx_t_8); __pyx_t_1 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_1 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_neutral_info); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 602, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 602, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_8))) {
          if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_8)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_1); __Pyx_INCREF(__pyx_t_9); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 602, __pyx_L1_error)
          #else
          __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 602, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
        } else {
          if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_1); __Pyx_INCREF(__pyx_t_9); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 602, __pyx_L1_error)
          #else
          __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 602, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          #endif
        }
      } else {
        __pyx_t_9 = __pyx_t_7(__pyx_t_8);
        if (unlikely(!__pyx_t_9)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(3, 602, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_9);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 602, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 602, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 602, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_i);
      __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 602, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = PyList_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(3, 602, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_12, 0, __pyx_int_0);
      if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_index, __pyx_t_12) < 0) __PYX_ERR(3, 602, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(3, 602, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_12))) __PYX_ERR(3, 602, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 602, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_4};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 602, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_4};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 602, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(3, 602, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 602, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_neutral_df, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":603
 *     if len(neutral_info)>0:
 *         neutral_df = pd.concat([pd.DataFrame(i,index=[0]) for i in neutral_info])
 *         neutral_df['index']=list(range(len(neutral_df.index)))             # <<<<<<<<<<<<<<
 *         neutral_df = neutral_df.set_index('index')
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_neutral_df, __pyx_n_s_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 603, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 603, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 603, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 603, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 603, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 603, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_neutral_df, __pyx_n_s_index, __pyx_t_6) < 0)) __PYX_ERR(3, 603, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "fwdpy/views.pyx":604
 *         neutral_df = pd.concat([pd.DataFrame(i,index=[0]) for i in neutral_info])
 *         neutral_df['index']=list(range(len(neutral_df.index)))
 *         neutral_df = neutral_df.set_index('index')             # <<<<<<<<<<<<<<
 * 
 *     selected_df = pd.DataFrame()
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_neutral_df, __pyx_n_s_set_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 604, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__63, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 604, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_neutral_df, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":601
 * 
 *     neutral_df = pd.DataFrame()
 *     if len(neutral_info)>0:             # <<<<<<<<<<<<<<
 *         neutral_df = pd.concat([pd.DataFrame(i,index=[0]) for i in neutral_info])
 *         neutral_df['index']=list(range(len(neutral_df.index)))
 */
  }

  /* "fwdpy/views.pyx":606
 *         neutral_df = neutral_df.set_index('index')
 * 
 *     selected_df = pd.DataFrame()             # <<<<<<<<<<<<<<
 *     if len(selected_info)>0:
 *         selected_df = pd.concat([pd.DataFrame(i,index=[0]) for i in selected_info])
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_12)) __PYX_ERR(3, 606, __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 && unlikely(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);
    }
  }
  if (__pyx_t_6) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 606, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 606, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_v_selected_df = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "fwdpy/views.pyx":607
 * 
 *     selected_df = pd.DataFrame()
 *     if len(selected_info)>0:             # <<<<<<<<<<<<<<
 *         selected_df = pd.concat([pd.DataFrame(i,index=[0]) for i in selected_info])
 *         selected_df['index']=list(range(len(selected_df.index)))
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_selected_info); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 607, __pyx_L1_error)
  __pyx_t_2 = ((__pyx_t_1 > 0) != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":608
 *     selected_df = pd.DataFrame()
 *     if len(selected_info)>0:
 *         selected_df = pd.concat([pd.DataFrame(i,index=[0]) for i in selected_info])             # <<<<<<<<<<<<<<
 *         selected_df['index']=list(range(len(selected_df.index)))
 *         selected_df = selected_df.set_index('index')
 */
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_12)) __PYX_ERR(3, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_concat); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 608, __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(3, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (likely(PyList_CheckExact(__pyx_v_selected_info)) || PyTuple_CheckExact(__pyx_v_selected_info)) {
      __pyx_t_4 = __pyx_v_selected_info; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_selected_info); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 608, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 608, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 608, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(3, 608, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 608, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_7(__pyx_t_4);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(3, 608, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_i);
      __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = PyList_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_10, 0, __pyx_int_0);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_index, __pyx_t_10) < 0) __PYX_ERR(3, 608, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_12, (PyObject*)__pyx_t_10))) __PYX_ERR(3, 608, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 608, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_12};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 608, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_12};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 608, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(3, 608, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_12);
        __pyx_t_12 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 608, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_selected_df, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":609
 *     if len(selected_info)>0:
 *         selected_df = pd.concat([pd.DataFrame(i,index=[0]) for i in selected_info])
 *         selected_df['index']=list(range(len(selected_df.index)))             # <<<<<<<<<<<<<<
 *         selected_df = selected_df.set_index('index')
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_df, __pyx_n_s_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 609, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(3, 609, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 609, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 609, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 609, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 609, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_selected_df, __pyx_n_s_index, __pyx_t_6) < 0)) __PYX_ERR(3, 609, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "fwdpy/views.pyx":610
 *         selected_df = pd.concat([pd.DataFrame(i,index=[0]) for i in selected_info])
 *         selected_df['index']=list(range(len(selected_df.index)))
 *         selected_df = selected_df.set_index('index')             # <<<<<<<<<<<<<<
 * 
 *     return {'neutral':vneutral,'selected':vselected,'neutral_info':neutral_df,'selected_info':selected_df}
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_df, __pyx_n_s_set_index); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__64, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_selected_df, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "fwdpy/views.pyx":607
 * 
 *     selected_df = pd.DataFrame()
 *     if len(selected_info)>0:             # <<<<<<<<<<<<<<
 *         selected_df = pd.concat([pd.DataFrame(i,index=[0]) for i in selected_info])
 *         selected_df['index']=list(range(len(selected_df.index)))
 */
  }

  /* "fwdpy/views.pyx":612
 *         selected_df = selected_df.set_index('index')
 * 
 *     return {'neutral':vneutral,'selected':vselected,'neutral_info':neutral_df,'selected_info':selected_df}             # <<<<<<<<<<<<<<
 * 
 * cdef struct diploid_view_data:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(__pyx_v_vneutral); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_neutral, __pyx_t_6) < 0) __PYX_ERR(3, 612, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(__pyx_v_vselected); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_selected, __pyx_t_6) < 0) __PYX_ERR(3, 612, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_neutral_info, __pyx_v_neutral_df) < 0) __PYX_ERR(3, 612, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_selected_info, __pyx_v_selected_df) < 0) __PYX_ERR(3, 612, __pyx_L1_error)
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":553
 *     return {'neutral':vneutral,'selected':vselected,'neutral_info':neutral_df,'selected_info':selected_df}
 * 
 * def diploid_mloc_view_to_sample(list view):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a "view" of diploids into the data types returned from :func:`fwdpy.fwdpy.get_samples`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("fwdpy.fwdpy.diploid_mloc_view_to_sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_neutral_info);
  __Pyx_XDECREF(__pyx_v_selected_info);
  __Pyx_XDECREF(__pyx_v_dip);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_neutral_df);
  __Pyx_XDECREF(__pyx_v_selected_df);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":618
 *     vector[unsigned] n,g,ind,chrom
 * 
 * cdef void resize_dip_view_data(diploid_view_data & dv, size_t nr) nogil:             # <<<<<<<<<<<<<<
 *     dv.s.resize(nr)
 *     dv.h.resize(nr)
 */

static void __pyx_f_5fwdpy_5fwdpy_resize_dip_view_data(struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data &__pyx_v_dv, size_t __pyx_v_nr) {

  /* "fwdpy/views.pyx":619
 * 
 * cdef void resize_dip_view_data(diploid_view_data & dv, size_t nr) nogil:
 *     dv.s.resize(nr)             # <<<<<<<<<<<<<<
 *     dv.h.resize(nr)
 *     dv.n.resize(nr)
 */
  try {
    __pyx_v_dv.s.resize(__pyx_v_nr);
  } catch(...) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_CppExn2PyErr();
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    __PYX_ERR(3, 619, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":620
 * cdef void resize_dip_view_data(diploid_view_data & dv, size_t nr) nogil:
 *     dv.s.resize(nr)
 *     dv.h.resize(nr)             # <<<<<<<<<<<<<<
 *     dv.n.resize(nr)
 *     dv.g.resize(nr)
 */
  try {
    __pyx_v_dv.h.resize(__pyx_v_nr);
  } catch(...) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_CppExn2PyErr();
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    __PYX_ERR(3, 620, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":621
 *     dv.s.resize(nr)
 *     dv.h.resize(nr)
 *     dv.n.resize(nr)             # <<<<<<<<<<<<<<
 *     dv.g.resize(nr)
 *     dv.ind.resize(nr)
 */
  try {
    __pyx_v_dv.n.resize(__pyx_v_nr);
  } catch(...) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_CppExn2PyErr();
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    __PYX_ERR(3, 621, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":622
 *     dv.h.resize(nr)
 *     dv.n.resize(nr)
 *     dv.g.resize(nr)             # <<<<<<<<<<<<<<
 *     dv.ind.resize(nr)
 *     dv.chrom.resize(nr)
 */
  try {
    __pyx_v_dv.g.resize(__pyx_v_nr);
  } catch(...) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_CppExn2PyErr();
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    __PYX_ERR(3, 622, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":623
 *     dv.n.resize(nr)
 *     dv.g.resize(nr)
 *     dv.ind.resize(nr)             # <<<<<<<<<<<<<<
 *     dv.chrom.resize(nr)
 * 
 */
  try {
    __pyx_v_dv.ind.resize(__pyx_v_nr);
  } catch(...) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_CppExn2PyErr();
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    __PYX_ERR(3, 623, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":624
 *     dv.g.resize(nr)
 *     dv.ind.resize(nr)
 *     dv.chrom.resize(nr)             # <<<<<<<<<<<<<<
 * 
 * cdef size_t fill_dip_view_data(vector[popgen_mut_data].iterator gbeg,
 */
  try {
    __pyx_v_dv.chrom.resize(__pyx_v_nr);
  } catch(...) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_CppExn2PyErr();
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    __PYX_ERR(3, 624, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":618
 *     vector[unsigned] n,g,ind,chrom
 * 
 * cdef void resize_dip_view_data(diploid_view_data & dv, size_t nr) nogil:             # <<<<<<<<<<<<<<
 *     dv.s.resize(nr)
 *     dv.h.resize(nr)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("fwdpy.fwdpy.resize_dip_view_data", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
}

/* "fwdpy/views.pyx":626
 *     dv.chrom.resize(nr)
 * 
 * cdef size_t fill_dip_view_data(vector[popgen_mut_data].iterator gbeg,             # <<<<<<<<<<<<<<
 *                                vector[popgen_mut_data].iterator gend,
 *                                diploid_view_data & rv,
 */

static size_t __pyx_f_5fwdpy_5fwdpy_fill_dip_view_data(std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data> ::iterator __pyx_v_gbeg, std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data> ::iterator __pyx_v_gend, struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data &__pyx_v_rv, size_t const __pyx_v_ROW, size_t const __pyx_v_IND, size_t const __pyx_v_ch) {
  size_t __pyx_v_R;
  size_t __pyx_r;
  int __pyx_t_1;
  double __pyx_t_2;
  unsigned int __pyx_t_3;

  /* "fwdpy/views.pyx":632
 *                                const size_t IND,
 *                                const size_t ch) nogil:
 *    cdef size_t R=ROW             # <<<<<<<<<<<<<<
 *    while gbeg != gend:
 *        rv.s[R] = deref(gbeg).s
 */
  __pyx_v_R = __pyx_v_ROW;

  /* "fwdpy/views.pyx":633
 *                                const size_t ch) nogil:
 *    cdef size_t R=ROW
 *    while gbeg != gend:             # <<<<<<<<<<<<<<
 *        rv.s[R] = deref(gbeg).s
 *        rv.h[R] = deref(gbeg).h
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_gbeg != __pyx_v_gend) != 0);
    if (!__pyx_t_1) break;

    /* "fwdpy/views.pyx":634
 *    cdef size_t R=ROW
 *    while gbeg != gend:
 *        rv.s[R] = deref(gbeg).s             # <<<<<<<<<<<<<<
 *        rv.h[R] = deref(gbeg).h
 *        rv.n[R] = deref(gbeg).n
 */
    __pyx_t_2 = (*__pyx_v_gbeg).s;
    (__pyx_v_rv.s[__pyx_v_R]) = __pyx_t_2;

    /* "fwdpy/views.pyx":635
 *    while gbeg != gend:
 *        rv.s[R] = deref(gbeg).s
 *        rv.h[R] = deref(gbeg).h             # <<<<<<<<<<<<<<
 *        rv.n[R] = deref(gbeg).n
 *        rv.g[R] = deref(gbeg).g
 */
    __pyx_t_2 = (*__pyx_v_gbeg).h;
    (__pyx_v_rv.h[__pyx_v_R]) = __pyx_t_2;

    /* "fwdpy/views.pyx":636
 *        rv.s[R] = deref(gbeg).s
 *        rv.h[R] = deref(gbeg).h
 *        rv.n[R] = deref(gbeg).n             # <<<<<<<<<<<<<<
 *        rv.g[R] = deref(gbeg).g
 *        rv.ind[R]=<unsigned>IND
 */
    __pyx_t_3 = (*__pyx_v_gbeg).n;
    (__pyx_v_rv.n[__pyx_v_R]) = __pyx_t_3;

    /* "fwdpy/views.pyx":637
 *        rv.h[R] = deref(gbeg).h
 *        rv.n[R] = deref(gbeg).n
 *        rv.g[R] = deref(gbeg).g             # <<<<<<<<<<<<<<
 *        rv.ind[R]=<unsigned>IND
 *        rv.chrom[R]=<unsigned>ch
 */
    __pyx_t_3 = (*__pyx_v_gbeg).g;
    (__pyx_v_rv.g[__pyx_v_R]) = __pyx_t_3;

    /* "fwdpy/views.pyx":638
 *        rv.n[R] = deref(gbeg).n
 *        rv.g[R] = deref(gbeg).g
 *        rv.ind[R]=<unsigned>IND             # <<<<<<<<<<<<<<
 *        rv.chrom[R]=<unsigned>ch
 *        R+=1
 */
    (__pyx_v_rv.ind[__pyx_v_R]) = ((unsigned int)__pyx_v_IND);

    /* "fwdpy/views.pyx":639
 *        rv.g[R] = deref(gbeg).g
 *        rv.ind[R]=<unsigned>IND
 *        rv.chrom[R]=<unsigned>ch             # <<<<<<<<<<<<<<
 *        R+=1
 *        inc(gbeg)
 */
    (__pyx_v_rv.chrom[__pyx_v_R]) = ((unsigned int)__pyx_v_ch);

    /* "fwdpy/views.pyx":640
 *        rv.ind[R]=<unsigned>IND
 *        rv.chrom[R]=<unsigned>ch
 *        R+=1             # <<<<<<<<<<<<<<
 *        inc(gbeg)
 *    return R
 */
    __pyx_v_R = (__pyx_v_R + 1);

    /* "fwdpy/views.pyx":641
 *        rv.chrom[R]=<unsigned>ch
 *        R+=1
 *        inc(gbeg)             # <<<<<<<<<<<<<<
 *    return R
 * 
 */
    (__pyx_v_gbeg++);
  }

  /* "fwdpy/views.pyx":642
 *        R+=1
 *        inc(gbeg)
 *    return R             # <<<<<<<<<<<<<<
 * 
 * cdef diploid_view_data view_diploids_pd_details(const singlepop_t * pop,
 */
  __pyx_r = __pyx_v_R;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":626
 *     dv.chrom.resize(nr)
 * 
 * cdef size_t fill_dip_view_data(vector[popgen_mut_data].iterator gbeg,             # <<<<<<<<<<<<<<
 *                                vector[popgen_mut_data].iterator gend,
 *                                diploid_view_data & rv,
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/views.pyx":644
 *    return R
 * 
 * cdef diploid_view_data view_diploids_pd_details(const singlepop_t * pop,             # <<<<<<<<<<<<<<
 *                                                 const vector[unsigned] & indlist,
 *                                                 bint selectedOnly) nogil:
 */

static struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data __pyx_f_5fwdpy_5fwdpy_view_diploids_pd_details(fwdpy::singlepop_t const *__pyx_v_pop, std::vector<unsigned int>  const &__pyx_v_indlist, int __pyx_v_selectedOnly) {
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_data>  __pyx_v_v;
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_data> ::iterator __pyx_v_beg;
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_data> ::iterator __pyx_v_end;
  size_t __pyx_v_nr;
  CYTHON_UNUSED struct __pyx_t_5fwdpy_5fwdpy_diploid_data __pyx_v_dd;
  struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data __pyx_v_rv;
  size_t __pyx_v_ROW;
  size_t __pyx_v_IND;
  struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data __pyx_r;
  int __pyx_t_1;

  /* "fwdpy/views.pyx":647
 *                                                 const vector[unsigned] & indlist,
 *                                                 bint selectedOnly) nogil:
 *     cdef vector[diploid_data] v = view_diploids_details(pop.diploids,             # <<<<<<<<<<<<<<
 *                                                         pop.gametes,
 *                                                         pop.mutations,
 */
  __pyx_v_v = __pyx_f_5fwdpy_5fwdpy_view_diploids_details(__pyx_v_pop->diploids, __pyx_v_pop->gametes, __pyx_v_pop->mutations, __pyx_v_pop->mcounts, __pyx_v_indlist);

  /* "fwdpy/views.pyx":653
 *                                                         indlist)
 *     cdef vector[diploid_data].iterator beg,end
 *     beg = v.begin()             # <<<<<<<<<<<<<<
 *     end = v.end()
 *     cdef size_t nr = 0
 */
  __pyx_v_beg = __pyx_v_v.begin();

  /* "fwdpy/views.pyx":654
 *     cdef vector[diploid_data].iterator beg,end
 *     beg = v.begin()
 *     end = v.end()             # <<<<<<<<<<<<<<
 *     cdef size_t nr = 0
 * 
 */
  __pyx_v_end = __pyx_v_v.end();

  /* "fwdpy/views.pyx":655
 *     beg = v.begin()
 *     end = v.end()
 *     cdef size_t nr = 0             # <<<<<<<<<<<<<<
 * 
 *     #Determine length of vectors that we'll need
 */
  __pyx_v_nr = 0;

  /* "fwdpy/views.pyx":658
 * 
 *     #Determine length of vectors that we'll need
 *     while beg != end:             # <<<<<<<<<<<<<<
 *         dd = deref(beg)
 *         if selectedOnly == False:
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_beg != __pyx_v_end) != 0);
    if (!__pyx_t_1) break;

    /* "fwdpy/views.pyx":659
 *     #Determine length of vectors that we'll need
 *     while beg != end:
 *         dd = deref(beg)             # <<<<<<<<<<<<<<
 *         if selectedOnly == False:
 *             nr += deref(beg).chrom0.neutral.size()
 */
    __pyx_v_dd = (*__pyx_v_beg);

    /* "fwdpy/views.pyx":660
 *     while beg != end:
 *         dd = deref(beg)
 *         if selectedOnly == False:             # <<<<<<<<<<<<<<
 *             nr += deref(beg).chrom0.neutral.size()
 *             nr += deref(beg).chrom1.neutral.size()
 */
    __pyx_t_1 = ((__pyx_v_selectedOnly == 0) != 0);
    if (__pyx_t_1) {

      /* "fwdpy/views.pyx":661
 *         dd = deref(beg)
 *         if selectedOnly == False:
 *             nr += deref(beg).chrom0.neutral.size()             # <<<<<<<<<<<<<<
 *             nr += deref(beg).chrom1.neutral.size()
 *         nr += deref(beg).chrom0.selected.size()
 */
      __pyx_v_nr = (__pyx_v_nr + (*__pyx_v_beg).chrom0.neutral.size());

      /* "fwdpy/views.pyx":662
 *         if selectedOnly == False:
 *             nr += deref(beg).chrom0.neutral.size()
 *             nr += deref(beg).chrom1.neutral.size()             # <<<<<<<<<<<<<<
 *         nr += deref(beg).chrom0.selected.size()
 *         nr += deref(beg).chrom1.selected.size()
 */
      __pyx_v_nr = (__pyx_v_nr + (*__pyx_v_beg).chrom1.neutral.size());

      /* "fwdpy/views.pyx":660
 *     while beg != end:
 *         dd = deref(beg)
 *         if selectedOnly == False:             # <<<<<<<<<<<<<<
 *             nr += deref(beg).chrom0.neutral.size()
 *             nr += deref(beg).chrom1.neutral.size()
 */
    }

    /* "fwdpy/views.pyx":663
 *             nr += deref(beg).chrom0.neutral.size()
 *             nr += deref(beg).chrom1.neutral.size()
 *         nr += deref(beg).chrom0.selected.size()             # <<<<<<<<<<<<<<
 *         nr += deref(beg).chrom1.selected.size()
 *         inc(beg)
 */
    __pyx_v_nr = (__pyx_v_nr + (*__pyx_v_beg).chrom0.selected.size());

    /* "fwdpy/views.pyx":664
 *             nr += deref(beg).chrom1.neutral.size()
 *         nr += deref(beg).chrom0.selected.size()
 *         nr += deref(beg).chrom1.selected.size()             # <<<<<<<<<<<<<<
 *         inc(beg)
 *     #Construct and size return value
 */
    __pyx_v_nr = (__pyx_v_nr + (*__pyx_v_beg).chrom1.selected.size());

    /* "fwdpy/views.pyx":665
 *         nr += deref(beg).chrom0.selected.size()
 *         nr += deref(beg).chrom1.selected.size()
 *         inc(beg)             # <<<<<<<<<<<<<<
 *     #Construct and size return value
 *     cdef diploid_view_data rv
 */
    (__pyx_v_beg++);
  }

  /* "fwdpy/views.pyx":668
 *     #Construct and size return value
 *     cdef diploid_view_data rv
 *     resize_dip_view_data(rv,nr)             # <<<<<<<<<<<<<<
 * 
 *     #Fill the return value
 */
  __pyx_f_5fwdpy_5fwdpy_resize_dip_view_data(__pyx_v_rv, __pyx_v_nr);

  /* "fwdpy/views.pyx":671
 * 
 *     #Fill the return value
 *     beg = v.begin()             # <<<<<<<<<<<<<<
 *     end = v.end()
 *     cdef:
 */
  __pyx_v_beg = __pyx_v_v.begin();

  /* "fwdpy/views.pyx":672
 *     #Fill the return value
 *     beg = v.begin()
 *     end = v.end()             # <<<<<<<<<<<<<<
 *     cdef:
 *         size_t ROW=0
 */
  __pyx_v_end = __pyx_v_v.end();

  /* "fwdpy/views.pyx":674
 *     end = v.end()
 *     cdef:
 *         size_t ROW=0             # <<<<<<<<<<<<<<
 *         size_t IND=0
 *     while beg != end:
 */
  __pyx_v_ROW = 0;

  /* "fwdpy/views.pyx":675
 *     cdef:
 *         size_t ROW=0
 *         size_t IND=0             # <<<<<<<<<<<<<<
 *     while beg != end:
 *         if selectedOnly == False:
 */
  __pyx_v_IND = 0;

  /* "fwdpy/views.pyx":676
 *         size_t ROW=0
 *         size_t IND=0
 *     while beg != end:             # <<<<<<<<<<<<<<
 *         if selectedOnly == False:
 *             ROW=fill_dip_view_data(deref(beg).chrom0.neutral.begin(),deref(beg).chrom0.neutral.end(),rv,ROW,IND,0)
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_beg != __pyx_v_end) != 0);
    if (!__pyx_t_1) break;

    /* "fwdpy/views.pyx":677
 *         size_t IND=0
 *     while beg != end:
 *         if selectedOnly == False:             # <<<<<<<<<<<<<<
 *             ROW=fill_dip_view_data(deref(beg).chrom0.neutral.begin(),deref(beg).chrom0.neutral.end(),rv,ROW,IND,0)
 *             ROW=fill_dip_view_data(deref(beg).chrom1.neutral.begin(),deref(beg).chrom1.neutral.end(),rv,ROW,IND,1)
 */
    __pyx_t_1 = ((__pyx_v_selectedOnly == 0) != 0);
    if (__pyx_t_1) {

      /* "fwdpy/views.pyx":678
 *     while beg != end:
 *         if selectedOnly == False:
 *             ROW=fill_dip_view_data(deref(beg).chrom0.neutral.begin(),deref(beg).chrom0.neutral.end(),rv,ROW,IND,0)             # <<<<<<<<<<<<<<
 *             ROW=fill_dip_view_data(deref(beg).chrom1.neutral.begin(),deref(beg).chrom1.neutral.end(),rv,ROW,IND,1)
 *         ROW=fill_dip_view_data(deref(beg).chrom0.selected.begin(),deref(beg).chrom0.selected.end(),rv,ROW,IND,0)
 */
      __pyx_v_ROW = __pyx_f_5fwdpy_5fwdpy_fill_dip_view_data((*__pyx_v_beg).chrom0.neutral.begin(), (*__pyx_v_beg).chrom0.neutral.end(), __pyx_v_rv, __pyx_v_ROW, __pyx_v_IND, 0);

      /* "fwdpy/views.pyx":679
 *         if selectedOnly == False:
 *             ROW=fill_dip_view_data(deref(beg).chrom0.neutral.begin(),deref(beg).chrom0.neutral.end(),rv,ROW,IND,0)
 *             ROW=fill_dip_view_data(deref(beg).chrom1.neutral.begin(),deref(beg).chrom1.neutral.end(),rv,ROW,IND,1)             # <<<<<<<<<<<<<<
 *         ROW=fill_dip_view_data(deref(beg).chrom0.selected.begin(),deref(beg).chrom0.selected.end(),rv,ROW,IND,0)
 *         ROW=fill_dip_view_data(deref(beg).chrom1.selected.begin(),deref(beg).chrom1.selected.end(),rv,ROW,IND,1)
 */
      __pyx_v_ROW = __pyx_f_5fwdpy_5fwdpy_fill_dip_view_data((*__pyx_v_beg).chrom1.neutral.begin(), (*__pyx_v_beg).chrom1.neutral.end(), __pyx_v_rv, __pyx_v_ROW, __pyx_v_IND, 1);

      /* "fwdpy/views.pyx":677
 *         size_t IND=0
 *     while beg != end:
 *         if selectedOnly == False:             # <<<<<<<<<<<<<<
 *             ROW=fill_dip_view_data(deref(beg).chrom0.neutral.begin(),deref(beg).chrom0.neutral.end(),rv,ROW,IND,0)
 *             ROW=fill_dip_view_data(deref(beg).chrom1.neutral.begin(),deref(beg).chrom1.neutral.end(),rv,ROW,IND,1)
 */
    }

    /* "fwdpy/views.pyx":680
 *             ROW=fill_dip_view_data(deref(beg).chrom0.neutral.begin(),deref(beg).chrom0.neutral.end(),rv,ROW,IND,0)
 *             ROW=fill_dip_view_data(deref(beg).chrom1.neutral.begin(),deref(beg).chrom1.neutral.end(),rv,ROW,IND,1)
 *         ROW=fill_dip_view_data(deref(beg).chrom0.selected.begin(),deref(beg).chrom0.selected.end(),rv,ROW,IND,0)             # <<<<<<<<<<<<<<
 *         ROW=fill_dip_view_data(deref(beg).chrom1.selected.begin(),deref(beg).chrom1.selected.end(),rv,ROW,IND,1)
 *         IND+=1
 */
    __pyx_v_ROW = __pyx_f_5fwdpy_5fwdpy_fill_dip_view_data((*__pyx_v_beg).chrom0.selected.begin(), (*__pyx_v_beg).chrom0.selected.end(), __pyx_v_rv, __pyx_v_ROW, __pyx_v_IND, 0);

    /* "fwdpy/views.pyx":681
 *             ROW=fill_dip_view_data(deref(beg).chrom1.neutral.begin(),deref(beg).chrom1.neutral.end(),rv,ROW,IND,1)
 *         ROW=fill_dip_view_data(deref(beg).chrom0.selected.begin(),deref(beg).chrom0.selected.end(),rv,ROW,IND,0)
 *         ROW=fill_dip_view_data(deref(beg).chrom1.selected.begin(),deref(beg).chrom1.selected.end(),rv,ROW,IND,1)             # <<<<<<<<<<<<<<
 *         IND+=1
 *         inc(beg)
 */
    __pyx_v_ROW = __pyx_f_5fwdpy_5fwdpy_fill_dip_view_data((*__pyx_v_beg).chrom1.selected.begin(), (*__pyx_v_beg).chrom1.selected.end(), __pyx_v_rv, __pyx_v_ROW, __pyx_v_IND, 1);

    /* "fwdpy/views.pyx":682
 *         ROW=fill_dip_view_data(deref(beg).chrom0.selected.begin(),deref(beg).chrom0.selected.end(),rv,ROW,IND,0)
 *         ROW=fill_dip_view_data(deref(beg).chrom1.selected.begin(),deref(beg).chrom1.selected.end(),rv,ROW,IND,1)
 *         IND+=1             # <<<<<<<<<<<<<<
 *         inc(beg)
 * 
 */
    __pyx_v_IND = (__pyx_v_IND + 1);

    /* "fwdpy/views.pyx":683
 *         ROW=fill_dip_view_data(deref(beg).chrom1.selected.begin(),deref(beg).chrom1.selected.end(),rv,ROW,IND,1)
 *         IND+=1
 *         inc(beg)             # <<<<<<<<<<<<<<
 * 
 * def view_diploids_pd_popvec(SpopVec p,
 */
    (__pyx_v_beg++);
  }

  /* "fwdpy/views.pyx":644
 *    return R
 * 
 * cdef diploid_view_data view_diploids_pd_details(const singlepop_t * pop,             # <<<<<<<<<<<<<<
 *                                                 const vector[unsigned] & indlist,
 *                                                 bint selectedOnly) nogil:
 */

  /* function exit code */
  return __pyx_r;
}

/* "fwdpy/views.pyx":685
 *         inc(beg)
 * 
 * def view_diploids_pd_popvec(SpopVec p,             # <<<<<<<<<<<<<<
 *                             vector[unsigned] & indlist,
 *                             bint selectedOnly):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_71view_diploids_pd_popvec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_71view_diploids_pd_popvec = {"view_diploids_pd_popvec", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_71view_diploids_pd_popvec, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_71view_diploids_pd_popvec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p = 0;
  std::vector<unsigned int>  __pyx_v_indlist;
  int __pyx_v_selectedOnly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_diploids_pd_popvec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_indlist,&__pyx_n_s_selectedOnly,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("view_diploids_pd_popvec", 1, 3, 3, 1); __PYX_ERR(3, 685, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_selectedOnly)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("view_diploids_pd_popvec", 1, 3, 3, 2); __PYX_ERR(3, 685, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view_diploids_pd_popvec") < 0)) __PYX_ERR(3, 685, __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_p = ((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)values[0]);
    __pyx_v_indlist = __pyx_convert_vector_from_py_unsigned_int(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 686, __pyx_L3_error)
    __pyx_v_selectedOnly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_selectedOnly == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 687, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view_diploids_pd_popvec", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 685, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_pd_popvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_SpopVec, 1, "p", 0))) __PYX_ERR(3, 685, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_70view_diploids_pd_popvec(__pyx_self, __pyx_v_p, __pyx_v_indlist, __pyx_v_selectedOnly);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_70view_diploids_pd_popvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p, std::vector<unsigned int>  __pyx_v_indlist, int __pyx_v_selectedOnly) {
  size_t __pyx_v_npops;
  int __pyx_v_i;
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data>  __pyx_v_rv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("view_diploids_pd_popvec", 0);

  /* "fwdpy/views.pyx":688
 *                             vector[unsigned] & indlist,
 *                             bint selectedOnly):
 *     cdef size_t npops = p.pops.size()             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef vector[diploid_view_data] rv
 */
  __pyx_v_npops = __pyx_v_p->pops.size();

  /* "fwdpy/views.pyx":691
 *     cdef int i
 *     cdef vector[diploid_view_data] rv
 *     rv.resize(npops)             # <<<<<<<<<<<<<<
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i]=view_diploids_pd_details(p.pops[i].get(),indlist,selectedOnly)
 */
  try {
    __pyx_v_rv.resize(__pyx_v_npops);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(3, 691, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":692
 *     cdef vector[diploid_view_data] rv
 *     rv.resize(npops)
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i]=view_diploids_pd_details(p.pops[i].get(),indlist,selectedOnly)
 *     return rv
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {
        __pyx_t_1 = __pyx_v_npops;
        if (1 == 0) abort();
        {
            __pyx_t_4 = 1;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_3 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static, __pyx_t_4)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_2);

                            /* "fwdpy/views.pyx":693
 *     rv.resize(npops)
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i]=view_diploids_pd_details(p.pops[i].get(),indlist,selectedOnly)             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
                            (__pyx_v_rv[__pyx_v_i]) = __pyx_f_5fwdpy_5fwdpy_view_diploids_pd_details((__pyx_v_p->pops[__pyx_v_i]).get(), __pyx_v_indlist, __pyx_v_selectedOnly);
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "fwdpy/views.pyx":692
 *     cdef vector[diploid_view_data] rv
 *     rv.resize(npops)
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i]=view_diploids_pd_details(p.pops[i].get(),indlist,selectedOnly)
 *     return rv
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "fwdpy/views.pyx":694
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i]=view_diploids_pd_details(p.pops[i].get(),indlist,selectedOnly)
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def view_diploids_pd_singlepop(Spop p,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_view_data(__pyx_v_rv); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":685
 *         inc(beg)
 * 
 * def view_diploids_pd_popvec(SpopVec p,             # <<<<<<<<<<<<<<
 *                             vector[unsigned] & indlist,
 *                             bint selectedOnly):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_pd_popvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":696
 *     return rv
 * 
 * def view_diploids_pd_singlepop(Spop p,             # <<<<<<<<<<<<<<
 *                                vector[unsigned] & indlist,
 *                                bint selectedOnly):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_73view_diploids_pd_singlepop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_73view_diploids_pd_singlepop = {"view_diploids_pd_singlepop", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_73view_diploids_pd_singlepop, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_73view_diploids_pd_singlepop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p = 0;
  std::vector<unsigned int>  __pyx_v_indlist;
  int __pyx_v_selectedOnly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_diploids_pd_singlepop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_indlist,&__pyx_n_s_selectedOnly,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("view_diploids_pd_singlepop", 1, 3, 3, 1); __PYX_ERR(3, 696, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_selectedOnly)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("view_diploids_pd_singlepop", 1, 3, 3, 2); __PYX_ERR(3, 696, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view_diploids_pd_singlepop") < 0)) __PYX_ERR(3, 696, __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_p = ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)values[0]);
    __pyx_v_indlist = __pyx_convert_vector_from_py_unsigned_int(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(3, 697, __pyx_L3_error)
    __pyx_v_selectedOnly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_selectedOnly == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 698, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view_diploids_pd_singlepop", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 696, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_pd_singlepop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_Spop, 1, "p", 0))) __PYX_ERR(3, 696, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_72view_diploids_pd_singlepop(__pyx_self, __pyx_v_p, __pyx_v_indlist, __pyx_v_selectedOnly);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_72view_diploids_pd_singlepop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p, std::vector<unsigned int>  __pyx_v_indlist, int __pyx_v_selectedOnly) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("view_diploids_pd_singlepop", 0);

  /* "fwdpy/views.pyx":699
 *                                vector[unsigned] & indlist,
 *                                bint selectedOnly):
 *     return view_diploids_pd_details(p.pop.get(),indlist,selectedOnly)             # <<<<<<<<<<<<<<
 * 
 * def view_diploids_pd(object p,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_view_data(__pyx_f_5fwdpy_5fwdpy_view_diploids_pd_details(__pyx_v_p->pop.get(), __pyx_v_indlist, __pyx_v_selectedOnly)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":696
 *     return rv
 * 
 * def view_diploids_pd_singlepop(Spop p,             # <<<<<<<<<<<<<<
 *                                vector[unsigned] & indlist,
 *                                bint selectedOnly):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_pd_singlepop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":701
 *     return view_diploids_pd_details(p.pop.get(),indlist,selectedOnly)
 * 
 * def view_diploids_pd(object p,             # <<<<<<<<<<<<<<
 *                      list indlist,
 *                      bint selectedOnly = True):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_75view_diploids_pd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_74view_diploids_pd[] = "\n    Get detailed list of a set of diploids in the population\n\n    :param p: a :class:`fwdpy.fwdpy.PopType` or a :class:`fwdpy.fwdpy.PopVec`\n    :param deme: if p is a :class`fwdpy.fwdpy.MetaPop`, deme is the index of the deme to sample\n    \n    :rtype: pandas.DataFrame or a list of such objects\n\n    .. note:: :class:`fwdpy.fwdpy.MetaPopVec` is not yet supported\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_75view_diploids_pd = {"view_diploids_pd", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_75view_diploids_pd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_74view_diploids_pd};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_75view_diploids_pd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_indlist = 0;
  int __pyx_v_selectedOnly;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_diploids_pd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_indlist,&__pyx_n_s_selectedOnly,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("view_diploids_pd", 0, 2, 3, 1); __PYX_ERR(3, 701, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_selectedOnly);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "view_diploids_pd") < 0)) __PYX_ERR(3, 701, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
    __pyx_v_indlist = ((PyObject*)values[1]);
    if (values[2]) {
      __pyx_v_selectedOnly = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_selectedOnly == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 703, __pyx_L3_error)
    } else {

      /* "fwdpy/views.pyx":703
 * def view_diploids_pd(object p,
 *                      list indlist,
 *                      bint selectedOnly = True):             # <<<<<<<<<<<<<<
 *     """
 *     Get detailed list of a set of diploids in the population
 */
      __pyx_v_selectedOnly = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("view_diploids_pd", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 701, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_pd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indlist), (&PyList_Type), 1, "indlist", 1))) __PYX_ERR(3, 702, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_74view_diploids_pd(__pyx_self, __pyx_v_p, __pyx_v_indlist, __pyx_v_selectedOnly);

  /* "fwdpy/views.pyx":701
 *     return view_diploids_pd_details(p.pop.get(),indlist,selectedOnly)
 * 
 * def view_diploids_pd(object p,             # <<<<<<<<<<<<<<
 *                      list indlist,
 *                      bint selectedOnly = True):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_74view_diploids_pd(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_indlist, int __pyx_v_selectedOnly) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __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;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("view_diploids_pd", 0);

  /* "fwdpy/views.pyx":714
 *     .. note:: :class:`fwdpy.fwdpy.MetaPopVec` is not yet supported
 *     """
 *     if isinstance(p,SpopVec):             # <<<<<<<<<<<<<<
 *         return [pd.DataFrame(i) for i in view_diploids_pd_popvec(p,indlist,selectedOnly)]
 *     elif isinstance(p,Spop):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_SpopVec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":715
 *     """
 *     if isinstance(p,SpopVec):
 *         return [pd.DataFrame(i) for i in view_diploids_pd_popvec(p,indlist,selectedOnly)]             # <<<<<<<<<<<<<<
 *     elif isinstance(p,Spop):
 *         return pd.DataFrame(view_diploids_pd_singlepop(p,indlist,selectedOnly))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_diploids_pd_popvec); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_selectedOnly); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_p, __pyx_v_indlist, __pyx_t_6};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 715, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_p, __pyx_v_indlist, __pyx_t_6};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 715, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 715, __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_INCREF(__pyx_v_p);
      __Pyx_GIVEREF(__pyx_v_p);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_p);
      __Pyx_INCREF(__pyx_v_indlist);
      __Pyx_GIVEREF(__pyx_v_indlist);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_indlist);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 715, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_10 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 715, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(3, 715, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(3, 715, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 715, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(3, 715, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 715, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_11(__pyx_t_5);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(3, 715, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 715, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 715, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      if (!__pyx_t_9) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 715, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_i};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 715, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_4);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_i};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 715, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_4);
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 715, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); __pyx_t_9 = NULL;
          __Pyx_INCREF(__pyx_v_i);
          __Pyx_GIVEREF(__pyx_v_i);
          PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_i);
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 715, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) __PYX_ERR(3, 715, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":714
 *     .. note:: :class:`fwdpy.fwdpy.MetaPopVec` is not yet supported
 *     """
 *     if isinstance(p,SpopVec):             # <<<<<<<<<<<<<<
 *         return [pd.DataFrame(i) for i in view_diploids_pd_popvec(p,indlist,selectedOnly)]
 *     elif isinstance(p,Spop):
 */
  }

  /* "fwdpy/views.pyx":716
 *     if isinstance(p,SpopVec):
 *         return [pd.DataFrame(i) for i in view_diploids_pd_popvec(p,indlist,selectedOnly)]
 *     elif isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return pd.DataFrame(view_diploids_pd_singlepop(p,indlist,selectedOnly))
 * 
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_Spop); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/views.pyx":717
 *         return [pd.DataFrame(i) for i in view_diploids_pd_popvec(p,indlist,selectedOnly)]
 *     elif isinstance(p,Spop):
 *         return pd.DataFrame(view_diploids_pd_singlepop(p,indlist,selectedOnly))             # <<<<<<<<<<<<<<
 * 
 * cdef diploid_traits_singlepop(Spop p):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pd); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_diploids_pd_singlepop); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_selectedOnly); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_v_p, __pyx_v_indlist, __pyx_t_7};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 717, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_v_p, __pyx_v_indlist, __pyx_t_7};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 717, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(3, 717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_INCREF(__pyx_v_p);
      __Pyx_GIVEREF(__pyx_v_p);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_8, __pyx_v_p);
      __Pyx_INCREF(__pyx_v_indlist);
      __Pyx_GIVEREF(__pyx_v_indlist);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_8, __pyx_v_indlist);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_8, __pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 717, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 717, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __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[2] = {__pyx_t_6, __pyx_t_5};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 717, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(3, 717, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_5);
        __pyx_t_5 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 717, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":716
 *     if isinstance(p,SpopVec):
 *         return [pd.DataFrame(i) for i in view_diploids_pd_popvec(p,indlist,selectedOnly)]
 *     elif isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return pd.DataFrame(view_diploids_pd_singlepop(p,indlist,selectedOnly))
 * 
 */
  }

  /* "fwdpy/views.pyx":701
 *     return view_diploids_pd_details(p.pop.get(),indlist,selectedOnly)
 * 
 * def view_diploids_pd(object p,             # <<<<<<<<<<<<<<
 *                      list indlist,
 *                      bint selectedOnly = True):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_diploids_pd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":719
 *         return pd.DataFrame(view_diploids_pd_singlepop(p,indlist,selectedOnly))
 * 
 * cdef diploid_traits_singlepop(Spop p):             # <<<<<<<<<<<<<<
 *     rv=[]
 *     for i in range(p.pop.get().diploids.size()):
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_traits_singlepop(struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p) {
  PyObject *__pyx_v_rv = NULL;
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("diploid_traits_singlepop", 0);

  /* "fwdpy/views.pyx":720
 * 
 * cdef diploid_traits_singlepop(Spop p):
 *     rv=[]             # <<<<<<<<<<<<<<
 *     for i in range(p.pop.get().diploids.size()):
 *         rv.append({'g':p.pop.get().diploids[i].g,
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rv = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":721
 * cdef diploid_traits_singlepop(Spop p):
 *     rv=[]
 *     for i in range(p.pop.get().diploids.size()):             # <<<<<<<<<<<<<<
 *         rv.append({'g':p.pop.get().diploids[i].g,
 *                    'e':p.pop.get().diploids[i].e,
 */
  __pyx_t_2 = __pyx_v_p->pop.get()->diploids.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "fwdpy/views.pyx":722
 *     rv=[]
 *     for i in range(p.pop.get().diploids.size()):
 *         rv.append({'g':p.pop.get().diploids[i].g,             # <<<<<<<<<<<<<<
 *                    'e':p.pop.get().diploids[i].e,
 *                    'w':p.pop.get().diploids[i].w})
 */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 722, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyFloat_FromDouble((__pyx_v_p->pop.get()->diploids[__pyx_v_i]).g); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 722, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_g, __pyx_t_4) < 0) __PYX_ERR(3, 722, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":723
 *     for i in range(p.pop.get().diploids.size()):
 *         rv.append({'g':p.pop.get().diploids[i].g,
 *                    'e':p.pop.get().diploids[i].e,             # <<<<<<<<<<<<<<
 *                    'w':p.pop.get().diploids[i].w})
 * 
 */
    __pyx_t_4 = PyFloat_FromDouble((__pyx_v_p->pop.get()->diploids[__pyx_v_i]).e); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_e, __pyx_t_4) < 0) __PYX_ERR(3, 722, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":724
 *         rv.append({'g':p.pop.get().diploids[i].g,
 *                    'e':p.pop.get().diploids[i].e,
 *                    'w':p.pop.get().diploids[i].w})             # <<<<<<<<<<<<<<
 * 
 *     return rv
 */
    __pyx_t_4 = PyFloat_FromDouble((__pyx_v_p->pop.get()->diploids[__pyx_v_i]).w); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_w, __pyx_t_4) < 0) __PYX_ERR(3, 722, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":722
 *     rv=[]
 *     for i in range(p.pop.get().diploids.size()):
 *         rv.append({'g':p.pop.get().diploids[i].g,             # <<<<<<<<<<<<<<
 *                    'e':p.pop.get().diploids[i].e,
 *                    'w':p.pop.get().diploids[i].w})
 */
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_rv, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(3, 722, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/views.pyx":726
 *                    'w':p.pop.get().diploids[i].w})
 * 
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * cdef diploid_traits_popvec(SpopVec p):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":719
 *         return pd.DataFrame(view_diploids_pd_singlepop(p,indlist,selectedOnly))
 * 
 * cdef diploid_traits_singlepop(Spop p):             # <<<<<<<<<<<<<<
 *     rv=[]
 *     for i in range(p.pop.get().diploids.size()):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.diploid_traits_singlepop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":728
 *     return rv
 * 
 * cdef diploid_traits_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     return [diploid_traits_singlepop(i) for i in p]
 * 
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_traits_popvec(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("diploid_traits_popvec", 0);

  /* "fwdpy/views.pyx":729
 * 
 * cdef diploid_traits_popvec(SpopVec p):
 *     return [diploid_traits_singlepop(i) for i in p]             # <<<<<<<<<<<<<<
 * 
 * cdef diploid_traits_singlepop_mloc(MlocusPop p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(((PyObject *)__pyx_v_p))) || PyTuple_CheckExact(((PyObject *)__pyx_v_p))) {
    __pyx_t_2 = ((PyObject *)__pyx_v_p); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_p)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 729, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 729, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(3, 729, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 729, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(3, 729, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 729, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(3, 729, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
    __pyx_t_5 = 0;
    if (!(likely(((__pyx_v_i) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_i, __pyx_ptype_5fwdpy_5fwdpy_Spop))))) __PYX_ERR(3, 729, __pyx_L1_error)
    __pyx_t_5 = __pyx_f_5fwdpy_5fwdpy_diploid_traits_singlepop(((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_i)); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 729, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(3, 729, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":728
 *     return rv
 * 
 * cdef diploid_traits_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     return [diploid_traits_singlepop(i) for i in p]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.diploid_traits_popvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":731
 *     return [diploid_traits_singlepop(i) for i in p]
 * 
 * cdef diploid_traits_singlepop_mloc(MlocusPop p):             # <<<<<<<<<<<<<<
 *     rv=[]
 *     for i in range(p.pop.get().diploids.size()):
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_traits_singlepop_mloc(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *__pyx_v_p) {
  PyObject *__pyx_v_rv = NULL;
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("diploid_traits_singlepop_mloc", 0);

  /* "fwdpy/views.pyx":732
 * 
 * cdef diploid_traits_singlepop_mloc(MlocusPop p):
 *     rv=[]             # <<<<<<<<<<<<<<
 *     for i in range(p.pop.get().diploids.size()):
 *         rv.append({'g':p.pop.get().diploids[i][0].g,
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rv = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":733
 * cdef diploid_traits_singlepop_mloc(MlocusPop p):
 *     rv=[]
 *     for i in range(p.pop.get().diploids.size()):             # <<<<<<<<<<<<<<
 *         rv.append({'g':p.pop.get().diploids[i][0].g,
 *                    'e':p.pop.get().diploids[i][0].e,
 */
  __pyx_t_2 = __pyx_v_p->pop.get()->diploids.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "fwdpy/views.pyx":734
 *     rv=[]
 *     for i in range(p.pop.get().diploids.size()):
 *         rv.append({'g':p.pop.get().diploids[i][0].g,             # <<<<<<<<<<<<<<
 *                    'e':p.pop.get().diploids[i][0].e,
 *                    'w':p.pop.get().diploids[i][0].w})
 */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 734, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_p->pop.get()->diploids[__pyx_v_i])[0]).g); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 734, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_g, __pyx_t_4) < 0) __PYX_ERR(3, 734, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":735
 *     for i in range(p.pop.get().diploids.size()):
 *         rv.append({'g':p.pop.get().diploids[i][0].g,
 *                    'e':p.pop.get().diploids[i][0].e,             # <<<<<<<<<<<<<<
 *                    'w':p.pop.get().diploids[i][0].w})
 * 
 */
    __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_p->pop.get()->diploids[__pyx_v_i])[0]).e); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 735, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_e, __pyx_t_4) < 0) __PYX_ERR(3, 734, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":736
 *         rv.append({'g':p.pop.get().diploids[i][0].g,
 *                    'e':p.pop.get().diploids[i][0].e,
 *                    'w':p.pop.get().diploids[i][0].w})             # <<<<<<<<<<<<<<
 * 
 *     return rv
 */
    __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_p->pop.get()->diploids[__pyx_v_i])[0]).w); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 736, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_w, __pyx_t_4) < 0) __PYX_ERR(3, 734, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "fwdpy/views.pyx":734
 *     rv=[]
 *     for i in range(p.pop.get().diploids.size()):
 *         rv.append({'g':p.pop.get().diploids[i][0].g,             # <<<<<<<<<<<<<<
 *                    'e':p.pop.get().diploids[i][0].e,
 *                    'w':p.pop.get().diploids[i][0].w})
 */
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_rv, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(3, 734, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/views.pyx":738
 *                    'w':p.pop.get().diploids[i][0].w})
 * 
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * cdef diploid_traits_popvec_mloc(MlocusPopVec p):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":731
 *     return [diploid_traits_singlepop(i) for i in p]
 * 
 * cdef diploid_traits_singlepop_mloc(MlocusPop p):             # <<<<<<<<<<<<<<
 *     rv=[]
 *     for i in range(p.pop.get().diploids.size()):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.diploid_traits_singlepop_mloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":740
 *     return rv
 * 
 * cdef diploid_traits_popvec_mloc(MlocusPopVec p):             # <<<<<<<<<<<<<<
 *     return [diploid_traits_singlepop_mloc(i) for i in p]
 * 
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_traits_popvec_mloc(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("diploid_traits_popvec_mloc", 0);

  /* "fwdpy/views.pyx":741
 * 
 * cdef diploid_traits_popvec_mloc(MlocusPopVec p):
 *     return [diploid_traits_singlepop_mloc(i) for i in p]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(((PyObject *)__pyx_v_p))) || PyTuple_CheckExact(((PyObject *)__pyx_v_p))) {
    __pyx_t_2 = ((PyObject *)__pyx_v_p); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_p)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 741, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 741, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(3, 741, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 741, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(3, 741, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 741, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(3, 741, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
    __pyx_t_5 = 0;
    if (!(likely(((__pyx_v_i) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_i, __pyx_ptype_5fwdpy_5fwdpy_MlocusPop))))) __PYX_ERR(3, 741, __pyx_L1_error)
    __pyx_t_5 = __pyx_f_5fwdpy_5fwdpy_diploid_traits_singlepop_mloc(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_i)); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 741, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(3, 741, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":740
 *     return rv
 * 
 * cdef diploid_traits_popvec_mloc(MlocusPopVec p):             # <<<<<<<<<<<<<<
 *     return [diploid_traits_singlepop_mloc(i) for i in p]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.diploid_traits_popvec_mloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":744
 * 
 * 
 * cdef diploid_traits_mpop(MetaPop m, deme):             # <<<<<<<<<<<<<<
 *     if deme > m.mpop.get().diploids.size():
 *         raise RuntimeError("deme value out of range")
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_traits_mpop(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_m, PyObject *__pyx_v_deme) {
  PyObject *__pyx_v_rv = NULL;
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  size_t __pyx_t_4;
  size_t __pyx_t_5;
  size_t __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("diploid_traits_mpop", 0);

  /* "fwdpy/views.pyx":745
 * 
 * cdef diploid_traits_mpop(MetaPop m, deme):
 *     if deme > m.mpop.get().diploids.size():             # <<<<<<<<<<<<<<
 *         raise RuntimeError("deme value out of range")
 *     rv=[]
 */
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_m->mpop.get()->diploids.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_deme, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 745, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(3, 745, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "fwdpy/views.pyx":746
 * cdef diploid_traits_mpop(MetaPop m, deme):
 *     if deme > m.mpop.get().diploids.size():
 *         raise RuntimeError("deme value out of range")             # <<<<<<<<<<<<<<
 *     rv=[]
 *     for i in range(m.mpop.get().diploids[deme].size()):
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__65, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(3, 746, __pyx_L1_error)

    /* "fwdpy/views.pyx":745
 * 
 * cdef diploid_traits_mpop(MetaPop m, deme):
 *     if deme > m.mpop.get().diploids.size():             # <<<<<<<<<<<<<<
 *         raise RuntimeError("deme value out of range")
 *     rv=[]
 */
  }

  /* "fwdpy/views.pyx":747
 *     if deme > m.mpop.get().diploids.size():
 *         raise RuntimeError("deme value out of range")
 *     rv=[]             # <<<<<<<<<<<<<<
 *     for i in range(m.mpop.get().diploids[deme].size()):
 *         rv.append({'g':m.mpop.get().diploids[deme][i].g,
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_rv = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "fwdpy/views.pyx":748
 *         raise RuntimeError("deme value out of range")
 *     rv=[]
 *     for i in range(m.mpop.get().diploids[deme].size()):             # <<<<<<<<<<<<<<
 *         rv.append({'g':m.mpop.get().diploids[deme][i].g,
 *                    'e':m.mpop.get().diploids[deme][i].e,
 */
  __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_deme); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 748, __pyx_L1_error)
  __pyx_t_5 = (__pyx_v_m->mpop.get()->diploids[__pyx_t_4]).size();
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "fwdpy/views.pyx":749
 *     rv=[]
 *     for i in range(m.mpop.get().diploids[deme].size()):
 *         rv.append({'g':m.mpop.get().diploids[deme][i].g,             # <<<<<<<<<<<<<<
 *                    'e':m.mpop.get().diploids[deme][i].e,
 *                    'w':m.mpop.get().diploids[deme][i].w})
 */
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 749, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_v_deme); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 749, __pyx_L1_error)
    __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_m->mpop.get()->diploids[__pyx_t_6])[__pyx_v_i]).g); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 749, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_g, __pyx_t_1) < 0) __PYX_ERR(3, 749, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "fwdpy/views.pyx":750
 *     for i in range(m.mpop.get().diploids[deme].size()):
 *         rv.append({'g':m.mpop.get().diploids[deme][i].g,
 *                    'e':m.mpop.get().diploids[deme][i].e,             # <<<<<<<<<<<<<<
 *                    'w':m.mpop.get().diploids[deme][i].w})
 * 
 */
    __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_v_deme); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 750, __pyx_L1_error)
    __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_m->mpop.get()->diploids[__pyx_t_6])[__pyx_v_i]).e); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 750, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_e, __pyx_t_1) < 0) __PYX_ERR(3, 749, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "fwdpy/views.pyx":751
 *         rv.append({'g':m.mpop.get().diploids[deme][i].g,
 *                    'e':m.mpop.get().diploids[deme][i].e,
 *                    'w':m.mpop.get().diploids[deme][i].w})             # <<<<<<<<<<<<<<
 * 
 * cdef diploid_traits_mpopvec(MetaPopVec p,deme):
 */
    __pyx_t_6 = __Pyx_PyInt_As_size_t(__pyx_v_deme); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 751, __pyx_L1_error)
    __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_m->mpop.get()->diploids[__pyx_t_6])[__pyx_v_i]).w); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_w, __pyx_t_1) < 0) __PYX_ERR(3, 749, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "fwdpy/views.pyx":749
 *     rv=[]
 *     for i in range(m.mpop.get().diploids[deme].size()):
 *         rv.append({'g':m.mpop.get().diploids[deme][i].g,             # <<<<<<<<<<<<<<
 *                    'e':m.mpop.get().diploids[deme][i].e,
 *                    'w':m.mpop.get().diploids[deme][i].w})
 */
    __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_rv, __pyx_t_2); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(3, 749, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }

  /* "fwdpy/views.pyx":744
 * 
 * 
 * cdef diploid_traits_mpop(MetaPop m, deme):             # <<<<<<<<<<<<<<
 *     if deme > m.mpop.get().diploids.size():
 *         raise RuntimeError("deme value out of range")
 */

  /* 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_AddTraceback("fwdpy.fwdpy.diploid_traits_mpop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":753
 *                    'w':m.mpop.get().diploids[deme][i].w})
 * 
 * cdef diploid_traits_mpopvec(MetaPopVec p,deme):             # <<<<<<<<<<<<<<
 *     return [diploid_traits_mpop(i,deme) for i in p]
 * 
 */

static PyObject *__pyx_f_5fwdpy_5fwdpy_diploid_traits_mpopvec(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_p, PyObject *__pyx_v_deme) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("diploid_traits_mpopvec", 0);

  /* "fwdpy/views.pyx":754
 * 
 * cdef diploid_traits_mpopvec(MetaPopVec p,deme):
 *     return [diploid_traits_mpop(i,deme) for i in p]             # <<<<<<<<<<<<<<
 * 
 * def diploid_traits(object p, deme = None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(((PyObject *)__pyx_v_p))) || PyTuple_CheckExact(((PyObject *)__pyx_v_p))) {
    __pyx_t_2 = ((PyObject *)__pyx_v_p); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_p)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 754, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(3, 754, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 754, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(3, 754, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 754, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(3, 754, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
    __pyx_t_5 = 0;
    if (!(likely(((__pyx_v_i) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_i, __pyx_ptype_5fwdpy_5fwdpy_MetaPop))))) __PYX_ERR(3, 754, __pyx_L1_error)
    __pyx_t_5 = __pyx_f_5fwdpy_5fwdpy_diploid_traits_mpop(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_i), __pyx_v_deme); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(3, 754, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/views.pyx":753
 *                    'w':m.mpop.get().diploids[deme][i].w})
 * 
 * cdef diploid_traits_mpopvec(MetaPopVec p,deme):             # <<<<<<<<<<<<<<
 *     return [diploid_traits_mpop(i,deme) for i in p]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.diploid_traits_mpopvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/views.pyx":756
 *     return [diploid_traits_mpop(i,deme) for i in p]
 * 
 * def diploid_traits(object p, deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Return genetic value (g), environmental value (e), and fitness (w) for all diploids.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_77diploid_traits(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_76diploid_traits[] = "\n    Return genetic value (g), environmental value (e), and fitness (w) for all diploids.\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_77diploid_traits = {"diploid_traits", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_77diploid_traits, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_76diploid_traits};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_77diploid_traits(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_deme = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("diploid_traits (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_deme,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_deme);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "diploid_traits") < 0)) __PYX_ERR(3, 756, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
    __pyx_v_deme = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("diploid_traits", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 756, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.diploid_traits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_76diploid_traits(__pyx_self, __pyx_v_p, __pyx_v_deme);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_76diploid_traits(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_deme) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("diploid_traits", 0);

  /* "fwdpy/views.pyx":760
 *     Return genetic value (g), environmental value (e), and fitness (w) for all diploids.
 *     """
 *     if isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return diploid_traits_singlepop(p)
 *     elif isinstance(p,MlocusPop):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_Spop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":761
 *     """
 *     if isinstance(p,Spop):
 *         return diploid_traits_singlepop(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MlocusPop):
 *         return diploid_traits_singlepop_mloc(p)
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_p) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_Spop))))) __PYX_ERR(3, 761, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_diploid_traits_singlepop(((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_p)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 761, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":760
 *     Return genetic value (g), environmental value (e), and fitness (w) for all diploids.
 *     """
 *     if isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return diploid_traits_singlepop(p)
 *     elif isinstance(p,MlocusPop):
 */
  }

  /* "fwdpy/views.pyx":762
 *     if isinstance(p,Spop):
 *         return diploid_traits_singlepop(p)
 *     elif isinstance(p,MlocusPop):             # <<<<<<<<<<<<<<
 *         return diploid_traits_singlepop_mloc(p)
 *     elif isinstance(p,MetaPop):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MlocusPop); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/views.pyx":763
 *         return diploid_traits_singlepop(p)
 *     elif isinstance(p,MlocusPop):
 *         return diploid_traits_singlepop_mloc(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MetaPop):
 *         if deme is None:
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_p) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MlocusPop))))) __PYX_ERR(3, 763, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_diploid_traits_singlepop_mloc(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_p)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":762
 *     if isinstance(p,Spop):
 *         return diploid_traits_singlepop(p)
 *     elif isinstance(p,MlocusPop):             # <<<<<<<<<<<<<<
 *         return diploid_traits_singlepop_mloc(p)
 *     elif isinstance(p,MetaPop):
 */
  }

  /* "fwdpy/views.pyx":764
 *     elif isinstance(p,MlocusPop):
 *         return diploid_traits_singlepop_mloc(p)
 *     elif isinstance(p,MetaPop):             # <<<<<<<<<<<<<<
 *         if deme is None:
 *             raise RuntimeError("deme cannot be None")
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MetaPop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":765
 *         return diploid_traits_singlepop_mloc(p)
 *     elif isinstance(p,MetaPop):
 *         if deme is None:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("deme cannot be None")
 *         return diploid_traits_mpop(p,deme)
 */
    __pyx_t_2 = (__pyx_v_deme == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "fwdpy/views.pyx":766
 *     elif isinstance(p,MetaPop):
 *         if deme is None:
 *             raise RuntimeError("deme cannot be None")             # <<<<<<<<<<<<<<
 *         return diploid_traits_mpop(p,deme)
 *     if isinstance(p,SpopVec):
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__66, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 766, __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(3, 766, __pyx_L1_error)

      /* "fwdpy/views.pyx":765
 *         return diploid_traits_singlepop_mloc(p)
 *     elif isinstance(p,MetaPop):
 *         if deme is None:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("deme cannot be None")
 *         return diploid_traits_mpop(p,deme)
 */
    }

    /* "fwdpy/views.pyx":767
 *         if deme is None:
 *             raise RuntimeError("deme cannot be None")
 *         return diploid_traits_mpop(p,deme)             # <<<<<<<<<<<<<<
 *     if isinstance(p,SpopVec):
 *         return diploid_traits_popvec(p)
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_p) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MetaPop))))) __PYX_ERR(3, 767, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_diploid_traits_mpop(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_p), __pyx_v_deme); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 767, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":764
 *     elif isinstance(p,MlocusPop):
 *         return diploid_traits_singlepop_mloc(p)
 *     elif isinstance(p,MetaPop):             # <<<<<<<<<<<<<<
 *         if deme is None:
 *             raise RuntimeError("deme cannot be None")
 */
  }

  /* "fwdpy/views.pyx":768
 *             raise RuntimeError("deme cannot be None")
 *         return diploid_traits_mpop(p,deme)
 *     if isinstance(p,SpopVec):             # <<<<<<<<<<<<<<
 *         return diploid_traits_popvec(p)
 *     if isinstance(p,MlocusPopVec):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_SpopVec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":769
 *         return diploid_traits_mpop(p,deme)
 *     if isinstance(p,SpopVec):
 *         return diploid_traits_popvec(p)             # <<<<<<<<<<<<<<
 *     if isinstance(p,MlocusPopVec):
 *         return diploid_traits_popvec_mloc(p)
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_p) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_SpopVec))))) __PYX_ERR(3, 769, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_diploid_traits_popvec(((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_p)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":768
 *             raise RuntimeError("deme cannot be None")
 *         return diploid_traits_mpop(p,deme)
 *     if isinstance(p,SpopVec):             # <<<<<<<<<<<<<<
 *         return diploid_traits_popvec(p)
 *     if isinstance(p,MlocusPopVec):
 */
  }

  /* "fwdpy/views.pyx":770
 *     if isinstance(p,SpopVec):
 *         return diploid_traits_popvec(p)
 *     if isinstance(p,MlocusPopVec):             # <<<<<<<<<<<<<<
 *         return diploid_traits_popvec_mloc(p)
 *     elif isinstance(p,MetaPopVec):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/views.pyx":771
 *         return diploid_traits_popvec(p)
 *     if isinstance(p,MlocusPopVec):
 *         return diploid_traits_popvec_mloc(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MetaPopVec):
 *         if deme is None:
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_p) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec))))) __PYX_ERR(3, 771, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_diploid_traits_popvec_mloc(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_p)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 771, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":770
 *     if isinstance(p,SpopVec):
 *         return diploid_traits_popvec(p)
 *     if isinstance(p,MlocusPopVec):             # <<<<<<<<<<<<<<
 *         return diploid_traits_popvec_mloc(p)
 *     elif isinstance(p,MetaPopVec):
 */
  }

  /* "fwdpy/views.pyx":772
 *     if isinstance(p,MlocusPopVec):
 *         return diploid_traits_popvec_mloc(p)
 *     elif isinstance(p,MetaPopVec):             # <<<<<<<<<<<<<<
 *         if deme is None:
 *             raise RuntimeError("deme cannot be None")
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MetaPopVec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/views.pyx":773
 *         return diploid_traits_popvec_mloc(p)
 *     elif isinstance(p,MetaPopVec):
 *         if deme is None:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("deme cannot be None")
 *         return diploid_traits_mpopvec(p,deme)
 */
    __pyx_t_2 = (__pyx_v_deme == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "fwdpy/views.pyx":774
 *     elif isinstance(p,MetaPopVec):
 *         if deme is None:
 *             raise RuntimeError("deme cannot be None")             # <<<<<<<<<<<<<<
 *         return diploid_traits_mpopvec(p,deme)
 *     else:
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__67, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 774, __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(3, 774, __pyx_L1_error)

      /* "fwdpy/views.pyx":773
 *         return diploid_traits_popvec_mloc(p)
 *     elif isinstance(p,MetaPopVec):
 *         if deme is None:             # <<<<<<<<<<<<<<
 *             raise RuntimeError("deme cannot be None")
 *         return diploid_traits_mpopvec(p,deme)
 */
    }

    /* "fwdpy/views.pyx":775
 *         if deme is None:
 *             raise RuntimeError("deme cannot be None")
 *         return diploid_traits_mpopvec(p,deme)             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError("unsupported type")
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(((__pyx_v_p) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MetaPopVec))))) __PYX_ERR(3, 775, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_5fwdpy_5fwdpy_diploid_traits_mpopvec(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_p), __pyx_v_deme); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/views.pyx":772
 *     if isinstance(p,MlocusPopVec):
 *         return diploid_traits_popvec_mloc(p)
 *     elif isinstance(p,MetaPopVec):             # <<<<<<<<<<<<<<
 *         if deme is None:
 *             raise RuntimeError("deme cannot be None")
 */
  }

  /* "fwdpy/views.pyx":777
 *         return diploid_traits_mpopvec(p,deme)
 *     else:
 *         raise ValueError("unsupported type")             # <<<<<<<<<<<<<<
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__68, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 777, __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(3, 777, __pyx_L1_error)
  }

  /* "fwdpy/views.pyx":756
 *     return [diploid_traits_mpop(i,deme) for i in p]
 * 
 * def diploid_traits(object p, deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Return genetic value (g), environmental value (e), and fitness (w) for all diploids.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("fwdpy.fwdpy.diploid_traits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/view_fixations.pyx":3
 * from libcpp.vector cimport vector
 * 
 * cdef popgen_mut_data get_fixed_mutation(const popgenmut & m,             # <<<<<<<<<<<<<<
 *                                         const unsigned ftime,
 *                                         const unsigned N) nogil:
 */

static struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data __pyx_f_5fwdpy_5fwdpy_get_fixed_mutation(KTfwd::popgenmut const &__pyx_v_m, unsigned int const __pyx_v_ftime, unsigned int const __pyx_v_N) {
  struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data __pyx_v_rv;
  struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data __pyx_r;
  double __pyx_t_1;
  unsigned int __pyx_t_2;
  bool __pyx_t_3;
  uint16_t __pyx_t_4;

  /* "fwdpy/view_fixations.pyx":7
 *                                         const unsigned N) nogil:
 *     cdef popgen_mut_data rv
 *     rv.pos=m.pos             # <<<<<<<<<<<<<<
 *     rv.n=2*N
 *     rv.g=m.g
 */
  __pyx_t_1 = __pyx_v_m.pos;
  __pyx_v_rv.pos = __pyx_t_1;

  /* "fwdpy/view_fixations.pyx":8
 *     cdef popgen_mut_data rv
 *     rv.pos=m.pos
 *     rv.n=2*N             # <<<<<<<<<<<<<<
 *     rv.g=m.g
 *     rv.ftime=ftime
 */
  __pyx_v_rv.n = (2 * __pyx_v_N);

  /* "fwdpy/view_fixations.pyx":9
 *     rv.pos=m.pos
 *     rv.n=2*N
 *     rv.g=m.g             # <<<<<<<<<<<<<<
 *     rv.ftime=ftime
 *     rv.s=m.s
 */
  __pyx_t_2 = __pyx_v_m.g;
  __pyx_v_rv.g = __pyx_t_2;

  /* "fwdpy/view_fixations.pyx":10
 *     rv.n=2*N
 *     rv.g=m.g
 *     rv.ftime=ftime             # <<<<<<<<<<<<<<
 *     rv.s=m.s
 *     rv.h=m.h
 */
  __pyx_v_rv.ftime = __pyx_v_ftime;

  /* "fwdpy/view_fixations.pyx":11
 *     rv.g=m.g
 *     rv.ftime=ftime
 *     rv.s=m.s             # <<<<<<<<<<<<<<
 *     rv.h=m.h
 *     rv.neutral=m.neutral
 */
  __pyx_t_1 = __pyx_v_m.s;
  __pyx_v_rv.s = __pyx_t_1;

  /* "fwdpy/view_fixations.pyx":12
 *     rv.ftime=ftime
 *     rv.s=m.s
 *     rv.h=m.h             # <<<<<<<<<<<<<<
 *     rv.neutral=m.neutral
 *     rv.label=m.xtra
 */
  __pyx_t_1 = __pyx_v_m.h;
  __pyx_v_rv.h = __pyx_t_1;

  /* "fwdpy/view_fixations.pyx":13
 *     rv.s=m.s
 *     rv.h=m.h
 *     rv.neutral=m.neutral             # <<<<<<<<<<<<<<
 *     rv.label=m.xtra
 *     return rv
 */
  __pyx_t_3 = __pyx_v_m.neutral;
  __pyx_v_rv.neutral = __pyx_t_3;

  /* "fwdpy/view_fixations.pyx":14
 *     rv.h=m.h
 *     rv.neutral=m.neutral
 *     rv.label=m.xtra             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
  __pyx_t_4 = __pyx_v_m.xtra;
  __pyx_v_rv.label = __pyx_t_4;

  /* "fwdpy/view_fixations.pyx":15
 *     rv.neutral=m.neutral
 *     rv.label=m.xtra
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * cdef vector[popgen_mut_data] view_fixations_details( const mcont_t & fixations,
 */
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/view_fixations.pyx":3
 * from libcpp.vector cimport vector
 * 
 * cdef popgen_mut_data get_fixed_mutation(const popgenmut & m,             # <<<<<<<<<<<<<<
 *                                         const unsigned ftime,
 *                                         const unsigned N) nogil:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/view_fixations.pyx":17
 *     return rv
 * 
 * cdef vector[popgen_mut_data] view_fixations_details( const mcont_t & fixations,             # <<<<<<<<<<<<<<
 *                                                      const vector[uint] & fixation_times,
 *                                                      const unsigned N) nogil:
 */

static std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data>  __pyx_f_5fwdpy_5fwdpy_view_fixations_details(fwdpy::mcont_t const &__pyx_v_fixations, std::vector<unsigned int>  const &__pyx_v_fixation_times, unsigned int const __pyx_v_N) {
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data>  __pyx_v_rv;
  size_t __pyx_v_i;
  size_t __pyx_v_j;
  std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data>  __pyx_r;
  int __pyx_t_1;

  /* "fwdpy/view_fixations.pyx":21
 *                                                      const unsigned N) nogil:
 *     cdef vector[popgen_mut_data] rv
 *     cdef size_t i=0,j=fixations.size()             # <<<<<<<<<<<<<<
 *     while i!=j:
 *         rv.push_back(get_fixed_mutation(fixations[i],fixation_times[i],N))
 */
  __pyx_v_i = 0;
  __pyx_v_j = __pyx_v_fixations.size();

  /* "fwdpy/view_fixations.pyx":22
 *     cdef vector[popgen_mut_data] rv
 *     cdef size_t i=0,j=fixations.size()
 *     while i!=j:             # <<<<<<<<<<<<<<
 *         rv.push_back(get_fixed_mutation(fixations[i],fixation_times[i],N))
 *         i+=1
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_i != __pyx_v_j) != 0);
    if (!__pyx_t_1) break;

    /* "fwdpy/view_fixations.pyx":23
 *     cdef size_t i=0,j=fixations.size()
 *     while i!=j:
 *         rv.push_back(get_fixed_mutation(fixations[i],fixation_times[i],N))             # <<<<<<<<<<<<<<
 *         i+=1
 *     return rv
 */
    try {
      __pyx_v_rv.push_back(__pyx_f_5fwdpy_5fwdpy_get_fixed_mutation((__pyx_v_fixations[__pyx_v_i]), (__pyx_v_fixation_times[__pyx_v_i]), __pyx_v_N));
    } catch(...) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      __Pyx_CppExn2PyErr();
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(7, 23, __pyx_L1_error)
    }

    /* "fwdpy/view_fixations.pyx":24
 *     while i!=j:
 *         rv.push_back(get_fixed_mutation(fixations[i],fixation_times[i],N))
 *         i+=1             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "fwdpy/view_fixations.pyx":25
 *         rv.push_back(get_fixed_mutation(fixations[i],fixation_times[i],N))
 *         i+=1
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def view_fixations_popvec(SpopVec p):
 */
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/view_fixations.pyx":17
 *     return rv
 * 
 * cdef vector[popgen_mut_data] view_fixations_details( const mcont_t & fixations,             # <<<<<<<<<<<<<<
 *                                                      const vector[uint] & fixation_times,
 *                                                      const unsigned N) nogil:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("fwdpy.fwdpy.view_fixations_details", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/view_fixations.pyx":27
 *     return rv
 * 
 * def view_fixations_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     cdef vector[vector[popgen_mut_data]] rv
 *     cdef size_t npops=p.pops.size()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_79view_fixations_popvec(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_79view_fixations_popvec = {"view_fixations_popvec", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_79view_fixations_popvec, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_79view_fixations_popvec(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_fixations_popvec (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_SpopVec, 1, "p", 0))) __PYX_ERR(7, 27, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_78view_fixations_popvec(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_78view_fixations_popvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p) {
  std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data> >  __pyx_v_rv;
  size_t __pyx_v_npops;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("view_fixations_popvec", 0);

  /* "fwdpy/view_fixations.pyx":29
 * def view_fixations_popvec(SpopVec p):
 *     cdef vector[vector[popgen_mut_data]] rv
 *     cdef size_t npops=p.pops.size()             # <<<<<<<<<<<<<<
 *     rv.resize(npops)
 *     cdef int i
 */
  __pyx_v_npops = __pyx_v_p->pops.size();

  /* "fwdpy/view_fixations.pyx":30
 *     cdef vector[vector[popgen_mut_data]] rv
 *     cdef size_t npops=p.pops.size()
 *     rv.resize(npops)             # <<<<<<<<<<<<<<
 *     cdef int i
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 */
  try {
    __pyx_v_rv.resize(__pyx_v_npops);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(7, 30, __pyx_L1_error)
  }

  /* "fwdpy/view_fixations.pyx":32
 *     rv.resize(npops)
 *     cdef int i
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i]=view_fixations_details(p.pops[i].get().fixations,p.pops[i].get().fixation_times,p.pops[i].get().N)
 *     return rv
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {
        __pyx_t_1 = __pyx_v_npops;
        if (1 == 0) abort();
        {
            __pyx_t_4 = 1;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_3 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static, __pyx_t_4)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_2);

                            /* "fwdpy/view_fixations.pyx":33
 *     cdef int i
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i]=view_fixations_details(p.pops[i].get().fixations,p.pops[i].get().fixation_times,p.pops[i].get().N)             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
                            (__pyx_v_rv[__pyx_v_i]) = __pyx_f_5fwdpy_5fwdpy_view_fixations_details((__pyx_v_p->pops[__pyx_v_i]).get()->fixations, (__pyx_v_p->pops[__pyx_v_i]).get()->fixation_times, (__pyx_v_p->pops[__pyx_v_i]).get()->N);
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "fwdpy/view_fixations.pyx":32
 *     rv.resize(npops)
 *     cdef int i
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i]=view_fixations_details(p.pops[i].get().fixations,p.pops[i].get().fixation_times,p.pops[i].get().N)
 *     return rv
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "fwdpy/view_fixations.pyx":34
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i]=view_fixations_details(p.pops[i].get().fixations,p.pops[i].get().fixation_times,p.pops[i].get().N)
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def view_fixations_mlocuspopvec(MlocusPopVec p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data_3e___(__pyx_v_rv); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "fwdpy/view_fixations.pyx":27
 *     return rv
 * 
 * def view_fixations_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     cdef vector[vector[popgen_mut_data]] rv
 *     cdef size_t npops=p.pops.size()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_fixations_popvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/view_fixations.pyx":36
 *     return rv
 * 
 * def view_fixations_mlocuspopvec(MlocusPopVec p):             # <<<<<<<<<<<<<<
 *     cdef vector[vector[popgen_mut_data]] rv
 *     cdef size_t npops=p.pops.size()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_81view_fixations_mlocuspopvec(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_81view_fixations_mlocuspopvec = {"view_fixations_mlocuspopvec", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_81view_fixations_mlocuspopvec, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_81view_fixations_mlocuspopvec(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_fixations_mlocuspopvec (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec, 1, "p", 0))) __PYX_ERR(7, 36, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_80view_fixations_mlocuspopvec(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_80view_fixations_mlocuspopvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *__pyx_v_p) {
  std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data> >  __pyx_v_rv;
  size_t __pyx_v_npops;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("view_fixations_mlocuspopvec", 0);

  /* "fwdpy/view_fixations.pyx":38
 * def view_fixations_mlocuspopvec(MlocusPopVec p):
 *     cdef vector[vector[popgen_mut_data]] rv
 *     cdef size_t npops=p.pops.size()             # <<<<<<<<<<<<<<
 *     rv.resize(npops)
 *     cdef int i
 */
  __pyx_v_npops = __pyx_v_p->pops.size();

  /* "fwdpy/view_fixations.pyx":39
 *     cdef vector[vector[popgen_mut_data]] rv
 *     cdef size_t npops=p.pops.size()
 *     rv.resize(npops)             # <<<<<<<<<<<<<<
 *     cdef int i
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 */
  try {
    __pyx_v_rv.resize(__pyx_v_npops);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(7, 39, __pyx_L1_error)
  }

  /* "fwdpy/view_fixations.pyx":41
 *     rv.resize(npops)
 *     cdef int i
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i]=view_fixations_details(p.pops[i].get().fixations,p.pops[i].get().fixation_times,p.pops[i].get().N)
 *     return rv
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {
        __pyx_t_1 = __pyx_v_npops;
        if (1 == 0) abort();
        {
            __pyx_t_4 = 1;
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   (x)
                #define unlikely(x) (x)
            #endif
            __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
            if (__pyx_t_3 > 0)
            {
                #ifdef _OPENMP
                #pragma omp parallel
                #endif /* _OPENMP */
                {
                    #ifdef _OPENMP
                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static, __pyx_t_4)
                    #endif /* _OPENMP */
                    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                        {
                            __pyx_v_i = (int)(0 + 1 * __pyx_t_2);

                            /* "fwdpy/view_fixations.pyx":42
 *     cdef int i
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i]=view_fixations_details(p.pops[i].get().fixations,p.pops[i].get().fixation_times,p.pops[i].get().N)             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
                            (__pyx_v_rv[__pyx_v_i]) = __pyx_f_5fwdpy_5fwdpy_view_fixations_details((__pyx_v_p->pops[__pyx_v_i]).get()->fixations, (__pyx_v_p->pops[__pyx_v_i]).get()->fixation_times, (__pyx_v_p->pops[__pyx_v_i]).get()->N);
                        }
                    }
                }
            }
        }
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   __builtin_expect(!!(x), 1)
            #define unlikely(x) __builtin_expect(!!(x), 0)
        #endif
      }

      /* "fwdpy/view_fixations.pyx":41
 *     rv.resize(npops)
 *     cdef int i
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):             # <<<<<<<<<<<<<<
 *         rv[i]=view_fixations_details(p.pops[i].get().fixations,p.pops[i].get().fixation_times,p.pops[i].get().N)
 *     return rv
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }

  /* "fwdpy/view_fixations.pyx":43
 *     for i in prange(npops,schedule='static',nogil=True,chunksize=1):
 *         rv[i]=view_fixations_details(p.pops[i].get().fixations,p.pops[i].get().fixation_times,p.pops[i].get().N)
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def view_fixations(object p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data_3e___(__pyx_v_rv); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "fwdpy/view_fixations.pyx":36
 *     return rv
 * 
 * def view_fixations_mlocuspopvec(MlocusPopVec p):             # <<<<<<<<<<<<<<
 *     cdef vector[vector[popgen_mut_data]] rv
 *     cdef size_t npops=p.pops.size()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_fixations_mlocuspopvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/view_fixations.pyx":45
 *     return rv
 * 
 * def view_fixations(object p):             # <<<<<<<<<<<<<<
 *     """
 *     Return information on fixed variants
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_83view_fixations(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_82view_fixations[] = "\n    Return information on fixed variants\n\n    :param p: a :class:`fwdpy.fwdpy.PopType` or a :class:`fwdpy.fwdpy.PopVec`\n\n    :return: A list of tuples. The first element is fixation time, and the second is a dict containing data about the mutation.\n\n    .. note:: You may need to call :func:`fwdpy.fwdpy.view_mutations` to view all types of fixations, depending on the type of simulation you are running.\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_83view_fixations = {"view_fixations", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_83view_fixations, METH_O, __pyx_doc_5fwdpy_5fwdpy_82view_fixations};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_83view_fixations(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("view_fixations (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_82view_fixations(__pyx_self, ((PyObject *)__pyx_v_p));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_82view_fixations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("view_fixations", 0);

  /* "fwdpy/view_fixations.pyx":57
 * 
 *     #Streamline using casts:
 *     if isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return view_fixations_details((<Spop>p).pop.get().fixations,(<Spop>p).pop.get().fixation_times,(<Spop>p).pop.get().N)
 *     if isinstance(p,MetaPop):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_Spop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/view_fixations.pyx":58
 *     #Streamline using casts:
 *     if isinstance(p,Spop):
 *         return view_fixations_details((<Spop>p).pop.get().fixations,(<Spop>p).pop.get().fixation_times,(<Spop>p).pop.get().N)             # <<<<<<<<<<<<<<
 *     if isinstance(p,MetaPop):
 *         return view_fixations_details((<MetaPop>p).mpop.get().fixations,(<MetaPop>p).mpop.get().fixation_times,sum((<MetaPop>p).mpop.get().Ns))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data(__pyx_f_5fwdpy_5fwdpy_view_fixations_details(((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_p)->pop.get()->fixations, ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_p)->pop.get()->fixation_times, ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_p)->pop.get()->N)); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 58, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/view_fixations.pyx":57
 * 
 *     #Streamline using casts:
 *     if isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return view_fixations_details((<Spop>p).pop.get().fixations,(<Spop>p).pop.get().fixation_times,(<Spop>p).pop.get().N)
 *     if isinstance(p,MetaPop):
 */
  }

  /* "fwdpy/view_fixations.pyx":59
 *     if isinstance(p,Spop):
 *         return view_fixations_details((<Spop>p).pop.get().fixations,(<Spop>p).pop.get().fixation_times,(<Spop>p).pop.get().N)
 *     if isinstance(p,MetaPop):             # <<<<<<<<<<<<<<
 *         return view_fixations_details((<MetaPop>p).mpop.get().fixations,(<MetaPop>p).mpop.get().fixation_times,sum((<MetaPop>p).mpop.get().Ns))
 *     elif isinstance(p,SpopVec):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MetaPop); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/view_fixations.pyx":60
 *         return view_fixations_details((<Spop>p).pop.get().fixations,(<Spop>p).pop.get().fixation_times,(<Spop>p).pop.get().N)
 *     if isinstance(p,MetaPop):
 *         return view_fixations_details((<MetaPop>p).mpop.get().fixations,(<MetaPop>p).mpop.get().fixation_times,sum((<MetaPop>p).mpop.get().Ns))             # <<<<<<<<<<<<<<
 *     elif isinstance(p,SpopVec):
 *         return view_fixations_popvec(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_int(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_p)->mpop.get()->Ns); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_sum, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(7, 60, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data(__pyx_f_5fwdpy_5fwdpy_view_fixations_details(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_p)->mpop.get()->fixations, ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_p)->mpop.get()->fixation_times, __pyx_t_5)); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 60, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/view_fixations.pyx":59
 *     if isinstance(p,Spop):
 *         return view_fixations_details((<Spop>p).pop.get().fixations,(<Spop>p).pop.get().fixation_times,(<Spop>p).pop.get().N)
 *     if isinstance(p,MetaPop):             # <<<<<<<<<<<<<<
 *         return view_fixations_details((<MetaPop>p).mpop.get().fixations,(<MetaPop>p).mpop.get().fixation_times,sum((<MetaPop>p).mpop.get().Ns))
 *     elif isinstance(p,SpopVec):
 */
  }

  /* "fwdpy/view_fixations.pyx":61
 *     if isinstance(p,MetaPop):
 *         return view_fixations_details((<MetaPop>p).mpop.get().fixations,(<MetaPop>p).mpop.get().fixation_times,sum((<MetaPop>p).mpop.get().Ns))
 *     elif isinstance(p,SpopVec):             # <<<<<<<<<<<<<<
 *         return view_fixations_popvec(p)
 *     elif isinstance(p,MlocusPopVec):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_SpopVec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/view_fixations.pyx":62
 *         return view_fixations_details((<MetaPop>p).mpop.get().fixations,(<MetaPop>p).mpop.get().fixation_times,sum((<MetaPop>p).mpop.get().Ns))
 *     elif isinstance(p,SpopVec):
 *         return view_fixations_popvec(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MlocusPopVec):
 *         return view_fixations_mlocuspopvec(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_fixations_popvec); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 62, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 62, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 62, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(7, 62, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_p);
        __Pyx_GIVEREF(__pyx_v_p);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_p);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 62, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/view_fixations.pyx":61
 *     if isinstance(p,MetaPop):
 *         return view_fixations_details((<MetaPop>p).mpop.get().fixations,(<MetaPop>p).mpop.get().fixation_times,sum((<MetaPop>p).mpop.get().Ns))
 *     elif isinstance(p,SpopVec):             # <<<<<<<<<<<<<<
 *         return view_fixations_popvec(p)
 *     elif isinstance(p,MlocusPopVec):
 */
  }

  /* "fwdpy/view_fixations.pyx":63
 *     elif isinstance(p,SpopVec):
 *         return view_fixations_popvec(p)
 *     elif isinstance(p,MlocusPopVec):             # <<<<<<<<<<<<<<
 *         return view_fixations_mlocuspopvec(p)
 *     else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/view_fixations.pyx":64
 *         return view_fixations_popvec(p)
 *     elif isinstance(p,MlocusPopVec):
 *         return view_fixations_mlocuspopvec(p)             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError("unsupported type")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_view_fixations_mlocuspopvec); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 64, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 64, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(7, 64, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_p);
        __Pyx_GIVEREF(__pyx_v_p);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_p);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 64, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/view_fixations.pyx":63
 *     elif isinstance(p,SpopVec):
 *         return view_fixations_popvec(p)
 *     elif isinstance(p,MlocusPopVec):             # <<<<<<<<<<<<<<
 *         return view_fixations_mlocuspopvec(p)
 *     else:
 */
  }

  /* "fwdpy/view_fixations.pyx":66
 *         return view_fixations_mlocuspopvec(p)
 *     else:
 *         raise ValueError("unsupported type")             # <<<<<<<<<<<<<<
 * 
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__69, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 66, __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(7, 66, __pyx_L1_error)
  }

  /* "fwdpy/view_fixations.pyx":45
 *     return rv
 * 
 * def view_fixations(object p):             # <<<<<<<<<<<<<<
 *     """
 *     Return information on fixed variants
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("fwdpy.fwdpy.view_fixations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/debug.pyx":1
 * def check_popdata_singlepop(Spop p):             # <<<<<<<<<<<<<<
 *     cdef bint csum = check_sum[gcont_t](p.pop.get().gametes,2*(<unsigned>p.pop.get().diploids.size()))
 *     cdef bint pds = popdata_sane[dipvector_t,gcont_t,mcont_t](p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_85check_popdata_singlepop(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_85check_popdata_singlepop = {"check_popdata_singlepop", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_85check_popdata_singlepop, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_85check_popdata_singlepop(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_popdata_singlepop (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_Spop, 1, "p", 0))) __PYX_ERR(8, 1, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_84check_popdata_singlepop(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_84check_popdata_singlepop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_Spop *__pyx_v_p) {
  int __pyx_v_csum;
  int __pyx_v_pds;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("check_popdata_singlepop", 0);

  /* "fwdpy/debug.pyx":2
 * def check_popdata_singlepop(Spop p):
 *     cdef bint csum = check_sum[gcont_t](p.pop.get().gametes,2*(<unsigned>p.pop.get().diploids.size()))             # <<<<<<<<<<<<<<
 *     cdef bint pds = popdata_sane[dipvector_t,gcont_t,mcont_t](p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts)
 *     return {'check_sum':csum,'popdata_sane':pds}
 */
  __pyx_v_csum = KTfwd::check_sum<fwdpy::gcont_t>(__pyx_v_p->pop.get()->gametes, (2 * ((unsigned int)__pyx_v_p->pop.get()->diploids.size())));

  /* "fwdpy/debug.pyx":3
 * def check_popdata_singlepop(Spop p):
 *     cdef bint csum = check_sum[gcont_t](p.pop.get().gametes,2*(<unsigned>p.pop.get().diploids.size()))
 *     cdef bint pds = popdata_sane[dipvector_t,gcont_t,mcont_t](p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts)             # <<<<<<<<<<<<<<
 *     return {'check_sum':csum,'popdata_sane':pds}
 * 
 */
  __pyx_v_pds = KTfwd::popdata_sane<fwdpy::dipvector_t,fwdpy::gcont_t,fwdpy::mcont_t>(__pyx_v_p->pop.get()->diploids, __pyx_v_p->pop.get()->gametes, __pyx_v_p->pop.get()->mutations, __pyx_v_p->pop.get()->mcounts);

  /* "fwdpy/debug.pyx":4
 *     cdef bint csum = check_sum[gcont_t](p.pop.get().gametes,2*(<unsigned>p.pop.get().diploids.size()))
 *     cdef bint pds = popdata_sane[dipvector_t,gcont_t,mcont_t](p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts)
 *     return {'check_sum':csum,'popdata_sane':pds}             # <<<<<<<<<<<<<<
 * 
 * def check_popdata_metapop(MetaPop p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_csum); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_check_sum, __pyx_t_2) < 0) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_pds); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_popdata_sane, __pyx_t_2) < 0) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/debug.pyx":1
 * def check_popdata_singlepop(Spop p):             # <<<<<<<<<<<<<<
 *     cdef bint csum = check_sum[gcont_t](p.pop.get().gametes,2*(<unsigned>p.pop.get().diploids.size()))
 *     cdef bint pds = popdata_sane[dipvector_t,gcont_t,mcont_t](p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("fwdpy.fwdpy.check_popdata_singlepop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/debug.pyx":6
 *     return {'check_sum':csum,'popdata_sane':pds}
 * 
 * def check_popdata_metapop(MetaPop p):             # <<<<<<<<<<<<<<
 *     cdef bint csum = check_sum[gcont_t](p.mpop.get().gametes,2*(<unsigned>p.mpop.get().diploids.size()))
 *     lpds=[]
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_87check_popdata_metapop(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_87check_popdata_metapop = {"check_popdata_metapop", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_87check_popdata_metapop, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_87check_popdata_metapop(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_popdata_metapop (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MetaPop, 1, "p", 0))) __PYX_ERR(8, 6, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_86check_popdata_metapop(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_86check_popdata_metapop(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *__pyx_v_p) {
  int __pyx_v_csum;
  PyObject *__pyx_v_lpds = NULL;
  int __pyx_v_pds;
  size_t __pyx_v_i;
  size_t __pyx_v_ndemes;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("check_popdata_metapop", 0);

  /* "fwdpy/debug.pyx":7
 * 
 * def check_popdata_metapop(MetaPop p):
 *     cdef bint csum = check_sum[gcont_t](p.mpop.get().gametes,2*(<unsigned>p.mpop.get().diploids.size()))             # <<<<<<<<<<<<<<
 *     lpds=[]
 *     cdef bint pds
 */
  __pyx_v_csum = KTfwd::check_sum<fwdpy::gcont_t>(__pyx_v_p->mpop.get()->gametes, (2 * ((unsigned int)__pyx_v_p->mpop.get()->diploids.size())));

  /* "fwdpy/debug.pyx":8
 * def check_popdata_metapop(MetaPop p):
 *     cdef bint csum = check_sum[gcont_t](p.mpop.get().gametes,2*(<unsigned>p.mpop.get().diploids.size()))
 *     lpds=[]             # <<<<<<<<<<<<<<
 *     cdef bint pds
 *     cdef size_t i = 0
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_lpds = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "fwdpy/debug.pyx":10
 *     lpds=[]
 *     cdef bint pds
 *     cdef size_t i = 0             # <<<<<<<<<<<<<<
 *     cdef size_t ndemes = p.mpop.get().diploids.size()
 *     while i < ndemes:
 */
  __pyx_v_i = 0;

  /* "fwdpy/debug.pyx":11
 *     cdef bint pds
 *     cdef size_t i = 0
 *     cdef size_t ndemes = p.mpop.get().diploids.size()             # <<<<<<<<<<<<<<
 *     while i < ndemes:
 *         pds=popdata_sane[dipvector_t,gcont_t,mcont_t](p.mpop.get().diploids[i],p.mpop.get().gametes,p.mpop.get().mutations,p.mpop.get().mcounts)
 */
  __pyx_v_ndemes = __pyx_v_p->mpop.get()->diploids.size();

  /* "fwdpy/debug.pyx":12
 *     cdef size_t i = 0
 *     cdef size_t ndemes = p.mpop.get().diploids.size()
 *     while i < ndemes:             # <<<<<<<<<<<<<<
 *         pds=popdata_sane[dipvector_t,gcont_t,mcont_t](p.mpop.get().diploids[i],p.mpop.get().gametes,p.mpop.get().mutations,p.mpop.get().mcounts)
 *         lpds.append(pds)
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_i < __pyx_v_ndemes) != 0);
    if (!__pyx_t_2) break;

    /* "fwdpy/debug.pyx":13
 *     cdef size_t ndemes = p.mpop.get().diploids.size()
 *     while i < ndemes:
 *         pds=popdata_sane[dipvector_t,gcont_t,mcont_t](p.mpop.get().diploids[i],p.mpop.get().gametes,p.mpop.get().mutations,p.mpop.get().mcounts)             # <<<<<<<<<<<<<<
 *         lpds.append(pds)
 *         i+=1
 */
    __pyx_v_pds = KTfwd::popdata_sane<fwdpy::dipvector_t,fwdpy::gcont_t,fwdpy::mcont_t>((__pyx_v_p->mpop.get()->diploids[__pyx_v_i]), __pyx_v_p->mpop.get()->gametes, __pyx_v_p->mpop.get()->mutations, __pyx_v_p->mpop.get()->mcounts);

    /* "fwdpy/debug.pyx":14
 *     while i < ndemes:
 *         pds=popdata_sane[dipvector_t,gcont_t,mcont_t](p.mpop.get().diploids[i],p.mpop.get().gametes,p.mpop.get().mutations,p.mpop.get().mcounts)
 *         lpds.append(pds)             # <<<<<<<<<<<<<<
 *         i+=1
 *     return {'check_sum':csum,'popdata_sane':lpds}
 */
    __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_pds); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_lpds, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(8, 14, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "fwdpy/debug.pyx":15
 *         pds=popdata_sane[dipvector_t,gcont_t,mcont_t](p.mpop.get().diploids[i],p.mpop.get().gametes,p.mpop.get().mutations,p.mpop.get().mcounts)
 *         lpds.append(pds)
 *         i+=1             # <<<<<<<<<<<<<<
 *     return {'check_sum':csum,'popdata_sane':lpds}
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "fwdpy/debug.pyx":16
 *         lpds.append(pds)
 *         i+=1
 *     return {'check_sum':csum,'popdata_sane':lpds}             # <<<<<<<<<<<<<<
 * 
 * def check_popdata_popvec(SpopVec p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_csum); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_check_sum, __pyx_t_4) < 0) __PYX_ERR(8, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_popdata_sane, __pyx_v_lpds) < 0) __PYX_ERR(8, 16, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/debug.pyx":6
 *     return {'check_sum':csum,'popdata_sane':pds}
 * 
 * def check_popdata_metapop(MetaPop p):             # <<<<<<<<<<<<<<
 *     cdef bint csum = check_sum[gcont_t](p.mpop.get().gametes,2*(<unsigned>p.mpop.get().diploids.size()))
 *     lpds=[]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.check_popdata_metapop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lpds);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/debug.pyx":18
 *     return {'check_sum':csum,'popdata_sane':lpds}
 * 
 * def check_popdata_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     return [check_popdata_singlepop(i) for i in p]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_89check_popdata_popvec(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_89check_popdata_popvec = {"check_popdata_popvec", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_89check_popdata_popvec, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_89check_popdata_popvec(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_popdata_popvec (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_SpopVec, 1, "p", 0))) __PYX_ERR(8, 18, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_88check_popdata_popvec(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_88check_popdata_popvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *__pyx_v_p) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("check_popdata_popvec", 0);

  /* "fwdpy/debug.pyx":19
 * 
 * def check_popdata_popvec(SpopVec p):
 *     return [check_popdata_singlepop(i) for i in p]             # <<<<<<<<<<<<<<
 * 
 * def check_popdata_mpopvec(MetaPopVec p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(((PyObject *)__pyx_v_p))) || PyTuple_CheckExact(((PyObject *)__pyx_v_p))) {
    __pyx_t_2 = ((PyObject *)__pyx_v_p); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_p)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 19, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 19, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(8, 19, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 19, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(8, 19, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 19, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(8, 19, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_popdata_singlepop); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 19, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 19, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_i};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 19, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_i};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 19, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(8, 19, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_i);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 19, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(8, 19, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/debug.pyx":18
 *     return {'check_sum':csum,'popdata_sane':lpds}
 * 
 * def check_popdata_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     return [check_popdata_singlepop(i) for i in p]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("fwdpy.fwdpy.check_popdata_popvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/debug.pyx":21
 *     return [check_popdata_singlepop(i) for i in p]
 * 
 * def check_popdata_mpopvec(MetaPopVec p):             # <<<<<<<<<<<<<<
 *     return [check_popdata_metapop(i) for i in p]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_91check_popdata_mpopvec(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_91check_popdata_mpopvec = {"check_popdata_mpopvec", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_91check_popdata_mpopvec, METH_O, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_91check_popdata_mpopvec(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_popdata_mpopvec (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_MetaPopVec, 1, "p", 0))) __PYX_ERR(8, 21, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_90check_popdata_mpopvec(__pyx_self, ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_p));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_90check_popdata_mpopvec(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *__pyx_v_p) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("check_popdata_mpopvec", 0);

  /* "fwdpy/debug.pyx":22
 * 
 * def check_popdata_mpopvec(MetaPopVec p):
 *     return [check_popdata_metapop(i) for i in p]             # <<<<<<<<<<<<<<
 * 
 * def check_popdata(object p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(((PyObject *)__pyx_v_p))) || PyTuple_CheckExact(((PyObject *)__pyx_v_p))) {
    __pyx_t_2 = ((PyObject *)__pyx_v_p); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_p)); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 22, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 22, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(8, 22, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 22, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(8, 22, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 22, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(8, 22, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_popdata_metapop); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 22, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 22, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_i};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 22, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_i};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 22, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(8, 22, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_i);
        __Pyx_GIVEREF(__pyx_v_i);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_i);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 22, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(8, 22, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/debug.pyx":21
 *     return [check_popdata_singlepop(i) for i in p]
 * 
 * def check_popdata_mpopvec(MetaPopVec p):             # <<<<<<<<<<<<<<
 *     return [check_popdata_metapop(i) for i in p]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("fwdpy.fwdpy.check_popdata_mpopvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/debug.pyx":24
 *     return [check_popdata_metapop(i) for i in p]
 * 
 * def check_popdata(object p):             # <<<<<<<<<<<<<<
 *     """
 *     Apply fwdpp's debugging functions to population containers.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_93check_popdata(PyObject *__pyx_self, PyObject *__pyx_v_p); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_92check_popdata[] = "\n    Apply fwdpp's debugging functions to population containers.\n    \n    :param p: A object of type :class:`fwdpy.fwdpy.poptype` or :class:`fwdpy.fwdpy.poptype`\n\n    :rtype: Dictionary with return values (True or False). Any false values reflect a critical data inconsistency, and mean an exception should be raised.\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_93check_popdata = {"check_popdata", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_93check_popdata, METH_O, __pyx_doc_5fwdpy_5fwdpy_92check_popdata};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_93check_popdata(PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_popdata (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_92check_popdata(__pyx_self, ((PyObject *)__pyx_v_p));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_92check_popdata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("check_popdata", 0);

  /* "fwdpy/debug.pyx":32
 *     :rtype: Dictionary with return values (True or False). Any false values reflect a critical data inconsistency, and mean an exception should be raised.
 *     """
 *     if isinstance(p,SpopVec):             # <<<<<<<<<<<<<<
 *         return check_popdata_popvec(p)
 *     elif isinstance(p,MetaPopVec):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_SpopVec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/debug.pyx":33
 *     """
 *     if isinstance(p,SpopVec):
 *         return check_popdata_popvec(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MetaPopVec):
 *         return check_popdata_mpopvec(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_popdata_popvec); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 33, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 33, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 33, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 33, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 33, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_p);
        __Pyx_GIVEREF(__pyx_v_p);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_p);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 33, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/debug.pyx":32
 *     :rtype: Dictionary with return values (True or False). Any false values reflect a critical data inconsistency, and mean an exception should be raised.
 *     """
 *     if isinstance(p,SpopVec):             # <<<<<<<<<<<<<<
 *         return check_popdata_popvec(p)
 *     elif isinstance(p,MetaPopVec):
 */
  }

  /* "fwdpy/debug.pyx":34
 *     if isinstance(p,SpopVec):
 *         return check_popdata_popvec(p)
 *     elif isinstance(p,MetaPopVec):             # <<<<<<<<<<<<<<
 *         return check_popdata_mpopvec(p)
 *     elif isinstance(p,Spop):
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MetaPopVec); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/debug.pyx":35
 *         return check_popdata_popvec(p)
 *     elif isinstance(p,MetaPopVec):
 *         return check_popdata_mpopvec(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,Spop):
 *         return check_popdata_singlepop(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_popdata_mpopvec); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 35, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 35, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 35, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 35, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 35, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_p);
        __Pyx_GIVEREF(__pyx_v_p);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_p);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 35, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/debug.pyx":34
 *     if isinstance(p,SpopVec):
 *         return check_popdata_popvec(p)
 *     elif isinstance(p,MetaPopVec):             # <<<<<<<<<<<<<<
 *         return check_popdata_mpopvec(p)
 *     elif isinstance(p,Spop):
 */
  }

  /* "fwdpy/debug.pyx":36
 *     elif isinstance(p,MetaPopVec):
 *         return check_popdata_mpopvec(p)
 *     elif isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return check_popdata_singlepop(p)
 *     elif isinstance(p,MetaPop):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_Spop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/debug.pyx":37
 *         return check_popdata_mpopvec(p)
 *     elif isinstance(p,Spop):
 *         return check_popdata_singlepop(p)             # <<<<<<<<<<<<<<
 *     elif isinstance(p,MetaPop):
 *         return check_popdata_metapop(p)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_popdata_singlepop); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 37, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 37, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 37, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 37, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_p);
        __Pyx_GIVEREF(__pyx_v_p);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_p);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 37, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/debug.pyx":36
 *     elif isinstance(p,MetaPopVec):
 *         return check_popdata_mpopvec(p)
 *     elif isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return check_popdata_singlepop(p)
 *     elif isinstance(p,MetaPop):
 */
  }

  /* "fwdpy/debug.pyx":38
 *     elif isinstance(p,Spop):
 *         return check_popdata_singlepop(p)
 *     elif isinstance(p,MetaPop):             # <<<<<<<<<<<<<<
 *         return check_popdata_metapop(p)
 *     else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_p, __pyx_ptype_5fwdpy_5fwdpy_MetaPop); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/debug.pyx":39
 *         return check_popdata_singlepop(p)
 *     elif isinstance(p,MetaPop):
 *         return check_popdata_metapop(p)             # <<<<<<<<<<<<<<
 *     else:
 *         raise RuntimeError("object type not understood")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_popdata_metapop); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 39, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 39, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_p};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 39, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 39, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_p);
        __Pyx_GIVEREF(__pyx_v_p);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_p);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 39, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "fwdpy/debug.pyx":38
 *     elif isinstance(p,Spop):
 *         return check_popdata_singlepop(p)
 *     elif isinstance(p,MetaPop):             # <<<<<<<<<<<<<<
 *         return check_popdata_metapop(p)
 *     else:
 */
  }

  /* "fwdpy/debug.pyx":41
 *         return check_popdata_metapop(p)
 *     else:
 *         raise RuntimeError("object type not understood")             # <<<<<<<<<<<<<<
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__70, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 41, __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(8, 41, __pyx_L1_error)
  }

  /* "fwdpy/debug.pyx":24
 *     return [check_popdata_metapop(i) for i in p]
 * 
 * def check_popdata(object p):             # <<<<<<<<<<<<<<
 *     """
 *     Apply fwdpp's debugging functions to population containers.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("fwdpy.fwdpy.check_popdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/ages.pyx":5
 * from libcpp.limits cimport numeric_limits
 * 
 * def allele_ages( list trajectories, double minfreq = 0.0, unsigned minsojourn = 1 ):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate allele age information from mutation frequency trajectories.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_95allele_ages(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_94allele_ages[] = "\n    Calculate allele age information from mutation frequency trajectories.\n\n    The return value is a list of dicts that include the generation when the mutation arose, its effect size, \n    maximum frequency, and the number of times a frequency was recorded for that mutation.\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_95allele_ages = {"allele_ages", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_95allele_ages, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_94allele_ages};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_95allele_ages(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_trajectories = 0;
  double __pyx_v_minfreq;
  unsigned int __pyx_v_minsojourn;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("allele_ages (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_trajectories,&__pyx_n_s_minfreq,&__pyx_n_s_minsojourn,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_trajectories)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_minfreq);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_minsojourn);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "allele_ages") < 0)) __PYX_ERR(9, 5, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_trajectories = ((PyObject*)values[0]);
    if (values[1]) {
      __pyx_v_minfreq = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_minfreq == (double)-1) && PyErr_Occurred())) __PYX_ERR(9, 5, __pyx_L3_error)
    } else {
      __pyx_v_minfreq = ((double)0.0);
    }
    if (values[2]) {
      __pyx_v_minsojourn = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_minsojourn == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(9, 5, __pyx_L3_error)
    } else {
      __pyx_v_minsojourn = ((unsigned int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("allele_ages", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(9, 5, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.allele_ages", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trajectories), (&PyList_Type), 1, "trajectories", 1))) __PYX_ERR(9, 5, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_94allele_ages(__pyx_self, __pyx_v_trajectories, __pyx_v_minfreq, __pyx_v_minsojourn);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_94allele_ages(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_trajectories, double __pyx_v_minfreq, unsigned int __pyx_v_minsojourn) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __pyx_t_5fwdpy_5fwdpy_freqTraj __pyx_t_1;
  std::vector<struct fwdpy::allele_age_data_t>  __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("allele_ages", 0);

  /* "fwdpy/ages.pyx":12
 *     maximum frequency, and the number of times a frequency was recorded for that mutation.
 *     """
 *     return  allele_ages_details(trajectories,minfreq,minsojourn)             # <<<<<<<<<<<<<<
 * 
 * def merge_trajectories(list trajectories1, list trajectories2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_from_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(__pyx_v_trajectories); if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 12, __pyx_L1_error)
  try {
    __pyx_t_2 = fwdpy::allele_ages_details(__pyx_t_1, __pyx_v_minfreq, __pyx_v_minsojourn);
  } catch(...) {
    __Pyx_CppExn2PyErr();
    __PYX_ERR(9, 12, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_allele_age_data_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(9, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "fwdpy/ages.pyx":5
 * from libcpp.limits cimport numeric_limits
 * 
 * def allele_ages( list trajectories, double minfreq = 0.0, unsigned minsojourn = 1 ):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate allele age information from mutation frequency trajectories.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("fwdpy.fwdpy.allele_ages", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/ages.pyx":14
 *     return  allele_ages_details(trajectories,minfreq,minsojourn)
 * 
 * def merge_trajectories(list trajectories1, list trajectories2):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_97merge_trajectories(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_96merge_trajectories[] = "\n    Take two sets of mutation trajectories and merge them.\n\n    The intended use case is that trajectories2 are from a later time point of the same\n    simulations used to generate trajectories 1.  For example, trajectories 1 may represent \n    mutations arising during evolution to equilibrium, and trajectories2 represent what happend\n    during a bottleneck.\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_97merge_trajectories = {"merge_trajectories", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_97merge_trajectories, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_96merge_trajectories};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_97merge_trajectories(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_trajectories1 = 0;
  PyObject *__pyx_v_trajectories2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("merge_trajectories (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_trajectories1,&__pyx_n_s_trajectories2,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_trajectories1)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_trajectories2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("merge_trajectories", 1, 2, 2, 1); __PYX_ERR(9, 14, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "merge_trajectories") < 0)) __PYX_ERR(9, 14, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_trajectories1 = ((PyObject*)values[0]);
    __pyx_v_trajectories2 = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("merge_trajectories", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(9, 14, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.merge_trajectories", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trajectories1), (&PyList_Type), 1, "trajectories1", 1))) __PYX_ERR(9, 14, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trajectories2), (&PyList_Type), 1, "trajectories2", 1))) __PYX_ERR(9, 14, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_96merge_trajectories(__pyx_self, __pyx_v_trajectories1, __pyx_v_trajectories2);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_96merge_trajectories(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_trajectories1, PyObject *__pyx_v_trajectories2) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __pyx_t_5fwdpy_5fwdpy_freqTraj __pyx_t_5;
  __pyx_t_5fwdpy_5fwdpy_freqTraj __pyx_t_6;
  __Pyx_RefNannySetupContext("merge_trajectories", 0);

  /* "fwdpy/ages.pyx":24
 *     during a bottleneck.
 *     """
 *     if len(trajectories1) != len(trajectories2):             # <<<<<<<<<<<<<<
 *         raise RuntimeError("the two input lists must be the same length")
 *     return merge_trajectories_details(trajectories1,trajectories2)
 */
  if (unlikely(__pyx_v_trajectories1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(9, 24, __pyx_L1_error)
  }
  __pyx_t_1 = PyList_GET_SIZE(__pyx_v_trajectories1); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(9, 24, __pyx_L1_error)
  if (unlikely(__pyx_v_trajectories2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(9, 24, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_v_trajectories2); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(9, 24, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_1 != __pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "fwdpy/ages.pyx":25
 *     """
 *     if len(trajectories1) != len(trajectories2):
 *         raise RuntimeError("the two input lists must be the same length")             # <<<<<<<<<<<<<<
 *     return merge_trajectories_details(trajectories1,trajectories2)
 *     #rv = []
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__71, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 25, __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(9, 25, __pyx_L1_error)

    /* "fwdpy/ages.pyx":24
 *     during a bottleneck.
 *     """
 *     if len(trajectories1) != len(trajectories2):             # <<<<<<<<<<<<<<
 *         raise RuntimeError("the two input lists must be the same length")
 *     return merge_trajectories_details(trajectories1,trajectories2)
 */
  }

  /* "fwdpy/ages.pyx":26
 *     if len(trajectories1) != len(trajectories2):
 *         raise RuntimeError("the two input lists must be the same length")
 *     return merge_trajectories_details(trajectories1,trajectories2)             # <<<<<<<<<<<<<<
 *     #rv = []
 * #    cdef freqTraj temp,temp2,temp3
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_convert_vector_from_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(__pyx_v_trajectories1); if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 26, __pyx_L1_error)
  __pyx_t_6 = __pyx_convert_vector_from_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(__pyx_v_trajectories2); if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 26, __pyx_L1_error)
  __pyx_t_4 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(fwdpy::merge_trajectories_details(__pyx_t_5, __pyx_t_6)); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "fwdpy/ages.pyx":14
 *     return  allele_ages_details(trajectories,minfreq,minsojourn)
 * 
 * def merge_trajectories(list trajectories1, list trajectories2):             # <<<<<<<<<<<<<<
 * 
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.merge_trajectories", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/ages.pyx":38
 * #    return rv
 * #
 * def tidy_trajectories_details(list trajectories,unsigned min_sojourn, double min_freq,             # <<<<<<<<<<<<<<
 *         unsigned remove_arose_after,unsigned remove_gone_before):
 *     return tidy_trajectory_info(trajectories,min_sojourn,min_freq,remove_gone_before,remove_arose_after)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_99tidy_trajectories_details(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_99tidy_trajectories_details = {"tidy_trajectories_details", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_99tidy_trajectories_details, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_99tidy_trajectories_details(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_trajectories = 0;
  unsigned int __pyx_v_min_sojourn;
  double __pyx_v_min_freq;
  unsigned int __pyx_v_remove_arose_after;
  unsigned int __pyx_v_remove_gone_before;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tidy_trajectories_details (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_trajectories,&__pyx_n_s_min_sojourn,&__pyx_n_s_min_freq,&__pyx_n_s_remove_arose_after,&__pyx_n_s_remove_gone_before,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_trajectories)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min_sojourn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tidy_trajectories_details", 1, 5, 5, 1); __PYX_ERR(9, 38, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min_freq)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tidy_trajectories_details", 1, 5, 5, 2); __PYX_ERR(9, 38, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_remove_arose_after)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tidy_trajectories_details", 1, 5, 5, 3); __PYX_ERR(9, 38, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_remove_gone_before)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("tidy_trajectories_details", 1, 5, 5, 4); __PYX_ERR(9, 38, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tidy_trajectories_details") < 0)) __PYX_ERR(9, 38, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_trajectories = ((PyObject*)values[0]);
    __pyx_v_min_sojourn = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_min_sojourn == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(9, 38, __pyx_L3_error)
    __pyx_v_min_freq = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_min_freq == (double)-1) && PyErr_Occurred())) __PYX_ERR(9, 38, __pyx_L3_error)
    __pyx_v_remove_arose_after = __Pyx_PyInt_As_unsigned_int(values[3]); if (unlikely((__pyx_v_remove_arose_after == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(9, 39, __pyx_L3_error)
    __pyx_v_remove_gone_before = __Pyx_PyInt_As_unsigned_int(values[4]); if (unlikely((__pyx_v_remove_gone_before == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(9, 39, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tidy_trajectories_details", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(9, 38, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.tidy_trajectories_details", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trajectories), (&PyList_Type), 1, "trajectories", 1))) __PYX_ERR(9, 38, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_98tidy_trajectories_details(__pyx_self, __pyx_v_trajectories, __pyx_v_min_sojourn, __pyx_v_min_freq, __pyx_v_remove_arose_after, __pyx_v_remove_gone_before);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_98tidy_trajectories_details(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_trajectories, unsigned int __pyx_v_min_sojourn, double __pyx_v_min_freq, unsigned int __pyx_v_remove_arose_after, unsigned int __pyx_v_remove_gone_before) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __pyx_t_5fwdpy_5fwdpy_freqTraj __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("tidy_trajectories_details", 0);

  /* "fwdpy/ages.pyx":40
 * def tidy_trajectories_details(list trajectories,unsigned min_sojourn, double min_freq,
 *         unsigned remove_arose_after,unsigned remove_gone_before):
 *     return tidy_trajectory_info(trajectories,min_sojourn,min_freq,remove_gone_before,remove_arose_after)             # <<<<<<<<<<<<<<
 * 
 * #def tidy_trajectories_details_list(list trajectories,unsigned min_sojourn, double min_freq,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_from_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(__pyx_v_trajectories); if (unlikely(PyErr_Occurred())) __PYX_ERR(9, 40, __pyx_L1_error)
  __pyx_t_2 = __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_selected_mut_data_tidy(fwdpy::tidy_trajectory_info(__pyx_t_1, __pyx_v_min_sojourn, __pyx_v_min_freq, __pyx_v_remove_gone_before, __pyx_v_remove_arose_after)); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "fwdpy/ages.pyx":38
 * #    return rv
 * #
 * def tidy_trajectories_details(list trajectories,unsigned min_sojourn, double min_freq,             # <<<<<<<<<<<<<<
 *         unsigned remove_arose_after,unsigned remove_gone_before):
 *     return tidy_trajectory_info(trajectories,min_sojourn,min_freq,remove_gone_before,remove_arose_after)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("fwdpy.fwdpy.tidy_trajectories_details", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/ages.pyx":47
 * #        yield tidy_trajectory_info((<freqTrajectories>i).thisptr,min_sojourn,min_freq,remove_gone_before,remove_arose_after)
 * 
 * def tidy_trajectories(trajectories, unsigned min_sojourn = 0, double min_freq = 0.0,             # <<<<<<<<<<<<<<
 *         remove_arose_after = None,remove_gone_before = None):
 *     """
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_101tidy_trajectories(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_100tidy_trajectories[] = "\n    Take a set of allele frequency trajectories and 'tidy' them for easier coercion into\n    a pandas.DataFrame.\n\n    :param trajectories: A list of mutation frequency trajectories from :class:`fwdpy.fwdpy.FreqSampler`.\n    :param min_sojourn: Exclude mutations that segregate for fewer generations than this value.\n    :param min_freq: Exclude mutations that never reach a frequency :math:`\\geq` this value.\n    :param remove_arose_after: (None) Do not include mutations whose origin times are > this value.\n    :param remove_gone_before: (None) Do not include mutations whose last recorded generation are <= this value.\n\n    .. note:: The sojourn time filter is not applied to fixations.  I'm assuming you are always interested in those.\n\n    The frequency data for each generation for each mutation are represesnted as a dict.\n\n    :rtype: list of dicts or generator to such a list\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_101tidy_trajectories = {"tidy_trajectories", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_101tidy_trajectories, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_100tidy_trajectories};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_101tidy_trajectories(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_trajectories = 0;
  unsigned int __pyx_v_min_sojourn;
  double __pyx_v_min_freq;
  PyObject *__pyx_v_remove_arose_after = 0;
  PyObject *__pyx_v_remove_gone_before = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tidy_trajectories (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_trajectories,&__pyx_n_s_min_sojourn,&__pyx_n_s_min_freq,&__pyx_n_s_remove_arose_after,&__pyx_n_s_remove_gone_before,0};
    PyObject* values[5] = {0,0,0,0,0};

    /* "fwdpy/ages.pyx":48
 * 
 * def tidy_trajectories(trajectories, unsigned min_sojourn = 0, double min_freq = 0.0,
 *         remove_arose_after = None,remove_gone_before = None):             # <<<<<<<<<<<<<<
 *     """
 *     Take a set of allele frequency trajectories and 'tidy' them for easier coercion into
 */
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_trajectories)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min_sojourn);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min_freq);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_remove_arose_after);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_remove_gone_before);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tidy_trajectories") < 0)) __PYX_ERR(9, 47, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_trajectories = values[0];
    if (values[1]) {
      __pyx_v_min_sojourn = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_min_sojourn == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(9, 47, __pyx_L3_error)
    } else {
      __pyx_v_min_sojourn = ((unsigned int)0);
    }
    if (values[2]) {
      __pyx_v_min_freq = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_min_freq == (double)-1) && PyErr_Occurred())) __PYX_ERR(9, 47, __pyx_L3_error)
    } else {
      __pyx_v_min_freq = ((double)0.0);
    }
    __pyx_v_remove_arose_after = values[3];
    __pyx_v_remove_gone_before = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tidy_trajectories", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(9, 47, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.tidy_trajectories", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_100tidy_trajectories(__pyx_self, __pyx_v_trajectories, __pyx_v_min_sojourn, __pyx_v_min_freq, __pyx_v_remove_arose_after, __pyx_v_remove_gone_before);

  /* "fwdpy/ages.pyx":47
 * #        yield tidy_trajectory_info((<freqTrajectories>i).thisptr,min_sojourn,min_freq,remove_gone_before,remove_arose_after)
 * 
 * def tidy_trajectories(trajectories, unsigned min_sojourn = 0, double min_freq = 0.0,             # <<<<<<<<<<<<<<
 *         remove_arose_after = None,remove_gone_before = None):
 *     """
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_100tidy_trajectories(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_trajectories, unsigned int __pyx_v_min_sojourn, double __pyx_v_min_freq, PyObject *__pyx_v_remove_arose_after, PyObject *__pyx_v_remove_gone_before) {
  std::numeric_limits<unsigned int>  __pyx_v_ul;
  unsigned int __pyx_v_raf;
  unsigned int __pyx_v_rgb;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  unsigned int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  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;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("tidy_trajectories", 0);

  /* "fwdpy/ages.pyx":66
 *     """
 *     cdef numeric_limits[unsigned] ul
 *     cdef unsigned raf = ul.max()             # <<<<<<<<<<<<<<
 *     cdef unsigned rgb = 0
 *     if remove_arose_after is not None:
 */
  __pyx_v_raf = __pyx_v_ul.max();

  /* "fwdpy/ages.pyx":67
 *     cdef numeric_limits[unsigned] ul
 *     cdef unsigned raf = ul.max()
 *     cdef unsigned rgb = 0             # <<<<<<<<<<<<<<
 *     if remove_arose_after is not None:
 *         raf=remove_arose_after
 */
  __pyx_v_rgb = 0;

  /* "fwdpy/ages.pyx":68
 *     cdef unsigned raf = ul.max()
 *     cdef unsigned rgb = 0
 *     if remove_arose_after is not None:             # <<<<<<<<<<<<<<
 *         raf=remove_arose_after
 *     if remove_gone_before is not None:
 */
  __pyx_t_1 = (__pyx_v_remove_arose_after != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/ages.pyx":69
 *     cdef unsigned rgb = 0
 *     if remove_arose_after is not None:
 *         raf=remove_arose_after             # <<<<<<<<<<<<<<
 *     if remove_gone_before is not None:
 *         rgb=remove_gone_before
 */
    __pyx_t_3 = __Pyx_PyInt_As_unsigned_int(__pyx_v_remove_arose_after); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(9, 69, __pyx_L1_error)
    __pyx_v_raf = __pyx_t_3;

    /* "fwdpy/ages.pyx":68
 *     cdef unsigned raf = ul.max()
 *     cdef unsigned rgb = 0
 *     if remove_arose_after is not None:             # <<<<<<<<<<<<<<
 *         raf=remove_arose_after
 *     if remove_gone_before is not None:
 */
  }

  /* "fwdpy/ages.pyx":70
 *     if remove_arose_after is not None:
 *         raf=remove_arose_after
 *     if remove_gone_before is not None:             # <<<<<<<<<<<<<<
 *         rgb=remove_gone_before
 *     return tidy_trajectories_details(trajectories,min_sojourn,min_freq,raf,rgb)
 */
  __pyx_t_2 = (__pyx_v_remove_gone_before != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/ages.pyx":71
 *         raf=remove_arose_after
 *     if remove_gone_before is not None:
 *         rgb=remove_gone_before             # <<<<<<<<<<<<<<
 *     return tidy_trajectories_details(trajectories,min_sojourn,min_freq,raf,rgb)
 * 
 */
    __pyx_t_3 = __Pyx_PyInt_As_unsigned_int(__pyx_v_remove_gone_before); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(9, 71, __pyx_L1_error)
    __pyx_v_rgb = __pyx_t_3;

    /* "fwdpy/ages.pyx":70
 *     if remove_arose_after is not None:
 *         raf=remove_arose_after
 *     if remove_gone_before is not None:             # <<<<<<<<<<<<<<
 *         rgb=remove_gone_before
 *     return tidy_trajectories_details(trajectories,min_sojourn,min_freq,raf,rgb)
 */
  }

  /* "fwdpy/ages.pyx":72
 *     if remove_gone_before is not None:
 *         rgb=remove_gone_before
 *     return tidy_trajectories_details(trajectories,min_sojourn,min_freq,raf,rgb)             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_tidy_trajectories_details); if (unlikely(!__pyx_t_5)) __PYX_ERR(9, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_unsigned_int(__pyx_v_min_sojourn); if (unlikely(!__pyx_t_6)) __PYX_ERR(9, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_min_freq); if (unlikely(!__pyx_t_7)) __PYX_ERR(9, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyInt_From_unsigned_int(__pyx_v_raf); if (unlikely(!__pyx_t_8)) __PYX_ERR(9, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_rgb); if (unlikely(!__pyx_t_9)) __PYX_ERR(9, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[6] = {__pyx_t_10, __pyx_v_trajectories, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 5+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 72, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[6] = {__pyx_t_10, __pyx_v_trajectories, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 5+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 72, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_12 = PyTuple_New(5+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(9, 72, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (__pyx_t_10) {
      __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
    }
    __Pyx_INCREF(__pyx_v_trajectories);
    __Pyx_GIVEREF(__pyx_v_trajectories);
    PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_v_trajectories);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_11, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_12, 4+__pyx_t_11, __pyx_t_9);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_9 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(9, 72, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "fwdpy/ages.pyx":47
 * #        yield tidy_trajectory_info((<freqTrajectories>i).thisptr,min_sojourn,min_freq,remove_gone_before,remove_arose_after)
 * 
 * def tidy_trajectories(trajectories, unsigned min_sojourn = 0, double min_freq = 0.0,             # <<<<<<<<<<<<<<
 *         remove_arose_after = None,remove_gone_before = None):
 *     """
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("fwdpy.fwdpy.tidy_trajectories", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":6
 * # distutils: language = c++
 * cdef class TemporalSampler:
 *     cpdef size_t size(self):             # <<<<<<<<<<<<<<
 *         return self.vec.size()
 *     def __dealloc__(self):
 */

static PyObject *__pyx_pw_5fwdpy_5fwdpy_15TemporalSampler_1size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static size_t __pyx_f_5fwdpy_5fwdpy_15TemporalSampler_size(struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_self, int __pyx_skip_dispatch) {
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  __Pyx_RefNannySetupContext("size", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_15TemporalSampler_1size)) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __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);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 6, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 6, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(4, 6, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_5;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "fwdpy/temporal_samplers.pyx":7
 * cdef class TemporalSampler:
 *     cpdef size_t size(self):
 *         return self.vec.size()             # <<<<<<<<<<<<<<
 *     def __dealloc__(self):
 *         clear_samplers(self.vec)
 */
  __pyx_r = __pyx_v_self->vec.size();
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":6
 * # distutils: language = c++
 * cdef class TemporalSampler:
 *     cpdef size_t size(self):             # <<<<<<<<<<<<<<
 *         return self.vec.size()
 *     def __dealloc__(self):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("fwdpy.fwdpy.TemporalSampler.size", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_15TemporalSampler_1size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_15TemporalSampler_1size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("size (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_15TemporalSampler_size(((struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_15TemporalSampler_size(struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("size", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_f_5fwdpy_5fwdpy_15TemporalSampler_size(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __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("fwdpy.fwdpy.TemporalSampler.size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":8
 *     cpdef size_t size(self):
 *         return self.vec.size()
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         clear_samplers(self.vec)
 *     def force_clear(self):
 */

/* Python wrapper */
static void __pyx_pw_5fwdpy_5fwdpy_15TemporalSampler_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5fwdpy_5fwdpy_15TemporalSampler_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_5fwdpy_5fwdpy_15TemporalSampler_2__dealloc__(((struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5fwdpy_5fwdpy_15TemporalSampler_2__dealloc__(struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "fwdpy/temporal_samplers.pyx":9
 *         return self.vec.size()
 *     def __dealloc__(self):
 *         clear_samplers(self.vec)             # <<<<<<<<<<<<<<
 *     def force_clear(self):
 *         clear_samplers(self.vec)
 */
  fwdpy::clear_samplers(__pyx_v_self->vec);

  /* "fwdpy/temporal_samplers.pyx":8
 *     cpdef size_t size(self):
 *         return self.vec.size()
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         clear_samplers(self.vec)
 *     def force_clear(self):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "fwdpy/temporal_samplers.pyx":10
 *     def __dealloc__(self):
 *         clear_samplers(self.vec)
 *     def force_clear(self):             # <<<<<<<<<<<<<<
 *         clear_samplers(self.vec)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_15TemporalSampler_5force_clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_15TemporalSampler_5force_clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("force_clear (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_15TemporalSampler_4force_clear(((struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_15TemporalSampler_4force_clear(struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("force_clear", 0);

  /* "fwdpy/temporal_samplers.pyx":11
 *         clear_samplers(self.vec)
 *     def force_clear(self):
 *         clear_samplers(self.vec)             # <<<<<<<<<<<<<<
 * 
 * cdef class NothingSampler(TemporalSampler):
 */
  fwdpy::clear_samplers(__pyx_v_self->vec);

  /* "fwdpy/temporal_samplers.pyx":10
 *     def __dealloc__(self):
 *         clear_samplers(self.vec)
 *     def force_clear(self):             # <<<<<<<<<<<<<<
 *         clear_samplers(self.vec)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":20
 *     where you are not interested in recording.
 *     """
 *     def __cinit__(self, unsigned n):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

/* Python wrapper */
static int __pyx_pw_5fwdpy_5fwdpy_14NothingSampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5fwdpy_5fwdpy_14NothingSampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_n;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(4, 20, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_n = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(4, 20, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.NothingSampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_14NothingSampler___cinit__(((struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler *)__pyx_v_self), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5fwdpy_5fwdpy_14NothingSampler___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler *__pyx_v_self, unsigned int __pyx_v_n) {
  CYTHON_UNUSED unsigned int __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  unsigned int __pyx_t_1;
  unsigned int __pyx_t_2;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "fwdpy/temporal_samplers.pyx":26
 *         :param n: A length.  Must correspond to number of simulations that will be run simultaneously.
 *         """
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[no_sampling](new no_sampling()))
 *     def get(self):
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/temporal_samplers.pyx":27
 *         """
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[no_sampling](new no_sampling()))             # <<<<<<<<<<<<<<
 *     def get(self):
 *         """
 */
    try {
      __pyx_v_self->__pyx_base.vec.push_back(((std::unique_ptr<fwdpy::sampler_base> )std::unique_ptr<fwdpy::no_sampling> (new fwdpy::no_sampling())));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(4, 27, __pyx_L1_error)
    }
  }

  /* "fwdpy/temporal_samplers.pyx":20
 *     where you are not interested in recording.
 *     """
 *     def __cinit__(self, unsigned n):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.NothingSampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":28
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[no_sampling](new no_sampling()))
 *     def get(self):             # <<<<<<<<<<<<<<
 *         """
 *         Retrieve the data from the sampler.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_14NothingSampler_3get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_14NothingSampler_2get[] = "\n        Retrieve the data from the sampler.\n\n        :return: None\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_14NothingSampler_3get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_14NothingSampler_2get(((struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_14NothingSampler_2get(CYTHON_UNUSED struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get", 0);

  /* "fwdpy/temporal_samplers.pyx":34
 *         :return: None
 *         """
 *         return None             # <<<<<<<<<<<<<<
 * 
 * cdef class QtraitStatsSampler(TemporalSampler):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":28
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[no_sampling](new no_sampling()))
 *     def get(self):             # <<<<<<<<<<<<<<
 *         """
 *         Retrieve the data from the sampler.
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":45
 *     .. note:: This is not useful for the standard fwdpy population.  It only actually records anything meaningful in the qtrait and qtrait_mloc modules.  This will change in a future release.
 *     """
 *     def __cinit__(self, unsigned n, double optimum):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

/* Python wrapper */
static int __pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_n;
  double __pyx_v_optimum;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_optimum,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_optimum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(4, 45, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(4, 45, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_n = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(4, 45, __pyx_L3_error)
    __pyx_v_optimum = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_optimum == (double)-1) && PyErr_Occurred())) __PYX_ERR(4, 45, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 45, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.QtraitStatsSampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler___cinit__(((struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *)__pyx_v_self), __pyx_v_n, __pyx_v_optimum);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *__pyx_v_self, unsigned int __pyx_v_n, double __pyx_v_optimum) {
  CYTHON_UNUSED unsigned int __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  unsigned int __pyx_t_1;
  unsigned int __pyx_t_2;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "fwdpy/temporal_samplers.pyx":52
 *         :param optimum: The value of the optimum trait/fitness value.
 *         """
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[pop_properties](new pop_properties(optimum)))
 *     def __iter__(self):
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/temporal_samplers.pyx":53
 *         """
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[pop_properties](new pop_properties(optimum)))             # <<<<<<<<<<<<<<
 *     def __iter__(self):
 *         for i in range(self.vec.size()):
 */
    try {
      __pyx_v_self->__pyx_base.vec.push_back(((std::unique_ptr<fwdpy::sampler_base> )std::unique_ptr<fwdpy::pop_properties> (new fwdpy::pop_properties(__pyx_v_optimum))));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(4, 53, __pyx_L1_error)
    }
  }

  /* "fwdpy/temporal_samplers.pyx":45
 *     .. note:: This is not useful for the standard fwdpy population.  It only actually records anything meaningful in the qtrait and qtrait_mloc modules.  This will change in a future release.
 *     """
 *     def __cinit__(self, unsigned n, double optimum):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.QtraitStatsSampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5fwdpy_5fwdpy_18QtraitStatsSampler_4generator4(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "fwdpy/temporal_samplers.pyx":54
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[pop_properties](new pop_properties(optimum)))
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.vec.size()):
 *             yield (<pop_properties*>(self.vec[i].get())).final()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_2__iter__(((struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_2__iter__(struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *__pyx_v_self) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ *)__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__(__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(4, 54, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5fwdpy_5fwdpy_18QtraitStatsSampler_4generator4, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_QtraitStatsSampler___iter, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!gen)) __PYX_ERR(4, 54, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.QtraitStatsSampler.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5fwdpy_5fwdpy_18QtraitStatsSampler_4generator4(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(4, 54, __pyx_L1_error)

  /* "fwdpy/temporal_samplers.pyx":55
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[pop_properties](new pop_properties(optimum)))
 *     def __iter__(self):
 *         for i in range(self.vec.size()):             # <<<<<<<<<<<<<<
 *             yield (<pop_properties*>(self.vec[i].get())).final()
 *     def __next__(self):
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->__pyx_base.vec.size();
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_2;

    /* "fwdpy/temporal_samplers.pyx":56
 *     def __iter__(self):
 *         for i in range(self.vec.size()):
 *             yield (<pop_properties*>(self.vec[i].get())).final()             # <<<<<<<<<<<<<<
 *     def __next__(self):
 *         return next(self)
 */
    __pyx_t_3 = __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_qtrait_stats_cython(((fwdpy::pop_properties *)(__pyx_cur_scope->__pyx_v_self->__pyx_base.vec[__pyx_cur_scope->__pyx_v_i]).get())->final()); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(4, 56, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "fwdpy/temporal_samplers.pyx":54
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[pop_properties](new pop_properties(optimum)))
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.vec.size()):
 *             yield (<pop_properties*>(self.vec[i].get())).final()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":57
 *         for i in range(self.vec.size()):
 *             yield (<pop_properties*>(self.vec[i].get())).final()
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __len__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_6__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_6__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_5__next__(((struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_5__next__(struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "fwdpy/temporal_samplers.pyx":58
 *             yield (<pop_properties*>(self.vec[i].get())).final()
 *     def __next__(self):
 *         return next(self)             # <<<<<<<<<<<<<<
 *     def __len__(self):
 *         return self.vec.size()
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyIter_Next(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":57
 *         for i in range(self.vec.size()):
 *             yield (<pop_properties*>(self.vec[i].get())).final()
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __len__(self):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.QtraitStatsSampler.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":59
 *     def __next__(self):
 *         return next(self)
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.vec.size()
 *     def __getitem__(self,i):
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_8__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_8__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_7__len__(((struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_7__len__(struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "fwdpy/temporal_samplers.pyx":60
 *         return next(self)
 *     def __len__(self):
 *         return self.vec.size()             # <<<<<<<<<<<<<<
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():
 */
  __pyx_r = __pyx_v_self->__pyx_base.vec.size();
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":59
 *     def __next__(self):
 *         return next(self)
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.vec.size()
 *     def __getitem__(self,i):
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":61
 *     def __len__(self):
 *         return self.vec.size()
 *     def __getitem__(self,i):             # <<<<<<<<<<<<<<
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_9__getitem__(((struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *)__pyx_v_self), ((PyObject *)__pyx_v_i));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_9__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *__pyx_v_self, PyObject *__pyx_v_i) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  size_t __pyx_t_4;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "fwdpy/temporal_samplers.pyx":62
 *         return self.vec.size()
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():             # <<<<<<<<<<<<<<
 *             raise IndexError("index out of range")
 *         return (<pop_properties*>(self.vec[i].get())).final()
 */
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->__pyx_base.vec.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 62, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(4, 62, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "fwdpy/temporal_samplers.pyx":63
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")             # <<<<<<<<<<<<<<
 *         return (<pop_properties*>(self.vec[i].get())).final()
 *     def get(self):
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__72, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 63, __pyx_L1_error)

    /* "fwdpy/temporal_samplers.pyx":62
 *         return self.vec.size()
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():             # <<<<<<<<<<<<<<
 *             raise IndexError("index out of range")
 *         return (<pop_properties*>(self.vec[i].get())).final()
 */
  }

  /* "fwdpy/temporal_samplers.pyx":64
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")
 *         return (<pop_properties*>(self.vec[i].get())).final()             # <<<<<<<<<<<<<<
 *     def get(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_i); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(4, 64, __pyx_L1_error)
  __pyx_t_2 = __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_qtrait_stats_cython(((fwdpy::pop_properties *)(__pyx_v_self->__pyx_base.vec[__pyx_t_4]).get())->final()); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":61
 *     def __len__(self):
 *         return self.vec.size()
 *     def __getitem__(self,i):             # <<<<<<<<<<<<<<
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("fwdpy.fwdpy.QtraitStatsSampler.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":65
 *             raise IndexError("index out of range")
 *         return (<pop_properties*>(self.vec[i].get())).final()
 *     def get(self):             # <<<<<<<<<<<<<<
 *         """
 *         Retrieve the data from the sampler.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_12get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_18QtraitStatsSampler_11get[] = "\n        Retrieve the data from the sampler.\n\n        .. note:: This returns all data as a list.  It is more RAM-friendly to iterate over the object.\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_12get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_11get(((struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_18QtraitStatsSampler_11get(struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *__pyx_v_self) {
  std::vector<std::vector<struct fwdpy::qtrait_stats_cython> >  __pyx_v_rv;
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get", 0);

  /* "fwdpy/temporal_samplers.pyx":72
 *         """
 *         cdef vector[vector[qtrait_stats_cython]] rv
 *         cdef size_t i=0             # <<<<<<<<<<<<<<
 *         for i in range(self.vec.size()):
 *             rv.push_back((<pop_properties*>(self.vec[i].get())).final())
 */
  __pyx_v_i = 0;

  /* "fwdpy/temporal_samplers.pyx":73
 *         cdef vector[vector[qtrait_stats_cython]] rv
 *         cdef size_t i=0
 *         for i in range(self.vec.size()):             # <<<<<<<<<<<<<<
 *             rv.push_back((<pop_properties*>(self.vec[i].get())).final())
 *         return rv
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.vec.size();
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/temporal_samplers.pyx":74
 *         cdef size_t i=0
 *         for i in range(self.vec.size()):
 *             rv.push_back((<pop_properties*>(self.vec[i].get())).final())             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
    try {
      __pyx_v_rv.push_back(((fwdpy::pop_properties *)(__pyx_v_self->__pyx_base.vec[__pyx_v_i]).get())->final());
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(4, 74, __pyx_L1_error)
    }
  }

  /* "fwdpy/temporal_samplers.pyx":75
 *         for i in range(self.vec.size()):
 *             rv.push_back((<pop_properties*>(self.vec[i].get())).final())
 *         return rv             # <<<<<<<<<<<<<<
 * 
 * cdef class PopSampler(TemporalSampler):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_qtrait_stats_cython_3e___(__pyx_v_rv); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":65
 *             raise IndexError("index out of range")
 *         return (<pop_properties*>(self.vec[i].get())).final()
 *     def get(self):             # <<<<<<<<<<<<<<
 *         """
 *         Retrieve the data from the sampler.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("fwdpy.fwdpy.QtraitStatsSampler.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":84
 *     or accessed via [i].
 *     """
 *     def __cinit__(self, unsigned n, unsigned nsam,GSLrng             # <<<<<<<<<<<<<<
 *             rng,removeFixed=True,neutral_file=None,selected_file=None,boundaries=None,append=False,recordSamples=True,recordDetails=True):
 *         """
 */

/* Python wrapper */
static int __pyx_pw_5fwdpy_5fwdpy_10PopSampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5fwdpy_5fwdpy_10PopSampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_n;
  unsigned int __pyx_v_nsam;
  struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng = 0;
  PyObject *__pyx_v_removeFixed = 0;
  PyObject *__pyx_v_neutral_file = 0;
  PyObject *__pyx_v_selected_file = 0;
  PyObject *__pyx_v_boundaries = 0;
  PyObject *__pyx_v_append = 0;
  PyObject *__pyx_v_recordSamples = 0;
  PyObject *__pyx_v_recordDetails = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_nsam,&__pyx_n_s_rng,&__pyx_n_s_removeFixed,&__pyx_n_s_neutral_file,&__pyx_n_s_selected_file,&__pyx_n_s_boundaries,&__pyx_n_s_append,&__pyx_n_s_recordSamples,&__pyx_n_s_recordDetails,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};

    /* "fwdpy/temporal_samplers.pyx":85
 *     """
 *     def __cinit__(self, unsigned n, unsigned nsam,GSLrng
 *             rng,removeFixed=True,neutral_file=None,selected_file=None,boundaries=None,append=False,recordSamples=True,recordDetails=True):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
    values[3] = ((PyObject *)Py_True);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_False);
    values[8] = ((PyObject *)Py_True);
    values[9] = ((PyObject *)Py_True);
    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);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nsam)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 10, 1); __PYX_ERR(4, 84, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rng)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 10, 2); __PYX_ERR(4, 84, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_removeFixed);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_neutral_file);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_selected_file);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_boundaries);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_append);
          if (value) { values[7] = value; kw_args--; }
        }
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_recordSamples);
          if (value) { values[8] = value; kw_args--; }
        }
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_recordDetails);
          if (value) { values[9] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(4, 84, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(4, 84, __pyx_L3_error)
    __pyx_v_nsam = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_nsam == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(4, 84, __pyx_L3_error)
    __pyx_v_rng = ((struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *)values[2]);
    __pyx_v_removeFixed = values[3];
    __pyx_v_neutral_file = values[4];
    __pyx_v_selected_file = values[5];
    __pyx_v_boundaries = values[6];
    __pyx_v_append = values[7];
    __pyx_v_recordSamples = values[8];
    __pyx_v_recordDetails = values[9];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 84, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.PopSampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rng), __pyx_ptype_5fwdpy_5fwdpy_GSLrng, 1, "rng", 0))) __PYX_ERR(4, 84, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10PopSampler___cinit__(((struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *)__pyx_v_self), __pyx_v_n, __pyx_v_nsam, __pyx_v_rng, __pyx_v_removeFixed, __pyx_v_neutral_file, __pyx_v_selected_file, __pyx_v_boundaries, __pyx_v_append, __pyx_v_recordSamples, __pyx_v_recordDetails);

  /* "fwdpy/temporal_samplers.pyx":84
 *     or accessed via [i].
 *     """
 *     def __cinit__(self, unsigned n, unsigned nsam,GSLrng             # <<<<<<<<<<<<<<
 *             rng,removeFixed=True,neutral_file=None,selected_file=None,boundaries=None,append=False,recordSamples=True,recordDetails=True):
 *         """
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5fwdpy_5fwdpy_10PopSampler___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *__pyx_v_self, unsigned int __pyx_v_n, unsigned int __pyx_v_nsam, struct __pyx_obj_5fwdpy_5fwdpy_GSLrng *__pyx_v_rng, PyObject *__pyx_v_removeFixed, PyObject *__pyx_v_neutral_file, PyObject *__pyx_v_selected_file, PyObject *__pyx_v_boundaries, PyObject *__pyx_v_append, PyObject *__pyx_v_recordSamples, PyObject *__pyx_v_recordDetails) {
  std::string __pyx_v_sfile;
  std::string __pyx_v_nfile;
  std::vector<std::pair<double,double> >  __pyx_v_locus_boundaries;
  unsigned int __pyx_v_i;
  PyObject *__pyx_v_temp = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  std::vector<std::pair<double,double> >  __pyx_t_3;
  std::string __pyx_t_4;
  std::string __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  unsigned int __pyx_t_8;
  unsigned int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "fwdpy/temporal_samplers.pyx":106
 *         cdef cppstring sfile,nfile
 *         cdef vector[pair[double,double]] locus_boundaries
 *         if boundaries is not None:             # <<<<<<<<<<<<<<
 *             locus_boundaries=boundaries
 *         if n==1:
 */
  __pyx_t_1 = (__pyx_v_boundaries != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/temporal_samplers.pyx":107
 *         cdef vector[pair[double,double]] locus_boundaries
 *         if boundaries is not None:
 *             locus_boundaries=boundaries             # <<<<<<<<<<<<<<
 *         if n==1:
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[sample_n](new
 */
    __pyx_t_3 = __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_double_3e___(__pyx_v_boundaries); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 107, __pyx_L1_error)
    __pyx_v_locus_boundaries = __pyx_t_3;

    /* "fwdpy/temporal_samplers.pyx":106
 *         cdef cppstring sfile,nfile
 *         cdef vector[pair[double,double]] locus_boundaries
 *         if boundaries is not None:             # <<<<<<<<<<<<<<
 *             locus_boundaries=boundaries
 *         if n==1:
 */
  }

  /* "fwdpy/temporal_samplers.pyx":108
 *         if boundaries is not None:
 *             locus_boundaries=boundaries
 *         if n==1:             # <<<<<<<<<<<<<<
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[sample_n](new
 *                 sample_n(nsam,rng.thisptr.get(),neutral_file,selected_file,removeFixed,recordSamples,recordDetails,locus_boundaries,append)))
 */
  __pyx_t_2 = ((__pyx_v_n == 1) != 0);
  if (__pyx_t_2) {

    /* "fwdpy/temporal_samplers.pyx":110
 *         if n==1:
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[sample_n](new
 *                 sample_n(nsam,rng.thisptr.get(),neutral_file,selected_file,removeFixed,recordSamples,recordDetails,locus_boundaries,append)))             # <<<<<<<<<<<<<<
 *         else:
 *             for i in range(n):
 */
    __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_neutral_file); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 110, __pyx_L1_error)
    __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_selected_file); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 110, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_removeFixed); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 110, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_recordSamples); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 110, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_recordDetails); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 110, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_append); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 110, __pyx_L1_error)

    /* "fwdpy/temporal_samplers.pyx":109
 *             locus_boundaries=boundaries
 *         if n==1:
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[sample_n](new             # <<<<<<<<<<<<<<
 *                 sample_n(nsam,rng.thisptr.get(),neutral_file,selected_file,removeFixed,recordSamples,recordDetails,locus_boundaries,append)))
 *         else:
 */
    try {
      __pyx_v_self->__pyx_base.vec.push_back(((std::unique_ptr<fwdpy::sampler_base> )std::unique_ptr<fwdpy::sample_n> (new fwdpy::sample_n(__pyx_v_nsam, __pyx_v_rng->thisptr->get(), __pyx_t_4, __pyx_t_5, __pyx_t_2, __pyx_t_1, __pyx_t_6, __pyx_v_locus_boundaries, __pyx_t_7))));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(4, 109, __pyx_L1_error)
    }

    /* "fwdpy/temporal_samplers.pyx":108
 *         if boundaries is not None:
 *             locus_boundaries=boundaries
 *         if n==1:             # <<<<<<<<<<<<<<
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[sample_n](new
 *                 sample_n(nsam,rng.thisptr.get(),neutral_file,selected_file,removeFixed,recordSamples,recordDetails,locus_boundaries,append)))
 */
    goto __pyx_L4;
  }

  /* "fwdpy/temporal_samplers.pyx":112
 *                 sample_n(nsam,rng.thisptr.get(),neutral_file,selected_file,removeFixed,recordSamples,recordDetails,locus_boundaries,append)))
 *         else:
 *             for i in range(n):             # <<<<<<<<<<<<<<
 *                 sfile.clear()
 *                 nfile.clear()
 */
  /*else*/ {
    __pyx_t_8 = __pyx_v_n;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "fwdpy/temporal_samplers.pyx":113
 *         else:
 *             for i in range(n):
 *                 sfile.clear()             # <<<<<<<<<<<<<<
 *                 nfile.clear()
 *                 if selected_file is not None:
 */
      __pyx_v_sfile.clear();

      /* "fwdpy/temporal_samplers.pyx":114
 *             for i in range(n):
 *                 sfile.clear()
 *                 nfile.clear()             # <<<<<<<<<<<<<<
 *                 if selected_file is not None:
 *                     temp=selected_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'
 */
      __pyx_v_nfile.clear();

      /* "fwdpy/temporal_samplers.pyx":115
 *                 sfile.clear()
 *                 nfile.clear()
 *                 if selected_file is not None:             # <<<<<<<<<<<<<<
 *                     temp=selected_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'
 *                     sfile=temp
 */
      __pyx_t_7 = (__pyx_v_selected_file != Py_None);
      __pyx_t_6 = (__pyx_t_7 != 0);
      if (__pyx_t_6) {

        /* "fwdpy/temporal_samplers.pyx":116
 *                 nfile.clear()
 *                 if selected_file is not None:
 *                     temp=selected_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'             # <<<<<<<<<<<<<<
 *                     sfile=temp
 *                 if neutral_file is not None:
 */
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_selected_file, __pyx_n_s_encode); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 116, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__73, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 116, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyNumber_Add(__pyx_t_11, __pyx_kp_b__74); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 116, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_PyInt_From_unsigned_int(__pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 116, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 116, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11);
        __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_12, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 116, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_encode); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 116, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__75, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 116, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = PyNumber_Add(__pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 116, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = PyNumber_Add(__pyx_t_12, __pyx_kp_b_gz); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 116, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF_SET(__pyx_v_temp, __pyx_t_11);
        __pyx_t_11 = 0;

        /* "fwdpy/temporal_samplers.pyx":117
 *                 if selected_file is not None:
 *                     temp=selected_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'
 *                     sfile=temp             # <<<<<<<<<<<<<<
 *                 if neutral_file is not None:
 *                     temp=neutral_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'
 */
        __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_temp); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 117, __pyx_L1_error)
        __pyx_v_sfile = __pyx_t_5;

        /* "fwdpy/temporal_samplers.pyx":115
 *                 sfile.clear()
 *                 nfile.clear()
 *                 if selected_file is not None:             # <<<<<<<<<<<<<<
 *                     temp=selected_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'
 *                     sfile=temp
 */
      }

      /* "fwdpy/temporal_samplers.pyx":118
 *                     temp=selected_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'
 *                     sfile=temp
 *                 if neutral_file is not None:             # <<<<<<<<<<<<<<
 *                     temp=neutral_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'
 *                     nfile=temp
 */
      __pyx_t_6 = (__pyx_v_neutral_file != Py_None);
      __pyx_t_7 = (__pyx_t_6 != 0);
      if (__pyx_t_7) {

        /* "fwdpy/temporal_samplers.pyx":119
 *                     sfile=temp
 *                 if neutral_file is not None:
 *                     temp=neutral_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'             # <<<<<<<<<<<<<<
 *                     nfile=temp
 *                 self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[sample_n](new
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_neutral_file, __pyx_n_s_encode); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 119, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__76, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 119, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = PyNumber_Add(__pyx_t_12, __pyx_kp_b__74); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 119, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = __Pyx_PyInt_From_unsigned_int(__pyx_v_i); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 119, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 119, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_12);
        __pyx_t_12 = 0;
        __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_10, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 119, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_encode); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 119, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__77, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 119, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyNumber_Add(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 119, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = PyNumber_Add(__pyx_t_10, __pyx_kp_b_gz); if (unlikely(!__pyx_t_12)) __PYX_ERR(4, 119, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF_SET(__pyx_v_temp, __pyx_t_12);
        __pyx_t_12 = 0;

        /* "fwdpy/temporal_samplers.pyx":120
 *                 if neutral_file is not None:
 *                     temp=neutral_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'
 *                     nfile=temp             # <<<<<<<<<<<<<<
 *                 self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[sample_n](new
 *                 sample_n(nsam,rng.thisptr.get(),nfile,sfile,removeFixed,recordSamples,recordDetails,locus_boundaries,append)))
 */
        __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_temp); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 120, __pyx_L1_error)
        __pyx_v_nfile = __pyx_t_5;

        /* "fwdpy/temporal_samplers.pyx":118
 *                     temp=selected_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'
 *                     sfile=temp
 *                 if neutral_file is not None:             # <<<<<<<<<<<<<<
 *                     temp=neutral_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'
 *                     nfile=temp
 */
      }

      /* "fwdpy/temporal_samplers.pyx":122
 *                     nfile=temp
 *                 self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[sample_n](new
 *                 sample_n(nsam,rng.thisptr.get(),nfile,sfile,removeFixed,recordSamples,recordDetails,locus_boundaries,append)))             # <<<<<<<<<<<<<<
 *     def __iter__(self):
 *         for i in range(self.vec.size()):
 */
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_removeFixed); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 122, __pyx_L1_error)
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_recordSamples); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 122, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_recordDetails); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 122, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_append); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 122, __pyx_L1_error)

      /* "fwdpy/temporal_samplers.pyx":121
 *                     temp=neutral_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'
 *                     nfile=temp
 *                 self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[sample_n](new             # <<<<<<<<<<<<<<
 *                 sample_n(nsam,rng.thisptr.get(),nfile,sfile,removeFixed,recordSamples,recordDetails,locus_boundaries,append)))
 *     def __iter__(self):
 */
      try {
        __pyx_v_self->__pyx_base.vec.push_back(((std::unique_ptr<fwdpy::sampler_base> )std::unique_ptr<fwdpy::sample_n> (new fwdpy::sample_n(__pyx_v_nsam, __pyx_v_rng->thisptr->get(), __pyx_v_nfile, __pyx_v_sfile, __pyx_t_7, __pyx_t_6, __pyx_t_1, __pyx_v_locus_boundaries, __pyx_t_2))));
      } catch(...) {
        __Pyx_CppExn2PyErr();
        __PYX_ERR(4, 121, __pyx_L1_error)
      }
    }
  }
  __pyx_L4:;

  /* "fwdpy/temporal_samplers.pyx":84
 *     or accessed via [i].
 *     """
 *     def __cinit__(self, unsigned n, unsigned nsam,GSLrng             # <<<<<<<<<<<<<<
 *             rng,removeFixed=True,neutral_file=None,selected_file=None,boundaries=None,append=False,recordSamples=True,recordDetails=True):
 *         """
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("fwdpy.fwdpy.PopSampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_temp);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5fwdpy_5fwdpy_10PopSampler_4generator5(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "fwdpy/temporal_samplers.pyx":123
 *                 self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[sample_n](new
 *                 sample_n(nsam,rng.thisptr.get(),nfile,sfile,removeFixed,recordSamples,recordDetails,locus_boundaries,append)))
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.vec.size()):
 *             yield (<sample_n*>self.vec[i].get()).final()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10PopSampler_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10PopSampler_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10PopSampler_2__iter__(((struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_10PopSampler_2__iter__(struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *__pyx_v_self) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ *)__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__(__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(4, 123, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5fwdpy_5fwdpy_10PopSampler_4generator5, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_PopSampler___iter, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!gen)) __PYX_ERR(4, 123, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.PopSampler.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5fwdpy_5fwdpy_10PopSampler_4generator5(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(4, 123, __pyx_L1_error)

  /* "fwdpy/temporal_samplers.pyx":124
 *                 sample_n(nsam,rng.thisptr.get(),nfile,sfile,removeFixed,recordSamples,recordDetails,locus_boundaries,append)))
 *     def __iter__(self):
 *         for i in range(self.vec.size()):             # <<<<<<<<<<<<<<
 *             yield (<sample_n*>self.vec[i].get()).final()
 *     def __next__(self):
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->__pyx_base.vec.size();
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_2;

    /* "fwdpy/temporal_samplers.pyx":125
 *     def __iter__(self):
 *         for i in range(self.vec.size()):
 *             yield (<sample_n*>self.vec[i].get()).final()             # <<<<<<<<<<<<<<
 *     def __next__(self):
 *         return next(self)
 */
    __pyx_t_3 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_KTfwd_3a__3a_sep_sample_t_2c_struct__fwdpy_3a__3a_popsample_details_3e___(((fwdpy::sample_n *)(__pyx_cur_scope->__pyx_v_self->__pyx_base.vec[__pyx_cur_scope->__pyx_v_i]).get())->final()); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(4, 125, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "fwdpy/temporal_samplers.pyx":123
 *                 self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[sample_n](new
 *                 sample_n(nsam,rng.thisptr.get(),nfile,sfile,removeFixed,recordSamples,recordDetails,locus_boundaries,append)))
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.vec.size()):
 *             yield (<sample_n*>self.vec[i].get()).final()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":126
 *         for i in range(self.vec.size()):
 *             yield (<sample_n*>self.vec[i].get()).final()
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __getitem__(self, int i):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10PopSampler_6__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10PopSampler_6__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10PopSampler_5__next__(((struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_10PopSampler_5__next__(struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "fwdpy/temporal_samplers.pyx":127
 *             yield (<sample_n*>self.vec[i].get()).final()
 *     def __next__(self):
 *         return next(self)             # <<<<<<<<<<<<<<
 *     def __getitem__(self, int i):
 *         if i>= self.vec.size():
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyIter_Next(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":126
 *         for i in range(self.vec.size()):
 *             yield (<sample_n*>self.vec[i].get()).final()
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __getitem__(self, int i):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.PopSampler.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":128
 *     def __next__(self):
 *         return next(self)
 *     def __getitem__(self, int i):             # <<<<<<<<<<<<<<
 *         if i>= self.vec.size():
 *             raise IndexError("index out of range")
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10PopSampler_8__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_10PopSampler_8__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) {
  int __pyx_v_i;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  assert(__pyx_arg_i); {
    __pyx_v_i = __Pyx_PyInt_As_int(__pyx_arg_i); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 128, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.PopSampler.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10PopSampler_7__getitem__(((struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *)__pyx_v_self), ((int)__pyx_v_i));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_10PopSampler_7__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *__pyx_v_self, int __pyx_v_i) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "fwdpy/temporal_samplers.pyx":129
 *         return next(self)
 *     def __getitem__(self, int i):
 *         if i>= self.vec.size():             # <<<<<<<<<<<<<<
 *             raise IndexError("index out of range")
 *         return (<sample_n*>self.vec[i].get()).final()
 */
  __pyx_t_1 = ((__pyx_v_i >= __pyx_v_self->__pyx_base.vec.size()) != 0);
  if (__pyx_t_1) {

    /* "fwdpy/temporal_samplers.pyx":130
 *     def __getitem__(self, int i):
 *         if i>= self.vec.size():
 *             raise IndexError("index out of range")             # <<<<<<<<<<<<<<
 *         return (<sample_n*>self.vec[i].get()).final()
 *     def __len__(self):
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__78, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 130, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 130, __pyx_L1_error)

    /* "fwdpy/temporal_samplers.pyx":129
 *         return next(self)
 *     def __getitem__(self, int i):
 *         if i>= self.vec.size():             # <<<<<<<<<<<<<<
 *             raise IndexError("index out of range")
 *         return (<sample_n*>self.vec[i].get()).final()
 */
  }

  /* "fwdpy/temporal_samplers.pyx":131
 *         if i>= self.vec.size():
 *             raise IndexError("index out of range")
 *         return (<sample_n*>self.vec[i].get()).final()             # <<<<<<<<<<<<<<
 *     def __len__(self):
 *         return self.vec.size()
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_KTfwd_3a__3a_sep_sample_t_2c_struct__fwdpy_3a__3a_popsample_details_3e___(((fwdpy::sample_n *)(__pyx_v_self->__pyx_base.vec[__pyx_v_i]).get())->final()); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":128
 *     def __next__(self):
 *         return next(self)
 *     def __getitem__(self, int i):             # <<<<<<<<<<<<<<
 *         if i>= self.vec.size():
 *             raise IndexError("index out of range")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("fwdpy.fwdpy.PopSampler.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":132
 *             raise IndexError("index out of range")
 *         return (<sample_n*>self.vec[i].get()).final()
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.vec.size()
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_10PopSampler_10__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_10PopSampler_10__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_10PopSampler_9__len__(((struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_10PopSampler_9__len__(struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "fwdpy/temporal_samplers.pyx":133
 *         return (<sample_n*>self.vec[i].get()).final()
 *     def __len__(self):
 *         return self.vec.size()             # <<<<<<<<<<<<<<
 * 
 * cdef class VASampler(TemporalSampler):
 */
  __pyx_r = __pyx_v_self->__pyx_base.vec.size();
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":132
 *             raise IndexError("index out of range")
 *         return (<sample_n*>self.vec[i].get()).final()
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.vec.size()
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":145
 *     .. note:: This is not useful for the standard fwdpy population.  It only actually records anything meaningful in the qtrait and qtrait_mloc modules.  This will change in a future release.
 *     """
 *     def __cinit__(self,unsigned n):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

/* Python wrapper */
static int __pyx_pw_5fwdpy_5fwdpy_9VASampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5fwdpy_5fwdpy_9VASampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_n;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(4, 145, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_n = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(4, 145, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 145, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.VASampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_9VASampler___cinit__(((struct __pyx_obj_5fwdpy_5fwdpy_VASampler *)__pyx_v_self), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5fwdpy_5fwdpy_9VASampler___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_VASampler *__pyx_v_self, unsigned int __pyx_v_n) {
  CYTHON_UNUSED unsigned int __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  unsigned int __pyx_t_1;
  unsigned int __pyx_t_2;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "fwdpy/temporal_samplers.pyx":151
 *         :param n: A length.  Must correspond to number of simulations that will be run simultaneously.
 *         """
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[additive_variance](new additive_variance()))
 *     def __iter__(self):
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/temporal_samplers.pyx":152
 *         """
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[additive_variance](new additive_variance()))             # <<<<<<<<<<<<<<
 *     def __iter__(self):
 *         for i in range(self.vec.size()):
 */
    try {
      __pyx_v_self->__pyx_base.vec.push_back(((std::unique_ptr<fwdpy::sampler_base> )std::unique_ptr<fwdpy::additive_variance> (new fwdpy::additive_variance())));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(4, 152, __pyx_L1_error)
    }
  }

  /* "fwdpy/temporal_samplers.pyx":145
 *     .. note:: This is not useful for the standard fwdpy population.  It only actually records anything meaningful in the qtrait and qtrait_mloc modules.  This will change in a future release.
 *     """
 *     def __cinit__(self,unsigned n):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.VASampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5fwdpy_5fwdpy_9VASampler_4generator6(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "fwdpy/temporal_samplers.pyx":153
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[additive_variance](new additive_variance()))
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.vec.size()):
 *             yield (<additive_variance*>(self.vec[i].get())).final()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9VASampler_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9VASampler_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_9VASampler_2__iter__(((struct __pyx_obj_5fwdpy_5fwdpy_VASampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_9VASampler_2__iter__(struct __pyx_obj_5fwdpy_5fwdpy_VASampler *__pyx_v_self) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ *)__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__(__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(4, 153, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5fwdpy_5fwdpy_9VASampler_4generator6, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_VASampler___iter, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!gen)) __PYX_ERR(4, 153, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.VASampler.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5fwdpy_5fwdpy_9VASampler_4generator6(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(4, 153, __pyx_L1_error)

  /* "fwdpy/temporal_samplers.pyx":154
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[additive_variance](new additive_variance()))
 *     def __iter__(self):
 *         for i in range(self.vec.size()):             # <<<<<<<<<<<<<<
 *             yield (<additive_variance*>(self.vec[i].get())).final()
 *     def __next__(self):
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->__pyx_base.vec.size();
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_2;

    /* "fwdpy/temporal_samplers.pyx":155
 *     def __iter__(self):
 *         for i in range(self.vec.size()):
 *             yield (<additive_variance*>(self.vec[i].get())).final()             # <<<<<<<<<<<<<<
 *     def __next__(self):
 *         return next(self)
 */
    __pyx_t_3 = __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_VAcum(((fwdpy::additive_variance *)(__pyx_cur_scope->__pyx_v_self->__pyx_base.vec[__pyx_cur_scope->__pyx_v_i]).get())->final()); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(4, 155, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "fwdpy/temporal_samplers.pyx":153
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[additive_variance](new additive_variance()))
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.vec.size()):
 *             yield (<additive_variance*>(self.vec[i].get())).final()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":156
 *         for i in range(self.vec.size()):
 *             yield (<additive_variance*>(self.vec[i].get())).final()
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __len__(self):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9VASampler_6__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9VASampler_6__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_9VASampler_5__next__(((struct __pyx_obj_5fwdpy_5fwdpy_VASampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_9VASampler_5__next__(struct __pyx_obj_5fwdpy_5fwdpy_VASampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "fwdpy/temporal_samplers.pyx":157
 *             yield (<additive_variance*>(self.vec[i].get())).final()
 *     def __next__(self):
 *         return next(self)             # <<<<<<<<<<<<<<
 *     def __len__(self):
 *         return self.vec.size()
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyIter_Next(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":156
 *         for i in range(self.vec.size()):
 *             yield (<additive_variance*>(self.vec[i].get())).final()
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __len__(self):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.VASampler.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":158
 *     def __next__(self):
 *         return next(self)
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.vec.size()
 *     def __getitem__(self,i):
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_9VASampler_8__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_9VASampler_8__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_9VASampler_7__len__(((struct __pyx_obj_5fwdpy_5fwdpy_VASampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_9VASampler_7__len__(struct __pyx_obj_5fwdpy_5fwdpy_VASampler *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "fwdpy/temporal_samplers.pyx":159
 *         return next(self)
 *     def __len__(self):
 *         return self.vec.size()             # <<<<<<<<<<<<<<
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():
 */
  __pyx_r = __pyx_v_self->__pyx_base.vec.size();
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":158
 *     def __next__(self):
 *         return next(self)
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.vec.size()
 *     def __getitem__(self,i):
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":160
 *     def __len__(self):
 *         return self.vec.size()
 *     def __getitem__(self,i):             # <<<<<<<<<<<<<<
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9VASampler_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9VASampler_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_9VASampler_9__getitem__(((struct __pyx_obj_5fwdpy_5fwdpy_VASampler *)__pyx_v_self), ((PyObject *)__pyx_v_i));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_9VASampler_9__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_VASampler *__pyx_v_self, PyObject *__pyx_v_i) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  size_t __pyx_t_4;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "fwdpy/temporal_samplers.pyx":161
 *         return self.vec.size()
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():             # <<<<<<<<<<<<<<
 *             raise IndexError("index out of range")
 *         return (<additive_variance*>(self.vec[i].get())).final()
 */
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->__pyx_base.vec.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 161, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(4, 161, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "fwdpy/temporal_samplers.pyx":162
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")             # <<<<<<<<<<<<<<
 *         return (<additive_variance*>(self.vec[i].get())).final()
 *     def get(self):
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__79, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 162, __pyx_L1_error)

    /* "fwdpy/temporal_samplers.pyx":161
 *         return self.vec.size()
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():             # <<<<<<<<<<<<<<
 *             raise IndexError("index out of range")
 *         return (<additive_variance*>(self.vec[i].get())).final()
 */
  }

  /* "fwdpy/temporal_samplers.pyx":163
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")
 *         return (<additive_variance*>(self.vec[i].get())).final()             # <<<<<<<<<<<<<<
 *     def get(self):
 *         """
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_i); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(4, 163, __pyx_L1_error)
  __pyx_t_2 = __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_VAcum(((fwdpy::additive_variance *)(__pyx_v_self->__pyx_base.vec[__pyx_t_4]).get())->final()); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":160
 *     def __len__(self):
 *         return self.vec.size()
 *     def __getitem__(self,i):             # <<<<<<<<<<<<<<
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("fwdpy.fwdpy.VASampler.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":164
 *             raise IndexError("index out of range")
 *         return (<additive_variance*>(self.vec[i].get())).final()
 *     def get(self):             # <<<<<<<<<<<<<<
 *         """
 *         Retrieve the data from the sampler.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9VASampler_12get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_9VASampler_11get[] = "\n        Retrieve the data from the sampler.\n\n        .. note:: This returns all data as a list.  It is more RAM-friendly to iterate over the object.\n        ";
static PyObject *__pyx_pw_5fwdpy_5fwdpy_9VASampler_12get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_9VASampler_11get(((struct __pyx_obj_5fwdpy_5fwdpy_VASampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_9VASampler_11get(struct __pyx_obj_5fwdpy_5fwdpy_VASampler *__pyx_v_self) {
  std::vector<std::vector<struct fwdpy::VAcum> >  __pyx_v_rv;
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get", 0);

  /* "fwdpy/temporal_samplers.pyx":171
 *         """
 *         cdef vector[vector[VAcum]] rv
 *         cdef size_t i=0             # <<<<<<<<<<<<<<
 *         for i in range(self.vec.size()):
 *             rv.push_back((<additive_variance*>(self.vec[i].get())).final())
 */
  __pyx_v_i = 0;

  /* "fwdpy/temporal_samplers.pyx":172
 *         cdef vector[vector[VAcum]] rv
 *         cdef size_t i=0
 *         for i in range(self.vec.size()):             # <<<<<<<<<<<<<<
 *             rv.push_back((<additive_variance*>(self.vec[i].get())).final())
 *         return rv
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.vec.size();
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/temporal_samplers.pyx":173
 *         cdef size_t i=0
 *         for i in range(self.vec.size()):
 *             rv.push_back((<additive_variance*>(self.vec[i].get())).final())             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
    try {
      __pyx_v_rv.push_back(((fwdpy::additive_variance *)(__pyx_v_self->__pyx_base.vec[__pyx_v_i]).get())->final());
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(4, 173, __pyx_L1_error)
    }
  }

  /* "fwdpy/temporal_samplers.pyx":174
 *         for i in range(self.vec.size()):
 *             rv.push_back((<additive_variance*>(self.vec[i].get())).final())
 *         return rv             # <<<<<<<<<<<<<<
 * 
 * cdef class FreqSampler(TemporalSampler):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_VAcum_3e___(__pyx_v_rv); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":164
 *             raise IndexError("index out of range")
 *         return (<additive_variance*>(self.vec[i].get())).final()
 *     def get(self):             # <<<<<<<<<<<<<<
 *         """
 *         Retrieve the data from the sampler.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("fwdpy.fwdpy.VASampler.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":183
 *     or accessed via [i].
 *     """
 *     def __cinit__(self,unsigned n):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

/* Python wrapper */
static int __pyx_pw_5fwdpy_5fwdpy_11FreqSampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5fwdpy_5fwdpy_11FreqSampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned int __pyx_v_n;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(4, 183, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_n = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(4, 183, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 183, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.FreqSampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_11FreqSampler___cinit__(((struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *)__pyx_v_self), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5fwdpy_5fwdpy_11FreqSampler___cinit__(struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *__pyx_v_self, unsigned int __pyx_v_n) {
  CYTHON_UNUSED unsigned int __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  unsigned int __pyx_t_1;
  unsigned int __pyx_t_2;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "fwdpy/temporal_samplers.pyx":189
 *         :param n: A length.  Must correspond to number of simulations that will be run simultaneously.
 *         """
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[selected_mut_tracker](new selected_mut_tracker()))
 *     def __iter__(self):
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "fwdpy/temporal_samplers.pyx":190
 *         """
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[selected_mut_tracker](new selected_mut_tracker()))             # <<<<<<<<<<<<<<
 *     def __iter__(self):
 *         for i in range(self.vec.size()):
 */
    try {
      __pyx_v_self->__pyx_base.vec.push_back(((std::unique_ptr<fwdpy::sampler_base> )std::unique_ptr<fwdpy::selected_mut_tracker> (new fwdpy::selected_mut_tracker())));
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(4, 190, __pyx_L1_error)
    }
  }

  /* "fwdpy/temporal_samplers.pyx":183
 *     or accessed via [i].
 *     """
 *     def __cinit__(self,unsigned n):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.FreqSampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5fwdpy_5fwdpy_11FreqSampler_4generator7(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "fwdpy/temporal_samplers.pyx":191
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[selected_mut_tracker](new selected_mut_tracker()))
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.vec.size()):
 *             yield (<selected_mut_tracker*>self.vec[i].get()).final()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_11FreqSampler_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_11FreqSampler_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_11FreqSampler_2__iter__(((struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_11FreqSampler_2__iter__(struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *__pyx_v_self) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ *)__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__(__pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(4, 191, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5fwdpy_5fwdpy_11FreqSampler_4generator7, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_FreqSampler___iter, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!gen)) __PYX_ERR(4, 191, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.FreqSampler.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5fwdpy_5fwdpy_11FreqSampler_4generator7(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(4, 191, __pyx_L1_error)

  /* "fwdpy/temporal_samplers.pyx":192
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[selected_mut_tracker](new selected_mut_tracker()))
 *     def __iter__(self):
 *         for i in range(self.vec.size()):             # <<<<<<<<<<<<<<
 *             yield (<selected_mut_tracker*>self.vec[i].get()).final()
 *     def __next__(self):
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->__pyx_base.vec.size();
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_2;

    /* "fwdpy/temporal_samplers.pyx":193
 *     def __iter__(self):
 *         for i in range(self.vec.size()):
 *             yield (<selected_mut_tracker*>self.vec[i].get()).final()             # <<<<<<<<<<<<<<
 *     def __next__(self):
 *         return next(self)
 */
    __pyx_t_3 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(((fwdpy::selected_mut_tracker *)(__pyx_cur_scope->__pyx_v_self->__pyx_base.vec[__pyx_cur_scope->__pyx_v_i]).get())->final()); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(4, 193, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "fwdpy/temporal_samplers.pyx":191
 *         for i in range(n):
 *             self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[selected_mut_tracker](new selected_mut_tracker()))
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         for i in range(self.vec.size()):
 *             yield (<selected_mut_tracker*>self.vec[i].get()).final()
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":194
 *         for i in range(self.vec.size()):
 *             yield (<selected_mut_tracker*>self.vec[i].get()).final()
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __getitem__(self,i):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_11FreqSampler_6__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_11FreqSampler_6__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_11FreqSampler_5__next__(((struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_11FreqSampler_5__next__(struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "fwdpy/temporal_samplers.pyx":195
 *             yield (<selected_mut_tracker*>self.vec[i].get()).final()
 *     def __next__(self):
 *         return next(self)             # <<<<<<<<<<<<<<
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyIter_Next(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":194
 *         for i in range(self.vec.size()):
 *             yield (<selected_mut_tracker*>self.vec[i].get()).final()
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         return next(self)
 *     def __getitem__(self,i):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("fwdpy.fwdpy.FreqSampler.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":196
 *     def __next__(self):
 *         return next(self)
 *     def __getitem__(self,i):             # <<<<<<<<<<<<<<
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_11FreqSampler_8__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/
static PyObject *__pyx_pw_5fwdpy_5fwdpy_11FreqSampler_8__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_11FreqSampler_7__getitem__(((struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *)__pyx_v_self), ((PyObject *)__pyx_v_i));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_11FreqSampler_7__getitem__(struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *__pyx_v_self, PyObject *__pyx_v_i) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  size_t __pyx_t_4;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "fwdpy/temporal_samplers.pyx":197
 *         return next(self)
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():             # <<<<<<<<<<<<<<
 *             raise IndexError("index out of range")
 *         return (<selected_mut_tracker*>self.vec[i].get()).final()
 */
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->__pyx_base.vec.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 197, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(4, 197, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "fwdpy/temporal_samplers.pyx":198
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")             # <<<<<<<<<<<<<<
 *         return (<selected_mut_tracker*>self.vec[i].get()).final()
 *     def __len__(self):
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__80, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 198, __pyx_L1_error)

    /* "fwdpy/temporal_samplers.pyx":197
 *         return next(self)
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():             # <<<<<<<<<<<<<<
 *             raise IndexError("index out of range")
 *         return (<selected_mut_tracker*>self.vec[i].get()).final()
 */
  }

  /* "fwdpy/temporal_samplers.pyx":199
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")
 *         return (<selected_mut_tracker*>self.vec[i].get()).final()             # <<<<<<<<<<<<<<
 *     def __len__(self):
 *         return self.vec.size()
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_i); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(4, 199, __pyx_L1_error)
  __pyx_t_2 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(((fwdpy::selected_mut_tracker *)(__pyx_v_self->__pyx_base.vec[__pyx_t_4]).get())->final()); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":196
 *     def __next__(self):
 *         return next(self)
 *     def __getitem__(self,i):             # <<<<<<<<<<<<<<
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("fwdpy.fwdpy.FreqSampler.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":200
 *             raise IndexError("index out of range")
 *         return (<selected_mut_tracker*>self.vec[i].get()).final()
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.vec.size()
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_11FreqSampler_10__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_5fwdpy_5fwdpy_11FreqSampler_10__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_11FreqSampler_9__len__(((struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_5fwdpy_5fwdpy_11FreqSampler_9__len__(struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "fwdpy/temporal_samplers.pyx":201
 *         return (<selected_mut_tracker*>self.vec[i].get()).final()
 *     def __len__(self):
 *         return self.vec.size()             # <<<<<<<<<<<<<<
 * 
 * def apply_sampler(PopVec pops,TemporalSampler sampler):
 */
  __pyx_r = __pyx_v_self->__pyx_base.vec.size();
  goto __pyx_L0;

  /* "fwdpy/temporal_samplers.pyx":200
 *             raise IndexError("index out of range")
 *         return (<selected_mut_tracker*>self.vec[i].get()).final()
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.vec.size()
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":203
 *         return self.vec.size()
 * 
 * def apply_sampler(PopVec pops,TemporalSampler sampler):             # <<<<<<<<<<<<<<
 *     """
 *     Apply a temporal sampler to a container of populations.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_103apply_sampler(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_102apply_sampler[] = "\n    Apply a temporal sampler to a container of populations.\n\n    :param pops: A :class:`fwdpy.fwdpy.PopVec`\n    :param sampler: A :class:`fwdpy.fwdpy.TemporalSampler`\n\n    :return: Nothing\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_103apply_sampler = {"apply_sampler", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_103apply_sampler, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_102apply_sampler};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_103apply_sampler(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_PopVec *__pyx_v_pops = 0;
  struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_sampler = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_sampler (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pops,&__pyx_n_s_sampler,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pops)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sampler)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_sampler", 1, 2, 2, 1); __PYX_ERR(4, 203, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_sampler") < 0)) __PYX_ERR(4, 203, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pops = ((struct __pyx_obj_5fwdpy_5fwdpy_PopVec *)values[0]);
    __pyx_v_sampler = ((struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_sampler", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 203, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.apply_sampler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pops), __pyx_ptype_5fwdpy_5fwdpy_PopVec, 1, "pops", 0))) __PYX_ERR(4, 203, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sampler), __pyx_ptype_5fwdpy_5fwdpy_TemporalSampler, 1, "sampler", 0))) __PYX_ERR(4, 203, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_102apply_sampler(__pyx_self, __pyx_v_pops, __pyx_v_sampler);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_102apply_sampler(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_PopVec *__pyx_v_pops, struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_sampler) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("apply_sampler", 0);

  /* "fwdpy/temporal_samplers.pyx":213
 *     """
 * 
 *     if not isinstance(pops,PopVec):             # <<<<<<<<<<<<<<
 *         raise TypeError("Expecting PopVec.")
 * 
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pops), __pyx_ptype_5fwdpy_5fwdpy_PopVec); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "fwdpy/temporal_samplers.pyx":214
 * 
 *     if not isinstance(pops,PopVec):
 *         raise TypeError("Expecting PopVec.")             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(pops,SpopVec):
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__81, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 214, __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(4, 214, __pyx_L1_error)

    /* "fwdpy/temporal_samplers.pyx":213
 *     """
 * 
 *     if not isinstance(pops,PopVec):             # <<<<<<<<<<<<<<
 *         raise TypeError("Expecting PopVec.")
 * 
 */
  }

  /* "fwdpy/temporal_samplers.pyx":216
 *         raise TypeError("Expecting PopVec.")
 * 
 *     if isinstance(pops,SpopVec):             # <<<<<<<<<<<<<<
 *         apply_sampler_cpp[singlepop_t]((<SpopVec>pops).pops,sampler.vec)
 *     elif isinstance(pops,MetaPopVec):
 */
  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pops), __pyx_ptype_5fwdpy_5fwdpy_SpopVec); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/temporal_samplers.pyx":217
 * 
 *     if isinstance(pops,SpopVec):
 *         apply_sampler_cpp[singlepop_t]((<SpopVec>pops).pops,sampler.vec)             # <<<<<<<<<<<<<<
 *     elif isinstance(pops,MetaPopVec):
 *         apply_sampler_cpp[metapop_t]((<MetaPopVec>pops).mpops,sampler.vec)
 */
    fwdpy::apply_sampler_cpp<fwdpy::singlepop_t>(((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)__pyx_v_pops)->pops, __pyx_v_sampler->vec);

    /* "fwdpy/temporal_samplers.pyx":216
 *         raise TypeError("Expecting PopVec.")
 * 
 *     if isinstance(pops,SpopVec):             # <<<<<<<<<<<<<<
 *         apply_sampler_cpp[singlepop_t]((<SpopVec>pops).pops,sampler.vec)
 *     elif isinstance(pops,MetaPopVec):
 */
    goto __pyx_L4;
  }

  /* "fwdpy/temporal_samplers.pyx":218
 *     if isinstance(pops,SpopVec):
 *         apply_sampler_cpp[singlepop_t]((<SpopVec>pops).pops,sampler.vec)
 *     elif isinstance(pops,MetaPopVec):             # <<<<<<<<<<<<<<
 *         apply_sampler_cpp[metapop_t]((<MetaPopVec>pops).mpops,sampler.vec)
 *     elif isinstance(pops,MlocusPopVec):
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pops), __pyx_ptype_5fwdpy_5fwdpy_MetaPopVec); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/temporal_samplers.pyx":219
 *         apply_sampler_cpp[singlepop_t]((<SpopVec>pops).pops,sampler.vec)
 *     elif isinstance(pops,MetaPopVec):
 *         apply_sampler_cpp[metapop_t]((<MetaPopVec>pops).mpops,sampler.vec)             # <<<<<<<<<<<<<<
 *     elif isinstance(pops,MlocusPopVec):
 *         apply_sampler_cpp[multilocus_t]((<MlocusPopVec>pops).pops,sampler.vec)
 */
    fwdpy::apply_sampler_cpp<fwdpy::metapop_t>(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)__pyx_v_pops)->mpops, __pyx_v_sampler->vec);

    /* "fwdpy/temporal_samplers.pyx":218
 *     if isinstance(pops,SpopVec):
 *         apply_sampler_cpp[singlepop_t]((<SpopVec>pops).pops,sampler.vec)
 *     elif isinstance(pops,MetaPopVec):             # <<<<<<<<<<<<<<
 *         apply_sampler_cpp[metapop_t]((<MetaPopVec>pops).mpops,sampler.vec)
 *     elif isinstance(pops,MlocusPopVec):
 */
    goto __pyx_L4;
  }

  /* "fwdpy/temporal_samplers.pyx":220
 *     elif isinstance(pops,MetaPopVec):
 *         apply_sampler_cpp[metapop_t]((<MetaPopVec>pops).mpops,sampler.vec)
 *     elif isinstance(pops,MlocusPopVec):             # <<<<<<<<<<<<<<
 *         apply_sampler_cpp[multilocus_t]((<MlocusPopVec>pops).pops,sampler.vec)
 *     else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pops), __pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/temporal_samplers.pyx":221
 *         apply_sampler_cpp[metapop_t]((<MetaPopVec>pops).mpops,sampler.vec)
 *     elif isinstance(pops,MlocusPopVec):
 *         apply_sampler_cpp[multilocus_t]((<MlocusPopVec>pops).pops,sampler.vec)             # <<<<<<<<<<<<<<
 *     else:
 *         raise RuntimeError("PopVec/PopType type not supported")
 */
    fwdpy::apply_sampler_cpp<fwdpy::multilocus_t>(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)__pyx_v_pops)->pops, __pyx_v_sampler->vec);

    /* "fwdpy/temporal_samplers.pyx":220
 *     elif isinstance(pops,MetaPopVec):
 *         apply_sampler_cpp[metapop_t]((<MetaPopVec>pops).mpops,sampler.vec)
 *     elif isinstance(pops,MlocusPopVec):             # <<<<<<<<<<<<<<
 *         apply_sampler_cpp[multilocus_t]((<MlocusPopVec>pops).pops,sampler.vec)
 *     else:
 */
    goto __pyx_L4;
  }

  /* "fwdpy/temporal_samplers.pyx":223
 *         apply_sampler_cpp[multilocus_t]((<MlocusPopVec>pops).pops,sampler.vec)
 *     else:
 *         raise RuntimeError("PopVec/PopType type not supported")             # <<<<<<<<<<<<<<
 * 
 * def apply_sampler_single(PopType pop,TemporalSampler sampler):
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__82, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 223, __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(4, 223, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "fwdpy/temporal_samplers.pyx":203
 *         return self.vec.size()
 * 
 * def apply_sampler(PopVec pops,TemporalSampler sampler):             # <<<<<<<<<<<<<<
 *     """
 *     Apply a temporal sampler to a container of populations.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("fwdpy.fwdpy.apply_sampler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/temporal_samplers.pyx":225
 *         raise RuntimeError("PopVec/PopType type not supported")
 * 
 * def apply_sampler_single(PopType pop,TemporalSampler sampler):             # <<<<<<<<<<<<<<
 *     """
 *     Apply a temporal sampler to an indivudal :class:`fwdpy.fwdpy.PopType`
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_105apply_sampler_single(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_104apply_sampler_single[] = "\n    Apply a temporal sampler to an indivudal :class:`fwdpy.fwdpy.PopType`\n\n    :param pop: A :class:`fwdpy.fwdpy.PopType`\n    :param sampler: A :class:`fwdpy.fwdpy.TemporalSampler`\n\n    The use case for this function is applying very expensive temporal samplers\n    at the end of a simulation.  It is assumed that len(sampler)==1.\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_105apply_sampler_single = {"apply_sampler_single", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_105apply_sampler_single, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_104apply_sampler_single};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_105apply_sampler_single(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_pop = 0;
  struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_sampler = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_sampler_single (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pop,&__pyx_n_s_sampler,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pop)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sampler)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_sampler_single", 1, 2, 2, 1); __PYX_ERR(4, 225, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_sampler_single") < 0)) __PYX_ERR(4, 225, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_pop = ((struct __pyx_obj_5fwdpy_5fwdpy_PopType *)values[0]);
    __pyx_v_sampler = ((struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_sampler_single", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 225, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.apply_sampler_single", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_PopType, 1, "pop", 0))) __PYX_ERR(4, 225, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sampler), __pyx_ptype_5fwdpy_5fwdpy_TemporalSampler, 1, "sampler", 0))) __PYX_ERR(4, 225, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_104apply_sampler_single(__pyx_self, __pyx_v_pop, __pyx_v_sampler);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_104apply_sampler_single(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_pop, struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *__pyx_v_sampler) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("apply_sampler_single", 0);

  /* "fwdpy/temporal_samplers.pyx":235
 *     at the end of a simulation.  It is assumed that len(sampler)==1.
 *     """
 *     if not isinstance(pop,PopType):             # <<<<<<<<<<<<<<
 *         raise TypeError("Expecting PopType.")
 *     if isinstance(pop,Spop):
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_PopType); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "fwdpy/temporal_samplers.pyx":236
 *     """
 *     if not isinstance(pop,PopType):
 *         raise TypeError("Expecting PopType.")             # <<<<<<<<<<<<<<
 *     if isinstance(pop,Spop):
 *         apply_sampler_single_cpp[singlepop_t]((<Spop>pop).pop.get(),sampler.vec)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__83, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 236, __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(4, 236, __pyx_L1_error)

    /* "fwdpy/temporal_samplers.pyx":235
 *     at the end of a simulation.  It is assumed that len(sampler)==1.
 *     """
 *     if not isinstance(pop,PopType):             # <<<<<<<<<<<<<<
 *         raise TypeError("Expecting PopType.")
 *     if isinstance(pop,Spop):
 */
  }

  /* "fwdpy/temporal_samplers.pyx":237
 *     if not isinstance(pop,PopType):
 *         raise TypeError("Expecting PopType.")
 *     if isinstance(pop,Spop):             # <<<<<<<<<<<<<<
 *         apply_sampler_single_cpp[singlepop_t]((<Spop>pop).pop.get(),sampler.vec)
 *     elif isinstance(pop,MlocusPop):
 */
  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_Spop); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/temporal_samplers.pyx":238
 *         raise TypeError("Expecting PopType.")
 *     if isinstance(pop,Spop):
 *         apply_sampler_single_cpp[singlepop_t]((<Spop>pop).pop.get(),sampler.vec)             # <<<<<<<<<<<<<<
 *     elif isinstance(pop,MlocusPop):
 *         apply_sampler_single_cpp[multilocus_t]((<MlocusPop>pop).pop.get(),sampler.vec)
 */
    fwdpy::apply_sampler_single_cpp<fwdpy::singlepop_t>(((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_pop)->pop.get(), __pyx_v_sampler->vec);

    /* "fwdpy/temporal_samplers.pyx":237
 *     if not isinstance(pop,PopType):
 *         raise TypeError("Expecting PopType.")
 *     if isinstance(pop,Spop):             # <<<<<<<<<<<<<<
 *         apply_sampler_single_cpp[singlepop_t]((<Spop>pop).pop.get(),sampler.vec)
 *     elif isinstance(pop,MlocusPop):
 */
    goto __pyx_L4;
  }

  /* "fwdpy/temporal_samplers.pyx":239
 *     if isinstance(pop,Spop):
 *         apply_sampler_single_cpp[singlepop_t]((<Spop>pop).pop.get(),sampler.vec)
 *     elif isinstance(pop,MlocusPop):             # <<<<<<<<<<<<<<
 *         apply_sampler_single_cpp[multilocus_t]((<MlocusPop>pop).pop.get(),sampler.vec)
 *     elif isinstance(pop,MetaPop):
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_MlocusPop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/temporal_samplers.pyx":240
 *         apply_sampler_single_cpp[singlepop_t]((<Spop>pop).pop.get(),sampler.vec)
 *     elif isinstance(pop,MlocusPop):
 *         apply_sampler_single_cpp[multilocus_t]((<MlocusPop>pop).pop.get(),sampler.vec)             # <<<<<<<<<<<<<<
 *     elif isinstance(pop,MetaPop):
 *         apply_sampler_single_cpp[metapop_t]((<MetaPop>pop).mpop.get(),sampler.vec)
 */
    fwdpy::apply_sampler_single_cpp<fwdpy::multilocus_t>(((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)__pyx_v_pop)->pop.get(), __pyx_v_sampler->vec);

    /* "fwdpy/temporal_samplers.pyx":239
 *     if isinstance(pop,Spop):
 *         apply_sampler_single_cpp[singlepop_t]((<Spop>pop).pop.get(),sampler.vec)
 *     elif isinstance(pop,MlocusPop):             # <<<<<<<<<<<<<<
 *         apply_sampler_single_cpp[multilocus_t]((<MlocusPop>pop).pop.get(),sampler.vec)
 *     elif isinstance(pop,MetaPop):
 */
    goto __pyx_L4;
  }

  /* "fwdpy/temporal_samplers.pyx":241
 *     elif isinstance(pop,MlocusPop):
 *         apply_sampler_single_cpp[multilocus_t]((<MlocusPop>pop).pop.get(),sampler.vec)
 *     elif isinstance(pop,MetaPop):             # <<<<<<<<<<<<<<
 *         apply_sampler_single_cpp[metapop_t]((<MetaPop>pop).mpop.get(),sampler.vec)
 *     else:
 */
  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_pop), __pyx_ptype_5fwdpy_5fwdpy_MetaPop); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "fwdpy/temporal_samplers.pyx":242
 *         apply_sampler_single_cpp[multilocus_t]((<MlocusPop>pop).pop.get(),sampler.vec)
 *     elif isinstance(pop,MetaPop):
 *         apply_sampler_single_cpp[metapop_t]((<MetaPop>pop).mpop.get(),sampler.vec)             # <<<<<<<<<<<<<<
 *     else:
 *         raise NotImplementedError("Not implemented for this type")
 */
    fwdpy::apply_sampler_single_cpp<fwdpy::metapop_t>(((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)__pyx_v_pop)->mpop.get(), __pyx_v_sampler->vec);

    /* "fwdpy/temporal_samplers.pyx":241
 *     elif isinstance(pop,MlocusPop):
 *         apply_sampler_single_cpp[multilocus_t]((<MlocusPop>pop).pop.get(),sampler.vec)
 *     elif isinstance(pop,MetaPop):             # <<<<<<<<<<<<<<
 *         apply_sampler_single_cpp[metapop_t]((<MetaPop>pop).mpop.get(),sampler.vec)
 *     else:
 */
    goto __pyx_L4;
  }

  /* "fwdpy/temporal_samplers.pyx":244
 *         apply_sampler_single_cpp[metapop_t]((<MetaPop>pop).mpop.get(),sampler.vec)
 *     else:
 *         raise NotImplementedError("Not implemented for this type")             # <<<<<<<<<<<<<<
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__84, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 244, __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(4, 244, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "fwdpy/temporal_samplers.pyx":225
 *         raise RuntimeError("PopVec/PopType type not supported")
 * 
 * def apply_sampler_single(PopType pop,TemporalSampler sampler):             # <<<<<<<<<<<<<<
 *     """
 *     Apply a temporal sampler to an indivudal :class:`fwdpy.fwdpy.PopType`
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("fwdpy.fwdpy.apply_sampler_single", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/add_mutations.pyx":3
 * ##Code for adding a mutation into a population
 * 
 * def add_mutation(PopType p,             # <<<<<<<<<<<<<<
 *                  const vector[size_t] & indlist,
 *                  const vector[short] & clist,
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_107add_mutation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_106add_mutation[] = "\n    Add a mutation to a population at a specific position.\n\n    :param p: A :class:`fwdpy.fwdpy.PopType`.\n    :param indlist: A list of individuals to whom the mutation will be added.  Must be unsigned indexes [0,N).\n    :param clist: A list of chromosomes to which to add the new mutation in each individual. 0 = chrom1, 1 = chrom2, 2 = both.\n    :param pos: The position of the new mutation\n    :param s: The selection coefficient/effect size of the new mutation\n    :param h: The dominance coefficient of the new mutation\n\n    .. note:: Only :class:`fwdpy.fwdpy.Spop` is currently supported\n\n    .. note:: RuntimeError will be thrown if pos already exists in p or if any element in clist and/or indlist is out of range.\n\n    Example:\n\n    >>> import fwdpy as fp\n    >>> #init a monomorphic pop\n    >>> p = fp.SpopVec(1,1000)\n    >>> x = fp.add_mutation(p[0],[0,10,20],[0,1,2],0.01,0.0,1.0)\n    >>> #x will have value 0 b/c it is first mutation entered into pop\n    >>> x\n    0\n    >>> fp.view_mutations(p[0])\n    [{'g': 0, 'h': 1.0, 'pos': 0.01, 'n': 4, 's': 0.0, 'ftime': 4294967295, 'label': 0, 'neutral': True}]\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_107add_mutation = {"add_mutation", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_107add_mutation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5fwdpy_5fwdpy_106add_mutation};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_107add_mutation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_p = 0;
  std::vector<size_t>  __pyx_v_indlist;
  std::vector<short>  __pyx_v_clist;
  double __pyx_v_pos;
  double __pyx_v_s;
  double __pyx_v_h;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_mutation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_indlist,&__pyx_n_s_clist,&__pyx_n_s_pos,&__pyx_n_s_s,&__pyx_n_s_h,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_indlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_mutation", 1, 6, 6, 1); __PYX_ERR(10, 3, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_clist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_mutation", 1, 6, 6, 2); __PYX_ERR(10, 3, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_mutation", 1, 6, 6, 3); __PYX_ERR(10, 3, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_mutation", 1, 6, 6, 4); __PYX_ERR(10, 3, __pyx_L3_error)
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_mutation", 1, 6, 6, 5); __PYX_ERR(10, 3, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_mutation") < 0)) __PYX_ERR(10, 3, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_p = ((struct __pyx_obj_5fwdpy_5fwdpy_PopType *)values[0]);
    __pyx_v_indlist = __pyx_convert_vector_from_py_size_t(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 4, __pyx_L3_error)
    __pyx_v_clist = __pyx_convert_vector_from_py_short(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(10, 5, __pyx_L3_error)
    __pyx_v_pos = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_pos == (double)-1) && PyErr_Occurred())) __PYX_ERR(10, 6, __pyx_L3_error)
    __pyx_v_s = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_s == (double)-1) && PyErr_Occurred())) __PYX_ERR(10, 7, __pyx_L3_error)
    __pyx_v_h = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_h == (double)-1) && PyErr_Occurred())) __PYX_ERR(10, 8, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_mutation", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("fwdpy.fwdpy.add_mutation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_PopType, 1, "p", 0))) __PYX_ERR(10, 3, __pyx_L1_error)
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_106add_mutation(__pyx_self, __pyx_v_p, __pyx_v_indlist, __pyx_v_clist, __pyx_v_pos, __pyx_v_s, __pyx_v_h);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_106add_mutation(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5fwdpy_5fwdpy_PopType *__pyx_v_p, std::vector<size_t>  __pyx_v_indlist, std::vector<short>  __pyx_v_clist, double __pyx_v_pos, double __pyx_v_s, double __pyx_v_h) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("add_mutation", 0);

  /* "fwdpy/add_mutations.pyx":35
 *     [{'g': 0, 'h': 1.0, 'pos': 0.01, 'n': 4, 's': 0.0, 'ftime': 4294967295, 'label': 0, 'neutral': True}]
 *     """
 *     if isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return add_mutation_cpp((<Spop>p).pop.get(),indlist,clist,pos,s,h)
 *     else:
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_p), __pyx_ptype_5fwdpy_5fwdpy_Spop); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "fwdpy/add_mutations.pyx":36
 *     """
 *     if isinstance(p,Spop):
 *         return add_mutation_cpp((<Spop>p).pop.get(),indlist,clist,pos,s,h)             # <<<<<<<<<<<<<<
 *     else:
 *         raise RuntimeError("PopType not supported")
 */
    __Pyx_XDECREF(__pyx_r);
    try {
      __pyx_t_3 = fwdpy::add_mutation_cpp(((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)__pyx_v_p)->pop.get(), __pyx_v_indlist, __pyx_v_clist, __pyx_v_pos, __pyx_v_s, __pyx_v_h);
    } catch(...) {
      __Pyx_CppExn2PyErr();
      __PYX_ERR(10, 36, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 36, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "fwdpy/add_mutations.pyx":35
 *     [{'g': 0, 'h': 1.0, 'pos': 0.01, 'n': 4, 's': 0.0, 'ftime': 4294967295, 'label': 0, 'neutral': True}]
 *     """
 *     if isinstance(p,Spop):             # <<<<<<<<<<<<<<
 *         return add_mutation_cpp((<Spop>p).pop.get(),indlist,clist,pos,s,h)
 *     else:
 */
  }

  /* "fwdpy/add_mutations.pyx":38
 *         return add_mutation_cpp((<Spop>p).pop.get(),indlist,clist,pos,s,h)
 *     else:
 *         raise RuntimeError("PopType not supported")             # <<<<<<<<<<<<<<
 * 
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__85, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 38, __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(10, 38, __pyx_L1_error)
  }

  /* "fwdpy/add_mutations.pyx":3
 * ##Code for adding a mutation into a population
 * 
 * def add_mutation(PopType p,             # <<<<<<<<<<<<<<
 *                  const vector[size_t] & indlist,
 *                  const vector[short] & clist,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("fwdpy.fwdpy.add_mutation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/fwdpy.pyx":21
 * include "add_mutations.pyx"
 * 
 * def pkg_version():             # <<<<<<<<<<<<<<
 *     """
 *     Return version numbers of this package
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_109pkg_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_108pkg_version[] = "\n    Return version numbers of this package\n\n    This function is very handy when reporting bugs!\n\n    :returns: dict\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_109pkg_version = {"pkg_version", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_109pkg_version, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_108pkg_version};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_109pkg_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pkg_version (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_108pkg_version(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_108pkg_version(CYTHON_UNUSED PyObject *__pyx_self) {
  std::vector<std::string>  __pyx_v_v;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("pkg_version", 0);

  /* "fwdpy/fwdpy.pyx":29
 *     :returns: dict
 *     """
 *     cdef vector[string] v = fwdpy_version()             # <<<<<<<<<<<<<<
 *     return ({'fwdpy':v[0]})
 * 
 */
  __pyx_v_v = fwdpy::fwdpy_version();

  /* "fwdpy/fwdpy.pyx":30
 *     """
 *     cdef vector[string] v = fwdpy_version()
 *     return ({'fwdpy':v[0]})             # <<<<<<<<<<<<<<
 * 
 * def cite():
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string((__pyx_v_v[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_fwdpy, __pyx_t_2) < 0) __PYX_ERR(11, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "fwdpy/fwdpy.pyx":21
 * include "add_mutations.pyx"
 * 
 * def pkg_version():             # <<<<<<<<<<<<<<
 *     """
 *     Return version numbers of this package
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("fwdpy.fwdpy.pkg_version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "fwdpy/fwdpy.pyx":32
 *     return ({'fwdpy':v[0]})
 * 
 * def cite():             # <<<<<<<<<<<<<<
 *     """
 *     Returns how to cite this package
 */

/* Python wrapper */
static PyObject *__pyx_pw_5fwdpy_5fwdpy_111cite(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5fwdpy_5fwdpy_110cite[] = "\n    Returns how to cite this package\n    ";
static PyMethodDef __pyx_mdef_5fwdpy_5fwdpy_111cite = {"cite", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_111cite, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_110cite};
static PyObject *__pyx_pw_5fwdpy_5fwdpy_111cite(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cite (wrapper)", 0);
  __pyx_r = __pyx_pf_5fwdpy_5fwdpy_110cite(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5fwdpy_5fwdpy_110cite(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cite", 0);

  /* "fwdpy/fwdpy.pyx":36
 *     Returns how to cite this package
 *     """
 *     fwdpy_citation()             # <<<<<<<<<<<<<<
 */
  fwdpy::fwdpy_citation();

  /* "fwdpy/fwdpy.pyx":32
 *     return ({'fwdpy':v[0]})
 * 
 * def cite():             # <<<<<<<<<<<<<<
 *     """
 *     Returns how to cite this package
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":91
 *             __data_union data
 * 
 *         def __getbuffer__(self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fullfill the PEP.
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_7cpython_5array_5array_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_7cpython_5array_5array___getbuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags) {
  PyObject *__pyx_v_item_count = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "array.pxd":96
 *             # In particular strided access is always provided regardless
 *             # of flags
 *             item_count = Py_SIZE(self)             # <<<<<<<<<<<<<<
 * 
 *             info.suboffsets = NULL
 */
  __pyx_t_1 = PyInt_FromSsize_t(Py_SIZE(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_item_count = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "array.pxd":98
 *             item_count = Py_SIZE(self)
 * 
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.buf = self.data.as_chars
 *             info.readonly = 0
 */
  __pyx_v_info->suboffsets = NULL;

  /* "array.pxd":99
 * 
 *             info.suboffsets = NULL
 *             info.buf = self.data.as_chars             # <<<<<<<<<<<<<<
 *             info.readonly = 0
 *             info.ndim = 1
 */
  __pyx_t_2 = __pyx_v_self->data.as_chars;
  __pyx_v_info->buf = __pyx_t_2;

  /* "array.pxd":100
 *             info.suboffsets = NULL
 *             info.buf = self.data.as_chars
 *             info.readonly = 0             # <<<<<<<<<<<<<<
 *             info.ndim = 1
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)
 */
  __pyx_v_info->readonly = 0;

  /* "array.pxd":101
 *             info.buf = self.data.as_chars
 *             info.readonly = 0
 *             info.ndim = 1             # <<<<<<<<<<<<<<
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)
 *             info.len = info.itemsize * item_count
 */
  __pyx_v_info->ndim = 1;

  /* "array.pxd":102
 *             info.readonly = 0
 *             info.ndim = 1
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)             # <<<<<<<<<<<<<<
 *             info.len = info.itemsize * item_count
 * 
 */
  __pyx_t_3 = __pyx_v_self->ob_descr->itemsize;
  __pyx_v_info->itemsize = __pyx_t_3;

  /* "array.pxd":103
 *             info.ndim = 1
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)
 *             info.len = info.itemsize * item_count             # <<<<<<<<<<<<<<
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
 */
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_info->itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_v_item_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(12, 103, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_info->len = __pyx_t_5;

  /* "array.pxd":105
 *             info.len = info.itemsize * item_count
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)             # <<<<<<<<<<<<<<
 *             if not info.shape:
 *                 raise MemoryError()
 */
  __pyx_v_info->shape = ((Py_ssize_t *)PyObject_Malloc(((sizeof(Py_ssize_t)) + 2)));

  /* "array.pxd":106
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
 *             if not info.shape:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing
 */
  __pyx_t_6 = ((!(__pyx_v_info->shape != 0)) != 0);
  if (__pyx_t_6) {

    /* "array.pxd":107
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
 *             if not info.shape:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             info.shape[0] = item_count      # constant regardless of resizing
 *             info.strides = &info.itemsize
 */
    PyErr_NoMemory(); __PYX_ERR(12, 107, __pyx_L1_error)

    /* "array.pxd":106
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
 *             if not info.shape:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing
 */
  }

  /* "array.pxd":108
 *             if not info.shape:
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing             # <<<<<<<<<<<<<<
 *             info.strides = &info.itemsize
 * 
 */
  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_item_count); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(12, 108, __pyx_L1_error)
  (__pyx_v_info->shape[0]) = __pyx_t_5;

  /* "array.pxd":109
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing
 *             info.strides = &info.itemsize             # <<<<<<<<<<<<<<
 * 
 *             info.format = <char*> (info.shape + 1)
 */
  __pyx_v_info->strides = (&__pyx_v_info->itemsize);

  /* "array.pxd":111
 *             info.strides = &info.itemsize
 * 
 *             info.format = <char*> (info.shape + 1)             # <<<<<<<<<<<<<<
 *             info.format[0] = self.ob_descr.typecode
 *             info.format[1] = 0
 */
  __pyx_v_info->format = ((char *)(__pyx_v_info->shape + 1));

  /* "array.pxd":112
 * 
 *             info.format = <char*> (info.shape + 1)
 *             info.format[0] = self.ob_descr.typecode             # <<<<<<<<<<<<<<
 *             info.format[1] = 0
 *             info.obj = self
 */
  __pyx_t_3 = __pyx_v_self->ob_descr->typecode;
  (__pyx_v_info->format[0]) = __pyx_t_3;

  /* "array.pxd":113
 *             info.format = <char*> (info.shape + 1)
 *             info.format[0] = self.ob_descr.typecode
 *             info.format[1] = 0             # <<<<<<<<<<<<<<
 *             info.obj = self
 * 
 */
  (__pyx_v_info->format[1]) = 0;

  /* "array.pxd":114
 *             info.format[0] = self.ob_descr.typecode
 *             info.format[1] = 0
 *             info.obj = self             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(self, Py_buffer* info):
 */
  __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);

  /* "array.pxd":91
 *             __data_union data
 * 
 *         def __getbuffer__(self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fullfill the PEP.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cpython.array.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_item_count);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":116
 *             info.obj = self
 * 
 *         def __releasebuffer__(self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             PyObject_Free(info.shape)
 * 
 */

/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static CYTHON_UNUSED void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_7cpython_5array_5array_2__releasebuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "array.pxd":117
 * 
 *         def __releasebuffer__(self, Py_buffer* info):
 *             PyObject_Free(info.shape)             # <<<<<<<<<<<<<<
 * 
 *     array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr)
 */
  PyObject_Free(__pyx_v_info->shape);

  /* "array.pxd":116
 *             info.obj = self
 * 
 *         def __releasebuffer__(self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             PyObject_Free(info.shape)
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "array.pxd":128
 * 
 * 
 * cdef inline array clone(array template, Py_ssize_t length, bint zero):             # <<<<<<<<<<<<<<
 *     """ fast creation of a new array, given a template array.
 *     type will be same as template.
 */

static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__pyx_v_template, Py_ssize_t __pyx_v_length, int __pyx_v_zero) {
  arrayobject *__pyx_v_op = NULL;
  arrayobject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("clone", 0);

  /* "array.pxd":132
 *     type will be same as template.
 *     if zero is true, new array will be initialized with zeroes."""
 *     op = newarrayobject(Py_TYPE(template), length, template.ob_descr)             # <<<<<<<<<<<<<<
 *     if zero and op is not None:
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
 */
  __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_template)), __pyx_v_length, __pyx_v_template->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_op = ((arrayobject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "array.pxd":133
 *     if zero is true, new array will be initialized with zeroes."""
 *     op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
 *     if zero and op is not None:             # <<<<<<<<<<<<<<
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
 *     return op
 */
  __pyx_t_3 = (__pyx_v_zero != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (((PyObject *)__pyx_v_op) != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "array.pxd":134
 *     op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
 *     if zero and op is not None:
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)             # <<<<<<<<<<<<<<
 *     return op
 * 
 */
    memset(__pyx_v_op->data.as_chars, 0, (__pyx_v_length * __pyx_v_op->ob_descr->itemsize));

    /* "array.pxd":133
 *     if zero is true, new array will be initialized with zeroes."""
 *     op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
 *     if zero and op is not None:             # <<<<<<<<<<<<<<
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
 *     return op
 */
  }

  /* "array.pxd":135
 *     if zero and op is not None:
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
 *     return op             # <<<<<<<<<<<<<<
 * 
 * cdef inline array copy(array self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_op));
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "array.pxd":128
 * 
 * 
 * cdef inline array clone(array template, Py_ssize_t length, bint zero):             # <<<<<<<<<<<<<<
 *     """ fast creation of a new array, given a template array.
 *     type will be same as template.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cpython.array.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":137
 *     return op
 * 
 * cdef inline array copy(array self):             # <<<<<<<<<<<<<<
 *     """ make a copy of an array. """
 *     op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
 */

static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) {
  arrayobject *__pyx_v_op = NULL;
  arrayobject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "array.pxd":139
 * cdef inline array copy(array self):
 *     """ make a copy of an array. """
 *     op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)             # <<<<<<<<<<<<<<
 *     memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
 *     return op
 */
  __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_self)), Py_SIZE(((PyObject *)__pyx_v_self)), __pyx_v_self->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_op = ((arrayobject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "array.pxd":140
 *     """ make a copy of an array. """
 *     op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
 *     memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)             # <<<<<<<<<<<<<<
 *     return op
 * 
 */
  memcpy(__pyx_v_op->data.as_chars, __pyx_v_self->data.as_chars, (Py_SIZE(((PyObject *)__pyx_v_op)) * __pyx_v_op->ob_descr->itemsize));

  /* "array.pxd":141
 *     op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
 *     memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
 *     return op             # <<<<<<<<<<<<<<
 * 
 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_op));
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "array.pxd":137
 *     return op
 * 
 * cdef inline array copy(array self):             # <<<<<<<<<<<<<<
 *     """ make a copy of an array. """
 *     op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cpython.array.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":143
 *     return op
 * 
 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:             # <<<<<<<<<<<<<<
 *     """ efficent appending of new stuff of same type
 *     (e.g. of same array type)
 */

static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__pyx_v_self, char *__pyx_v_stuff, Py_ssize_t __pyx_v_n) {
  Py_ssize_t __pyx_v_itemsize;
  Py_ssize_t __pyx_v_origsize;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("extend_buffer", 0);

  /* "array.pxd":147
 *     (e.g. of same array type)
 *     n: number of elements (not number of bytes!) """
 *     cdef Py_ssize_t itemsize = self.ob_descr.itemsize             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t origsize = Py_SIZE(self)
 *     resize_smart(self, origsize + n)
 */
  __pyx_t_1 = __pyx_v_self->ob_descr->itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "array.pxd":148
 *     n: number of elements (not number of bytes!) """
 *     cdef Py_ssize_t itemsize = self.ob_descr.itemsize
 *     cdef Py_ssize_t origsize = Py_SIZE(self)             # <<<<<<<<<<<<<<
 *     resize_smart(self, origsize + n)
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
 */
  __pyx_v_origsize = Py_SIZE(((PyObject *)__pyx_v_self));

  /* "array.pxd":149
 *     cdef Py_ssize_t itemsize = self.ob_descr.itemsize
 *     cdef Py_ssize_t origsize = Py_SIZE(self)
 *     resize_smart(self, origsize + n)             # <<<<<<<<<<<<<<
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
 *     return 0
 */
  __pyx_t_1 = resize_smart(__pyx_v_self, (__pyx_v_origsize + __pyx_v_n)); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(12, 149, __pyx_L1_error)

  /* "array.pxd":150
 *     cdef Py_ssize_t origsize = Py_SIZE(self)
 *     resize_smart(self, origsize + n)
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  memcpy((__pyx_v_self->data.as_chars + (__pyx_v_origsize * __pyx_v_itemsize)), __pyx_v_stuff, (__pyx_v_n * __pyx_v_itemsize));

  /* "array.pxd":151
 *     resize_smart(self, origsize + n)
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int extend(array self, array other) except -1:
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "array.pxd":143
 *     return op
 * 
 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:             # <<<<<<<<<<<<<<
 *     """ efficent appending of new stuff of same type
 *     (e.g. of same array type)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cpython.array.extend_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":153
 *     return 0
 * 
 * cdef inline int extend(array self, array other) except -1:             # <<<<<<<<<<<<<<
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
 */

static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("extend", 0);

  /* "array.pxd":155
 * cdef inline int extend(array self, array other) except -1:
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:             # <<<<<<<<<<<<<<
 *         PyErr_BadArgument()
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 */
  __pyx_t_1 = ((__pyx_v_self->ob_descr->typecode != __pyx_v_other->ob_descr->typecode) != 0);
  if (__pyx_t_1) {

    /* "array.pxd":156
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
 *         PyErr_BadArgument()             # <<<<<<<<<<<<<<
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 * 
 */
    __pyx_t_2 = PyErr_BadArgument(); if (unlikely(__pyx_t_2 == 0)) __PYX_ERR(12, 156, __pyx_L1_error)

    /* "array.pxd":155
 * cdef inline int extend(array self, array other) except -1:
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:             # <<<<<<<<<<<<<<
 *         PyErr_BadArgument()
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 */
  }

  /* "array.pxd":157
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
 *         PyErr_BadArgument()
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))             # <<<<<<<<<<<<<<
 * 
 * cdef inline void zero(array self):
 */
  __pyx_t_2 = __pyx_f_7cpython_5array_extend_buffer(__pyx_v_self, __pyx_v_other->data.as_chars, Py_SIZE(((PyObject *)__pyx_v_other))); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(12, 157, __pyx_L1_error)
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "array.pxd":153
 *     return 0
 * 
 * cdef inline int extend(array self, array other) except -1:             # <<<<<<<<<<<<<<
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cpython.array.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":159
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 * 
 * cdef inline void zero(array self):             # <<<<<<<<<<<<<<
 *     """ set all elements of array to zero. """
 *     memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
 */

static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zero", 0);

  /* "array.pxd":161
 * cdef inline void zero(array self):
 *     """ set all elements of array to zero. """
 *     memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)             # <<<<<<<<<<<<<<
 */
  memset(__pyx_v_self->data.as_chars, 0, (Py_SIZE(((PyObject *)__pyx_v_self)) * __pyx_v_self->ob_descr->itemsize));

  /* "array.pxd":159
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 * 
 * cdef inline void zero(array self):             # <<<<<<<<<<<<<<
 *     """ set all elements of array to zero. """
 *     memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "fwdpy/fitness.pxd":58
 * 
 * #Helper functions for making custom fitness functions
 * cdef inline double return_w(double w) nogil:             # <<<<<<<<<<<<<<
 *     return max[double](0.0,w)
 * 
 */

static CYTHON_INLINE double __pyx_f_5fwdpy_7fitness_return_w(double __pyx_v_w) {
  double __pyx_r;

  /* "fwdpy/fitness.pxd":59
 * #Helper functions for making custom fitness functions
 * cdef inline double return_w(double w) nogil:
 *     return max[double](0.0,w)             # <<<<<<<<<<<<<<
 * 
 * cdef inline double return_w_plus1(double w) nogil:
 */
  __pyx_r = std::max<double>(0.0, __pyx_v_w);
  goto __pyx_L0;

  /* "fwdpy/fitness.pxd":58
 * 
 * #Helper functions for making custom fitness functions
 * cdef inline double return_w(double w) nogil:             # <<<<<<<<<<<<<<
 *     return max[double](0.0,w)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/fitness.pxd":61
 *     return max[double](0.0,w)
 * 
 * cdef inline double return_w_plus1(double w) nogil:             # <<<<<<<<<<<<<<
 *     return max[double](0.0,1.0+w)
 * 
 */

static CYTHON_INLINE double __pyx_f_5fwdpy_7fitness_return_w_plus1(double __pyx_v_w) {
  double __pyx_r;

  /* "fwdpy/fitness.pxd":62
 * 
 * cdef inline double return_w_plus1(double w) nogil:
 *     return max[double](0.0,1.0+w)             # <<<<<<<<<<<<<<
 * 
 * cdef inline double return_trait_value(double w) nogil:
 */
  __pyx_r = std::max<double>(0.0, (1.0 + __pyx_v_w));
  goto __pyx_L0;

  /* "fwdpy/fitness.pxd":61
 *     return max[double](0.0,w)
 * 
 * cdef inline double return_w_plus1(double w) nogil:             # <<<<<<<<<<<<<<
 *     return max[double](0.0,1.0+w)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/fitness.pxd":64
 *     return max[double](0.0,1.0+w)
 * 
 * cdef inline double return_trait_value(double w) nogil:             # <<<<<<<<<<<<<<
 *     return w
 * 
 */

static CYTHON_INLINE double __pyx_f_5fwdpy_7fitness_return_trait_value(double __pyx_v_w) {
  double __pyx_r;

  /* "fwdpy/fitness.pxd":65
 * 
 * cdef inline double return_trait_value(double w) nogil:
 *     return w             # <<<<<<<<<<<<<<
 * 
 * cdef inline double return_trait_value_minus1(double w) nogil:
 */
  __pyx_r = __pyx_v_w;
  goto __pyx_L0;

  /* "fwdpy/fitness.pxd":64
 *     return max[double](0.0,1.0+w)
 * 
 * cdef inline double return_trait_value(double w) nogil:             # <<<<<<<<<<<<<<
 *     return w
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/fitness.pxd":67
 *     return w
 * 
 * cdef inline double return_trait_value_minus1(double w) nogil:             # <<<<<<<<<<<<<<
 *     return w-1.0
 * 
 */

static CYTHON_INLINE double __pyx_f_5fwdpy_7fitness_return_trait_value_minus1(double __pyx_v_w) {
  double __pyx_r;

  /* "fwdpy/fitness.pxd":68
 * 
 * cdef inline double return_trait_value_minus1(double w) nogil:
 *     return w-1.0             # <<<<<<<<<<<<<<
 * 
 * cdef inline void het_additive_update(double & w, const popgenmut & m) nogil:
 */
  __pyx_r = (__pyx_v_w - 1.0);
  goto __pyx_L0;

  /* "fwdpy/fitness.pxd":67
 *     return w
 * 
 * cdef inline double return_trait_value_minus1(double w) nogil:             # <<<<<<<<<<<<<<
 *     return w-1.0
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/fitness.pxd":70
 *     return w-1.0
 * 
 * cdef inline void het_additive_update(double & w, const popgenmut & m) nogil:             # <<<<<<<<<<<<<<
 *     (&w)[0] += m.s*m.h
 * 
 */

static CYTHON_INLINE void __pyx_f_5fwdpy_7fitness_het_additive_update(double &__pyx_v_w, KTfwd::popgenmut const &__pyx_v_m) {
  double *__pyx_t_1;
  long __pyx_t_2;

  /* "fwdpy/fitness.pxd":71
 * 
 * cdef inline void het_additive_update(double & w, const popgenmut & m) nogil:
 *     (&w)[0] += m.s*m.h             # <<<<<<<<<<<<<<
 * 
 * cdef inline void hom_additive_update_2(double & w, const popgenmut & m) nogil:
 */
  __pyx_t_1 = (&__pyx_v_w);
  __pyx_t_2 = 0;
  (__pyx_t_1[__pyx_t_2]) = ((__pyx_t_1[__pyx_t_2]) + (__pyx_v_m.s * __pyx_v_m.h));

  /* "fwdpy/fitness.pxd":70
 *     return w-1.0
 * 
 * cdef inline void het_additive_update(double & w, const popgenmut & m) nogil:             # <<<<<<<<<<<<<<
 *     (&w)[0] += m.s*m.h
 * 
 */

  /* function exit code */
}

/* "fwdpy/fitness.pxd":73
 *     (&w)[0] += m.s*m.h
 * 
 * cdef inline void hom_additive_update_2(double & w, const popgenmut & m) nogil:             # <<<<<<<<<<<<<<
 *     (&w)[0] += 2.0*m.s
 * 
 */

static CYTHON_INLINE void __pyx_f_5fwdpy_7fitness_hom_additive_update_2(double &__pyx_v_w, KTfwd::popgenmut const &__pyx_v_m) {
  double *__pyx_t_1;
  long __pyx_t_2;

  /* "fwdpy/fitness.pxd":74
 * 
 * cdef inline void hom_additive_update_2(double & w, const popgenmut & m) nogil:
 *     (&w)[0] += 2.0*m.s             # <<<<<<<<<<<<<<
 * 
 * cdef inline void hom_additive_update_1(double & w, const popgenmut & m) nogil:
 */
  __pyx_t_1 = (&__pyx_v_w);
  __pyx_t_2 = 0;
  (__pyx_t_1[__pyx_t_2]) = ((__pyx_t_1[__pyx_t_2]) + (2.0 * __pyx_v_m.s));

  /* "fwdpy/fitness.pxd":73
 *     (&w)[0] += m.s*m.h
 * 
 * cdef inline void hom_additive_update_2(double & w, const popgenmut & m) nogil:             # <<<<<<<<<<<<<<
 *     (&w)[0] += 2.0*m.s
 * 
 */

  /* function exit code */
}

/* "fwdpy/fitness.pxd":76
 *     (&w)[0] += 2.0*m.s
 * 
 * cdef inline void hom_additive_update_1(double & w, const popgenmut & m) nogil:             # <<<<<<<<<<<<<<
 *     (&w)[0] += m.s
 * 
 */

static CYTHON_INLINE void __pyx_f_5fwdpy_7fitness_hom_additive_update_1(double &__pyx_v_w, KTfwd::popgenmut const &__pyx_v_m) {
  double *__pyx_t_1;
  long __pyx_t_2;

  /* "fwdpy/fitness.pxd":77
 * 
 * cdef inline void hom_additive_update_1(double & w, const popgenmut & m) nogil:
 *     (&w)[0] += m.s             # <<<<<<<<<<<<<<
 * 
 * cdef inline genotype_fitness_updater choose_additive_hom_updater(int scaling) nogil:
 */
  __pyx_t_1 = (&__pyx_v_w);
  __pyx_t_2 = 0;
  (__pyx_t_1[__pyx_t_2]) = ((__pyx_t_1[__pyx_t_2]) + __pyx_v_m.s);

  /* "fwdpy/fitness.pxd":76
 *     (&w)[0] += 2.0*m.s
 * 
 * cdef inline void hom_additive_update_1(double & w, const popgenmut & m) nogil:             # <<<<<<<<<<<<<<
 *     (&w)[0] += m.s
 * 
 */

  /* function exit code */
}

/* "fwdpy/fitness.pxd":79
 *     (&w)[0] += m.s
 * 
 * cdef inline genotype_fitness_updater choose_additive_hom_updater(int scaling) nogil:             # <<<<<<<<<<<<<<
 *     #Defaults to using a scaling of 2
 *     if scaling==1:
 */

static CYTHON_INLINE fwdpy::genotype_fitness_updater __pyx_f_5fwdpy_7fitness_choose_additive_hom_updater(int __pyx_v_scaling) {
  fwdpy::genotype_fitness_updater __pyx_r;
  int __pyx_t_1;

  /* "fwdpy/fitness.pxd":81
 * cdef inline genotype_fitness_updater choose_additive_hom_updater(int scaling) nogil:
 *     #Defaults to using a scaling of 2
 *     if scaling==1:             # <<<<<<<<<<<<<<
 *         return <genotype_fitness_updater>hom_additive_update_1
 *     return <genotype_fitness_updater>hom_additive_update_2
 */
  __pyx_t_1 = ((__pyx_v_scaling == 1) != 0);
  if (__pyx_t_1) {

    /* "fwdpy/fitness.pxd":82
 *     #Defaults to using a scaling of 2
 *     if scaling==1:
 *         return <genotype_fitness_updater>hom_additive_update_1             # <<<<<<<<<<<<<<
 *     return <genotype_fitness_updater>hom_additive_update_2
 * 
 */
    __pyx_r = ((fwdpy::genotype_fitness_updater)__pyx_f_5fwdpy_7fitness_hom_additive_update_1);
    goto __pyx_L0;

    /* "fwdpy/fitness.pxd":81
 * cdef inline genotype_fitness_updater choose_additive_hom_updater(int scaling) nogil:
 *     #Defaults to using a scaling of 2
 *     if scaling==1:             # <<<<<<<<<<<<<<
 *         return <genotype_fitness_updater>hom_additive_update_1
 *     return <genotype_fitness_updater>hom_additive_update_2
 */
  }

  /* "fwdpy/fitness.pxd":83
 *     if scaling==1:
 *         return <genotype_fitness_updater>hom_additive_update_1
 *     return <genotype_fitness_updater>hom_additive_update_2             # <<<<<<<<<<<<<<
 * 
 * cdef inline void het_mult_update(double & w, const popgenmut & m) nogil:
 */
  __pyx_r = ((fwdpy::genotype_fitness_updater)__pyx_f_5fwdpy_7fitness_hom_additive_update_2);
  goto __pyx_L0;

  /* "fwdpy/fitness.pxd":79
 *     (&w)[0] += m.s
 * 
 * cdef inline genotype_fitness_updater choose_additive_hom_updater(int scaling) nogil:             # <<<<<<<<<<<<<<
 *     #Defaults to using a scaling of 2
 *     if scaling==1:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/fitness.pxd":85
 *     return <genotype_fitness_updater>hom_additive_update_2
 * 
 * cdef inline void het_mult_update(double & w, const popgenmut & m) nogil:             # <<<<<<<<<<<<<<
 *     (&w)[0] *= (1.0+m.s*m.h)
 * 
 */

static CYTHON_INLINE void __pyx_f_5fwdpy_7fitness_het_mult_update(double &__pyx_v_w, KTfwd::popgenmut const &__pyx_v_m) {
  double *__pyx_t_1;
  long __pyx_t_2;

  /* "fwdpy/fitness.pxd":86
 * 
 * cdef inline void het_mult_update(double & w, const popgenmut & m) nogil:
 *     (&w)[0] *= (1.0+m.s*m.h)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void hom_mult_update_2(double & w, const popgenmut & m) nogil:
 */
  __pyx_t_1 = (&__pyx_v_w);
  __pyx_t_2 = 0;
  (__pyx_t_1[__pyx_t_2]) = ((__pyx_t_1[__pyx_t_2]) * (1.0 + (__pyx_v_m.s * __pyx_v_m.h)));

  /* "fwdpy/fitness.pxd":85
 *     return <genotype_fitness_updater>hom_additive_update_2
 * 
 * cdef inline void het_mult_update(double & w, const popgenmut & m) nogil:             # <<<<<<<<<<<<<<
 *     (&w)[0] *= (1.0+m.s*m.h)
 * 
 */

  /* function exit code */
}

/* "fwdpy/fitness.pxd":88
 *     (&w)[0] *= (1.0+m.s*m.h)
 * 
 * cdef inline void hom_mult_update_2(double & w, const popgenmut & m) nogil:             # <<<<<<<<<<<<<<
 *     (&w)[0] *= (1.0+2.0*m.s)
 * 
 */

static CYTHON_INLINE void __pyx_f_5fwdpy_7fitness_hom_mult_update_2(double &__pyx_v_w, KTfwd::popgenmut const &__pyx_v_m) {
  double *__pyx_t_1;
  long __pyx_t_2;

  /* "fwdpy/fitness.pxd":89
 * 
 * cdef inline void hom_mult_update_2(double & w, const popgenmut & m) nogil:
 *     (&w)[0] *= (1.0+2.0*m.s)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void hom_mult_update_1(double & w, const popgenmut & m) nogil:
 */
  __pyx_t_1 = (&__pyx_v_w);
  __pyx_t_2 = 0;
  (__pyx_t_1[__pyx_t_2]) = ((__pyx_t_1[__pyx_t_2]) * (1.0 + (2.0 * __pyx_v_m.s)));

  /* "fwdpy/fitness.pxd":88
 *     (&w)[0] *= (1.0+m.s*m.h)
 * 
 * cdef inline void hom_mult_update_2(double & w, const popgenmut & m) nogil:             # <<<<<<<<<<<<<<
 *     (&w)[0] *= (1.0+2.0*m.s)
 * 
 */

  /* function exit code */
}

/* "fwdpy/fitness.pxd":91
 *     (&w)[0] *= (1.0+2.0*m.s)
 * 
 * cdef inline void hom_mult_update_1(double & w, const popgenmut & m) nogil:             # <<<<<<<<<<<<<<
 *     (&w)[0] *= (1.0+m.s)
 * 
 */

static CYTHON_INLINE void __pyx_f_5fwdpy_7fitness_hom_mult_update_1(double &__pyx_v_w, KTfwd::popgenmut const &__pyx_v_m) {
  double *__pyx_t_1;
  long __pyx_t_2;

  /* "fwdpy/fitness.pxd":92
 * 
 * cdef inline void hom_mult_update_1(double & w, const popgenmut & m) nogil:
 *     (&w)[0] *= (1.0+m.s)             # <<<<<<<<<<<<<<
 * 
 * cdef inline genotype_fitness_updater choose_mult_hom_updater(int scaling) nogil:
 */
  __pyx_t_1 = (&__pyx_v_w);
  __pyx_t_2 = 0;
  (__pyx_t_1[__pyx_t_2]) = ((__pyx_t_1[__pyx_t_2]) * (1.0 + __pyx_v_m.s));

  /* "fwdpy/fitness.pxd":91
 *     (&w)[0] *= (1.0+2.0*m.s)
 * 
 * cdef inline void hom_mult_update_1(double & w, const popgenmut & m) nogil:             # <<<<<<<<<<<<<<
 *     (&w)[0] *= (1.0+m.s)
 * 
 */

  /* function exit code */
}

/* "fwdpy/fitness.pxd":94
 *     (&w)[0] *= (1.0+m.s)
 * 
 * cdef inline genotype_fitness_updater choose_mult_hom_updater(int scaling) nogil:             # <<<<<<<<<<<<<<
 *     #Defaults to using a scaling of 2
 *     if scaling==1:
 */

static CYTHON_INLINE fwdpy::genotype_fitness_updater __pyx_f_5fwdpy_7fitness_choose_mult_hom_updater(int __pyx_v_scaling) {
  fwdpy::genotype_fitness_updater __pyx_r;
  int __pyx_t_1;

  /* "fwdpy/fitness.pxd":96
 * cdef inline genotype_fitness_updater choose_mult_hom_updater(int scaling) nogil:
 *     #Defaults to using a scaling of 2
 *     if scaling==1:             # <<<<<<<<<<<<<<
 *         return <genotype_fitness_updater>hom_additive_update_1
 *     return <genotype_fitness_updater>hom_additive_update_2
 */
  __pyx_t_1 = ((__pyx_v_scaling == 1) != 0);
  if (__pyx_t_1) {

    /* "fwdpy/fitness.pxd":97
 *     #Defaults to using a scaling of 2
 *     if scaling==1:
 *         return <genotype_fitness_updater>hom_additive_update_1             # <<<<<<<<<<<<<<
 *     return <genotype_fitness_updater>hom_additive_update_2
 * 
 */
    __pyx_r = ((fwdpy::genotype_fitness_updater)__pyx_f_5fwdpy_7fitness_hom_additive_update_1);
    goto __pyx_L0;

    /* "fwdpy/fitness.pxd":96
 * cdef inline genotype_fitness_updater choose_mult_hom_updater(int scaling) nogil:
 *     #Defaults to using a scaling of 2
 *     if scaling==1:             # <<<<<<<<<<<<<<
 *         return <genotype_fitness_updater>hom_additive_update_1
 *     return <genotype_fitness_updater>hom_additive_update_2
 */
  }

  /* "fwdpy/fitness.pxd":98
 *     if scaling==1:
 *         return <genotype_fitness_updater>hom_additive_update_1
 *     return <genotype_fitness_updater>hom_additive_update_2             # <<<<<<<<<<<<<<
 * 
 * cdef inline double sum_haplotype_effects(const gamete_t & g, const mcont_t & m) nogil:
 */
  __pyx_r = ((fwdpy::genotype_fitness_updater)__pyx_f_5fwdpy_7fitness_hom_additive_update_2);
  goto __pyx_L0;

  /* "fwdpy/fitness.pxd":94
 *     (&w)[0] *= (1.0+m.s)
 * 
 * cdef inline genotype_fitness_updater choose_mult_hom_updater(int scaling) nogil:             # <<<<<<<<<<<<<<
 *     #Defaults to using a scaling of 2
 *     if scaling==1:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "fwdpy/fitness.pxd":100
 *     return <genotype_fitness_updater>hom_additive_update_2
 * 
 * cdef inline double sum_haplotype_effects(const gamete_t & g, const mcont_t & m) nogil:             # <<<<<<<<<<<<<<
 *     cdef size_t i=0,n=g.smutations.size()
 *     cdef double rv = 0.0
 */

static CYTHON_INLINE double __pyx_f_5fwdpy_7fitness_sum_haplotype_effects(__pyx_t_5fwdpy_7fitness_gamete_t const &__pyx_v_g, __pyx_t_5fwdpy_7fitness_mcont_t const &__pyx_v_m) {
  size_t __pyx_v_i;
  size_t __pyx_v_n;
  double __pyx_v_rv;
  double __pyx_r;
  int __pyx_t_1;

  /* "fwdpy/fitness.pxd":101
 * 
 * cdef inline double sum_haplotype_effects(const gamete_t & g, const mcont_t & m) nogil:
 *     cdef size_t i=0,n=g.smutations.size()             # <<<<<<<<<<<<<<
 *     cdef double rv = 0.0
 *     while i<n:
 */
  __pyx_v_i = 0;
  __pyx_v_n = __pyx_v_g.smutations.size();

  /* "fwdpy/fitness.pxd":102
 * cdef inline double sum_haplotype_effects(const gamete_t & g, const mcont_t & m) nogil:
 *     cdef size_t i=0,n=g.smutations.size()
 *     cdef double rv = 0.0             # <<<<<<<<<<<<<<
 *     while i<n:
 *         rv+=m[g.smutations[i]].s
 */
  __pyx_v_rv = 0.0;

  /* "fwdpy/fitness.pxd":103
 *     cdef size_t i=0,n=g.smutations.size()
 *     cdef double rv = 0.0
 *     while i<n:             # <<<<<<<<<<<<<<
 *         rv+=m[g.smutations[i]].s
 *         i+=1
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_i < __pyx_v_n) != 0);
    if (!__pyx_t_1) break;

    /* "fwdpy/fitness.pxd":104
 *     cdef double rv = 0.0
 *     while i<n:
 *         rv+=m[g.smutations[i]].s             # <<<<<<<<<<<<<<
 *         i+=1
 *     return rv
 */
    __pyx_v_rv = (__pyx_v_rv + (__pyx_v_m[(__pyx_v_g.smutations[__pyx_v_i])]).s);

    /* "fwdpy/fitness.pxd":105
 *     while i<n:
 *         rv+=m[g.smutations[i]].s
 *         i+=1             # <<<<<<<<<<<<<<
 *     return rv
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "fwdpy/fitness.pxd":106
 *         rv+=m[g.smutations[i]].s
 *         i+=1
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * cdef class SpopFitness(object):
 */
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "fwdpy/fitness.pxd":100
 *     return <genotype_fitness_updater>hom_additive_update_2
 * 
 * cdef inline double sum_haplotype_effects(const gamete_t & g, const mcont_t & m) nogil:             # <<<<<<<<<<<<<<
 *     cdef size_t i=0,n=g.smutations.size()
 *     cdef double rv = 0.0
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "vector.from_py":49
 * 
 * @cname("__pyx_convert_vector_from_py_unsigned_int")
 * cdef vector[X] __pyx_convert_vector_from_py_unsigned_int(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<unsigned int>  __pyx_convert_vector_from_py_unsigned_int(PyObject *__pyx_v_o) {
  std::vector<unsigned int>  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<unsigned int>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  unsigned int __pyx_t_5;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_unsigned_int", 0);

  /* "vector.from_py":51
 * cdef vector[X] __pyx_convert_vector_from_py_unsigned_int(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(X_from_py(item))
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 51, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 51, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(13, 51, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 51, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(13, 51, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 51, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(13, 51, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":52
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(X_from_py(item))             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_v_item); if (unlikely(__pyx_t_5 == -1 && PyErr_Occurred())) __PYX_ERR(13, 52, __pyx_L1_error)
    __pyx_v_v.push_back(__pyx_t_5);

    /* "vector.from_py":51
 * cdef vector[X] __pyx_convert_vector_from_py_unsigned_int(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(X_from_py(item))
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":53
 *     for item in o:
 *         v.push_back(X_from_py(item))
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":49
 * 
 * @cname("__pyx_convert_vector_from_py_unsigned_int")
 * cdef vector[X] __pyx_convert_vector_from_py_unsigned_int(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_unsigned_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.from_py":13
 * 
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length
 *     cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 */

static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) {
  Py_ssize_t __pyx_v_length;
  char *__pyx_v_data;
  std::string __pyx_r;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0);

  /* "string.from_py":15
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:
 *     cdef Py_ssize_t length
 *     cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length)             # <<<<<<<<<<<<<<
 *     return string(data, length)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(13, 15, __pyx_L1_error)
  __pyx_v_data = __pyx_t_1;

  /* "string.from_py":16
 *     cdef Py_ssize_t length
 *     cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 *     return string(data, length)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = std::string(__pyx_v_data, __pyx_v_length);
  goto __pyx_L0;

  /* "string.from_py":13
 * 
 * @cname("__pyx_convert_string_from_py_std__in_string")
 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length
 *     cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pair.from_py":164
 * 
 * @cname("__pyx_convert_pair_from_py_double__and_std_3a__3a_string")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_double__and_std_3a__3a_string(object o) except *:             # <<<<<<<<<<<<<<
 *     x, y = o
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))
 */

static std::pair<double,std::string>  __pyx_convert_pair_from_py_double__and_std_3a__3a_string(PyObject *__pyx_v_o) {
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  std::pair<double,std::string>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  double __pyx_t_5;
  std::string __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_convert_pair_from_py_double__and_std_3a__3a_string", 0);

  /* "pair.from_py":165
 * @cname("__pyx_convert_pair_from_py_double__and_std_3a__3a_string")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_double__and_std_3a__3a_string(object o) except *:
 *     x, y = o             # <<<<<<<<<<<<<<
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))
 * 
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_o))) || (PyList_CheckExact(__pyx_v_o))) {
    PyObject* sequence = __pyx_v_o;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(13, 165, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(13, 165, __pyx_L1_error)
    __pyx_t_4 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(13, 165, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_y = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pair.from_py":166
 * cdef pair[X,Y] __pyx_convert_pair_from_py_double__and_std_3a__3a_string(object o) except *:
 *     x, y = o
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_x); if (unlikely(__pyx_t_5 == -1.0 && PyErr_Occurred())) __PYX_ERR(13, 166, __pyx_L1_error)
  __pyx_t_6 = __pyx_convert_string_from_py_std__in_string(__pyx_v_y); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 166, __pyx_L1_error)
  __pyx_r = std::pair<double,std::string> (__pyx_t_5, __pyx_t_6);
  goto __pyx_L0;

  /* "pair.from_py":164
 * 
 * @cname("__pyx_convert_pair_from_py_double__and_std_3a__3a_string")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_double__and_std_3a__3a_string(object o) except *:             # <<<<<<<<<<<<<<
 *     x, y = o
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pair.from_py.__pyx_convert_pair_from_py_double__and_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.from_py":50
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<std::pair<double,std::string> >  __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(PyObject *__pyx_v_o) {
  std::vector<std::pair<double,std::string> >  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<std::pair<double,std::string> >  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  std::pair<double,std::string>  __pyx_t_5;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___", 0);

  /* "vector.from_py":52
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(X_from_py(item))
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 52, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(13, 52, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 52, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(13, 52, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 52, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(13, 52, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":53
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(X_from_py(item))             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __pyx_convert_pair_from_py_double__and_std_3a__3a_string(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 53, __pyx_L1_error)
    __pyx_v_v.push_back(__pyx_t_5);

    /* "vector.from_py":52
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(X_from_py(item))
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":54
 *     for item in o:
 *         v.push_back(X_from_py(item))
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":50
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.from_py":49
 * 
 * @cname("__pyx_convert_vector_from_py_size_t")
 * cdef vector[X] __pyx_convert_vector_from_py_size_t(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<size_t>  __pyx_convert_vector_from_py_size_t(PyObject *__pyx_v_o) {
  std::vector<size_t>  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<size_t>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_size_t", 0);

  /* "vector.from_py":51
 * cdef vector[X] __pyx_convert_vector_from_py_size_t(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(X_from_py(item))
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 51, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 51, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(13, 51, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 51, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(13, 51, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 51, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(13, 51, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":52
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(X_from_py(item))             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_v_item); if (unlikely(__pyx_t_5 == -1L && PyErr_Occurred())) __PYX_ERR(13, 52, __pyx_L1_error)
    __pyx_v_v.push_back(__pyx_t_5);

    /* "vector.from_py":51
 * cdef vector[X] __pyx_convert_vector_from_py_size_t(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(X_from_py(item))
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":53
 *     for item in o:
 *         v.push_back(X_from_py(item))
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":49
 * 
 * @cname("__pyx_convert_vector_from_py_size_t")
 * cdef vector[X] __pyx_convert_vector_from_py_size_t(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_size_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static std::vector<short>  __pyx_convert_vector_from_py_short(PyObject *__pyx_v_o) {
  std::vector<short>  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<short>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  short __pyx_t_5;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_short", 0);

  /* "vector.from_py":51
 * cdef vector[X] __pyx_convert_vector_from_py_short(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(X_from_py(item))
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 51, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 51, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(13, 51, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 51, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(13, 51, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 51, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(13, 51, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":52
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(X_from_py(item))             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __Pyx_PyInt_As_short(__pyx_v_item); if (unlikely(__pyx_t_5 == -1 && PyErr_Occurred())) __PYX_ERR(13, 52, __pyx_L1_error)
    __pyx_v_v.push_back(__pyx_t_5);

    /* "vector.from_py":51
 * cdef vector[X] __pyx_convert_vector_from_py_short(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(X_from_py(item))
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":53
 *     for item in o:
 *         v.push_back(X_from_py(item))
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":49
 * 
 * @cname("__pyx_convert_vector_from_py_short")
 * cdef vector[X] __pyx_convert_vector_from_py_short(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_short", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_unsigned_int")
 * cdef object __pyx_convert_vector_to_py_unsigned_int(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_unsigned_int(const std::vector<unsigned int>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_unsigned_int", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_unsigned_int")
 * cdef object __pyx_convert_vector_to_py_unsigned_int(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __Pyx_PyInt_From_unsigned_int((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_unsigned_int")
 * cdef object __pyx_convert_vector_to_py_unsigned_int(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_unsigned_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":31
 * 
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0);

  /* "string.to_py":32
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyUnicode_FromStringAndSize(char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":31
 * 
 * @cname("__pyx_convert_PyObject_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":37
 * 
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0);

  /* "string.to_py":38
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyStr_FromStringAndSize(char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":37
 * 
 * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":43
 * 
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 0);

  /* "string.to_py":44
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyBytes_FromStringAndSize(char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":43
 * 
 * @cname("__pyx_convert_PyStr_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":49
 * 
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 0);

  /* "string.to_py":50
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * cdef extern from *:
 *     cdef object __Pyx_PyByteArray_FromStringAndSize(char*, size_t)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":49
 * 
 * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
 * cdef extern from *:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "string.to_py":55
 * 
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
 * 
 */

static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0);

  /* "string.to_py":56
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "string.to_py":55
 * 
 * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string")
 * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s):             # <<<<<<<<<<<<<<
 *     return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pair.to_py":180
 * 
 * @cname("__pyx_convert_pair_to_py_double____std_3a__3a_string")
 * cdef object __pyx_convert_pair_to_py_double____std_3a__3a_string(const pair[X,Y]& p):             # <<<<<<<<<<<<<<
 *     return X_to_py(p.first), Y_to_py(p.second)
 * 
 */

static PyObject *__pyx_convert_pair_to_py_double____std_3a__3a_string(std::pair<double,std::string>  const &__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_pair_to_py_double____std_3a__3a_string", 0);

  /* "pair.to_py":181
 * @cname("__pyx_convert_pair_to_py_double____std_3a__3a_string")
 * cdef object __pyx_convert_pair_to_py_double____std_3a__3a_string(const pair[X,Y]& p):
 *     return X_to_py(p.first), Y_to_py(p.second)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_p.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_convert_PyObject_string_to_py_std__in_string(__pyx_v_p.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pair.to_py":180
 * 
 * @cname("__pyx_convert_pair_to_py_double____std_3a__3a_string")
 * cdef object __pyx_convert_pair_to_py_double____std_3a__3a_string(const pair[X,Y]& p):             # <<<<<<<<<<<<<<
 *     return X_to_py(p.first), Y_to_py(p.second)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pair.to_py.__pyx_convert_pair_to_py_double____std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(const std::vector<std::pair<double,std::string> >  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert_pair_to_py_double____std_3a__3a_string((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pair.to_py":180
 * 
 * @cname("__pyx_convert_pair_to_py_KTfwd_3a__3a_sample_t____KTfwd_3a__3a_sample_t")
 * cdef object __pyx_convert_pair_to_py_KTfwd_3a__3a_sample_t____KTfwd_3a__3a_sample_t(const pair[X,Y]& p):             # <<<<<<<<<<<<<<
 *     return X_to_py(p.first), Y_to_py(p.second)
 * 
 */

static PyObject *__pyx_convert_pair_to_py_KTfwd_3a__3a_sample_t____KTfwd_3a__3a_sample_t(std::pair<KTfwd::sample_t,KTfwd::sample_t>  const &__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_pair_to_py_KTfwd_3a__3a_sample_t____KTfwd_3a__3a_sample_t", 0);

  /* "pair.to_py":181
 * @cname("__pyx_convert_pair_to_py_KTfwd_3a__3a_sample_t____KTfwd_3a__3a_sample_t")
 * cdef object __pyx_convert_pair_to_py_KTfwd_3a__3a_sample_t____KTfwd_3a__3a_sample_t(const pair[X,Y]& p):
 *     return X_to_py(p.first), Y_to_py(p.second)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(__pyx_v_p.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_convert_vector_to_py_std_3a__3a_pair_3c_double_2c_std_3a__3a_string_3e___(__pyx_v_p.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pair.to_py":180
 * 
 * @cname("__pyx_convert_pair_to_py_KTfwd_3a__3a_sample_t____KTfwd_3a__3a_sample_t")
 * cdef object __pyx_convert_pair_to_py_KTfwd_3a__3a_sample_t____KTfwd_3a__3a_sample_t(const pair[X,Y]& p):             # <<<<<<<<<<<<<<
 *     return X_to_py(p.first), Y_to_py(p.second)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pair.to_py.__pyx_convert_pair_to_py_KTfwd_3a__3a_sample_t____KTfwd_3a__3a_sample_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pair.from_py":163
 * 
 * @cname("__pyx_convert_pair_from_py_double__and_double")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_double__and_double(object o) except *:             # <<<<<<<<<<<<<<
 *     x, y = o
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))
 */

static std::pair<double,double>  __pyx_convert_pair_from_py_double__and_double(PyObject *__pyx_v_o) {
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  std::pair<double,double>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  double __pyx_t_5;
  double __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_convert_pair_from_py_double__and_double", 0);

  /* "pair.from_py":164
 * @cname("__pyx_convert_pair_from_py_double__and_double")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_double__and_double(object o) except *:
 *     x, y = o             # <<<<<<<<<<<<<<
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))
 * 
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_o))) || (PyList_CheckExact(__pyx_v_o))) {
    PyObject* sequence = __pyx_v_o;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(13, 164, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(13, 164, __pyx_L1_error)
    __pyx_t_4 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(13, 164, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_y = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pair.from_py":165
 * cdef pair[X,Y] __pyx_convert_pair_from_py_double__and_double(object o) except *:
 *     x, y = o
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_x); if (unlikely(__pyx_t_5 == -1.0 && PyErr_Occurred())) __PYX_ERR(13, 165, __pyx_L1_error)
  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_y); if (unlikely(__pyx_t_6 == -1.0 && PyErr_Occurred())) __PYX_ERR(13, 165, __pyx_L1_error)
  __pyx_r = std::pair<double,double> (__pyx_t_5, __pyx_t_6);
  goto __pyx_L0;

  /* "pair.from_py":163
 * 
 * @cname("__pyx_convert_pair_from_py_double__and_double")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_double__and_double(object o) except *:             # <<<<<<<<<<<<<<
 *     x, y = o
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pair.from_py.__pyx_convert_pair_from_py_double__and_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.from_py":50
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_double_3e___")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_double_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<std::pair<double,double> >  __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_double_3e___(PyObject *__pyx_v_o) {
  std::vector<std::pair<double,double> >  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<std::pair<double,double> >  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  std::pair<double,double>  __pyx_t_5;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_double_3e___", 0);

  /* "vector.from_py":52
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_double_3e___(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(X_from_py(item))
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 52, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(13, 52, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 52, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(13, 52, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 52, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(13, 52, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":53
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(X_from_py(item))             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __pyx_convert_pair_from_py_double__and_double(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 53, __pyx_L1_error)
    __pyx_v_v.push_back(__pyx_t_5);

    /* "vector.from_py":52
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_double_3e___(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(X_from_py(item))
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":54
 *     for item in o:
 *         v.push_back(X_from_py(item))
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":50
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_double_3e___")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_double_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_pair_3c_double_2c_double_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_KTfwd_3a__3a_sep_sample_t")
 * cdef object __pyx_convert_vector_to_py_KTfwd_3a__3a_sep_sample_t(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_KTfwd_3a__3a_sep_sample_t(const std::vector<KTfwd::sep_sample_t>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_KTfwd_3a__3a_sep_sample_t", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_KTfwd_3a__3a_sep_sample_t")
 * cdef object __pyx_convert_vector_to_py_KTfwd_3a__3a_sep_sample_t(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert_pair_to_py_KTfwd_3a__3a_sample_t____KTfwd_3a__3a_sample_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_KTfwd_3a__3a_sep_sample_t")
 * cdef object __pyx_convert_vector_to_py_KTfwd_3a__3a_sep_sample_t(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_KTfwd_3a__3a_sep_sample_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_double(const std::vector<double>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_double", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_double")
 * cdef object __pyx_convert_vector_to_py_double(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = PyFloat_FromDouble((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_double")
 * cdef object __pyx_convert_vector_to_py_double(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_uint16_t(const std::vector<uint16_t>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_uint16_t", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_uint16_t")
 * cdef object __pyx_convert_vector_to_py_uint16_t(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __Pyx_PyInt_From_uint16_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_uint16_t")
 * cdef object __pyx_convert_vector_to_py_uint16_t(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_uint16_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data(const std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data")
 * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data")
 * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data_3e___(const std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data> >  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data_3e___", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data_3e___(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data(const std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data")
 * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data")
 * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_gamete_data_3e___(const std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_gamete_data> >  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_gamete_data_3e___", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_gamete_data_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_gamete_data_3e___(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_gamete_data_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_gamete_data_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_gamete_data_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_data(const std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_data>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_data", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_data")
 * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_data(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_data((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_data")
 * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_data(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_int(const std::vector<int>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_int", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_int")
 * cdef object __pyx_convert_vector_to_py_int(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_int")
 * cdef object __pyx_convert_vector_to_py_int(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data(const std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data")
 * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data")
 * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_data_3e___(const std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_data> >  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_data_3e___", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_data_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_data_3e___(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_data((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_data_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_data_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_data_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data_3e___(const std::vector<std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data> >  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data_3e___", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data_3e___(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_view_data(const std::vector<struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_view_data", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_view_data")
 * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_view_data(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_view_data((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_view_data")
 * cdef object __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_view_data(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_view_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "FromPyStructUtility":11
 * 
 * @cname("__pyx_convert__from_py_struct__fwdpy_3a__3a_selected_mut_data")
 * cdef selected_mut_data __pyx_convert__from_py_struct__fwdpy_3a__3a_selected_mut_data(obj) except *:             # <<<<<<<<<<<<<<
 *     cdef selected_mut_data result
 *     if not PyMapping_Check(obj):
 */

static struct fwdpy::selected_mut_data __pyx_convert__from_py_struct__fwdpy_3a__3a_selected_mut_data(PyObject *__pyx_v_obj) {
  struct fwdpy::selected_mut_data __pyx_v_result;
  PyObject *__pyx_v_value = NULL;
  struct fwdpy::selected_mut_data __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  double __pyx_t_10;
  unsigned int __pyx_t_11;
  __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct__fwdpy_3a__3a_selected_mut_data", 0);

  /* "FromPyStructUtility":13
 * cdef selected_mut_data __pyx_convert__from_py_struct__fwdpy_3a__3a_selected_mut_data(obj) except *:
 *     cdef selected_mut_data result
 *     if not PyMapping_Check(obj):             # <<<<<<<<<<<<<<
 *         PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name)
 * 
 */
  __pyx_t_1 = ((!(PyMapping_Check(__pyx_v_obj) != 0)) != 0);
  if (__pyx_t_1) {

    /* "FromPyStructUtility":14
 *     cdef selected_mut_data result
 *     if not PyMapping_Check(obj):
 *         PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_t_2 = PyErr_Format(__pyx_builtin_TypeError, ((char const *)"Expected %.16s, got %.200s"), ((char *)"a mapping"), Py_TYPE(__pyx_v_obj)->tp_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "FromPyStructUtility":13
 * cdef selected_mut_data __pyx_convert__from_py_struct__fwdpy_3a__3a_selected_mut_data(obj) except *:
 *     cdef selected_mut_data result
 *     if not PyMapping_Check(obj):             # <<<<<<<<<<<<<<
 *         PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name)
 * 
 */
  }

  /* "FromPyStructUtility":16
 *         PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['pos']
 *     except KeyError:
 */
  {
    __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:*/ {

      /* "FromPyStructUtility":17
 * 
 *     try:
 *         value = obj['pos']             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'pos'")
 */
      __pyx_t_2 = PyObject_GetItem(__pyx_v_obj, __pyx_n_s_pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 17, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_value = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "FromPyStructUtility":16
 *         PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['pos']
 *     except KeyError:
 */
    }
    __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_L11_try_end;
    __pyx_L4_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "FromPyStructUtility":18
 *     try:
 *         value = obj['pos']
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         raise ValueError("No value specified for struct attribute 'pos'")
 *     result.pos = value
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__fwdpy_3a__3a_selected_mut_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(13, 18, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);

      /* "FromPyStructUtility":19
 *         value = obj['pos']
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'pos'")             # <<<<<<<<<<<<<<
 *     result.pos = value
 *     try:
 */
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__86, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 19, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(13, 19, __pyx_L6_except_error)
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;

    /* "FromPyStructUtility":16
 *         PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['pos']
 *     except KeyError:
 */
    __Pyx_PyThreadState_assign
    __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_L11_try_end:;
  }

  /* "FromPyStructUtility":20
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'pos'")
 *     result.pos = value             # <<<<<<<<<<<<<<
 *     try:
 *         value = obj['esize']
 */
  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(13, 20, __pyx_L1_error)
  __pyx_v_result.pos = __pyx_t_10;

  /* "FromPyStructUtility":21
 *         raise ValueError("No value specified for struct attribute 'pos'")
 *     result.pos = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['esize']
 *     except KeyError:
 */
  {
    __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:*/ {

      /* "FromPyStructUtility":22
 *     result.pos = value
 *     try:
 *         value = obj['esize']             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'esize'")
 */
      __pyx_t_8 = PyObject_GetItem(__pyx_v_obj, __pyx_n_s_esize); if (unlikely(!__pyx_t_8)) __PYX_ERR(13, 22, __pyx_L14_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "FromPyStructUtility":21
 *         raise ValueError("No value specified for struct attribute 'pos'")
 *     result.pos = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['esize']
 *     except KeyError:
 */
    }
    __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_L21_try_end;
    __pyx_L14_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "FromPyStructUtility":23
 *     try:
 *         value = obj['esize']
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         raise ValueError("No value specified for struct attribute 'esize'")
 *     result.esize = value
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__fwdpy_3a__3a_selected_mut_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(13, 23, __pyx_L16_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_2);

      /* "FromPyStructUtility":24
 *         value = obj['esize']
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'esize'")             # <<<<<<<<<<<<<<
 *     result.esize = value
 *     try:
 */
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__87, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 24, __pyx_L16_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(13, 24, __pyx_L16_except_error)
    }
    goto __pyx_L16_except_error;
    __pyx_L16_except_error:;

    /* "FromPyStructUtility":21
 *         raise ValueError("No value specified for struct attribute 'pos'")
 *     result.pos = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['esize']
 *     except KeyError:
 */
    __Pyx_PyThreadState_assign
    __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);
    goto __pyx_L1_error;
    __pyx_L21_try_end:;
  }

  /* "FromPyStructUtility":25
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'esize'")
 *     result.esize = value             # <<<<<<<<<<<<<<
 *     try:
 *         value = obj['origin']
 */
  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(13, 25, __pyx_L1_error)
  __pyx_v_result.esize = __pyx_t_10;

  /* "FromPyStructUtility":26
 *         raise ValueError("No value specified for struct attribute 'esize'")
 *     result.esize = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['origin']
 *     except KeyError:
 */
  {
    __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:*/ {

      /* "FromPyStructUtility":27
 *     result.esize = value
 *     try:
 *         value = obj['origin']             # <<<<<<<<<<<<<<
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'origin'")
 */
      __pyx_t_2 = PyObject_GetItem(__pyx_v_obj, __pyx_n_s_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 27, __pyx_L24_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "FromPyStructUtility":26
 *         raise ValueError("No value specified for struct attribute 'esize'")
 *     result.esize = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['origin']
 *     except KeyError:
 */
    }
    __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_L31_try_end;
    __pyx_L24_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "FromPyStructUtility":28
 *     try:
 *         value = obj['origin']
 *     except KeyError:             # <<<<<<<<<<<<<<
 *         raise ValueError("No value specified for struct attribute 'origin'")
 *     result.origin = value
 */
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__fwdpy_3a__3a_selected_mut_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(13, 28, __pyx_L26_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);

      /* "FromPyStructUtility":29
 *         value = obj['origin']
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'origin'")             # <<<<<<<<<<<<<<
 *     result.origin = value
 *     return result
 */
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__88, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 29, __pyx_L26_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(13, 29, __pyx_L26_except_error)
    }
    goto __pyx_L26_except_error;
    __pyx_L26_except_error:;

    /* "FromPyStructUtility":26
 *         raise ValueError("No value specified for struct attribute 'esize'")
 *     result.esize = value
 *     try:             # <<<<<<<<<<<<<<
 *         value = obj['origin']
 *     except KeyError:
 */
    __Pyx_PyThreadState_assign
    __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_L31_try_end:;
  }

  /* "FromPyStructUtility":30
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'origin'")
 *     result.origin = value             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_t_11 = __Pyx_PyInt_As_unsigned_int(__pyx_v_value); if (unlikely((__pyx_t_11 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(13, 30, __pyx_L1_error)
  __pyx_v_result.origin = __pyx_t_11;

  /* "FromPyStructUtility":31
 *         raise ValueError("No value specified for struct attribute 'origin'")
 *     result.origin = value
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "FromPyStructUtility":11
 * 
 * @cname("__pyx_convert__from_py_struct__fwdpy_3a__3a_selected_mut_data")
 * cdef selected_mut_data __pyx_convert__from_py_struct__fwdpy_3a__3a_selected_mut_data(obj) except *:             # <<<<<<<<<<<<<<
 *     cdef selected_mut_data result
 *     if not PyMapping_Check(obj):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__fwdpy_3a__3a_selected_mut_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pair.from_py":163
 * 
 * @cname("__pyx_convert_pair_from_py_unsigned_int__and_double")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_unsigned_int__and_double(object o) except *:             # <<<<<<<<<<<<<<
 *     x, y = o
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))
 */

static std::pair<unsigned int,double>  __pyx_convert_pair_from_py_unsigned_int__and_double(PyObject *__pyx_v_o) {
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  std::pair<unsigned int,double>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  unsigned int __pyx_t_5;
  double __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_convert_pair_from_py_unsigned_int__and_double", 0);

  /* "pair.from_py":164
 * @cname("__pyx_convert_pair_from_py_unsigned_int__and_double")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_unsigned_int__and_double(object o) except *:
 *     x, y = o             # <<<<<<<<<<<<<<
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))
 * 
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_o))) || (PyList_CheckExact(__pyx_v_o))) {
    PyObject* sequence = __pyx_v_o;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(13, 164, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(13, 164, __pyx_L1_error)
    __pyx_t_4 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(13, 164, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_y = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pair.from_py":165
 * cdef pair[X,Y] __pyx_convert_pair_from_py_unsigned_int__and_double(object o) except *:
 *     x, y = o
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_v_x); if (unlikely(__pyx_t_5 == -1 && PyErr_Occurred())) __PYX_ERR(13, 165, __pyx_L1_error)
  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_y); if (unlikely(__pyx_t_6 == -1.0 && PyErr_Occurred())) __PYX_ERR(13, 165, __pyx_L1_error)
  __pyx_r = std::pair<unsigned int,double> (__pyx_t_5, __pyx_t_6);
  goto __pyx_L0;

  /* "pair.from_py":163
 * 
 * @cname("__pyx_convert_pair_from_py_unsigned_int__and_double")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_unsigned_int__and_double(object o) except *:             # <<<<<<<<<<<<<<
 *     x, y = o
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pair.from_py.__pyx_convert_pair_from_py_unsigned_int__and_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.from_py":50
 * 
 * @cname("__pyx_convert_vector_from_py___pyx_t_5fwdpy_5fwdpy_genfreqPair")
 * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_5fwdpy_5fwdpy_genfreqPair(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair>  __pyx_convert_vector_from_py___pyx_t_5fwdpy_5fwdpy_genfreqPair(PyObject *__pyx_v_o) {
  std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair>  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair>  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  __pyx_t_5fwdpy_5fwdpy_genfreqPair __pyx_t_5;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py___pyx_t_5fwdpy_5fwdpy_genfreqPair", 0);

  /* "vector.from_py":52
 * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_5fwdpy_5fwdpy_genfreqPair(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(X_from_py(item))
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 52, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(13, 52, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 52, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(13, 52, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 52, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(13, 52, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":53
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(X_from_py(item))             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __pyx_convert_pair_from_py_unsigned_int__and_double(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 53, __pyx_L1_error)
    __pyx_v_v.push_back(__pyx_t_5);

    /* "vector.from_py":52
 * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_5fwdpy_5fwdpy_genfreqPair(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(X_from_py(item))
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":54
 *     for item in o:
 *         v.push_back(X_from_py(item))
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":50
 * 
 * @cname("__pyx_convert_vector_from_py___pyx_t_5fwdpy_5fwdpy_genfreqPair")
 * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_5fwdpy_5fwdpy_genfreqPair(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py___pyx_t_5fwdpy_5fwdpy_genfreqPair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pair.from_py":165
 * 
 * @cname("__pyx_convert_pair_from_py_struct__fwdpy_3a__3a_selected_mut_data__and_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_struct__fwdpy_3a__3a_selected_mut_data__and_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     x, y = o
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))
 */

static std::pair<struct fwdpy::selected_mut_data,std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair> >  __pyx_convert_pair_from_py_struct__fwdpy_3a__3a_selected_mut_data__and_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___(PyObject *__pyx_v_o) {
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  std::pair<struct fwdpy::selected_mut_data,std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair> >  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  struct fwdpy::selected_mut_data __pyx_t_5;
  std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair>  __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_convert_pair_from_py_struct__fwdpy_3a__3a_selected_mut_data__and_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___", 0);

  /* "pair.from_py":166
 * @cname("__pyx_convert_pair_from_py_struct__fwdpy_3a__3a_selected_mut_data__and_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_struct__fwdpy_3a__3a_selected_mut_data__and_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___(object o) except *:
 *     x, y = o             # <<<<<<<<<<<<<<
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))
 * 
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_o))) || (PyList_CheckExact(__pyx_v_o))) {
    PyObject* sequence = __pyx_v_o;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(13, 166, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(13, 166, __pyx_L1_error)
    __pyx_t_4 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(13, 166, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_y = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pair.from_py":167
 * cdef pair[X,Y] __pyx_convert_pair_from_py_struct__fwdpy_3a__3a_selected_mut_data__and_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___(object o) except *:
 *     x, y = o
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __pyx_convert__from_py_struct__fwdpy_3a__3a_selected_mut_data(__pyx_v_x); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 167, __pyx_L1_error)
  __pyx_t_6 = __pyx_convert_vector_from_py___pyx_t_5fwdpy_5fwdpy_genfreqPair(__pyx_v_y); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 167, __pyx_L1_error)
  __pyx_r = std::pair<struct fwdpy::selected_mut_data,std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair> > (__pyx_t_5, __pyx_t_6);
  goto __pyx_L0;

  /* "pair.from_py":165
 * 
 * @cname("__pyx_convert_pair_from_py_struct__fwdpy_3a__3a_selected_mut_data__and_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___")
 * cdef pair[X,Y] __pyx_convert_pair_from_py_struct__fwdpy_3a__3a_selected_mut_data__and_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     x, y = o
 *     return pair[X,Y](X_from_py(x), Y_from_py(y))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pair.from_py.__pyx_convert_pair_from_py_struct__fwdpy_3a__3a_selected_mut_data__and_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.from_py":50
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

static std::vector<std::pair<struct fwdpy::selected_mut_data,std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair> > >  __pyx_convert_vector_from_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(PyObject *__pyx_v_o) {
  std::vector<std::pair<struct fwdpy::selected_mut_data,std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair> > >  __pyx_v_v;
  PyObject *__pyx_v_item = NULL;
  std::vector<std::pair<struct fwdpy::selected_mut_data,std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair> > >  __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  std::pair<struct fwdpy::selected_mut_data,std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair> >  __pyx_t_5;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___", 0);

  /* "vector.from_py":52
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(X_from_py(item))
 *     return v
 */
  if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
    __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 52, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(13, 52, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 52, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(13, 52, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 52, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(13, 52, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vector.from_py":53
 *     cdef vector[X] v
 *     for item in o:
 *         v.push_back(X_from_py(item))             # <<<<<<<<<<<<<<
 *     return v
 * 
 */
    __pyx_t_5 = __pyx_convert_pair_from_py_struct__fwdpy_3a__3a_selected_mut_data__and_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 53, __pyx_L1_error)
    __pyx_v_v.push_back(__pyx_t_5);

    /* "vector.from_py":52
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(object o) except *:
 *     cdef vector[X] v
 *     for item in o:             # <<<<<<<<<<<<<<
 *         v.push_back(X_from_py(item))
 *     return v
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vector.from_py":54
 *     for item in o:
 *         v.push_back(X_from_py(item))
 *     return v             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "vector.from_py":50
 * 
 * @cname("__pyx_convert_vector_from_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___")
 * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(object o) except *:             # <<<<<<<<<<<<<<
 *     cdef vector[X] v
 *     for item in o:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_allele_age_data_t")
 * cdef object __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_allele_age_data_t(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_allele_age_data_t(const std::vector<struct fwdpy::allele_age_data_t>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_allele_age_data_t", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_allele_age_data_t")
 * cdef object __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_allele_age_data_t(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert__to_py_struct__fwdpy_3a__3a_allele_age_data_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_allele_age_data_t")
 * cdef object __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_allele_age_data_t(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_allele_age_data_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pair.to_py":180
 * 
 * @cname("__pyx_convert_pair_to_py_unsigned_int____double")
 * cdef object __pyx_convert_pair_to_py_unsigned_int____double(const pair[X,Y]& p):             # <<<<<<<<<<<<<<
 *     return X_to_py(p.first), Y_to_py(p.second)
 * 
 */

static PyObject *__pyx_convert_pair_to_py_unsigned_int____double(std::pair<unsigned int,double>  const &__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_pair_to_py_unsigned_int____double", 0);

  /* "pair.to_py":181
 * @cname("__pyx_convert_pair_to_py_unsigned_int____double")
 * cdef object __pyx_convert_pair_to_py_unsigned_int____double(const pair[X,Y]& p):
 *     return X_to_py(p.first), Y_to_py(p.second)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_p.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pair.to_py":180
 * 
 * @cname("__pyx_convert_pair_to_py_unsigned_int____double")
 * cdef object __pyx_convert_pair_to_py_unsigned_int____double(const pair[X,Y]& p):             # <<<<<<<<<<<<<<
 *     return X_to_py(p.first), Y_to_py(p.second)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pair.to_py.__pyx_convert_pair_to_py_unsigned_int____double", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py___pyx_t_5fwdpy_5fwdpy_genfreqPair")
 * cdef object __pyx_convert_vector_to_py___pyx_t_5fwdpy_5fwdpy_genfreqPair(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py___pyx_t_5fwdpy_5fwdpy_genfreqPair(const std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py___pyx_t_5fwdpy_5fwdpy_genfreqPair", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py___pyx_t_5fwdpy_5fwdpy_genfreqPair")
 * cdef object __pyx_convert_vector_to_py___pyx_t_5fwdpy_5fwdpy_genfreqPair(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert_pair_to_py_unsigned_int____double((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py___pyx_t_5fwdpy_5fwdpy_genfreqPair")
 * cdef object __pyx_convert_vector_to_py___pyx_t_5fwdpy_5fwdpy_genfreqPair(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py___pyx_t_5fwdpy_5fwdpy_genfreqPair", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pair.to_py":180
 * 
 * @cname("__pyx_convert_pair_to_py_struct__fwdpy_3a__3a_selected_mut_data____std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___")
 * cdef object __pyx_convert_pair_to_py_struct__fwdpy_3a__3a_selected_mut_data____std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___(const pair[X,Y]& p):             # <<<<<<<<<<<<<<
 *     return X_to_py(p.first), Y_to_py(p.second)
 * 
 */

static PyObject *__pyx_convert_pair_to_py_struct__fwdpy_3a__3a_selected_mut_data____std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___(std::pair<struct fwdpy::selected_mut_data,std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair> >  const &__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_pair_to_py_struct__fwdpy_3a__3a_selected_mut_data____std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___", 0);

  /* "pair.to_py":181
 * @cname("__pyx_convert_pair_to_py_struct__fwdpy_3a__3a_selected_mut_data____std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___")
 * cdef object __pyx_convert_pair_to_py_struct__fwdpy_3a__3a_selected_mut_data____std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___(const pair[X,Y]& p):
 *     return X_to_py(p.first), Y_to_py(p.second)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert__to_py_struct__fwdpy_3a__3a_selected_mut_data(__pyx_v_p.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_convert_vector_to_py___pyx_t_5fwdpy_5fwdpy_genfreqPair(__pyx_v_p.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pair.to_py":180
 * 
 * @cname("__pyx_convert_pair_to_py_struct__fwdpy_3a__3a_selected_mut_data____std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___")
 * cdef object __pyx_convert_pair_to_py_struct__fwdpy_3a__3a_selected_mut_data____std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___(const pair[X,Y]& p):             # <<<<<<<<<<<<<<
 *     return X_to_py(p.first), Y_to_py(p.second)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pair.to_py.__pyx_convert_pair_to_py_struct__fwdpy_3a__3a_selected_mut_data____std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(const std::vector<std::pair<struct fwdpy::selected_mut_data,std::vector<__pyx_t_5fwdpy_5fwdpy_genfreqPair> > >  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert_pair_to_py_struct__fwdpy_3a__3a_selected_mut_data____std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e___((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_pair_3c_struct__fwdpy_3a__3a_selected_mut_data_2c_std_3a__3a_vector_3c___pyx_t_5fwdpy_5fwdpy_genfreqPair_3e____3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_selected_mut_data_tidy(const std::vector<struct fwdpy::selected_mut_data_tidy>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_selected_mut_data_tidy", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_selected_mut_data_tidy")
 * cdef object __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_selected_mut_data_tidy(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert__to_py_struct__fwdpy_3a__3a_selected_mut_data_tidy((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_selected_mut_data_tidy")
 * cdef object __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_selected_mut_data_tidy(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_selected_mut_data_tidy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_qtrait_stats_cython(const std::vector<struct fwdpy::qtrait_stats_cython>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_qtrait_stats_cython", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_qtrait_stats_cython")
 * cdef object __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_qtrait_stats_cython(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert__to_py_struct__fwdpy_3a__3a_qtrait_stats_cython((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_qtrait_stats_cython")
 * cdef object __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_qtrait_stats_cython(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_qtrait_stats_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_qtrait_stats_cython_3e___(const std::vector<std::vector<struct fwdpy::qtrait_stats_cython> >  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_qtrait_stats_cython_3e___", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_qtrait_stats_cython_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_qtrait_stats_cython_3e___(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_qtrait_stats_cython((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_qtrait_stats_cython_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_qtrait_stats_cython_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_qtrait_stats_cython_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pair.to_py":180
 * 
 * @cname("__pyx_convert_pair_to_py_KTfwd_3a__3a_sep_sample_t____struct__fwdpy_3a__3a_popsample_details")
 * cdef object __pyx_convert_pair_to_py_KTfwd_3a__3a_sep_sample_t____struct__fwdpy_3a__3a_popsample_details(const pair[X,Y]& p):             # <<<<<<<<<<<<<<
 *     return X_to_py(p.first), Y_to_py(p.second)
 * 
 */

static PyObject *__pyx_convert_pair_to_py_KTfwd_3a__3a_sep_sample_t____struct__fwdpy_3a__3a_popsample_details(std::pair<KTfwd::sep_sample_t,struct fwdpy::popsample_details>  const &__pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_pair_to_py_KTfwd_3a__3a_sep_sample_t____struct__fwdpy_3a__3a_popsample_details", 0);

  /* "pair.to_py":181
 * @cname("__pyx_convert_pair_to_py_KTfwd_3a__3a_sep_sample_t____struct__fwdpy_3a__3a_popsample_details")
 * cdef object __pyx_convert_pair_to_py_KTfwd_3a__3a_sep_sample_t____struct__fwdpy_3a__3a_popsample_details(const pair[X,Y]& p):
 *     return X_to_py(p.first), Y_to_py(p.second)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_convert_pair_to_py_KTfwd_3a__3a_sample_t____KTfwd_3a__3a_sample_t(__pyx_v_p.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_convert__to_py_struct__fwdpy_3a__3a_popsample_details(__pyx_v_p.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pair.to_py":180
 * 
 * @cname("__pyx_convert_pair_to_py_KTfwd_3a__3a_sep_sample_t____struct__fwdpy_3a__3a_popsample_details")
 * cdef object __pyx_convert_pair_to_py_KTfwd_3a__3a_sep_sample_t____struct__fwdpy_3a__3a_popsample_details(const pair[X,Y]& p):             # <<<<<<<<<<<<<<
 *     return X_to_py(p.first), Y_to_py(p.second)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pair.to_py.__pyx_convert_pair_to_py_KTfwd_3a__3a_sep_sample_t____struct__fwdpy_3a__3a_popsample_details", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_KTfwd_3a__3a_sep_sample_t_2c_struct__fwdpy_3a__3a_popsample_details_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_KTfwd_3a__3a_sep_sample_t_2c_struct__fwdpy_3a__3a_popsample_details_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_pair_3c_KTfwd_3a__3a_sep_sample_t_2c_struct__fwdpy_3a__3a_popsample_details_3e___(const std::vector<std::pair<KTfwd::sep_sample_t,struct fwdpy::popsample_details> >  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_KTfwd_3a__3a_sep_sample_t_2c_struct__fwdpy_3a__3a_popsample_details_3e___", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_KTfwd_3a__3a_sep_sample_t_2c_struct__fwdpy_3a__3a_popsample_details_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_KTfwd_3a__3a_sep_sample_t_2c_struct__fwdpy_3a__3a_popsample_details_3e___(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert_pair_to_py_KTfwd_3a__3a_sep_sample_t____struct__fwdpy_3a__3a_popsample_details((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_pair_3c_KTfwd_3a__3a_sep_sample_t_2c_struct__fwdpy_3a__3a_popsample_details_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_pair_3c_KTfwd_3a__3a_sep_sample_t_2c_struct__fwdpy_3a__3a_popsample_details_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_pair_3c_KTfwd_3a__3a_sep_sample_t_2c_struct__fwdpy_3a__3a_popsample_details_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_VAcum(const std::vector<struct fwdpy::VAcum>  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_VAcum", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_VAcum")
 * cdef object __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_VAcum(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert__to_py_struct__fwdpy_3a__3a_VAcum((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_VAcum")
 * cdef object __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_VAcum(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct__fwdpy_3a__3a_VAcum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_VAcum_3e___(const std::vector<std::vector<struct fwdpy::VAcum> >  &__pyx_v_v) {
  size_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_VAcum_3e___", 0);

  /* "vector.to_py":68
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_VAcum_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_VAcum_3e___(vector[X]& v):
 *     return [X_to_py(v[i]) for i in range(v.size())]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_v_v.size();
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_convert_vector_to_py_struct__fwdpy_3a__3a_VAcum((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(13, 68, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "vector.to_py":67
 * 
 * @cname("__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_VAcum_3e___")
 * cdef object __pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_VAcum_3e___(vector[X]& v):             # <<<<<<<<<<<<<<
 *     return [X_to_py(v[i]) for i in range(v.size())]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_std_3a__3a_vector_3c_struct__fwdpy_3a__3a_VAcum_3e___", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":120
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

/* Python wrapper */
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_shape = 0;
  Py_ssize_t __pyx_v_itemsize;
  PyObject *__pyx_v_format = 0;
  PyObject *__pyx_v_mode = 0;
  int __pyx_v_allocate_buffer;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_n_s_c);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(13, 120, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(13, 120, __pyx_L3_error)
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_allocate_buffer);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(13, 120, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_shape = ((PyObject*)values[0]);
    __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(13, 120, __pyx_L3_error)
    __pyx_v_format = values[2];
    __pyx_v_mode = values[3];
    if (values[4]) {
      __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(13, 121, __pyx_L3_error)
    } else {

      /* "View.MemoryView":121
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
 *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
 * 
 *         cdef int idx
 */
      __pyx_v_allocate_buffer = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(13, 120, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(13, 120, __pyx_L1_error)
  if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(13, 120, __pyx_L1_error)
  }
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);

  /* "View.MemoryView":120
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
  int __pyx_v_idx;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_dim;
  PyObject **__pyx_v_p;
  char __pyx_v_order;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  char *__pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_format);

  /* "View.MemoryView":127
 *         cdef PyObject **p
 * 
 *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
 *         self.itemsize = itemsize
 * 
 */
  if (unlikely(__pyx_v_shape == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(13, 127, __pyx_L1_error)
  }
  __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(13, 127, __pyx_L1_error)
  __pyx_v_self->ndim = ((int)__pyx_t_1);

  /* "View.MemoryView":128
 * 
 *         self.ndim = <int> len(shape)
 *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not self.ndim:
 */
  __pyx_v_self->itemsize = __pyx_v_itemsize;

  /* "View.MemoryView":130
 *         self.itemsize = itemsize
 * 
 *         if not self.ndim:             # <<<<<<<<<<<<<<
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":131
 * 
 *         if not self.ndim:
 *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if itemsize <= 0:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__89, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 131, __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(13, 131, __pyx_L1_error)

    /* "View.MemoryView":130
 *         self.itemsize = itemsize
 * 
 *         if not self.ndim:             # <<<<<<<<<<<<<<
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 */
  }

  /* "View.MemoryView":133
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 *         if itemsize <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 */
  __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":134
 * 
 *         if itemsize <= 0:
 *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(format, bytes):
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__90, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 134, __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(13, 134, __pyx_L1_error)

    /* "View.MemoryView":133
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 *         if itemsize <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 */
  }

  /* "View.MemoryView":136
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 */
  __pyx_t_2 = PyBytes_Check(__pyx_v_format); 
  __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_4) {

    /* "View.MemoryView":137
 * 
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__91, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "View.MemoryView":136
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 */
  }

  /* "View.MemoryView":138
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
 *         self.format = self._format
 * 
 */
  if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(13, 138, __pyx_L1_error)
  __pyx_t_5 = __pyx_v_format;
  __Pyx_INCREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->_format);
  __Pyx_DECREF(__pyx_v_self->_format);
  __pyx_v_self->_format = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "View.MemoryView":139
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_self->_format); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(13, 139, __pyx_L1_error)
  __pyx_v_self->format = __pyx_t_6;

  /* "View.MemoryView":142
 * 
 * 
 *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
 *         self._strides = self._shape + self.ndim
 * 
 */
  __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));

  /* "View.MemoryView":143
 * 
 *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
 *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
 * 
 *         if not self._shape:
 */
  __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);

  /* "View.MemoryView":145
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError("unable to allocate shape and strides.")
 * 
 */
  __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
  if (__pyx_t_4) {

    /* "View.MemoryView":146
 * 
 *         if not self._shape:
 *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__92, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(13, 146, __pyx_L1_error)

    /* "View.MemoryView":145
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError("unable to allocate shape and strides.")
 * 
 */
  }

  /* "View.MemoryView":149
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 */
  __pyx_t_7 = 0;
  __pyx_t_5 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(13, 149, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(13, 149, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_dim = __pyx_t_8;
    __pyx_v_idx = __pyx_t_7;
    __pyx_t_7 = (__pyx_t_7 + 1);

    /* "View.MemoryView":150
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 *             self._shape[idx] = dim
 */
    __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
    if (__pyx_t_4) {

      /* "View.MemoryView":151
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
 *             self._shape[idx] = dim
 * 
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(13, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
      __pyx_t_3 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(13, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 151, __pyx_L1_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(13, 151, __pyx_L1_error)

      /* "View.MemoryView":150
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 *             self._shape[idx] = dim
 */
    }

    /* "View.MemoryView":152
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
 * 
 *         cdef char order
 */
    (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;

    /* "View.MemoryView":149
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 */
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "View.MemoryView":155
 * 
 *         cdef char order
 *         if mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
 */
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(13, 155, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "View.MemoryView":156
 *         cdef char order
 *         if mode == 'fortran':
 *             order = b'F'             # <<<<<<<<<<<<<<
 *             self.mode = u'fortran'
 *         elif mode == 'c':
 */
    __pyx_v_order = 'F';

    /* "View.MemoryView":157
 *         if mode == 'fortran':
 *             order = b'F'
 *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
 *         elif mode == 'c':
 *             order = b'C'
 */
    __Pyx_INCREF(__pyx_n_u_fortran);
    __Pyx_GIVEREF(__pyx_n_u_fortran);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_n_u_fortran;

    /* "View.MemoryView":155
 * 
 *         cdef char order
 *         if mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
 */
    goto __pyx_L10;
  }

  /* "View.MemoryView":158
 *             order = b'F'
 *             self.mode = u'fortran'
 *         elif mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
 */
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(13, 158, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "View.MemoryView":159
 *             self.mode = u'fortran'
 *         elif mode == 'c':
 *             order = b'C'             # <<<<<<<<<<<<<<
 *             self.mode = u'c'
 *         else:
 */
    __pyx_v_order = 'C';

    /* "View.MemoryView":160
 *         elif mode == 'c':
 *             order = b'C'
 *             self.mode = u'c'             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
 */
    __Pyx_INCREF(__pyx_n_u_c);
    __Pyx_GIVEREF(__pyx_n_u_c);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_n_u_c;

    /* "View.MemoryView":158
 *             order = b'F'
 *             self.mode = u'fortran'
 *         elif mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
 */
    goto __pyx_L10;
  }

  /* "View.MemoryView":162
 *             self.mode = u'c'
 *         else:
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides,
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(13, 162, __pyx_L1_error)
  }
  __pyx_L10:;

  /* "View.MemoryView":164
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
 *                                              itemsize, self.ndim, order)
 * 
 */
  __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);

  /* "View.MemoryView":167
 *                                              itemsize, self.ndim, order)
 * 
 *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:
 */
  __pyx_v_self->free_data = __pyx_v_allocate_buffer;

  /* "View.MemoryView":168
 * 
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
 *         if allocate_buffer:
 * 
 */
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 168, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(13, 168, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_self->dtype_is_object = __pyx_t_4;

  /* "View.MemoryView":169
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
  if (__pyx_t_4) {

    /* "View.MemoryView":172
 * 
 * 
 *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")
 */
    __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));

    /* "View.MemoryView":173
 * 
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:             # <<<<<<<<<<<<<<
 *                 raise MemoryError("unable to allocate array data.")
 * 
 */
    __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
    if (__pyx_t_4) {

      /* "View.MemoryView":174
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
 * 
 *             if self.dtype_is_object:
 */
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__93, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 174, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(13, 174, __pyx_L1_error)

      /* "View.MemoryView":173
 * 
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:             # <<<<<<<<<<<<<<
 *                 raise MemoryError("unable to allocate array data.")
 * 
 */
    }

    /* "View.MemoryView":176
 *                 raise MemoryError("unable to allocate array data.")
 * 
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):
 */
    __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
    if (__pyx_t_4) {

      /* "View.MemoryView":177
 * 
 *             if self.dtype_is_object:
 *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
 *                 for i in range(self.len / itemsize):
 *                     p[i] = Py_None
 */
      __pyx_v_p = ((PyObject **)__pyx_v_self->data);

      /* "View.MemoryView":178
 *             if self.dtype_is_object:
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
 *                     p[i] = Py_None
 *                     Py_INCREF(Py_None)
 */
      if (unlikely(__pyx_v_itemsize == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
        __PYX_ERR(13, 178, __pyx_L1_error)
      }
      else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
        PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
        __PYX_ERR(13, 178, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
      for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_1; __pyx_t_8+=1) {
        __pyx_v_i = __pyx_t_8;

        /* "View.MemoryView":179
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):
 *                     p[i] = Py_None             # <<<<<<<<<<<<<<
 *                     Py_INCREF(Py_None)
 * 
 */
        (__pyx_v_p[__pyx_v_i]) = Py_None;

        /* "View.MemoryView":180
 *                 for i in range(self.len / itemsize):
 *                     p[i] = Py_None
 *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
 */
        Py_INCREF(Py_None);
      }

      /* "View.MemoryView":176
 *                 raise MemoryError("unable to allocate array data.")
 * 
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):
 */
    }

    /* "View.MemoryView":169
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":120
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_format);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":183
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_bufmode;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t *__pyx_t_7;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "View.MemoryView":184
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 */
  __pyx_v_bufmode = -1;

  /* "View.MemoryView":185
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if self.mode == u"c":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(13, 185, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":186
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 */
    __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);

    /* "View.MemoryView":185
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if self.mode == u"c":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":187
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 */
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(13, 187, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":188
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 */
    __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);

    /* "View.MemoryView":187
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":189
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 */
  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":190
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
 *         info.buf = self.data
 *         info.len = self.len
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__94, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 190, __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(13, 190, __pyx_L1_error)

    /* "View.MemoryView":189
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 */
  }

  /* "View.MemoryView":191
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data             # <<<<<<<<<<<<<<
 *         info.len = self.len
 *         info.ndim = self.ndim
 */
  __pyx_t_4 = __pyx_v_self->data;
  __pyx_v_info->buf = __pyx_t_4;

  /* "View.MemoryView":192
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 *         info.len = self.len             # <<<<<<<<<<<<<<
 *         info.ndim = self.ndim
 *         info.shape = self._shape
 */
  __pyx_t_5 = __pyx_v_self->len;
  __pyx_v_info->len = __pyx_t_5;

  /* "View.MemoryView":193
 *         info.buf = self.data
 *         info.len = self.len
 *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
 *         info.shape = self._shape
 *         info.strides = self._strides
 */
  __pyx_t_6 = __pyx_v_self->ndim;
  __pyx_v_info->ndim = __pyx_t_6;

  /* "View.MemoryView":194
 *         info.len = self.len
 *         info.ndim = self.ndim
 *         info.shape = self._shape             # <<<<<<<<<<<<<<
 *         info.strides = self._strides
 *         info.suboffsets = NULL
 */
  __pyx_t_7 = __pyx_v_self->_shape;
  __pyx_v_info->shape = __pyx_t_7;

  /* "View.MemoryView":195
 *         info.ndim = self.ndim
 *         info.shape = self._shape
 *         info.strides = self._strides             # <<<<<<<<<<<<<<
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize
 */
  __pyx_t_7 = __pyx_v_self->_strides;
  __pyx_v_info->strides = __pyx_t_7;

  /* "View.MemoryView":196
 *         info.shape = self._shape
 *         info.strides = self._strides
 *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *         info.itemsize = self.itemsize
 *         info.readonly = 0
 */
  __pyx_v_info->suboffsets = NULL;

  /* "View.MemoryView":197
 *         info.strides = self._strides
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
 *         info.readonly = 0
 * 
 */
  __pyx_t_5 = __pyx_v_self->itemsize;
  __pyx_v_info->itemsize = __pyx_t_5;

  /* "View.MemoryView":198
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize
 *         info.readonly = 0             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
 */
  __pyx_v_info->readonly = 0;

  /* "View.MemoryView":200
 *         info.readonly = 0
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.format
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":201
 * 
 *         if flags & PyBUF_FORMAT:
 *             info.format = self.format             # <<<<<<<<<<<<<<
 *         else:
 *             info.format = NULL
 */
    __pyx_t_4 = __pyx_v_self->format;
    __pyx_v_info->format = __pyx_t_4;

    /* "View.MemoryView":200
 *         info.readonly = 0
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.format
 *         else:
 */
    goto __pyx_L5;
  }

  /* "View.MemoryView":203
 *             info.format = self.format
 *         else:
 *             info.format = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.obj = self
 */
  /*else*/ {
    __pyx_v_info->format = NULL;
  }
  __pyx_L5:;

  /* "View.MemoryView":205
 *             info.format = NULL
 * 
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 */
  __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);

  /* "View.MemoryView":183
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":209
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 */

/* Python wrapper */
static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "View.MemoryView":210
 * 
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 */
  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":211
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
 *         elif self.free_data:
 *             if self.dtype_is_object:
 */
    __pyx_v_self->callback_free_data(__pyx_v_self->data);

    /* "View.MemoryView":210
 * 
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":212
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,
 */
  __pyx_t_1 = (__pyx_v_self->free_data != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":213
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape,
 *                                           self._strides, self.ndim, False)
 */
    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":214
 *         elif self.free_data:
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
 *                                           self._strides, self.ndim, False)
 *             free(self.data)
 */
      __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);

      /* "View.MemoryView":213
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape,
 *                                           self._strides, self.ndim, False)
 */
    }

    /* "View.MemoryView":216
 *                 refcount_objects_in_slice(self.data, self._shape,
 *                                           self._strides, self.ndim, False)
 *             free(self.data)             # <<<<<<<<<<<<<<
 *         PyObject_Free(self._shape)
 * 
 */
    free(__pyx_v_self->data);

    /* "View.MemoryView":212
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":217
 *                                           self._strides, self.ndim, False)
 *             free(self.data)
 *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  PyObject_Free(__pyx_v_self->_shape);

  /* "View.MemoryView":209
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":220
 * 
 *     @property
 *     def memview(self):             # <<<<<<<<<<<<<<
 *         return self.get_memview()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":221
 *     @property
 *     def memview(self):
 *         return self.get_memview()             # <<<<<<<<<<<<<<
 * 
 *     @cname('get_memview')
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":220
 * 
 *     @property
 *     def memview(self):             # <<<<<<<<<<<<<<
 *         return self.get_memview()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":224
 * 
 *     @cname('get_memview')
 *     cdef get_memview(self):             # <<<<<<<<<<<<<<
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)
 */

static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get_memview", 0);

  /* "View.MemoryView":225
 *     @cname('get_memview')
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 */
  __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);

  /* "View.MemoryView":226
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":224
 * 
 *     @cname('get_memview')
 *     cdef get_memview(self):             # <<<<<<<<<<<<<<
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":229
 * 
 * 
 *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
 *         return getattr(self.memview, attr)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "View.MemoryView":230
 * 
 *     def __getattr__(self, attr):
 *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, item):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":229
 * 
 * 
 *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
 *         return getattr(self.memview, attr)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":232
 *         return getattr(self.memview, attr)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.memview[item]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":233
 * 
 *     def __getitem__(self, item):
 *         return self.memview[item]             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, item, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":232
 *         return getattr(self.memview, attr)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.memview[item]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":235
 *         return self.memview[item]
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.memview[item] = value
 * 
 */

/* Python wrapper */
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "View.MemoryView":236
 * 
 *     def __setitem__(self, item, value):
 *         self.memview[item] = value             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(13, 236, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":235
 *         return self.memview[item]
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.memview[item] = value
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":240
 * 
 * @cname("__pyx_array_new")
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
 *                           char *mode, char *buf):
 *     cdef array result
 */

static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) {
  struct __pyx_array_obj *__pyx_v_result = 0;
  struct __pyx_array_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("array_cwrapper", 0);

  /* "View.MemoryView":244
 *     cdef array result
 * 
 *     if buf == NULL:             # <<<<<<<<<<<<<<
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":245
 * 
 *     if buf == NULL:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":244
 *     cdef array result
 * 
 *     if buf == NULL:             # <<<<<<<<<<<<<<
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":247
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
 *                        allocate_buffer=False)
 *         result.data = buf
 */
  /*else*/ {
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;

    /* "View.MemoryView":248
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),
 *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
 *         result.data = buf
 * 
 */
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(13, 248, __pyx_L1_error)

    /* "View.MemoryView":247
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
 *                        allocate_buffer=False)
 *         result.data = buf
 */
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "View.MemoryView":249
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),
 *                        allocate_buffer=False)
 *         result.data = buf             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_v_result->data = __pyx_v_buf;
  }
  __pyx_L3:;

  /* "View.MemoryView":251
 *         result.data = buf
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "View.MemoryView":240
 * 
 * @cname("__pyx_array_new")
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
 *                           char *mode, char *buf):
 *     cdef array result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":277
 * cdef class Enum(object):
 *     cdef object name
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         self.name = name
 *     def __repr__(self):
 */

/* Python wrapper */
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(13, 277, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(13, 277, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "View.MemoryView":278
 *     cdef object name
 *     def __init__(self, name):
 *         self.name = name             # <<<<<<<<<<<<<<
 *     def __repr__(self):
 *         return self.name
 */
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = __pyx_v_name;

  /* "View.MemoryView":277
 * cdef class Enum(object):
 *     cdef object name
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         self.name = name
 *     def __repr__(self):
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":279
 *     def __init__(self, name):
 *         self.name = name
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":280
 *         self.name = name
 *     def __repr__(self):
 *         return self.name             # <<<<<<<<<<<<<<
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

  /* "View.MemoryView":279
 *     def __init__(self, name):
 *         self.name = name
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":294
 * 
 * @cname('__pyx_align_pointer')
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
 */

static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
  Py_intptr_t __pyx_v_aligned_p;
  size_t __pyx_v_offset;
  void *__pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":296
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
 *     cdef size_t offset
 * 
 */
  __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);

  /* "View.MemoryView":300
 * 
 *     with cython.cdivision(True):
 *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
 * 
 *     if offset > 0:
 */
  __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);

  /* "View.MemoryView":302
 *         offset = aligned_p % alignment
 * 
 *     if offset > 0:             # <<<<<<<<<<<<<<
 *         aligned_p += alignment - offset
 * 
 */
  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":303
 * 
 *     if offset > 0:
 *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
 * 
 *     return <void *> aligned_p
 */
    __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));

    /* "View.MemoryView":302
 *         offset = aligned_p % alignment
 * 
 *     if offset > 0:             # <<<<<<<<<<<<<<
 *         aligned_p += alignment - offset
 * 
 */
  }

  /* "View.MemoryView":305
 *         aligned_p += alignment - offset
 * 
 *     return <void *> aligned_p             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((void *)__pyx_v_aligned_p);
  goto __pyx_L0;

  /* "View.MemoryView":294
 * 
 * @cname('__pyx_align_pointer')
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":341
 *     cdef __Pyx_TypeInfo *typeinfo
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
 *         self.obj = obj
 *         self.flags = flags
 */

/* Python wrapper */
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obj = 0;
  int __pyx_v_flags;
  int __pyx_v_dtype_is_object;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(13, 341, __pyx_L3_error)
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dtype_is_object);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(13, 341, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obj = values[0];
    __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(13, 341, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(13, 341, __pyx_L3_error)
    } else {
      __pyx_v_dtype_is_object = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(13, 341, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "View.MemoryView":342
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
 *         self.obj = obj             # <<<<<<<<<<<<<<
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:
 */
  __Pyx_INCREF(__pyx_v_obj);
  __Pyx_GIVEREF(__pyx_v_obj);
  __Pyx_GOTREF(__pyx_v_self->obj);
  __Pyx_DECREF(__pyx_v_self->obj);
  __pyx_v_self->obj = __pyx_v_obj;

  /* "View.MemoryView":343
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
 *         self.obj = obj
 *         self.flags = flags             # <<<<<<<<<<<<<<
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 */
  __pyx_v_self->flags = __pyx_v_flags;

  /* "View.MemoryView":344
 *         self.obj = obj
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 */
  __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_obj != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "View.MemoryView":345
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 */
    __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(13, 345, __pyx_L1_error)

    /* "View.MemoryView":346
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)
 */
    __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":347
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
 *                 Py_INCREF(Py_None)
 * 
 */
      ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;

      /* "View.MemoryView":348
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *         global __pyx_memoryview_thread_locks_used
 */
      Py_INCREF(Py_None);

      /* "View.MemoryView":346
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)
 */
    }

    /* "View.MemoryView":344
 *         self.obj = obj
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 */
  }

  /* "View.MemoryView":351
 * 
 *         global __pyx_memoryview_thread_locks_used
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 */
  __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":352
 *         global __pyx_memoryview_thread_locks_used
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:
 */
    __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);

    /* "View.MemoryView":353
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()
 */
    __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);

    /* "View.MemoryView":351
 * 
 *         global __pyx_memoryview_thread_locks_used
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 */
  }

  /* "View.MemoryView":354
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:             # <<<<<<<<<<<<<<
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:
 */
  __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":355
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
 *             if self.lock is NULL:
 *                 raise MemoryError
 */
    __pyx_v_self->lock = PyThread_allocate_lock();

    /* "View.MemoryView":356
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
    __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":357
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
 */
      PyErr_NoMemory(); __PYX_ERR(13, 357, __pyx_L1_error)

      /* "View.MemoryView":356
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
    }

    /* "View.MemoryView":354
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:             # <<<<<<<<<<<<<<
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:
 */
  }

  /* "View.MemoryView":359
 *                 raise MemoryError
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":360
 * 
 *         if flags & PyBUF_FORMAT:
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
 *         else:
 *             self.dtype_is_object = dtype_is_object
 */
    __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L11_bool_binop_done:;
    __pyx_v_self->dtype_is_object = __pyx_t_1;

    /* "View.MemoryView":359
 *                 raise MemoryError
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 */
    goto __pyx_L10;
  }

  /* "View.MemoryView":362
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
 * 
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
 */
  /*else*/ {
    __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
  }
  __pyx_L10:;

  /* "View.MemoryView":364
 *             self.dtype_is_object = dtype_is_object
 * 
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
 *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
 *         self.typeinfo = NULL
 */
  __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));

  /* "View.MemoryView":366
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
 *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
 *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(memoryview self):
 */
  __pyx_v_self->typeinfo = NULL;

  /* "View.MemoryView":341
 *     cdef __Pyx_TypeInfo *typeinfo
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
 *         self.obj = obj
 *         self.flags = flags
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":368
 *         self.typeinfo = NULL
 * 
 *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)
 */

/* Python wrapper */
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
  int __pyx_v_i;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyThread_type_lock __pyx_t_5;
  PyThread_type_lock __pyx_t_6;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "View.MemoryView":369
 * 
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_ReleaseBuffer(&self.view)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->obj != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":370
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
 * 
 *         cdef int i
 */
    __Pyx_ReleaseBuffer((&__pyx_v_self->view));

    /* "View.MemoryView":369
 * 
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_ReleaseBuffer(&self.view)
 * 
 */
  }

  /* "View.MemoryView":374
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 */
  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":375
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 */
    __pyx_t_3 = __pyx_memoryview_thread_locks_used;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":376
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 */
      __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":377
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 */
        __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);

        /* "View.MemoryView":378
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 */
        __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":380
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
 *                     break
 *             else:
 */
          __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
          __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]);

          /* "View.MemoryView":379
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 *                     break
 */
          (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5;
          (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6;

          /* "View.MemoryView":378
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 */
        }

        /* "View.MemoryView":381
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 PyThread_free_lock(self.lock)
 */
        goto __pyx_L6_break;

        /* "View.MemoryView":376
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 */
      }
    }
    /*else*/ {

      /* "View.MemoryView":383
 *                     break
 *             else:
 *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
 */
      PyThread_free_lock(__pyx_v_self->lock);
    }
    __pyx_L6_break:;

    /* "View.MemoryView":374
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 */
  }

  /* "View.MemoryView":368
 *         self.typeinfo = NULL
 * 
 *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":385
 *                 PyThread_free_lock(self.lock)
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf
 */

static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  Py_ssize_t __pyx_v_dim;
  char *__pyx_v_itemp;
  PyObject *__pyx_v_idx = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  char *__pyx_t_7;
  __Pyx_RefNannySetupContext("get_item_pointer", 0);

  /* "View.MemoryView":387
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
 * 
 *         for dim, idx in enumerate(index):
 */
  __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);

  /* "View.MemoryView":389
 *         cdef char *itemp = <char *> self.view.buf
 * 
 *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 */
  __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
    __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 389, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(13, 389, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 389, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(13, 389, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 389, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(13, 389, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_v_dim = __pyx_t_1;
    __pyx_t_1 = (__pyx_t_1 + 1);

    /* "View.MemoryView":390
 * 
 *         for dim, idx in enumerate(index):
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
 * 
 *         return itemp
 */
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(13, 390, __pyx_L1_error)
    __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == NULL)) __PYX_ERR(13, 390, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_7;

    /* "View.MemoryView":389
 *         cdef char *itemp = <char *> self.view.buf
 * 
 *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":392
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 *         return itemp             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_itemp;
  goto __pyx_L0;

  /* "View.MemoryView":385
 *                 PyThread_free_lock(self.lock)
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":395
 * 
 * 
 *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
 *         if index is Ellipsis:
 *             return self
 */

/* Python wrapper */
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_v_have_slices = NULL;
  PyObject *__pyx_v_indices = NULL;
  char *__pyx_v_itemp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  char *__pyx_t_6;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":396
 * 
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:             # <<<<<<<<<<<<<<
 *             return self
 * 
 */
  __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":397
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:
 *             return self             # <<<<<<<<<<<<<<
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;

    /* "View.MemoryView":396
 * 
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:             # <<<<<<<<<<<<<<
 *             return self
 * 
 */
  }

  /* "View.MemoryView":399
 *             return self
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         cdef char *itemp
 */
  __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(13, 399, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(13, 399, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_indices = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "View.MemoryView":402
 * 
 *         cdef char *itemp
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             return memview_slice(self, indices)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(13, 402, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "View.MemoryView":403
 *         cdef char *itemp
 *         if have_slices:
 *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
 *         else:
 *             itemp = self.get_item_pointer(indices)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 403, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":402
 * 
 *         cdef char *itemp
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             return memview_slice(self, indices)
 *         else:
 */
  }

  /* "View.MemoryView":405
 *             return memview_slice(self, indices)
 *         else:
 *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
 *             return self.convert_item_to_object(itemp)
 * 
 */
  /*else*/ {
    __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == NULL)) __PYX_ERR(13, 405, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_6;

    /* "View.MemoryView":406
 *         else:
 *             itemp = self.get_item_pointer(indices)
 *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(memoryview self, object index, object value):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":395
 * 
 * 
 *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
 *         if index is Ellipsis:
 *             return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_have_slices);
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":408
 *             return self.convert_item_to_object(itemp)
 * 
 *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 */

/* Python wrapper */
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_have_slices = NULL;
  PyObject *__pyx_v_obj = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__setitem__", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "View.MemoryView":409
 * 
 *     def __setitem__(memoryview self, object index, object value):
 *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         if have_slices:
 */
  __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(13, 409, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(13, 409, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "View.MemoryView":411
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj:
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(13, 411, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "View.MemoryView":412
 * 
 *         if have_slices:
 *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
 *             if obj:
 *                 self.setitem_slice_assignment(self[index], obj)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_obj = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "View.MemoryView":413
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 */
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(13, 413, __pyx_L1_error)
    if (__pyx_t_4) {

      /* "View.MemoryView":414
 *             obj = self.is_slice(value)
 *             if obj:
 *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)
 */
      __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 414, __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;

      /* "View.MemoryView":413
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 */
      goto __pyx_L4;
    }

    /* "View.MemoryView":416
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
 *         else:
 *             self.setitem_indexed(index, value)
 */
    /*else*/ {
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(13, 416, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 416, __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;
    }
    __pyx_L4:;

    /* "View.MemoryView":411
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":418
 *                 self.setitem_slice_assign_scalar(self[index], value)
 *         else:
 *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef is_slice(self, obj):
 */
  /*else*/ {
    __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":408
 *             return self.convert_item_to_object(itemp)
 * 
 *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_have_slices);
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":420
 *             self.setitem_indexed(index, value)
 * 
 *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
 *         if not isinstance(obj, memoryview):
 *             try:
 */

static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __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;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("is_slice", 0);
  __Pyx_INCREF(__pyx_v_obj);

  /* "View.MemoryView":421
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":422
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
    {
      __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:*/ {

        /* "View.MemoryView":423
 *         if not isinstance(obj, memoryview):
 *             try:
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
 *                                  self.dtype_is_object)
 *             except TypeError:
 */
        __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(13, 423, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_6);

        /* "View.MemoryView":424
 *             try:
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
 *             except TypeError:
 *                 return None
 */
        __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(13, 424, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "View.MemoryView":423
 *         if not isinstance(obj, memoryview):
 *             try:
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
 *                                  self.dtype_is_object)
 *             except TypeError:
 */
        __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(13, 423, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_v_obj);
        __Pyx_GIVEREF(__pyx_v_obj);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
        __pyx_t_6 = 0;
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(13, 423, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "View.MemoryView":422
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
      }
      __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_L11_try_end;
      __pyx_L4_error:;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "View.MemoryView":425
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 *             except TypeError:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
      __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
      if (__pyx_t_9) {
        __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(13, 425, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_6);

        /* "View.MemoryView":426
 *                                  self.dtype_is_object)
 *             except TypeError:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         return obj
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_None);
        __pyx_r = Py_None;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_except_return;
      }
      goto __pyx_L6_except_error;
      __pyx_L6_except_error:;

      /* "View.MemoryView":422
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
      __Pyx_PyThreadState_assign
      __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_L7_except_return:;
      __Pyx_PyThreadState_assign
      __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_L0;
      __pyx_L11_try_end:;
    }

    /* "View.MemoryView":421
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
 */
  }

  /* "View.MemoryView":428
 *                 return None
 * 
 *         return obj             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assignment(self, dst, src):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_obj);
  __pyx_r = __pyx_v_obj;
  goto __pyx_L0;

  /* "View.MemoryView":420
 *             self.setitem_indexed(index, value)
 * 
 *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
 *         if not isinstance(obj, memoryview):
 *             try:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":430
 *         return obj
 * 
 *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
 */

static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
  __Pyx_memviewslice __pyx_v_dst_slice;
  __Pyx_memviewslice __pyx_v_src_slice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);

  /* "View.MemoryView":434
 *         cdef __Pyx_memviewslice src_slice
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 */
  if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(13, 434, __pyx_L1_error)

  /* "View.MemoryView":435
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
 *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 */
  if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(13, 435, __pyx_L1_error)

  /* "View.MemoryView":436
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(13, 436, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(13, 436, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":434
 *         cdef __Pyx_memviewslice src_slice
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 */
  __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(13, 434, __pyx_L1_error)

  /* "View.MemoryView":430
 *         return obj
 * 
 *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":438
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
 *         cdef int array[128]
 *         cdef void *tmp = NULL
 */

static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
  int __pyx_v_array[0x80];
  void *__pyx_v_tmp;
  void *__pyx_v_item;
  __Pyx_memviewslice *__pyx_v_dst_slice;
  __Pyx_memviewslice __pyx_v_tmp_slice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char const *__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;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);

  /* "View.MemoryView":440
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
 *         cdef int array[128]
 *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
 *         cdef void *item
 * 
 */
  __pyx_v_tmp = NULL;

  /* "View.MemoryView":445
 *         cdef __Pyx_memviewslice *dst_slice
 *         cdef __Pyx_memviewslice tmp_slice
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):
 */
  __pyx_v_dst_slice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));

  /* "View.MemoryView":447
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 */
  __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":448
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
 *             if tmp == NULL:
 *                 raise MemoryError
 */
    __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);

    /* "View.MemoryView":449
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
 */
    __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":450
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 *             item = tmp
 *         else:
 */
      PyErr_NoMemory(); __PYX_ERR(13, 450, __pyx_L1_error)

      /* "View.MemoryView":449
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
 */
    }

    /* "View.MemoryView":451
 *             if tmp == NULL:
 *                 raise MemoryError
 *             item = tmp             # <<<<<<<<<<<<<<
 *         else:
 *             item = <void *> array
 */
    __pyx_v_item = __pyx_v_tmp;

    /* "View.MemoryView":447
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":453
 *             item = tmp
 *         else:
 *             item = <void *> array             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  /*else*/ {
    __pyx_v_item = ((void *)__pyx_v_array);
  }
  __pyx_L3:;

  /* "View.MemoryView":455
 *             item = <void *> array
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 (<PyObject **> item)[0] = <PyObject *> value
 */
  /*try:*/ {

    /* "View.MemoryView":456
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 */
    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":457
 *         try:
 *             if self.dtype_is_object:
 *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
 *             else:
 *                 self.assign_item_from_object(<char *> item, value)
 */
      (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);

      /* "View.MemoryView":456
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 */
      goto __pyx_L8;
    }

    /* "View.MemoryView":459
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    /*else*/ {
      __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 459, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L8:;

    /* "View.MemoryView":463
 * 
 * 
 *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 */
    __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":464
 * 
 *             if self.view.suboffsets != NULL:
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 *                                 item, self.dtype_is_object)
 */
      __pyx_t_2 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 464, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "View.MemoryView":463
 * 
 * 
 *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 */
    }

    /* "View.MemoryView":465
 *             if self.view.suboffsets != NULL:
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
 *                                 item, self.dtype_is_object)
 *         finally:
 */
    __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
  }

  /* "View.MemoryView":468
 *                                 item, self.dtype_is_object)
 *         finally:
 *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_indexed(self, index, value):
 */
  /*finally:*/ {
    /*normal exit:*/{
      PyMem_Free(__pyx_v_tmp);
      goto __pyx_L7;
    }
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __pyx_L6_error:;
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_PyThreadState_assign
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
      {
        PyMem_Free(__pyx_v_tmp);
      }
      __Pyx_PyThreadState_assign
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "View.MemoryView":438
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
 *         cdef int array[128]
 *         cdef void *tmp = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":470
 *             PyMem_Free(tmp)
 * 
 *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)
 */

static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  char *__pyx_v_itemp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("setitem_indexed", 0);

  /* "View.MemoryView":471
 * 
 *     cdef setitem_indexed(self, index, value):
 *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
 *         self.assign_item_from_object(itemp, value)
 * 
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(13, 471, __pyx_L1_error)
  __pyx_v_itemp = __pyx_t_1;

  /* "View.MemoryView":472
 *     cdef setitem_indexed(self, index, value):
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 */
  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":470
 *             PyMem_Free(tmp)
 * 
 *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":474
 *         self.assign_item_from_object(itemp, value)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
  PyObject *__pyx_v_struct = NULL;
  PyObject *__pyx_v_bytesitem = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":477
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 *         import struct             # <<<<<<<<<<<<<<
 *         cdef bytes bytesitem
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":480
 *         cdef bytes bytesitem
 * 
 *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)
 */
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":481
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "View.MemoryView":482
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 482, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(13, 482, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 482, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 482, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 482, __pyx_L3_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_6);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
        __Pyx_INCREF(__pyx_v_bytesitem);
        __Pyx_GIVEREF(__pyx_v_bytesitem);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
        __pyx_t_6 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 482, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "View.MemoryView":481
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 */
    }

    /* "View.MemoryView":486
 *             raise ValueError("Unable to convert item to object")
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
 */
    /*else:*/ {
      __pyx_t_10 = strlen(__pyx_v_self->view.format); 
      __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
      if (__pyx_t_11) {

        /* "View.MemoryView":487
 *         else:
 *             if len(self.view.format) == 1:
 *                 return result[0]             # <<<<<<<<<<<<<<
 *             return result
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 487, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L6_except_return;

        /* "View.MemoryView":486
 *             raise ValueError("Unable to convert item to object")
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
 */
      }

      /* "View.MemoryView":488
 *             if len(self.view.format) == 1:
 *                 return result[0]
 *             return result             # <<<<<<<<<<<<<<
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_result);
      __pyx_r = __pyx_v_result;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_PyThreadState_assign
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "View.MemoryView":483
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:             # <<<<<<<<<<<<<<
 *             raise ValueError("Unable to convert item to object")
 *         else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 483, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {
      __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9) < 0) __PYX_ERR(13, 483, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_9);

      /* "View.MemoryView":484
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
 *         else:
 *             if len(self.view.format) == 1:
 */
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__95, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(13, 484, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(13, 484, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "View.MemoryView":481
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 */
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_PyThreadState_assign
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
  }

  /* "View.MemoryView":474
 *         self.assign_item_from_object(itemp, value)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_struct);
  __Pyx_XDECREF(__pyx_v_bytesitem);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":490
 *             return result
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_struct = NULL;
  char __pyx_v_c;
  PyObject *__pyx_v_bytesvalue = 0;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  char *__pyx_t_11;
  char *__pyx_t_12;
  char *__pyx_t_13;
  char *__pyx_t_14;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":493
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 *         import struct             # <<<<<<<<<<<<<<
 *         cdef char c
 *         cdef bytes bytesvalue
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":498
 *         cdef Py_ssize_t i
 * 
 *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 */
  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "View.MemoryView":499
 * 
 *         if isinstance(value, tuple):
 *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
 *         else:
 *             bytesvalue = struct.pack(self.view.format, value)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 499, __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 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(13, 499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(13, 499, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":498
 *         cdef Py_ssize_t i
 * 
 *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":501
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
 * 
 *         for i, c in enumerate(bytesvalue):
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(13, 501, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 501, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 501, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 501, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(13, 501, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
      __Pyx_INCREF(__pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
      __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 501, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(13, 501, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":503
 *             bytesvalue = struct.pack(self.view.format, value)
 * 
 *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
 *             itemp[i] = c
 * 
 */
  __pyx_t_9 = 0;
  if (unlikely(__pyx_v_bytesvalue == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(13, 503, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_v_bytesvalue);
  __pyx_t_10 = __pyx_v_bytesvalue;
  __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
  __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
  for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
    __pyx_t_11 = __pyx_t_14;
    __pyx_v_c = (__pyx_t_11[0]);

    /* "View.MemoryView":504
 * 
 *         for i, c in enumerate(bytesvalue):
 *             itemp[i] = c             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
 */
    __pyx_v_i = __pyx_t_9;

    /* "View.MemoryView":503
 *             bytesvalue = struct.pack(self.view.format, value)
 * 
 *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
 *             itemp[i] = c
 * 
 */
    __pyx_t_9 = (__pyx_t_9 + 1);

    /* "View.MemoryView":504
 * 
 *         for i, c in enumerate(bytesvalue):
 *             itemp[i] = c             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
 */
    (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "View.MemoryView":490
 *             return result
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

  /* 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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_struct);
  __Pyx_XDECREF(__pyx_v_bytesvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":507
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         if flags & PyBUF_STRIDES:
 *             info.shape = self.view.shape
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  char *__pyx_t_3;
  void *__pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "View.MemoryView":508
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.shape = self.view.shape
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":509
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_STRIDES:
 *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
 *         else:
 *             info.shape = NULL
 */
    __pyx_t_2 = __pyx_v_self->view.shape;
    __pyx_v_info->shape = __pyx_t_2;

    /* "View.MemoryView":508
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.shape = self.view.shape
 *         else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":511
 *             info.shape = self.view.shape
 *         else:
 *             info.shape = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_STRIDES:
 */
  /*else*/ {
    __pyx_v_info->shape = NULL;
  }
  __pyx_L3:;

  /* "View.MemoryView":513
 *             info.shape = NULL
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.strides = self.view.strides
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":514
 * 
 *         if flags & PyBUF_STRIDES:
 *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
 *         else:
 *             info.strides = NULL
 */
    __pyx_t_2 = __pyx_v_self->view.strides;
    __pyx_v_info->strides = __pyx_t_2;

    /* "View.MemoryView":513
 *             info.shape = NULL
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.strides = self.view.strides
 *         else:
 */
    goto __pyx_L4;
  }

  /* "View.MemoryView":516
 *             info.strides = self.view.strides
 *         else:
 *             info.strides = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_INDIRECT:
 */
  /*else*/ {
    __pyx_v_info->strides = NULL;
  }
  __pyx_L4:;

  /* "View.MemoryView":518
 *             info.strides = NULL
 * 
 *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
 *             info.suboffsets = self.view.suboffsets
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":519
 * 
 *         if flags & PyBUF_INDIRECT:
 *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
 *         else:
 *             info.suboffsets = NULL
 */
    __pyx_t_2 = __pyx_v_self->view.suboffsets;
    __pyx_v_info->suboffsets = __pyx_t_2;

    /* "View.MemoryView":518
 *             info.strides = NULL
 * 
 *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
 *             info.suboffsets = self.view.suboffsets
 *         else:
 */
    goto __pyx_L5;
  }

  /* "View.MemoryView":521
 *             info.suboffsets = self.view.suboffsets
 *         else:
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
 */
  /*else*/ {
    __pyx_v_info->suboffsets = NULL;
  }
  __pyx_L5:;

  /* "View.MemoryView":523
 *             info.suboffsets = NULL
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.view.format
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":524
 * 
 *         if flags & PyBUF_FORMAT:
 *             info.format = self.view.format             # <<<<<<<<<<<<<<
 *         else:
 *             info.format = NULL
 */
    __pyx_t_3 = __pyx_v_self->view.format;
    __pyx_v_info->format = __pyx_t_3;

    /* "View.MemoryView":523
 *             info.suboffsets = NULL
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.view.format
 *         else:
 */
    goto __pyx_L6;
  }

  /* "View.MemoryView":526
 *             info.format = self.view.format
 *         else:
 *             info.format = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.buf = self.view.buf
 */
  /*else*/ {
    __pyx_v_info->format = NULL;
  }
  __pyx_L6:;

  /* "View.MemoryView":528
 *             info.format = NULL
 * 
 *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize
 */
  __pyx_t_4 = __pyx_v_self->view.buf;
  __pyx_v_info->buf = __pyx_t_4;

  /* "View.MemoryView":529
 * 
 *         info.buf = self.view.buf
 *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len
 */
  __pyx_t_5 = __pyx_v_self->view.ndim;
  __pyx_v_info->ndim = __pyx_t_5;

  /* "View.MemoryView":530
 *         info.buf = self.view.buf
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
 *         info.len = self.view.len
 *         info.readonly = 0
 */
  __pyx_t_6 = __pyx_v_self->view.itemsize;
  __pyx_v_info->itemsize = __pyx_t_6;

  /* "View.MemoryView":531
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len             # <<<<<<<<<<<<<<
 *         info.readonly = 0
 *         info.obj = self
 */
  __pyx_t_6 = __pyx_v_self->view.len;
  __pyx_v_info->len = __pyx_t_6;

  /* "View.MemoryView":532
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len
 *         info.readonly = 0             # <<<<<<<<<<<<<<
 *         info.obj = self
 * 
 */
  __pyx_v_info->readonly = 0;

  /* "View.MemoryView":533
 *         info.len = self.view.len
 *         info.readonly = 0
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
 */
  __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);

  /* "View.MemoryView":507
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         if flags & PyBUF_STRIDES:
 *             info.shape = self.view.shape
 */

  /* function exit code */
  __pyx_r = 0;
  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":539
 * 
 *     @property
 *     def T(self):             # <<<<<<<<<<<<<<
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":540
 *     @property
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&result.from_slice)
 *         return result
 */
  __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(13, 540, __pyx_L1_error)
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":541
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == 0)) __PYX_ERR(13, 541, __pyx_L1_error)

  /* "View.MemoryView":542
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":539
 * 
 *     @property
 *     def T(self):             # <<<<<<<<<<<<<<
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":545
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.obj
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":546
 *     @property
 *     def base(self):
 *         return self.obj             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->obj);
  __pyx_r = __pyx_v_self->obj;
  goto __pyx_L0;

  /* "View.MemoryView":545
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.obj
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":549
 * 
 *     @property
 *     def shape(self):             # <<<<<<<<<<<<<<
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":550
 *     @property
 *     def shape(self):
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
  for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_length = (__pyx_t_2[0]);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 550, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(13, 550, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":549
 * 
 *     @property
 *     def shape(self):             # <<<<<<<<<<<<<<
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":553
 * 
 *     @property
 *     def strides(self):             # <<<<<<<<<<<<<<
 *         if self.view.strides == NULL:
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_stride;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":554
 *     @property
 *     def strides(self):
 *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError("Buffer view does not expose strides")
 */
  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":556
 *         if self.view.strides == NULL:
 * 
 *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__96, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(13, 556, __pyx_L1_error)

    /* "View.MemoryView":554
 *     @property
 *     def strides(self):
 *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError("Buffer view does not expose strides")
 */
  }

  /* "View.MemoryView":558
 *             raise ValueError("Buffer view does not expose strides")
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 558, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
  for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
    __pyx_t_3 = __pyx_t_5;
    __pyx_v_stride = (__pyx_t_3[0]);
    __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(13, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(13, 558, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(13, 558, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":553
 * 
 *     @property
 *     def strides(self):             # <<<<<<<<<<<<<<
 *         if self.view.strides == NULL:
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":561
 * 
 *     @property
 *     def suboffsets(self):             # <<<<<<<<<<<<<<
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  Py_ssize_t *__pyx_t_6;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":562
 *     @property
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
 *             return (-1,) * self.view.ndim
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":563
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 563, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__97, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 563, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":562
 *     @property
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
 *             return (-1,) * self.view.ndim
 * 
 */
  }

  /* "View.MemoryView":565
 *             return (-1,) * self.view.ndim
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
  for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
    __pyx_t_4 = __pyx_t_6;
    __pyx_v_suboffset = (__pyx_t_4[0]);
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 565, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(13, 565, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":561
 * 
 *     @property
 *     def suboffsets(self):             # <<<<<<<<<<<<<<
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":568
 * 
 *     @property
 *     def ndim(self):             # <<<<<<<<<<<<<<
 *         return self.view.ndim
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":569
 *     @property
 *     def ndim(self):
 *         return self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":568
 * 
 *     @property
 *     def ndim(self):             # <<<<<<<<<<<<<<
 *         return self.view.ndim
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":572
 * 
 *     @property
 *     def itemsize(self):             # <<<<<<<<<<<<<<
 *         return self.view.itemsize
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":573
 *     @property
 *     def itemsize(self):
 *         return self.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":572
 * 
 *     @property
 *     def itemsize(self):             # <<<<<<<<<<<<<<
 *         return self.view.itemsize
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":576
 * 
 *     @property
 *     def nbytes(self):             # <<<<<<<<<<<<<<
 *         return self.size * self.view.itemsize
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":577
 *     @property
 *     def nbytes(self):
 *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":576
 * 
 *     @property
 *     def nbytes(self):             # <<<<<<<<<<<<<<
 *         return self.size * self.view.itemsize
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":580
 * 
 *     @property
 *     def size(self):             # <<<<<<<<<<<<<<
 *         if self._size is None:
 *             result = 1
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_length = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":581
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_size == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":582
 *     def size(self):
 *         if self._size is None:
 *             result = 1             # <<<<<<<<<<<<<<
 * 
 *             for length in self.view.shape[:self.view.ndim]:
 */
    __Pyx_INCREF(__pyx_int_1);
    __pyx_v_result = __pyx_int_1;

    /* "View.MemoryView":584
 *             result = 1
 * 
 *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
 *                 result *= length
 * 
 */
    __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
    for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(13, 584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "View.MemoryView":585
 * 
 *             for length in self.view.shape[:self.view.ndim]:
 *                 result *= length             # <<<<<<<<<<<<<<
 * 
 *             self._size = result
 */
      __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(13, 585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
      __pyx_t_6 = 0;
    }

    /* "View.MemoryView":587
 *                 result *= length
 * 
 *             self._size = result             # <<<<<<<<<<<<<<
 * 
 *         return self._size
 */
    __Pyx_INCREF(__pyx_v_result);
    __Pyx_GIVEREF(__pyx_v_result);
    __Pyx_GOTREF(__pyx_v_self->_size);
    __Pyx_DECREF(__pyx_v_self->_size);
    __pyx_v_self->_size = __pyx_v_result;

    /* "View.MemoryView":581
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
 */
  }

  /* "View.MemoryView":589
 *             self._size = result
 * 
 *         return self._size             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_size);
  __pyx_r = __pyx_v_self->_size;
  goto __pyx_L0;

  /* "View.MemoryView":580
 * 
 *     @property
 *     def size(self):             # <<<<<<<<<<<<<<
 *         if self._size is None:
 *             result = 1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_length);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":591
 *         return self._size
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]
 */

/* Python wrapper */
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "View.MemoryView":592
 * 
 *     def __len__(self):
 *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
 *             return self.view.shape[0]
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":593
 *     def __len__(self):
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    __pyx_r = (__pyx_v_self->view.shape[0]);
    goto __pyx_L0;

    /* "View.MemoryView":592
 * 
 *     def __len__(self):
 *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
 *             return self.view.shape[0]
 * 
 */
  }

  /* "View.MemoryView":595
 *             return self.view.shape[0]
 * 
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":591
 *         return self._size
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":597
 *         return 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))
 */

/* Python wrapper */
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":598
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 598, __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_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":599
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":598
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":597
 *         return 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":601
 *                                                id(self))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "View.MemoryView":602
 * 
 *     def __str__(self):
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 602, __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_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":601
 *                                                id(self))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":605
 * 
 * 
 *     def is_c_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice *__pyx_v_mslice;
  __Pyx_memviewslice __pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("is_c_contig", 0);

  /* "View.MemoryView":608
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 */
  __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));

  /* "View.MemoryView":609
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *     def is_f_contig(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":605
 * 
 * 
 *     def is_c_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":611
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 *     def is_f_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice *__pyx_v_mslice;
  __Pyx_memviewslice __pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("is_f_contig", 0);

  /* "View.MemoryView":614
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 */
  __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));

  /* "View.MemoryView":615
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":611
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 *     def is_f_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":617
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_mslice;
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "View.MemoryView":619
 *     def copy(self):
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
 * 
 *         slice_copy(self, &mslice)
 */
  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));

  /* "View.MemoryView":621
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 * 
 *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
 *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
 *                                    self.view.itemsize,
 */
  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));

  /* "View.MemoryView":622
 * 
 *         slice_copy(self, &mslice)
 *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
 *                                    self.view.itemsize,
 *                                    flags|PyBUF_C_CONTIGUOUS,
 */
  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 622, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":627
 *                                    self.dtype_is_object)
 * 
 *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
 * 
 *     def copy_fortran(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":617
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":629
 *         return memoryview_copy_from_slice(self, &mslice)
 * 
 *     def copy_fortran(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_src;
  __Pyx_memviewslice __pyx_v_dst;
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("copy_fortran", 0);

  /* "View.MemoryView":631
 *     def copy_fortran(self):
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
 * 
 *         slice_copy(self, &src)
 */
  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));

  /* "View.MemoryView":633
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 * 
 *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
 *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
 *                                 self.view.itemsize,
 */
  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));

  /* "View.MemoryView":634
 * 
 *         slice_copy(self, &src)
 *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
 *                                 self.view.itemsize,
 *                                 flags|PyBUF_F_CONTIGUOUS,
 */
  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(13, 634, __pyx_L1_error)
  __pyx_v_dst = __pyx_t_1;

  /* "View.MemoryView":639
 *                                 self.dtype_is_object)
 * 
 *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":629
 *         return memoryview_copy_from_slice(self, &mslice)
 * 
 *     def copy_fortran(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":643
 * 
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 */

static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
  struct __pyx_memoryview_obj *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);

  /* "View.MemoryView":644
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
 *     result.typeinfo = typeinfo
 *     return result
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_o);
  __Pyx_GIVEREF(__pyx_v_o);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":645
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_v_result->typeinfo = __pyx_v_typeinfo;

  /* "View.MemoryView":646
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_check')
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":643
 * 
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":649
 * 
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
 *     return isinstance(o, memoryview)
 * 
 */

static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("memoryview_check", 0);

  /* "View.MemoryView":650
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o):
 *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _unellipsify(object index, int ndim):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); 
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "View.MemoryView":649
 * 
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
 *     return isinstance(o, memoryview)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":652
 *     return isinstance(o, memoryview)
 * 
 * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
 *     """
 *     Replace all ellipses with full slices and fill incomplete indices with
 */

static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  PyObject *__pyx_v_tup = NULL;
  PyObject *__pyx_v_result = NULL;
  int __pyx_v_have_slices;
  int __pyx_v_seen_ellipsis;
  CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
  PyObject *__pyx_v_item = NULL;
  Py_ssize_t __pyx_v_nslices;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("_unellipsify", 0);

  /* "View.MemoryView":657
 *     full slices.
 *     """
 *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
 *         tup = (index,)
 *     else:
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":658
 *     """
 *     if not isinstance(index, tuple):
 *         tup = (index,)             # <<<<<<<<<<<<<<
 *     else:
 *         tup = index
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 658, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_index);
    __Pyx_GIVEREF(__pyx_v_index);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
    __pyx_v_tup = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "View.MemoryView":657
 *     full slices.
 *     """
 *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
 *         tup = (index,)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":660
 *         tup = (index,)
 *     else:
 *         tup = index             # <<<<<<<<<<<<<<
 * 
 *     result = []
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_index);
    __pyx_v_tup = __pyx_v_index;
  }
  __pyx_L3:;

  /* "View.MemoryView":662
 *         tup = index
 * 
 *     result = []             # <<<<<<<<<<<<<<
 *     have_slices = False
 *     seen_ellipsis = False
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_result = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "View.MemoryView":663
 * 
 *     result = []
 *     have_slices = False             # <<<<<<<<<<<<<<
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 */
  __pyx_v_have_slices = 0;

  /* "View.MemoryView":664
 *     result = []
 *     have_slices = False
 *     seen_ellipsis = False             # <<<<<<<<<<<<<<
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 */
  __pyx_v_seen_ellipsis = 0;

  /* "View.MemoryView":665
 *     have_slices = False
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_3 = __pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
    __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 665, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(13, 665, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(13, 665, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(13, 665, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(13, 665, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(13, 665, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      }
    } else {
      __pyx_t_7 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_7)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(13, 665, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
    __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(13, 665, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3);
    __pyx_t_3 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "View.MemoryView":666
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 */
    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":667
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True
 */
      __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
      if (__pyx_t_1) {

        /* "View.MemoryView":668
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
 *                 seen_ellipsis = True
 *             else:
 */
        __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(13, 668, __pyx_L1_error)
        __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(13, 668, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        { Py_ssize_t __pyx_temp;
          for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
            __Pyx_INCREF(__pyx_slice__98);
            __Pyx_GIVEREF(__pyx_slice__98);
            PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__98);
          }
        }
        __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(13, 668, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "View.MemoryView":669
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
 *             else:
 *                 result.append(slice(None))
 */
        __pyx_v_seen_ellipsis = 1;

        /* "View.MemoryView":667
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True
 */
        goto __pyx_L7;
      }

      /* "View.MemoryView":671
 *                 seen_ellipsis = True
 *             else:
 *                 result.append(slice(None))             # <<<<<<<<<<<<<<
 *             have_slices = True
 *         else:
 */
      /*else*/ {
        __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__99); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(13, 671, __pyx_L1_error)
      }
      __pyx_L7:;

      /* "View.MemoryView":672
 *             else:
 *                 result.append(slice(None))
 *             have_slices = True             # <<<<<<<<<<<<<<
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):
 */
      __pyx_v_have_slices = 1;

      /* "View.MemoryView":666
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":674
 *             have_slices = True
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 */
    /*else*/ {
      __pyx_t_2 = PySlice_Check(__pyx_v_item); 
      __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
      if (__pyx_t_10) {
      } else {
        __pyx_t_1 = __pyx_t_10;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
      __pyx_t_1 = __pyx_t_10;
      __pyx_L9_bool_binop_done:;
      if (__pyx_t_1) {

        /* "View.MemoryView":675
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):
 *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
 * 
 *             have_slices = have_slices or isinstance(item, slice)
 */
        __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(13, 675, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(13, 675, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_11, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(13, 675, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_Raise(__pyx_t_7, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __PYX_ERR(13, 675, __pyx_L1_error)

        /* "View.MemoryView":674
 *             have_slices = True
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 */
      }

      /* "View.MemoryView":677
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
 *             result.append(item)
 * 
 */
      __pyx_t_10 = (__pyx_v_have_slices != 0);
      if (!__pyx_t_10) {
      } else {
        __pyx_t_1 = __pyx_t_10;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_10 = PySlice_Check(__pyx_v_item); 
      __pyx_t_2 = (__pyx_t_10 != 0);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L11_bool_binop_done:;
      __pyx_v_have_slices = __pyx_t_1;

      /* "View.MemoryView":678
 * 
 *             have_slices = have_slices or isinstance(item, slice)
 *             result.append(item)             # <<<<<<<<<<<<<<
 * 
 *     nslices = ndim - len(result)
 */
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(13, 678, __pyx_L1_error)
    }
    __pyx_L6:;

    /* "View.MemoryView":665
 *     have_slices = False
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":680
 *             result.append(item)
 * 
 *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
 *     if nslices:
 *         result.extend([slice(None)] * nslices)
 */
  __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(13, 680, __pyx_L1_error)
  __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);

  /* "View.MemoryView":681
 * 
 *     nslices = ndim - len(result)
 *     if nslices:             # <<<<<<<<<<<<<<
 *         result.extend([slice(None)] * nslices)
 * 
 */
  __pyx_t_1 = (__pyx_v_nslices != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":682
 *     nslices = ndim - len(result)
 *     if nslices:
 *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
 * 
 *     return have_slices or nslices, tuple(result)
 */
    __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 682, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    { Py_ssize_t __pyx_temp;
      for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
        __Pyx_INCREF(__pyx_slice__100);
        __Pyx_GIVEREF(__pyx_slice__100);
        PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__100);
      }
    }
    __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(13, 682, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "View.MemoryView":681
 * 
 *     nslices = ndim - len(result)
 *     if nslices:             # <<<<<<<<<<<<<<
 *         result.extend([slice(None)] * nslices)
 * 
 */
  }

  /* "View.MemoryView":684
 *         result.extend([slice(None)] * nslices)
 * 
 *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 */
  __Pyx_XDECREF(__pyx_r);
  if (!__pyx_v_have_slices) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 684, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_L14_bool_binop_done:;
  __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(13, 684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":652
 *     return isinstance(o, memoryview)
 * 
 * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
 *     """
 *     Replace all ellipses with full slices and fill incomplete indices with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tup);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":686
 *     return have_slices or nslices, tuple(result)
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 */

static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);

  /* "View.MemoryView":687
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")
 */
  __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
  for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
    __pyx_t_1 = __pyx_t_3;
    __pyx_v_suboffset = (__pyx_t_1[0]);

    /* "View.MemoryView":688
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Indirect dimensions not supported")
 * 
 */
    __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
    if (__pyx_t_4) {

      /* "View.MemoryView":689
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__101, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 689, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(13, 689, __pyx_L1_error)

      /* "View.MemoryView":688
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Indirect dimensions not supported")
 * 
 */
    }
  }

  /* "View.MemoryView":686
 *     return have_slices or nslices, tuple(result)
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":696
 * 
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim
 *     cdef bint negative_step
 */

static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
  int __pyx_v_new_ndim;
  int __pyx_v_suboffset_dim;
  int __pyx_v_dim;
  __Pyx_memviewslice __pyx_v_src;
  __Pyx_memviewslice __pyx_v_dst;
  __Pyx_memviewslice *__pyx_v_p_src;
  struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
  __Pyx_memviewslice *__pyx_v_p_dst;
  int *__pyx_v_p_suboffset_dim;
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_stop;
  Py_ssize_t __pyx_v_step;
  int __pyx_v_have_start;
  int __pyx_v_have_stop;
  int __pyx_v_have_step;
  PyObject *__pyx_v_index = NULL;
  struct __pyx_memoryview_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_memoryview_obj *__pyx_t_4;
  char *__pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  __Pyx_RefNannySetupContext("memview_slice", 0);

  /* "View.MemoryView":697
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
 *     cdef bint negative_step
 *     cdef __Pyx_memviewslice src, dst
 */
  __pyx_v_new_ndim = 0;
  __pyx_v_suboffset_dim = -1;

  /* "View.MemoryView":704
 * 
 * 
 *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
 * 
 *     cdef _memoryviewslice memviewsliceobj
 */
  memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)));

  /* "View.MemoryView":708
 *     cdef _memoryviewslice memviewsliceobj
 * 
 *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(13, 708, __pyx_L1_error)
    }
  }
  #endif

  /* "View.MemoryView":710
 *     assert memview.view.ndim > 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":711
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
 *         p_src = &memviewsliceobj.from_slice
 *     else:
 */
    if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(13, 711, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":712
 *     if isinstance(memview, _memoryviewslice):
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
 *     else:
 *         slice_copy(memview, &src)
 */
    __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);

    /* "View.MemoryView":710
 *     assert memview.view.ndim > 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":714
 *         p_src = &memviewsliceobj.from_slice
 *     else:
 *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
 *         p_src = &src
 * 
 */
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));

    /* "View.MemoryView":715
 *     else:
 *         slice_copy(memview, &src)
 *         p_src = &src             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_p_src = (&__pyx_v_src);
  }
  __pyx_L3:;

  /* "View.MemoryView":721
 * 
 * 
 *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
 *     dst.data = p_src.data
 * 
 */
  __pyx_t_4 = __pyx_v_p_src->memview;
  __pyx_v_dst.memview = __pyx_t_4;

  /* "View.MemoryView":722
 * 
 *     dst.memview = p_src.memview
 *     dst.data = p_src.data             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __pyx_v_p_src->data;
  __pyx_v_dst.data = __pyx_t_5;

  /* "View.MemoryView":727
 * 
 * 
 *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
 *     cdef int *p_suboffset_dim = &suboffset_dim
 *     cdef Py_ssize_t start, stop, step
 */
  __pyx_v_p_dst = (&__pyx_v_dst);

  /* "View.MemoryView":728
 * 
 *     cdef __Pyx_memviewslice *p_dst = &dst
 *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t start, stop, step
 *     cdef bint have_start, have_stop, have_step
 */
  __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);

  /* "View.MemoryView":732
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             slice_memviewslice(
 */
  __pyx_t_6 = 0;
  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
    __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 732, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(13, 732, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(13, 732, __pyx_L1_error)
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 732, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
      } else {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(13, 732, __pyx_L1_error)
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 732, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
      }
    } else {
      __pyx_t_9 = __pyx_t_8(__pyx_t_3);
      if (unlikely(!__pyx_t_9)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(13, 732, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_9);
    }
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_v_dim = __pyx_t_6;
    __pyx_t_6 = (__pyx_t_6 + 1);

    /* "View.MemoryView":733
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             slice_memviewslice(
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 */
    __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":737
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 */
      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(13, 737, __pyx_L1_error)

      /* "View.MemoryView":734
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):
 *             slice_memviewslice(             # <<<<<<<<<<<<<<
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 */
      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(13, 734, __pyx_L1_error)

      /* "View.MemoryView":733
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             slice_memviewslice(
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":740
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 *         elif index is None:             # <<<<<<<<<<<<<<
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 */
    __pyx_t_2 = (__pyx_v_index == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":741
 *                 False)
 *         elif index is None:
 *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1
 */
      (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;

      /* "View.MemoryView":742
 *         elif index is None:
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
 *             p_dst.suboffsets[new_ndim] = -1
 *             new_ndim += 1
 */
      (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;

      /* "View.MemoryView":743
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
 *             new_ndim += 1
 *         else:
 */
      (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;

      /* "View.MemoryView":744
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1
 *             new_ndim += 1             # <<<<<<<<<<<<<<
 *         else:
 *             start = index.start or 0
 */
      __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);

      /* "View.MemoryView":740
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 *         elif index is None:             # <<<<<<<<<<<<<<
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":746
 *             new_ndim += 1
 *         else:
 *             start = index.start or 0             # <<<<<<<<<<<<<<
 *             stop = index.stop or 0
 *             step = index.step or 0
 */
    /*else*/ {
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 746, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(13, 746, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(13, 746, __pyx_L1_error)
        __pyx_t_10 = __pyx_t_12;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_10 = 0;
      __pyx_L7_bool_binop_done:;
      __pyx_v_start = __pyx_t_10;

      /* "View.MemoryView":747
 *         else:
 *             start = index.start or 0
 *             stop = index.stop or 0             # <<<<<<<<<<<<<<
 *             step = index.step or 0
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 747, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(13, 747, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(13, 747, __pyx_L1_error)
        __pyx_t_10 = __pyx_t_12;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_10 = 0;
      __pyx_L9_bool_binop_done:;
      __pyx_v_stop = __pyx_t_10;

      /* "View.MemoryView":748
 *             start = index.start or 0
 *             stop = index.stop or 0
 *             step = index.step or 0             # <<<<<<<<<<<<<<
 * 
 *             have_start = index.start is not None
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 748, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(13, 748, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(13, 748, __pyx_L1_error)
        __pyx_t_10 = __pyx_t_12;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_10 = 0;
      __pyx_L11_bool_binop_done:;
      __pyx_v_step = __pyx_t_10;

      /* "View.MemoryView":750
 *             step = index.step or 0
 * 
 *             have_start = index.start is not None             # <<<<<<<<<<<<<<
 *             have_stop = index.stop is not None
 *             have_step = index.step is not None
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 750, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_start = __pyx_t_1;

      /* "View.MemoryView":751
 * 
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
 *             have_step = index.step is not None
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 751, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_stop = __pyx_t_1;

      /* "View.MemoryView":752
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None
 *             have_step = index.step is not None             # <<<<<<<<<<<<<<
 * 
 *             slice_memviewslice(
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(13, 752, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_step = __pyx_t_1;

      /* "View.MemoryView":754
 *             have_step = index.step is not None
 * 
 *             slice_memviewslice(             # <<<<<<<<<<<<<<
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 */
      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(13, 754, __pyx_L1_error)

      /* "View.MemoryView":760
 *                 have_start, have_stop, have_step,
 *                 True)
 *             new_ndim += 1             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
 */
      __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
    }
    __pyx_L6:;

    /* "View.MemoryView":732
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             slice_memviewslice(
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":762
 *             new_ndim += 1
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":763
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));

    /* "View.MemoryView":764
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_dtype_func,
 *                                     memview.dtype_is_object)
 */
    if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(13, 764, __pyx_L1_error) }

    /* "View.MemoryView":765
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 *     else:
 */
    if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(13, 765, __pyx_L1_error) }

    /* "View.MemoryView":763
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
 */
    __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(13, 763, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":762
 *             new_ndim += 1
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 */
  }

  /* "View.MemoryView":768
 *                                     memview.dtype_is_object)
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(((PyObject *)__pyx_r));

    /* "View.MemoryView":769
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
 *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "View.MemoryView":768
 *                                     memview.dtype_is_object)
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 * 
 */
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(13, 768, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":696
 * 
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim
 *     cdef bint negative_step
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":793
 * 
 * @cname('__pyx_memoryview_slice_memviewslice')
 * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
 *         __Pyx_memviewslice *dst,
 *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
 */

static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
  Py_ssize_t __pyx_v_new_shape;
  int __pyx_v_negative_step;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "View.MemoryView":813
 *     cdef bint negative_step
 * 
 *     if not is_slice:             # <<<<<<<<<<<<<<
 * 
 *         if start < 0:
 */
  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":815
 *     if not is_slice:
 * 
 *         if start < 0:             # <<<<<<<<<<<<<<
 *             start += shape
 *         if not 0 <= start < shape:
 */
    __pyx_t_1 = ((__pyx_v_start < 0) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":816
 * 
 *         if start < 0:
 *             start += shape             # <<<<<<<<<<<<<<
 *         if not 0 <= start < shape:
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
 */
      __pyx_v_start = (__pyx_v_start + __pyx_v_shape);

      /* "View.MemoryView":815
 *     if not is_slice:
 * 
 *         if start < 0:             # <<<<<<<<<<<<<<
 *             start += shape
 *         if not 0 <= start < shape:
 */
    }

    /* "View.MemoryView":817
 *         if start < 0:
 *             start += shape
 *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
 *     else:
 */
    __pyx_t_1 = (0 <= __pyx_v_start);
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
    }
    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":818
 *             start += shape
 *         if not 0 <= start < shape:
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
 *     else:
 * 
 */
      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(13, 818, __pyx_L1_error)

      /* "View.MemoryView":817
 *         if start < 0:
 *             start += shape
 *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
 *     else:
 */
    }

    /* "View.MemoryView":813
 *     cdef bint negative_step
 * 
 *     if not is_slice:             # <<<<<<<<<<<<<<
 * 
 *         if start < 0:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":821
 *     else:
 * 
 *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
 * 
 *         if have_step and step == 0:
 */
  /*else*/ {
    __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_1 = ((__pyx_v_step < 0) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L6_bool_binop_done:;
    __pyx_v_negative_step = __pyx_t_2;

    /* "View.MemoryView":823
 *         negative_step = have_step != 0 and step < 0
 * 
 *         if have_step and step == 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
 * 
 */
    __pyx_t_1 = (__pyx_v_have_step != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_1 = ((__pyx_v_step == 0) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_2) {

      /* "View.MemoryView":824
 * 
 *         if have_step and step == 0:
 *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(13, 824, __pyx_L1_error)

      /* "View.MemoryView":823
 *         negative_step = have_step != 0 and step < 0
 * 
 *         if have_step and step == 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
 * 
 */
    }

    /* "View.MemoryView":827
 * 
 * 
 *         if have_start:             # <<<<<<<<<<<<<<
 *             if start < 0:
 *                 start += shape
 */
    __pyx_t_2 = (__pyx_v_have_start != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":828
 * 
 *         if have_start:
 *             if start < 0:             # <<<<<<<<<<<<<<
 *                 start += shape
 *                 if start < 0:
 */
      __pyx_t_2 = ((__pyx_v_start < 0) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":829
 *         if have_start:
 *             if start < 0:
 *                 start += shape             # <<<<<<<<<<<<<<
 *                 if start < 0:
 *                     start = 0
 */
        __pyx_v_start = (__pyx_v_start + __pyx_v_shape);

        /* "View.MemoryView":830
 *             if start < 0:
 *                 start += shape
 *                 if start < 0:             # <<<<<<<<<<<<<<
 *                     start = 0
 *             elif start >= shape:
 */
        __pyx_t_2 = ((__pyx_v_start < 0) != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":831
 *                 start += shape
 *                 if start < 0:
 *                     start = 0             # <<<<<<<<<<<<<<
 *             elif start >= shape:
 *                 if negative_step:
 */
          __pyx_v_start = 0;

          /* "View.MemoryView":830
 *             if start < 0:
 *                 start += shape
 *                 if start < 0:             # <<<<<<<<<<<<<<
 *                     start = 0
 *             elif start >= shape:
 */
        }

        /* "View.MemoryView":828
 * 
 *         if have_start:
 *             if start < 0:             # <<<<<<<<<<<<<<
 *                 start += shape
 *                 if start < 0:
 */
        goto __pyx_L12;
      }

      /* "View.MemoryView":832
 *                 if start < 0:
 *                     start = 0
 *             elif start >= shape:             # <<<<<<<<<<<<<<
 *                 if negative_step:
 *                     start = shape - 1
 */
      __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":833
 *                     start = 0
 *             elif start >= shape:
 *                 if negative_step:             # <<<<<<<<<<<<<<
 *                     start = shape - 1
 *                 else:
 */
        __pyx_t_2 = (__pyx_v_negative_step != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":834
 *             elif start >= shape:
 *                 if negative_step:
 *                     start = shape - 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     start = shape
 */
          __pyx_v_start = (__pyx_v_shape - 1);

          /* "View.MemoryView":833
 *                     start = 0
 *             elif start >= shape:
 *                 if negative_step:             # <<<<<<<<<<<<<<
 *                     start = shape - 1
 *                 else:
 */
          goto __pyx_L14;
        }

        /* "View.MemoryView":836
 *                     start = shape - 1
 *                 else:
 *                     start = shape             # <<<<<<<<<<<<<<
 *         else:
 *             if negative_step:
 */
        /*else*/ {
          __pyx_v_start = __pyx_v_shape;
        }
        __pyx_L14:;

        /* "View.MemoryView":832
 *                 if start < 0:
 *                     start = 0
 *             elif start >= shape:             # <<<<<<<<<<<<<<
 *                 if negative_step:
 *                     start = shape - 1
 */
      }
      __pyx_L12:;

      /* "View.MemoryView":827
 * 
 * 
 *         if have_start:             # <<<<<<<<<<<<<<
 *             if start < 0:
 *                 start += shape
 */
      goto __pyx_L11;
    }

    /* "View.MemoryView":838
 *                     start = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 start = shape - 1
 *             else:
 */
    /*else*/ {
      __pyx_t_2 = (__pyx_v_negative_step != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":839
 *         else:
 *             if negative_step:
 *                 start = shape - 1             # <<<<<<<<<<<<<<
 *             else:
 *                 start = 0
 */
        __pyx_v_start = (__pyx_v_shape - 1);

        /* "View.MemoryView":838
 *                     start = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 start = shape - 1
 *             else:
 */
        goto __pyx_L15;
      }

      /* "View.MemoryView":841
 *                 start = shape - 1
 *             else:
 *                 start = 0             # <<<<<<<<<<<<<<
 * 
 *         if have_stop:
 */
      /*else*/ {
        __pyx_v_start = 0;
      }
      __pyx_L15:;
    }
    __pyx_L11:;

    /* "View.MemoryView":843
 *                 start = 0
 * 
 *         if have_stop:             # <<<<<<<<<<<<<<
 *             if stop < 0:
 *                 stop += shape
 */
    __pyx_t_2 = (__pyx_v_have_stop != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":844
 * 
 *         if have_stop:
 *             if stop < 0:             # <<<<<<<<<<<<<<
 *                 stop += shape
 *                 if stop < 0:
 */
      __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":845
 *         if have_stop:
 *             if stop < 0:
 *                 stop += shape             # <<<<<<<<<<<<<<
 *                 if stop < 0:
 *                     stop = 0
 */
        __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);

        /* "View.MemoryView":846
 *             if stop < 0:
 *                 stop += shape
 *                 if stop < 0:             # <<<<<<<<<<<<<<
 *                     stop = 0
 *             elif stop > shape:
 */
        __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":847
 *                 stop += shape
 *                 if stop < 0:
 *                     stop = 0             # <<<<<<<<<<<<<<
 *             elif stop > shape:
 *                 stop = shape
 */
          __pyx_v_stop = 0;

          /* "View.MemoryView":846
 *             if stop < 0:
 *                 stop += shape
 *                 if stop < 0:             # <<<<<<<<<<<<<<
 *                     stop = 0
 *             elif stop > shape:
 */
        }

        /* "View.MemoryView":844
 * 
 *         if have_stop:
 *             if stop < 0:             # <<<<<<<<<<<<<<
 *                 stop += shape
 *                 if stop < 0:
 */
        goto __pyx_L17;
      }

      /* "View.MemoryView":848
 *                 if stop < 0:
 *                     stop = 0
 *             elif stop > shape:             # <<<<<<<<<<<<<<
 *                 stop = shape
 *         else:
 */
      __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":849
 *                     stop = 0
 *             elif stop > shape:
 *                 stop = shape             # <<<<<<<<<<<<<<
 *         else:
 *             if negative_step:
 */
        __pyx_v_stop = __pyx_v_shape;

        /* "View.MemoryView":848
 *                 if stop < 0:
 *                     stop = 0
 *             elif stop > shape:             # <<<<<<<<<<<<<<
 *                 stop = shape
 *         else:
 */
      }
      __pyx_L17:;

      /* "View.MemoryView":843
 *                 start = 0
 * 
 *         if have_stop:             # <<<<<<<<<<<<<<
 *             if stop < 0:
 *                 stop += shape
 */
      goto __pyx_L16;
    }

    /* "View.MemoryView":851
 *                 stop = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 stop = -1
 *             else:
 */
    /*else*/ {
      __pyx_t_2 = (__pyx_v_negative_step != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":852
 *         else:
 *             if negative_step:
 *                 stop = -1             # <<<<<<<<<<<<<<
 *             else:
 *                 stop = shape
 */
        __pyx_v_stop = -1L;

        /* "View.MemoryView":851
 *                 stop = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 stop = -1
 *             else:
 */
        goto __pyx_L19;
      }

      /* "View.MemoryView":854
 *                 stop = -1
 *             else:
 *                 stop = shape             # <<<<<<<<<<<<<<
 * 
 *         if not have_step:
 */
      /*else*/ {
        __pyx_v_stop = __pyx_v_shape;
      }
      __pyx_L19:;
    }
    __pyx_L16:;

    /* "View.MemoryView":856
 *                 stop = shape
 * 
 *         if not have_step:             # <<<<<<<<<<<<<<
 *             step = 1
 * 
 */
    __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":857
 * 
 *         if not have_step:
 *             step = 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_step = 1;

      /* "View.MemoryView":856
 *                 stop = shape
 * 
 *         if not have_step:             # <<<<<<<<<<<<<<
 *             step = 1
 * 
 */
    }

    /* "View.MemoryView":861
 * 
 *         with cython.cdivision(True):
 *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
 * 
 *             if (stop - start) - step * new_shape:
 */
    __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);

    /* "View.MemoryView":863
 *             new_shape = (stop - start) // step
 * 
 *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
 *                 new_shape += 1
 * 
 */
    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":864
 * 
 *             if (stop - start) - step * new_shape:
 *                 new_shape += 1             # <<<<<<<<<<<<<<
 * 
 *         if new_shape < 0:
 */
      __pyx_v_new_shape = (__pyx_v_new_shape + 1);

      /* "View.MemoryView":863
 *             new_shape = (stop - start) // step
 * 
 *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
 *                 new_shape += 1
 * 
 */
    }

    /* "View.MemoryView":866
 *                 new_shape += 1
 * 
 *         if new_shape < 0:             # <<<<<<<<<<<<<<
 *             new_shape = 0
 * 
 */
    __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":867
 * 
 *         if new_shape < 0:
 *             new_shape = 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_new_shape = 0;

      /* "View.MemoryView":866
 *                 new_shape += 1
 * 
 *         if new_shape < 0:             # <<<<<<<<<<<<<<
 *             new_shape = 0
 * 
 */
    }

    /* "View.MemoryView":870
 * 
 * 
 *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
 *         dst.shape[new_ndim] = new_shape
 *         dst.suboffsets[new_ndim] = suboffset
 */
    (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);

    /* "View.MemoryView":871
 * 
 *         dst.strides[new_ndim] = stride * step
 *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
 *         dst.suboffsets[new_ndim] = suboffset
 * 
 */
    (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;

    /* "View.MemoryView":872
 *         dst.strides[new_ndim] = stride * step
 *         dst.shape[new_ndim] = new_shape
 *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
  }
  __pyx_L3:;

  /* "View.MemoryView":875
 * 
 * 
 *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
 *         dst.data += start * stride
 *     else:
 */
  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":876
 * 
 *     if suboffset_dim[0] < 0:
 *         dst.data += start * stride             # <<<<<<<<<<<<<<
 *     else:
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 */
    __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));

    /* "View.MemoryView":875
 * 
 * 
 *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
 *         dst.data += start * stride
 *     else:
 */
    goto __pyx_L23;
  }

  /* "View.MemoryView":878
 *         dst.data += start * stride
 *     else:
 *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
 * 
 *     if suboffset >= 0:
 */
  /*else*/ {
    __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
    (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
  }
  __pyx_L23:;

  /* "View.MemoryView":880
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 * 
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         if not is_slice:
 *             if new_ndim == 0:
 */
  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":881
 * 
 *     if suboffset >= 0:
 *         if not is_slice:             # <<<<<<<<<<<<<<
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 */
    __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":882
 *     if suboffset >= 0:
 *         if not is_slice:
 *             if new_ndim == 0:             # <<<<<<<<<<<<<<
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 */
      __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":883
 *         if not is_slice:
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
 *             else:
 *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
 */
        __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);

        /* "View.MemoryView":882
 *     if suboffset >= 0:
 *         if not is_slice:
 *             if new_ndim == 0:             # <<<<<<<<<<<<<<
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 */
        goto __pyx_L26;
      }

      /* "View.MemoryView":885
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
 *                                      "must be indexed and not sliced", dim)
 *         else:
 */
      /*else*/ {

        /* "View.MemoryView":886
 *             else:
 *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
 *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
 *         else:
 *             suboffset_dim[0] = new_ndim
 */
        __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(13, 885, __pyx_L1_error)
      }
      __pyx_L26:;

      /* "View.MemoryView":881
 * 
 *     if suboffset >= 0:
 *         if not is_slice:             # <<<<<<<<<<<<<<
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 */
      goto __pyx_L25;
    }

    /* "View.MemoryView":888
 *                                      "must be indexed and not sliced", dim)
 *         else:
 *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
    /*else*/ {
      (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
    }
    __pyx_L25:;

    /* "View.MemoryView":880
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 * 
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         if not is_slice:
 *             if new_ndim == 0:
 */
  }

  /* "View.MemoryView":890
 *             suboffset_dim[0] = new_ndim
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":793
 * 
 * @cname('__pyx_memoryview_slice_memviewslice')
 * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
 *         __Pyx_memviewslice *dst,
 *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":896
 * 
 * @cname('__pyx_pybuffer_index')
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 */

static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
  Py_ssize_t __pyx_v_shape;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_v_suboffset;
  Py_ssize_t __pyx_v_itemsize;
  char *__pyx_v_resultp;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("pybuffer_index", 0);

  /* "View.MemoryView":898
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t itemsize = view.itemsize
 *     cdef char *resultp
 */
  __pyx_v_suboffset = -1L;

  /* "View.MemoryView":899
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
 *     cdef char *resultp
 * 
 */
  __pyx_t_1 = __pyx_v_view->itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":902
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len / itemsize
 *         stride = itemsize
 */
  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":903
 * 
 *     if view.ndim == 0:
 *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
 *         stride = itemsize
 *     else:
 */
    if (unlikely(__pyx_v_itemsize == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(13, 903, __pyx_L1_error)
    }
    else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(13, 903, __pyx_L1_error)
    }
    __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);

    /* "View.MemoryView":904
 *     if view.ndim == 0:
 *         shape = view.len / itemsize
 *         stride = itemsize             # <<<<<<<<<<<<<<
 *     else:
 *         shape = view.shape[dim]
 */
    __pyx_v_stride = __pyx_v_itemsize;

    /* "View.MemoryView":902
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len / itemsize
 *         stride = itemsize
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":906
 *         stride = itemsize
 *     else:
 *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:
 */
  /*else*/ {
    __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);

    /* "View.MemoryView":907
 *     else:
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
 *         if view.suboffsets != NULL:
 *             suboffset = view.suboffsets[dim]
 */
    __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);

    /* "View.MemoryView":908
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
 */
    __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":909
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:
 *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
 * 
 *     if index < 0:
 */
      __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);

      /* "View.MemoryView":908
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
 */
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":911
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
 */
  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":912
 * 
 *     if index < 0:
 *         index += view.shape[dim]             # <<<<<<<<<<<<<<
 *         if index < 0:
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 */
    __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));

    /* "View.MemoryView":913
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":914
 *         index += view.shape[dim]
 *         if index < 0:
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
 * 
 *     if index >= shape:
 */
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 914, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 914, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 914, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 914, __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(13, 914, __pyx_L1_error)

      /* "View.MemoryView":913
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
    }

    /* "View.MemoryView":911
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
 */
  }

  /* "View.MemoryView":916
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":917
 * 
 *     if index >= shape:
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
 * 
 *     resultp = bufp + index * stride
 */
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(13, 917, __pyx_L1_error)

    /* "View.MemoryView":916
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
  }

  /* "View.MemoryView":919
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
 *     if suboffset >= 0:
 *         resultp = (<char **> resultp)[0] + suboffset
 */
  __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));

  /* "View.MemoryView":920
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 */
  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":921
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:
 *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
 * 
 *     return resultp
 */
    __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);

    /* "View.MemoryView":920
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 */
  }

  /* "View.MemoryView":923
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 *     return resultp             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_resultp;
  goto __pyx_L0;

  /* "View.MemoryView":896
 * 
 * @cname('__pyx_pybuffer_index')
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":929
 * 
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 */

static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  int __pyx_v_ndim;
  Py_ssize_t *__pyx_v_shape;
  Py_ssize_t *__pyx_v_strides;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_r;
  int __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  long __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;

  /* "View.MemoryView":930
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
 *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t *shape = memslice.shape
 */
  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
  __pyx_v_ndim = __pyx_t_1;

  /* "View.MemoryView":932
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t *strides = memslice.strides
 * 
 */
  __pyx_t_2 = __pyx_v_memslice->shape;
  __pyx_v_shape = __pyx_t_2;

  /* "View.MemoryView":933
 * 
 *     cdef Py_ssize_t *shape = memslice.shape
 *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __pyx_v_memslice->strides;
  __pyx_v_strides = __pyx_t_2;

  /* "View.MemoryView":937
 * 
 *     cdef int i, j
 *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]
 */
  __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":938
 *     cdef int i, j
 *     for i in range(ndim / 2):
 *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
 *         strides[i], strides[j] = strides[j], strides[i]
 *         shape[i], shape[j] = shape[j], shape[i]
 */
    __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);

    /* "View.MemoryView":939
 *     for i in range(ndim / 2):
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 */
    __pyx_t_4 = (__pyx_v_strides[__pyx_v_j]);
    __pyx_t_5 = (__pyx_v_strides[__pyx_v_i]);
    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_4;
    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_5;

    /* "View.MemoryView":940
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]
 *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
 */
    __pyx_t_5 = (__pyx_v_shape[__pyx_v_j]);
    __pyx_t_4 = (__pyx_v_shape[__pyx_v_i]);
    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_5;
    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_4;

    /* "View.MemoryView":942
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 */
    __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
    __pyx_t_6 = __pyx_t_7;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_6) {

      /* "View.MemoryView":943
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
 * 
 *     return 1
 */
      __pyx_t_8 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(13, 943, __pyx_L1_error)

      /* "View.MemoryView":942
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 */
    }
  }

  /* "View.MemoryView":945
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "View.MemoryView":929
 * 
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":962
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 */

/* Python wrapper */
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "View.MemoryView":963
 * 
 *     def __dealloc__(self):
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 */
  __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);

  /* "View.MemoryView":962
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":965
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)
 */

static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":966
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":967
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
 *         else:
 *             return memoryview.convert_item_to_object(self, itemp)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":966
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
 */
  }

  /* "View.MemoryView":969
 *             return self.to_object_func(itemp)
 *         else:
 *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":965
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":971
 *             return memoryview.convert_item_to_object(self, itemp)
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)
 */

static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":972
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
 *             self.to_dtype_func(itemp, value)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":973
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)
 */
    __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == 0)) __PYX_ERR(13, 973, __pyx_L1_error)

    /* "View.MemoryView":972
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
 *             self.to_dtype_func(itemp, value)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":975
 *             self.to_dtype_func(itemp, value)
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  /*else*/ {
    __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":971
 *             return memoryview.convert_item_to_object(self, itemp)
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":978
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":979
 *     @property
 *     def base(self):
 *         return self.from_object             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->from_object);
  __pyx_r = __pyx_v_self->from_object;
  goto __pyx_L0;

  /* "View.MemoryView":978
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":985
 * 
 * @cname('__pyx_memoryview_fromslice')
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
 *                           int ndim,
 *                           object (*to_object_func)(char *),
 */

static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_v_length = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_TypeInfo *__pyx_t_4;
  Py_buffer __pyx_t_5;
  Py_ssize_t *__pyx_t_6;
  Py_ssize_t *__pyx_t_7;
  Py_ssize_t *__pyx_t_8;
  Py_ssize_t __pyx_t_9;
  __Pyx_RefNannySetupContext("memoryview_fromslice", 0);

  /* "View.MemoryView":993
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":994
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;

    /* "View.MemoryView":993
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  }

  /* "View.MemoryView":999
 * 
 * 
 *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     result.from_slice = memviewslice
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":1001
 *     result = _memoryviewslice(None, 0, dtype_is_object)
 * 
 *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
 */
  __pyx_v_result->from_slice = __pyx_v_memviewslice;

  /* "View.MemoryView":1002
 * 
 *     result.from_slice = memviewslice
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base
 */
  __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);

  /* "View.MemoryView":1004
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 1004, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_result->from_object);
  __Pyx_DECREF(__pyx_v_result->from_object);
  __pyx_v_result->from_object = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "View.MemoryView":1005
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base
 *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
 * 
 *     result.view = memviewslice.memview.view
 */
  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;

  /* "View.MemoryView":1007
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
 *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim
 */
  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
  __pyx_v_result->__pyx_base.view = __pyx_t_5;

  /* "View.MemoryView":1008
 * 
 *     result.view = memviewslice.memview.view
 *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 */
  __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);

  /* "View.MemoryView":1009
 *     result.view = memviewslice.memview.view
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 *     Py_INCREF(Py_None)
 */
  __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;

  /* "View.MemoryView":1010
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
 *     Py_INCREF(Py_None)
 * 
 */
  ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;

  /* "View.MemoryView":1011
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *     result.flags = PyBUF_RECORDS
 */
  Py_INCREF(Py_None);

  /* "View.MemoryView":1013
 *     Py_INCREF(Py_None)
 * 
 *     result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
 */
  __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;

  /* "View.MemoryView":1015
 *     result.flags = PyBUF_RECORDS
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
 *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
 * 
 */
  __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);

  /* "View.MemoryView":1016
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
 *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);

  /* "View.MemoryView":1019
 * 
 * 
 *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:
 */
  __pyx_v_result->__pyx_base.view.suboffsets = NULL;

  /* "View.MemoryView":1020
 * 
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 */
  __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
  for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
    __pyx_t_6 = __pyx_t_8;
    __pyx_v_suboffset = (__pyx_t_6[0]);

    /* "View.MemoryView":1021
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break
 */
    __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":1022
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);

      /* "View.MemoryView":1023
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break             # <<<<<<<<<<<<<<
 * 
 *     result.view.len = result.view.itemsize
 */
      goto __pyx_L5_break;

      /* "View.MemoryView":1021
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break
 */
    }
  }
  __pyx_L5_break:;

  /* "View.MemoryView":1025
 *             break
 * 
 *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
 *     for length in result.view.shape[:ndim]:
 *         result.view.len *= length
 */
  __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
  __pyx_v_result->__pyx_base.view.len = __pyx_t_9;

  /* "View.MemoryView":1026
 * 
 *     result.view.len = result.view.itemsize
 *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
 *         result.view.len *= length
 * 
 */
  __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
  for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
    __pyx_t_6 = __pyx_t_8;
    __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 1026, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "View.MemoryView":1027
 *     result.view.len = result.view.itemsize
 *     for length in result.view.shape[:ndim]:
 *         result.view.len *= length             # <<<<<<<<<<<<<<
 * 
 *     result.to_object_func = to_object_func
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 1027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 1027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(13, 1027, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
  }

  /* "View.MemoryView":1029
 *         result.view.len *= length
 * 
 *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
 *     result.to_dtype_func = to_dtype_func
 * 
 */
  __pyx_v_result->to_object_func = __pyx_v_to_object_func;

  /* "View.MemoryView":1030
 * 
 *     result.to_object_func = to_object_func
 *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
  __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;

  /* "View.MemoryView":1032
 *     result.to_dtype_func = to_dtype_func
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":985
 * 
 * @cname('__pyx_memoryview_fromslice')
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
 *                           int ndim,
 *                           object (*to_object_func)(char *),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_length);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1035
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
 *                                                    __Pyx_memviewslice *mslice):
 *     cdef _memoryviewslice obj
 */

static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
  struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
  __Pyx_memviewslice *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get_slice_from_memview", 0);

  /* "View.MemoryView":1038
 *                                                    __Pyx_memviewslice *mslice):
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1039
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview             # <<<<<<<<<<<<<<
 *         return &obj.from_slice
 *     else:
 */
    if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(13, 1039, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":1040
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview
 *         return &obj.from_slice             # <<<<<<<<<<<<<<
 *     else:
 *         slice_copy(memview, mslice)
 */
    __pyx_r = (&__pyx_v_obj->from_slice);
    goto __pyx_L0;

    /* "View.MemoryView":1038
 *                                                    __Pyx_memviewslice *mslice):
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
 */
  }

  /* "View.MemoryView":1042
 *         return &obj.from_slice
 *     else:
 *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
 *         return mslice
 * 
 */
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);

    /* "View.MemoryView":1043
 *     else:
 *         slice_copy(memview, mslice)
 *         return mslice             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_slice_copy')
 */
    __pyx_r = __pyx_v_mslice;
    goto __pyx_L0;
  }

  /* "View.MemoryView":1035
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
 *                                                    __Pyx_memviewslice *mslice):
 *     cdef _memoryviewslice obj
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1046
 * 
 * @cname('__pyx_memoryview_slice_copy')
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
 *     cdef int dim
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 */

static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
  int __pyx_v_dim;
  Py_ssize_t *__pyx_v_shape;
  Py_ssize_t *__pyx_v_strides;
  Py_ssize_t *__pyx_v_suboffsets;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  __Pyx_RefNannySetupContext("slice_copy", 0);

  /* "View.MemoryView":1050
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 * 
 *     shape = memview.view.shape             # <<<<<<<<<<<<<<
 *     strides = memview.view.strides
 *     suboffsets = memview.view.suboffsets
 */
  __pyx_t_1 = __pyx_v_memview->view.shape;
  __pyx_v_shape = __pyx_t_1;

  /* "View.MemoryView":1051
 * 
 *     shape = memview.view.shape
 *     strides = memview.view.strides             # <<<<<<<<<<<<<<
 *     suboffsets = memview.view.suboffsets
 * 
 */
  __pyx_t_1 = __pyx_v_memview->view.strides;
  __pyx_v_strides = __pyx_t_1;

  /* "View.MemoryView":1052
 *     shape = memview.view.shape
 *     strides = memview.view.strides
 *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
 * 
 *     dst.memview = <__pyx_memoryview *> memview
 */
  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
  __pyx_v_suboffsets = __pyx_t_1;

  /* "View.MemoryView":1054
 *     suboffsets = memview.view.suboffsets
 * 
 *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
 *     dst.data = <char *> memview.view.buf
 * 
 */
  __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);

  /* "View.MemoryView":1055
 * 
 *     dst.memview = <__pyx_memoryview *> memview
 *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
 * 
 *     for dim in range(memview.view.ndim):
 */
  __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);

  /* "View.MemoryView":1057
 *     dst.data = <char *> memview.view.buf
 * 
 *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
 */
  __pyx_t_2 = __pyx_v_memview->view.ndim;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_dim = __pyx_t_3;

    /* "View.MemoryView":1058
 * 
 *     for dim in range(memview.view.ndim):
 *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 */
    (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);

    /* "View.MemoryView":1059
 *     for dim in range(memview.view.ndim):
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 * 
 */
    (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);

    /* "View.MemoryView":1060
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object')
 */
    if ((__pyx_v_suboffsets != 0)) {
      __pyx_t_4 = (__pyx_v_suboffsets[__pyx_v_dim]);
    } else {
      __pyx_t_4 = -1L;
    }
    (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_4;
  }

  /* "View.MemoryView":1046
 * 
 * @cname('__pyx_memoryview_slice_copy')
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
 *     cdef int dim
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":1063
 * 
 * @cname('__pyx_memoryview_copy_object')
 * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 */

static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
  __Pyx_memviewslice __pyx_v_memviewslice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("memoryview_copy", 0);

  /* "View.MemoryView":1066
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
 *     return memoryview_copy_from_slice(memview, &memviewslice)
 * 
 */
  __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));

  /* "View.MemoryView":1067
 *     cdef __Pyx_memviewslice memviewslice
 *     slice_copy(memview, &memviewslice)
 *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 1067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1063
 * 
 * @cname('__pyx_memoryview_copy_object')
 * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1070
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new memoryview object from a given memoryview object and slice.
 */

static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
  PyObject *(*__pyx_v_to_object_func)(char *);
  int (*__pyx_v_to_dtype_func)(char *, PyObject *);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *(*__pyx_t_3)(char *);
  int (*__pyx_t_4)(char *, PyObject *);
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);

  /* "View.MemoryView":1077
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1078
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
 */
    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
    __pyx_v_to_object_func = __pyx_t_3;

    /* "View.MemoryView":1079
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
 *     else:
 *         to_object_func = NULL
 */
    __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
    __pyx_v_to_dtype_func = __pyx_t_4;

    /* "View.MemoryView":1077
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1081
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
 *         to_object_func = NULL             # <<<<<<<<<<<<<<
 *         to_dtype_func = NULL
 * 
 */
  /*else*/ {
    __pyx_v_to_object_func = NULL;

    /* "View.MemoryView":1082
 *     else:
 *         to_object_func = NULL
 *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
 * 
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
 */
    __pyx_v_to_dtype_func = NULL;
  }
  __pyx_L3:;

  /* "View.MemoryView":1084
 *         to_dtype_func = NULL
 * 
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)
 */
  __Pyx_XDECREF(__pyx_r);

  /* "View.MemoryView":1086
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1070
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new memoryview object from a given memoryview object and slice.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1092
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
 *     if arg < 0:
 *         return -arg
 */

static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  Py_ssize_t __pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":1093
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:             # <<<<<<<<<<<<<<
 *         return -arg
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1094
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:
 *         return -arg             # <<<<<<<<<<<<<<
 *     else:
 *         return arg
 */
    __pyx_r = (-__pyx_v_arg);
    goto __pyx_L0;

    /* "View.MemoryView":1093
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:             # <<<<<<<<<<<<<<
 *         return -arg
 *     else:
 */
  }

  /* "View.MemoryView":1096
 *         return -arg
 *     else:
 *         return arg             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_get_best_slice_order')
 */
  /*else*/ {
    __pyx_r = __pyx_v_arg;
    goto __pyx_L0;
  }

  /* "View.MemoryView":1092
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
 *     if arg < 0:
 *         return -arg
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1099
 * 
 * @cname('__pyx_get_best_slice_order')
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Figure out the best memory access order for a given slice.
 */

static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
  int __pyx_v_i;
  Py_ssize_t __pyx_v_c_stride;
  Py_ssize_t __pyx_v_f_stride;
  char __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "View.MemoryView":1104
 *     """
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t f_stride = 0
 * 
 */
  __pyx_v_c_stride = 0;

  /* "View.MemoryView":1105
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0
 *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim - 1, -1, -1):
 */
  __pyx_v_f_stride = 0;

  /* "View.MemoryView":1107
 *     cdef Py_ssize_t f_stride = 0
 * 
 *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
 */
  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1L; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":1108
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
 */
    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1109
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);

      /* "View.MemoryView":1110
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
 */
      goto __pyx_L4_break;

      /* "View.MemoryView":1108
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
 */
    }
  }
  __pyx_L4_break:;

  /* "View.MemoryView":1112
 *             break
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]
 */
  __pyx_t_1 = __pyx_v_ndim;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_1; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1113
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
 */
    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1114
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);

      /* "View.MemoryView":1115
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
 */
      goto __pyx_L7_break;

      /* "View.MemoryView":1113
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
 */
    }
  }
  __pyx_L7_break:;

  /* "View.MemoryView":1117
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
 */
  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1118
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
 *         return 'C'             # <<<<<<<<<<<<<<
 *     else:
 *         return 'F'
 */
    __pyx_r = 'C';
    goto __pyx_L0;

    /* "View.MemoryView":1117
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
 */
  }

  /* "View.MemoryView":1120
 *         return 'C'
 *     else:
 *         return 'F'             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
 */
  /*else*/ {
    __pyx_r = 'F';
    goto __pyx_L0;
  }

  /* "View.MemoryView":1099
 * 
 * @cname('__pyx_get_best_slice_order')
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Figure out the best memory access order for a given slice.
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1123
 * 
 * @cython.cdivision(True)
 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
 *                                    char *dst_data, Py_ssize_t *dst_strides,
 *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
 */

static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
  Py_ssize_t __pyx_v_dst_extent;
  Py_ssize_t __pyx_v_src_stride;
  Py_ssize_t __pyx_v_dst_stride;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;

  /* "View.MemoryView":1130
 * 
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]
 */
  __pyx_v_src_extent = (__pyx_v_src_shape[0]);

  /* "View.MemoryView":1131
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t src_extent = src_shape[0]
 *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t src_stride = src_strides[0]
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 */
  __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);

  /* "View.MemoryView":1132
 *     cdef Py_ssize_t src_extent = src_shape[0]
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 */
  __pyx_v_src_stride = (__pyx_v_src_strides[0]);

  /* "View.MemoryView":1133
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]
 *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
 * 
 *     if ndim == 1:
 */
  __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);

  /* "View.MemoryView":1135
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 */
  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1136
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
    __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }

    /* "View.MemoryView":1137
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 *        else:
 */
    __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
    if (__pyx_t_2) {
      __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
    }
    __pyx_t_3 = (__pyx_t_2 != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;

    /* "View.MemoryView":1136
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
    if (__pyx_t_1) {

      /* "View.MemoryView":1138
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
 *        else:
 *            for i in range(dst_extent):
 */
      memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent));

      /* "View.MemoryView":1136
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
      goto __pyx_L4;
    }

    /* "View.MemoryView":1140
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 *        else:
 *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride
 */
    /*else*/ {
      __pyx_t_4 = __pyx_v_dst_extent;
      for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
        __pyx_v_i = __pyx_t_5;

        /* "View.MemoryView":1141
 *        else:
 *            for i in range(dst_extent):
 *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
 *                src_data += src_stride
 *                dst_data += dst_stride
 */
        memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize);

        /* "View.MemoryView":1142
 *            for i in range(dst_extent):
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride             # <<<<<<<<<<<<<<
 *                dst_data += dst_stride
 *     else:
 */
        __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);

        /* "View.MemoryView":1143
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride
 *                dst_data += dst_stride             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(dst_extent):
 */
        __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
      }
    }
    __pyx_L4:;

    /* "View.MemoryView":1135
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1145
 *                dst_data += dst_stride
 *     else:
 *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
 *             _copy_strided_to_strided(src_data, src_strides + 1,
 *                                      dst_data, dst_strides + 1,
 */
  /*else*/ {
    __pyx_t_4 = __pyx_v_dst_extent;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "View.MemoryView":1146
 *     else:
 *         for i in range(dst_extent):
 *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
 *                                      dst_data, dst_strides + 1,
 *                                      src_shape + 1, dst_shape + 1,
 */
      _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);

      /* "View.MemoryView":1150
 *                                      src_shape + 1, dst_shape + 1,
 *                                      ndim - 1, itemsize)
 *             src_data += src_stride             # <<<<<<<<<<<<<<
 *             dst_data += dst_stride
 * 
 */
      __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);

      /* "View.MemoryView":1151
 *                                      ndim - 1, itemsize)
 *             src_data += src_stride
 *             dst_data += dst_stride             # <<<<<<<<<<<<<<
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
 */
      __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1123
 * 
 * @cython.cdivision(True)
 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
 *                                    char *dst_data, Py_ssize_t *dst_strides,
 *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
 */

  /* function exit code */
}

/* "View.MemoryView":1153
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 */

static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {

  /* "View.MemoryView":1156
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
 *                              src.shape, dst.shape, ndim, itemsize)
 * 
 */
  _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);

  /* "View.MemoryView":1153
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1160
 * 
 * @cname('__pyx_memoryview_slice_get_size')
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef int i
 */

static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
  int __pyx_v_i;
  Py_ssize_t __pyx_v_size;
  Py_ssize_t __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "View.MemoryView":1163
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef int i
 *     cdef Py_ssize_t size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
 */
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_size = __pyx_t_1;

  /* "View.MemoryView":1165
 *     cdef Py_ssize_t size = src.memview.view.itemsize
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         size *= src.shape[i]
 * 
 */
  __pyx_t_2 = __pyx_v_ndim;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1166
 * 
 *     for i in range(ndim):
 *         size *= src.shape[i]             # <<<<<<<<<<<<<<
 * 
 *     return size
 */
    __pyx_v_size = (__pyx_v_size * (__pyx_v_src->shape[__pyx_v_i]));
  }

  /* "View.MemoryView":1168
 *         size *= src.shape[i]
 * 
 *     return size             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_fill_contig_strides_array')
 */
  __pyx_r = __pyx_v_size;
  goto __pyx_L0;

  /* "View.MemoryView":1160
 * 
 * @cname('__pyx_memoryview_slice_get_size')
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef int i
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1171
 * 
 * @cname('__pyx_fill_contig_strides_array')
 * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
 *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
 *                 int ndim, char order) nogil:
 */

static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
  int __pyx_v_idx;
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "View.MemoryView":1180
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
 */
  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1181
 * 
 *     if order == 'F':
 *         for idx in range(ndim):             # <<<<<<<<<<<<<<
 *             strides[idx] = stride
 *             stride = stride * shape[idx]
 */
    __pyx_t_2 = __pyx_v_ndim;
    for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
      __pyx_v_idx = __pyx_t_3;

      /* "View.MemoryView":1182
 *     if order == 'F':
 *         for idx in range(ndim):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride = stride * shape[idx]
 *     else:
 */
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1183
 *         for idx in range(ndim):
 *             strides[idx] = stride
 *             stride = stride * shape[idx]             # <<<<<<<<<<<<<<
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
 */
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }

    /* "View.MemoryView":1180
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1185
 *             stride = stride * shape[idx]
 *     else:
 *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *             strides[idx] = stride
 *             stride = stride * shape[idx]
 */
  /*else*/ {
    for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1L; __pyx_t_2-=1) {
      __pyx_v_idx = __pyx_t_2;

      /* "View.MemoryView":1186
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride = stride * shape[idx]
 * 
 */
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1187
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride
 *             stride = stride * shape[idx]             # <<<<<<<<<<<<<<
 * 
 *     return stride
 */
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1189
 *             stride = stride * shape[idx]
 * 
 *     return stride             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 */
  __pyx_r = __pyx_v_stride;
  goto __pyx_L0;

  /* "View.MemoryView":1171
 * 
 * @cname('__pyx_fill_contig_strides_array')
 * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
 *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
 *                 int ndim, char order) nogil:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1192
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                              __Pyx_memviewslice *tmpslice,
 *                              char order,
 */

static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
  int __pyx_v_i;
  void *__pyx_v_result;
  size_t __pyx_v_itemsize;
  size_t __pyx_v_size;
  void *__pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  struct __pyx_memoryview_obj *__pyx_t_4;
  int __pyx_t_5;

  /* "View.MemoryView":1203
 *     cdef void *result
 * 
 *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
 */
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":1204
 * 
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
 * 
 *     result = malloc(size)
 */
  __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);

  /* "View.MemoryView":1206
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
 *     result = malloc(size)             # <<<<<<<<<<<<<<
 *     if not result:
 *         _err(MemoryError, NULL)
 */
  __pyx_v_result = malloc(__pyx_v_size);

  /* "View.MemoryView":1207
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err(MemoryError, NULL)
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1208
 *     result = malloc(size)
 *     if not result:
 *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(13, 1208, __pyx_L1_error)

    /* "View.MemoryView":1207
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err(MemoryError, NULL)
 * 
 */
  }

  /* "View.MemoryView":1211
 * 
 * 
 *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
 */
  __pyx_v_tmpslice->data = ((char *)__pyx_v_result);

  /* "View.MemoryView":1212
 * 
 *     tmpslice.data = <char *> result
 *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]
 */
  __pyx_t_4 = __pyx_v_src->memview;
  __pyx_v_tmpslice->memview = __pyx_t_4;

  /* "View.MemoryView":1213
 *     tmpslice.data = <char *> result
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         tmpslice.shape[i] = src.shape[i]
 *         tmpslice.suboffsets[i] = -1
 */
  __pyx_t_3 = __pyx_v_ndim;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "View.MemoryView":1214
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
 *         tmpslice.suboffsets[i] = -1
 * 
 */
    (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);

    /* "View.MemoryView":1215
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]
 *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
 * 
 *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
 */
    (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1217
 *         tmpslice.suboffsets[i] = -1
 * 
 *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
 *                               ndim, order)
 * 
 */
  __pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order);

  /* "View.MemoryView":1221
 * 
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if tmpslice.shape[i] == 1:
 *             tmpslice.strides[i] = 0
 */
  __pyx_t_3 = __pyx_v_ndim;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "View.MemoryView":1222
 * 
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
 *             tmpslice.strides[i] = 0
 * 
 */
    __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1223
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:
 *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
 * 
 *     if slice_is_contig(src[0], order, ndim):
 */
      (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;

      /* "View.MemoryView":1222
 * 
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
 *             tmpslice.strides[i] = 0
 * 
 */
    }
  }

  /* "View.MemoryView":1225
 *             tmpslice.strides[i] = 0
 * 
 *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
 *         memcpy(result, src.data, size)
 *     else:
 */
  __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1226
 * 
 *     if slice_is_contig(src[0], order, ndim):
 *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
 *     else:
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
 */
    memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size);

    /* "View.MemoryView":1225
 *             tmpslice.strides[i] = 0
 * 
 *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
 *         memcpy(result, src.data, size)
 *     else:
 */
    goto __pyx_L9;
  }

  /* "View.MemoryView":1228
 *         memcpy(result, src.data, size)
 *     else:
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
  /*else*/ {
    copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
  }
  __pyx_L9:;

  /* "View.MemoryView":1230
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "View.MemoryView":1192
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                              __Pyx_memviewslice *tmpslice,
 *                              char order,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1235
 * 
 * @cname('__pyx_memoryview_err_extents')
 * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 */

static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err_extents", 0);

  /* "View.MemoryView":1238
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err_dim')
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 1238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 1238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 1238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 1238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;

  /* "View.MemoryView":1237
 * cdef int _err_extents(int i, Py_ssize_t extent1,
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
 *                                                         (i, extent1, extent2))
 * 
 */
  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 1237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 1237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 1237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __PYX_ERR(13, 1237, __pyx_L1_error)

  /* "View.MemoryView":1235
 * 
 * @cname('__pyx_memoryview_err_extents')
 * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1241
 * 
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
 *     raise error(msg.decode('ascii') % dim)
 * 
 */

static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
  int __pyx_r;
  __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;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err_dim", 0);
  __Pyx_INCREF(__pyx_v_error);

  /* "View.MemoryView":1242
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
 *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err')
 */
  __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 1242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 1242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(13, 1242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_v_error);
  __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 1242, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 1242, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 1242, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(13, 1242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 1242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(13, 1242, __pyx_L1_error)

  /* "View.MemoryView":1241
 * 
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
 *     raise error(msg.decode('ascii') % dim)
 * 
 */

  /* function exit code */
  __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_5);
  __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1245
 * 
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))
 */

static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err", 0);
  __Pyx_INCREF(__pyx_v_error);

  /* "View.MemoryView":1246
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:             # <<<<<<<<<<<<<<
 *         raise error(msg.decode('ascii'))
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1247
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
 *     else:
 *         raise error
 */
    __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(13, 1247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_error);
    __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 1247, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 1247, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 1247, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(13, 1247, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(13, 1247, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(13, 1247, __pyx_L1_error)

    /* "View.MemoryView":1246
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:             # <<<<<<<<<<<<<<
 *         raise error(msg.decode('ascii'))
 *     else:
 */
  }

  /* "View.MemoryView":1249
 *         raise error(msg.decode('ascii'))
 *     else:
 *         raise error             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_contents')
 */
  /*else*/ {
    __Pyx_Raise(__pyx_v_error, 0, 0, 0);
    __PYX_ERR(13, 1249, __pyx_L1_error)
  }

  /* "View.MemoryView":1245
 * 
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1252
 * 
 * @cname('__pyx_memoryview_copy_contents')
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice dst,
 *                                   int src_ndim, int dst_ndim,
 */

static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
  void *__pyx_v_tmpdata;
  size_t __pyx_v_itemsize;
  int __pyx_v_i;
  char __pyx_v_order;
  int __pyx_v_broadcasting;
  int __pyx_v_direct_copy;
  __Pyx_memviewslice __pyx_v_tmp;
  int __pyx_v_ndim;
  int __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  void *__pyx_t_6;
  int __pyx_t_7;

  /* "View.MemoryView":1260
 *     Check for overlapping memory and verify the shapes.
 *     """
 *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef int i
 */
  __pyx_v_tmpdata = NULL;

  /* "View.MemoryView":1261
 *     """
 *     cdef void *tmpdata = NULL
 *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)
 */
  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":1263
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
 *     cdef bint broadcasting = False
 *     cdef bint direct_copy = False
 */
  __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);

  /* "View.MemoryView":1264
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)
 *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
 *     cdef bint direct_copy = False
 *     cdef __Pyx_memviewslice tmp
 */
  __pyx_v_broadcasting = 0;

  /* "View.MemoryView":1265
 *     cdef char order = get_best_order(&src, src_ndim)
 *     cdef bint broadcasting = False
 *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
 *     cdef __Pyx_memviewslice tmp
 * 
 */
  __pyx_v_direct_copy = 0;

  /* "View.MemoryView":1268
 *     cdef __Pyx_memviewslice tmp
 * 
 *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 */
  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1269
 * 
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
 *     elif dst_ndim < src_ndim:
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 */
    __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);

    /* "View.MemoryView":1268
 *     cdef __Pyx_memviewslice tmp
 * 
 *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1270
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 */
  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1271
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
 * 
 *     cdef int ndim = max(src_ndim, dst_ndim)
 */
    __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);

    /* "View.MemoryView":1270
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":1273
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
 */
  __pyx_t_3 = __pyx_v_dst_ndim;
  __pyx_t_4 = __pyx_v_src_ndim;
  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
    __pyx_t_5 = __pyx_t_3;
  } else {
    __pyx_t_5 = __pyx_t_4;
  }
  __pyx_v_ndim = __pyx_t_5;

  /* "View.MemoryView":1275
 *     cdef int ndim = max(src_ndim, dst_ndim)
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:
 */
  __pyx_t_5 = __pyx_v_ndim;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1276
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 */
    __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1277
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
 *                 broadcasting = True
 *                 src.strides[i] = 0
 */
      __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":1278
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:
 *                 broadcasting = True             # <<<<<<<<<<<<<<
 *                 src.strides[i] = 0
 *             else:
 */
        __pyx_v_broadcasting = 1;

        /* "View.MemoryView":1279
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 */
        (__pyx_v_src.strides[__pyx_v_i]) = 0;

        /* "View.MemoryView":1277
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
 *                 broadcasting = True
 *                 src.strides[i] = 0
 */
        goto __pyx_L7;
      }

      /* "View.MemoryView":1281
 *                 src.strides[i] = 0
 *             else:
 *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
 * 
 *         if src.suboffsets[i] >= 0:
 */
      /*else*/ {
        __pyx_t_4 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(13, 1281, __pyx_L1_error)
      }
      __pyx_L7:;

      /* "View.MemoryView":1276
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 */
    }

    /* "View.MemoryView":1283
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 */
    __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1284
 * 
 *         if src.suboffsets[i] >= 0:
 *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 */
      __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(13, 1284, __pyx_L1_error)

      /* "View.MemoryView":1283
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 */
    }
  }

  /* "View.MemoryView":1286
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
 */
  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1288
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
 */
    __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1289
 * 
 *         if not slice_is_contig(src, order, ndim):
 *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
 */
      __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);

      /* "View.MemoryView":1288
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
 */
    }

    /* "View.MemoryView":1291
 *             order = get_best_order(&dst, ndim)
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
 *         src = tmp
 * 
 */
    __pyx_t_6 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_6 == NULL)) __PYX_ERR(13, 1291, __pyx_L1_error)
    __pyx_v_tmpdata = __pyx_t_6;

    /* "View.MemoryView":1292
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
 *         src = tmp             # <<<<<<<<<<<<<<
 * 
 *     if not broadcasting:
 */
    __pyx_v_src = __pyx_v_tmp;

    /* "View.MemoryView":1286
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
 */
  }

  /* "View.MemoryView":1294
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1297
 * 
 * 
 *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 */
    __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1298
 * 
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
 *         elif slice_is_contig(src, 'F', ndim):
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 */
      __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);

      /* "View.MemoryView":1297
 * 
 * 
 *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 */
      goto __pyx_L12;
    }

    /* "View.MemoryView":1299
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 */
    __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1300
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
 * 
 *         if direct_copy:
 */
      __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);

      /* "View.MemoryView":1299
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 */
    }
    __pyx_L12:;

    /* "View.MemoryView":1302
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    __pyx_t_2 = (__pyx_v_direct_copy != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1304
 *         if direct_copy:
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 */
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

      /* "View.MemoryView":1305
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)
 */
      memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim));

      /* "View.MemoryView":1306
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 *             free(tmpdata)
 *             return 0
 */
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

      /* "View.MemoryView":1307
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
      free(__pyx_v_tmpdata);

      /* "View.MemoryView":1308
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "View.MemoryView":1302
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    }

    /* "View.MemoryView":1294
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":1310
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = (__pyx_v_order == 'F');
  if (__pyx_t_2) {
    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
  }
  __pyx_t_7 = (__pyx_t_2 != 0);
  if (__pyx_t_7) {

    /* "View.MemoryView":1313
 * 
 * 
 *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&dst)
 * 
 */
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == 0)) __PYX_ERR(13, 1313, __pyx_L1_error)

    /* "View.MemoryView":1314
 * 
 *         transpose_memslice(&src)
 *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == 0)) __PYX_ERR(13, 1314, __pyx_L1_error)

    /* "View.MemoryView":1310
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":1316
 *         transpose_memslice(&dst)
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 */
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1317
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 * 
 */
  copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);

  /* "View.MemoryView":1318
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 * 
 *     free(tmpdata)
 */
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1320
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 * 
 *     free(tmpdata)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  free(__pyx_v_tmpdata);

  /* "View.MemoryView":1321
 * 
 *     free(tmpdata)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1252
 * 
 * @cname('__pyx_memoryview_copy_contents')
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice dst,
 *                                   int src_ndim, int dst_ndim,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1324
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
 *                             int ndim,
 *                             int ndim_other) nogil:
 */

static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
  int __pyx_v_i;
  int __pyx_v_offset;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "View.MemoryView":1328
 *                             int ndim_other) nogil:
 *     cdef int i
 *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim - 1, -1, -1):
 */
  __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);

  /* "View.MemoryView":1330
 *     cdef int offset = ndim_other - ndim
 * 
 *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]
 */
  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1L; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":1331
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
 *         mslice.strides[i + offset] = mslice.strides[i]
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 */
    (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);

    /* "View.MemoryView":1332
 *     for i in range(ndim - 1, -1, -1):
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 * 
 */
    (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);

    /* "View.MemoryView":1333
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
 * 
 *     for i in range(offset):
 */
    (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
  }

  /* "View.MemoryView":1335
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 * 
 *     for i in range(offset):             # <<<<<<<<<<<<<<
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]
 */
  __pyx_t_1 = __pyx_v_offset;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "View.MemoryView":1336
 * 
 *     for i in range(offset):
 *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
 *         mslice.strides[i] = mslice.strides[0]
 *         mslice.suboffsets[i] = -1
 */
    (__pyx_v_mslice->shape[__pyx_v_i]) = 1;

    /* "View.MemoryView":1337
 *     for i in range(offset):
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
 *         mslice.suboffsets[i] = -1
 * 
 */
    (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);

    /* "View.MemoryView":1338
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]
 *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1324
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
 *                             int ndim,
 *                             int ndim_other) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1346
 * 
 * @cname('__pyx_memoryview_refcount_copying')
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
 *                            int ndim, bint inc) nogil:
 * 
 */

static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
  int __pyx_t_1;

  /* "View.MemoryView":1350
 * 
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
 *                                            dst.strides, ndim, inc)
 */
  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1351
 * 
 *     if dtype_is_object:
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
 *                                            dst.strides, ndim, inc)
 * 
 */
    __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);

    /* "View.MemoryView":1350
 * 
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
 *                                            dst.strides, ndim, inc)
 */
  }

  /* "View.MemoryView":1346
 * 
 * @cname('__pyx_memoryview_refcount_copying')
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
 *                            int ndim, bint inc) nogil:
 * 
 */

  /* function exit code */
}

/* "View.MemoryView":1355
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 */

static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
  __Pyx_RefNannyDeclarations
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);

  /* "View.MemoryView":1358
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 */
  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);

  /* "View.MemoryView":1355
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "View.MemoryView":1361
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                     Py_ssize_t *strides, int ndim, bint inc):
 *     cdef Py_ssize_t i
 */

static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);

  /* "View.MemoryView":1365
 *     cdef Py_ssize_t i
 * 
 *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
 *         if ndim == 1:
 *             if inc:
 */
  __pyx_t_1 = (__pyx_v_shape[0]);
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "View.MemoryView":1366
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
 */
    __pyx_t_3 = ((__pyx_v_ndim == 1) != 0);
    if (__pyx_t_3) {

      /* "View.MemoryView":1367
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 */
      __pyx_t_3 = (__pyx_v_inc != 0);
      if (__pyx_t_3) {

        /* "View.MemoryView":1368
 *         if ndim == 1:
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])
 */
        Py_INCREF((((PyObject **)__pyx_v_data)[0]));

        /* "View.MemoryView":1367
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 */
        goto __pyx_L6;
      }

      /* "View.MemoryView":1370
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,
 */
      /*else*/ {
        Py_DECREF((((PyObject **)__pyx_v_data)[0]));
      }
      __pyx_L6:;

      /* "View.MemoryView":1366
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
 */
      goto __pyx_L5;
    }

    /* "View.MemoryView":1372
 *                 Py_DECREF((<PyObject **> data)[0])
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
 *                                       ndim - 1, inc)
 * 
 */
    /*else*/ {

      /* "View.MemoryView":1373
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,
 *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
 * 
 *         data += strides[0]
 */
      __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
    }
    __pyx_L5:;

    /* "View.MemoryView":1375
 *                                       ndim - 1, inc)
 * 
 *         data += strides[0]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
  }

  /* "View.MemoryView":1361
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                     Py_ssize_t *strides, int ndim, bint inc):
 *     cdef Py_ssize_t i
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":1381
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 */

static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {

  /* "View.MemoryView":1384
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
 *                          itemsize, item)
 */
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1385
 *                               bint dtype_is_object) nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, False)
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
 *                          itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, True)
 */
  __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);

  /* "View.MemoryView":1387
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
 *                          itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1381
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1391
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                               Py_ssize_t *strides, int ndim,
 *                               size_t itemsize, void *item) nogil:
 */

static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_v_extent;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;

  /* "View.MemoryView":1395
 *                               size_t itemsize, void *item) nogil:
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t extent = shape[0]
 * 
 */
  __pyx_v_stride = (__pyx_v_strides[0]);

  /* "View.MemoryView":1396
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]
 *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
 * 
 *     if ndim == 1:
 */
  __pyx_v_extent = (__pyx_v_shape[0]);

  /* "View.MemoryView":1398
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 */
  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1399
 * 
 *     if ndim == 1:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             memcpy(data, item, itemsize)
 *             data += stride
 */
    __pyx_t_2 = __pyx_v_extent;
    for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
      __pyx_v_i = __pyx_t_3;

      /* "View.MemoryView":1400
 *     if ndim == 1:
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
 *             data += stride
 *     else:
 */
      memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize);

      /* "View.MemoryView":1401
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 *             data += stride             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(extent):
 */
      __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
    }

    /* "View.MemoryView":1398
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1403
 *             data += stride
 *     else:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             _slice_assign_scalar(data, shape + 1, strides + 1,
 *                                 ndim - 1, itemsize, item)
 */
  /*else*/ {
    __pyx_t_2 = __pyx_v_extent;
    for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
      __pyx_v_i = __pyx_t_3;

      /* "View.MemoryView":1404
 *     else:
 *         for i in range(extent):
 *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
 *                                 ndim - 1, itemsize, item)
 *             data += stride
 */
      __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);

      /* "View.MemoryView":1406
 *             _slice_assign_scalar(data, shape + 1, strides + 1,
 *                                 ndim - 1, itemsize, item)
 *             data += stride             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1391
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                               Py_ssize_t *strides, int ndim,
 *                               size_t itemsize, void *item) nogil:
 */

  /* function exit code */
}

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_PopType(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy_PopType(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_PopType = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.PopType", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_PopType), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_PopType, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    Empty base class for a population object.\n\n    Example derived types include :class:`fwdpy.fwdpy.singlepop` and :class:`fwdpy.fwdpy.metapop`\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_PopType, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_Spop __pyx_vtable_5fwdpy_5fwdpy_Spop;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_Spop(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5fwdpy_5fwdpy_Spop *p;
  PyObject *o = __pyx_tp_new_5fwdpy_5fwdpy_PopType(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)o);
  p->__pyx_vtab = __pyx_vtabptr_5fwdpy_5fwdpy_Spop;
  new((void*)&(p->pop)) std::shared_ptr<fwdpy::singlepop_t> ();
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy_Spop(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy_Spop *p = (struct __pyx_obj_5fwdpy_5fwdpy_Spop *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5fwdpy_5fwdpy_4Spop_1__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  __Pyx_call_destructor(p->pop);
  __pyx_tp_dealloc_5fwdpy_5fwdpy_PopType(o);
}

static PyMethodDef __pyx_methods_5fwdpy_5fwdpy_Spop[] = {
  {"gen", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_4Spop_3gen, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_4Spop_2gen},
  {"popsize", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_4Spop_5popsize, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_4Spop_4popsize},
  {"sane", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_4Spop_7sane, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_4Spop_6sane},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_Spop = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.Spop", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_Spop), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_Spop, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    Object representing data structures for single-deme simulations\n    based on a mutation type having a single 's' and 'h' term.\n\n    Users are not expected to construct these on their own.  Rather,\n    they should be working with :class:`SpopVec`.  This type exists as\n    the output of iterating through a :class:`SpopVec`.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_Spop, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_Spop, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_MetaPop __pyx_vtable_5fwdpy_5fwdpy_MetaPop;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_MetaPop(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *p;
  PyObject *o = __pyx_tp_new_5fwdpy_5fwdpy_PopType(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)o);
  p->__pyx_vtab = __pyx_vtabptr_5fwdpy_5fwdpy_MetaPop;
  new((void*)&(p->mpop)) std::shared_ptr<fwdpy::metapop_t> ();
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy_MetaPop(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *p = (struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5fwdpy_5fwdpy_7MetaPop_1__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  __Pyx_call_destructor(p->mpop);
  __pyx_tp_dealloc_5fwdpy_5fwdpy_PopType(o);
}

static PyMethodDef __pyx_methods_5fwdpy_5fwdpy_MetaPop[] = {
  {"gen", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7MetaPop_5gen, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_7MetaPop_4gen},
  {"popsizes", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7MetaPop_7popsizes, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_7MetaPop_6popsizes},
  {"sane", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7MetaPop_9sane, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_7MetaPop_8sane},
  {"from_Spop", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7MetaPop_11from_Spop, METH_O, 0},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_MetaPop = {
  __pyx_pw_5fwdpy_5fwdpy_7MetaPop_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_MetaPop = {
  __pyx_pw_5fwdpy_5fwdpy_7MetaPop_3__len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_MetaPop = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.MetaPop", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_MetaPop, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_MetaPop, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_MetaPop, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    Object representing data structures for single-deme simulations.\n\n    Users are not expected to construct these on their own.  Rather,\n    they should be working with :class:`MetaPopVec`.  This type exists as\n    the output of iterating through a :class:`MetaPopVec`.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_MetaPop, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_MetaPop, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_MlocusPop __pyx_vtable_5fwdpy_5fwdpy_MlocusPop;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_MlocusPop(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *p;
  PyObject *o = __pyx_tp_new_5fwdpy_5fwdpy_PopType(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)o);
  p->__pyx_vtab = __pyx_vtabptr_5fwdpy_5fwdpy_MlocusPop;
  new((void*)&(p->pop)) std::shared_ptr<fwdpy::multilocus_t> ();
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy_MlocusPop(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *p = (struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5fwdpy_5fwdpy_9MlocusPop_1__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  __Pyx_call_destructor(p->pop);
  __pyx_tp_dealloc_5fwdpy_5fwdpy_PopType(o);
}

static PyMethodDef __pyx_methods_5fwdpy_5fwdpy_MlocusPop[] = {
  {"gen", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_3gen, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_9MlocusPop_2gen},
  {"popsize", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_5popsize, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_9MlocusPop_4popsize},
  {"sane", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_9MlocusPop_7sane, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_9MlocusPop_6sane},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_MlocusPop = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.MlocusPop", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_MlocusPop, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    Object representing data structures for single-deme, multi-locus/region simulations\n    based on a mutation type having a single 's' and 'h' term.\n\n    Users are not expected to construct these on their own.  Rather,\n    they should be working with :class:`MlocusPopVec`.  This type exists as\n    the output of iterating through a :class:`MlocusPopVec`.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_MlocusPop, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_MlocusPop, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_SpopGenMut __pyx_vtable_5fwdpy_5fwdpy_SpopGenMut;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_SpopGenMut(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *p;
  PyObject *o = __pyx_tp_new_5fwdpy_5fwdpy_PopType(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *)o);
  p->__pyx_vtab = __pyx_vtabptr_5fwdpy_5fwdpy_SpopGenMut;
  new((void*)&(p->pop)) std::shared_ptr<fwdpy::singlepop_gm_vec_t> ();
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy_SpopGenMut(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *p = (struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_1__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  __Pyx_call_destructor(p->pop);
  __pyx_tp_dealloc_5fwdpy_5fwdpy_PopType(o);
}

static PyMethodDef __pyx_methods_5fwdpy_5fwdpy_SpopGenMut[] = {
  {"gen", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_3gen, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_10SpopGenMut_2gen},
  {"popsize", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_5popsize, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_10SpopGenMut_4popsize},
  {"sane", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_10SpopGenMut_7sane, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_10SpopGenMut_6sane},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_SpopGenMut = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.SpopGenMut", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_SpopGenMut, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    Object representing data structures for single-deme simulations\n    based on a mutation type having a vector of properties.\n\n    Users are not expected to construct these on their own.  Rather,\n    they should be working with :class:`SpopGenMutVec`.  This type exists as\n    the output of iterating through a :class:`SpopGenMut`.\n\n    ..note:: Currently, there are no functions in fwdpy using this type!  See :class:`fwdpy.fwdpy.Spop` instead.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_SpopGenMut, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_SpopGenMut, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_PopVec(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy_PopVec(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_PopVec = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.PopVec", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_PopVec), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_PopVec, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    Empty base class for containers of population objects.\n\n    Example derived types include :class:`fwdpy.fwdpy.SpopVec` and :class:`fwdpy.fwdpy.MetaPopVec`\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_PopVec, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_SpopVec __pyx_vtable_5fwdpy_5fwdpy_SpopVec;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_SpopVec(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *p;
  PyObject *o = __pyx_tp_new_5fwdpy_5fwdpy_PopVec(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)o);
  p->__pyx_vtab = __pyx_vtabptr_5fwdpy_5fwdpy_SpopVec;
  new((void*)&(p->pops)) std::vector<std::shared_ptr<fwdpy::singlepop_t> > ();
  if (unlikely(__pyx_pw_5fwdpy_5fwdpy_7SpopVec_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy_SpopVec(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *p = (struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5fwdpy_5fwdpy_7SpopVec_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  __Pyx_call_destructor(p->pops);
  __pyx_tp_dealloc_5fwdpy_5fwdpy_PopVec(o);
}
static PyObject *__pyx_sq_item_5fwdpy_5fwdpy_SpopVec(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_5fwdpy_5fwdpy_SpopVec[] = {
  {"__next__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7SpopVec_8__next__, METH_NOARGS|METH_COEXIST, 0},
  {"__append_details__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7SpopVec_14__append_details__, METH_O, 0},
  {"append", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7SpopVec_16append, METH_O, __pyx_doc_5fwdpy_5fwdpy_7SpopVec_15append},
  {"size", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7SpopVec_18size, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_7SpopVec_17size},
  {"clear", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_7SpopVec_20clear, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_7SpopVec_19clear},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_SpopVec = {
  __pyx_pw_5fwdpy_5fwdpy_7SpopVec_12__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5fwdpy_5fwdpy_SpopVec, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_SpopVec = {
  __pyx_pw_5fwdpy_5fwdpy_7SpopVec_12__len__, /*mp_length*/
  __pyx_pw_5fwdpy_5fwdpy_7SpopVec_10__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_SpopVec = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.SpopVec", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_SpopVec, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_SpopVec, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_SpopVec, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    Vector of single-deme objects\n\n    Internally, the class contains \"smart\" pointers to the underlying C++ types.\n\n    The class is iterable, yielding :class:`fwdpy.fwdpy.Spop` objects.\n\n    See :func:`evolve_regions` for use cases.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5fwdpy_5fwdpy_7SpopVec_5__iter__, /*tp_iter*/
  __pyx_pw_5fwdpy_5fwdpy_7SpopVec_8__next__, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_SpopVec, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_SpopVec, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_SpopGenMutVec __pyx_vtable_5fwdpy_5fwdpy_SpopGenMutVec;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_SpopGenMutVec(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *p;
  PyObject *o = __pyx_tp_new_5fwdpy_5fwdpy_PopVec(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *)o);
  p->__pyx_vtab = __pyx_vtabptr_5fwdpy_5fwdpy_SpopGenMutVec;
  new((void*)&(p->pops)) std::vector<std::shared_ptr<fwdpy::singlepop_gm_vec_t> > ();
  if (unlikely(__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy_SpopGenMutVec(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *p = (struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  __Pyx_call_destructor(p->pops);
  __pyx_tp_dealloc_5fwdpy_5fwdpy_PopVec(o);
}
static PyObject *__pyx_sq_item_5fwdpy_5fwdpy_SpopGenMutVec(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_5fwdpy_5fwdpy_SpopGenMutVec[] = {
  {"__next__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_8__next__, METH_NOARGS|METH_COEXIST, 0},
  {"size", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_14size, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_13SpopGenMutVec_13size},
  {"clear", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_16clear, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_13SpopGenMutVec_15clear},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_SpopGenMutVec = {
  __pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_12__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5fwdpy_5fwdpy_SpopGenMutVec, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_SpopGenMutVec = {
  __pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_12__len__, /*mp_length*/
  __pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_10__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_SpopGenMutVec = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.SpopGenMutVec", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_SpopGenMutVec, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_SpopGenMutVec, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_SpopGenMutVec, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_5__iter__, /*tp_iter*/
  __pyx_pw_5fwdpy_5fwdpy_13SpopGenMutVec_8__next__, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_SpopGenMutVec, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_SpopGenMutVec, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_MetaPopVec __pyx_vtable_5fwdpy_5fwdpy_MetaPopVec;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_MetaPopVec(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *p;
  PyObject *o = __pyx_tp_new_5fwdpy_5fwdpy_PopVec(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)o);
  p->__pyx_vtab = __pyx_vtabptr_5fwdpy_5fwdpy_MetaPopVec;
  new((void*)&(p->mpops)) std::vector<std::shared_ptr<fwdpy::metapop_t> > ();
  if (unlikely(__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy_MetaPopVec(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *p = (struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  __Pyx_call_destructor(p->mpops);
  __pyx_tp_dealloc_5fwdpy_5fwdpy_PopVec(o);
}
static PyObject *__pyx_sq_item_5fwdpy_5fwdpy_MetaPopVec(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_5fwdpy_5fwdpy_MetaPopVec[] = {
  {"__next__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_8__next__, METH_NOARGS|METH_COEXIST, 0},
  {"size", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_14size, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_10MetaPopVec_13size},
  {"__append_details__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_16__append_details__, METH_O, 0},
  {"append", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_18append, METH_O, __pyx_doc_5fwdpy_5fwdpy_10MetaPopVec_17append},
  {"clear", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_20clear, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_10MetaPopVec_19clear},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_MetaPopVec = {
  __pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_12__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5fwdpy_5fwdpy_MetaPopVec, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_MetaPopVec = {
  __pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_12__len__, /*mp_length*/
  __pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_10__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_MetaPopVec = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.MetaPopVec", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_MetaPopVec, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_MetaPopVec, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_MetaPopVec, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    Vector of metapopulation objects.\n\n    Internally, the class contains \"smart\" pointers to the underlying C++ types.\n\n    The class is iterable, yielding :class:`fwdpy.fwdpy.MetaPop` objects.\n\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_5__iter__, /*tp_iter*/
  __pyx_pw_5fwdpy_5fwdpy_10MetaPopVec_8__next__, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_MetaPopVec, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_MetaPopVec, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_MlocusPopVec __pyx_vtable_5fwdpy_5fwdpy_MlocusPopVec;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_MlocusPopVec(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *p;
  PyObject *o = __pyx_tp_new_5fwdpy_5fwdpy_PopVec(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)o);
  p->__pyx_vtab = __pyx_vtabptr_5fwdpy_5fwdpy_MlocusPopVec;
  new((void*)&(p->pops)) std::vector<std::shared_ptr<fwdpy::multilocus_t> > ();
  if (unlikely(__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy_MlocusPopVec(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *p = (struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  __Pyx_call_destructor(p->pops);
  __pyx_tp_dealloc_5fwdpy_5fwdpy_PopVec(o);
}
static PyObject *__pyx_sq_item_5fwdpy_5fwdpy_MlocusPopVec(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_5fwdpy_5fwdpy_MlocusPopVec[] = {
  {"__next__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_8__next__, METH_NOARGS|METH_COEXIST, 0},
  {"__append_details__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_14__append_details__, METH_O, 0},
  {"append", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_16append, METH_O, __pyx_doc_5fwdpy_5fwdpy_12MlocusPopVec_15append},
  {"size", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_18size, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_12MlocusPopVec_17size},
  {"clear", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_20clear, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_12MlocusPopVec_19clear},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_MlocusPopVec = {
  __pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_12__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5fwdpy_5fwdpy_MlocusPopVec, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_MlocusPopVec = {
  __pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_12__len__, /*mp_length*/
  __pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_10__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_MlocusPopVec = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.MlocusPopVec", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_MlocusPopVec, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_MlocusPopVec, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_MlocusPopVec, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    Vector of single-deme objects representing multiple partially-linked regions.\n\n    Internally, the class contains \"smart\" pointers to the underlying C++ types.\n\n    The class is iterable, yielding :class:`fwdpy.fwdpy.MlocusPop` objects.\n\n    See :func:`evolve_regions` for use cases.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_5__iter__, /*tp_iter*/
  __pyx_pw_5fwdpy_5fwdpy_12MlocusPopVec_8__next__, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_MlocusPopVec, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_MlocusPopVec, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_GSLrng(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_5fwdpy_5fwdpy_6GSLrng_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy_GSLrng(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5fwdpy_5fwdpy_6GSLrng_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

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

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_GSLrng = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.GSLrng", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_GSLrng), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_GSLrng, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    A wrapper around a random number generator (rng) \n    from the GNU Scientific Library (GSL).\n\n    The constructor takes a seed (int) as an argument.\n\n    Example:\n\n    >>> import fwdpy\n    >>> rng = fwdpy.GSLrng(100)\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_GSLrng, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_GSLrng, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_TemporalSampler __pyx_vtable_5fwdpy_5fwdpy_TemporalSampler;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_TemporalSampler(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *)o);
  p->__pyx_vtab = __pyx_vtabptr_5fwdpy_5fwdpy_TemporalSampler;
  new((void*)&(p->vec)) std::vector<std::unique_ptr<fwdpy::sampler_base> > ();
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy_TemporalSampler(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *p = (struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_5fwdpy_5fwdpy_15TemporalSampler_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  __Pyx_call_destructor(p->vec);
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_5fwdpy_5fwdpy_TemporalSampler[] = {
  {"size", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_15TemporalSampler_1size, METH_NOARGS, 0},
  {"force_clear", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_15TemporalSampler_5force_clear, METH_NOARGS, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_TemporalSampler = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.TemporalSampler", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_TemporalSampler, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    Base class representing containers of functions\n    to be applied to simluated populations at regular intervals.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_TemporalSampler, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_TemporalSampler, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_NothingSampler __pyx_vtable_5fwdpy_5fwdpy_NothingSampler;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_NothingSampler(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler *p;
  PyObject *o = __pyx_tp_new_5fwdpy_5fwdpy_TemporalSampler(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5fwdpy_5fwdpy_TemporalSampler*)__pyx_vtabptr_5fwdpy_5fwdpy_NothingSampler;
  if (unlikely(__pyx_pw_5fwdpy_5fwdpy_14NothingSampler_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static PyMethodDef __pyx_methods_5fwdpy_5fwdpy_NothingSampler[] = {
  {"get", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_14NothingSampler_3get, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_14NothingSampler_2get},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_NothingSampler = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.NothingSampler", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_NothingSampler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_TemporalSampler, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    A :class:`fwdpy.fwdpy.TemporalSampler` that does nothing.\n\n    This is useful during evolution to equilibrium or in other situations\n    where you are not interested in recording.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_NothingSampler, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_NothingSampler, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_QtraitStatsSampler __pyx_vtable_5fwdpy_5fwdpy_QtraitStatsSampler;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_QtraitStatsSampler(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *p;
  PyObject *o = __pyx_tp_new_5fwdpy_5fwdpy_TemporalSampler(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5fwdpy_5fwdpy_TemporalSampler*)__pyx_vtabptr_5fwdpy_5fwdpy_QtraitStatsSampler;
  if (unlikely(__pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}
static PyObject *__pyx_sq_item_5fwdpy_5fwdpy_QtraitStatsSampler(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_5fwdpy_5fwdpy_QtraitStatsSampler[] = {
  {"__next__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_6__next__, METH_NOARGS|METH_COEXIST, 0},
  {"get", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_12get, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_18QtraitStatsSampler_11get},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_QtraitStatsSampler = {
  __pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_8__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5fwdpy_5fwdpy_QtraitStatsSampler, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_QtraitStatsSampler = {
  __pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_8__len__, /*mp_length*/
  __pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_10__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_QtraitStatsSampler = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.QtraitStatsSampler", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_TemporalSampler, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_QtraitStatsSampler, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_QtraitStatsSampler, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    A :class:`fwdpy.fwdpy.TemporalSampler` that records various statistics about the population.\n\n    This type is a model of an iterable container.  Return values may be either yielded\n    or accessed via [i].\n\n    .. note:: This is not useful for the standard fwdpy population.  It only actually records anything meaningful in the qtrait and qtrait_mloc modules.  This will change in a future release.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_3__iter__, /*tp_iter*/
  __pyx_pw_5fwdpy_5fwdpy_18QtraitStatsSampler_6__next__, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_QtraitStatsSampler, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_QtraitStatsSampler, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_PopSampler __pyx_vtable_5fwdpy_5fwdpy_PopSampler;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_PopSampler(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *p;
  PyObject *o = __pyx_tp_new_5fwdpy_5fwdpy_TemporalSampler(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5fwdpy_5fwdpy_TemporalSampler*)__pyx_vtabptr_5fwdpy_5fwdpy_PopSampler;
  if (unlikely(__pyx_pw_5fwdpy_5fwdpy_10PopSampler_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}
static PyObject *__pyx_sq_item_5fwdpy_5fwdpy_PopSampler(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_5fwdpy_5fwdpy_PopSampler[] = {
  {"__next__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_10PopSampler_6__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_PopSampler = {
  __pyx_pw_5fwdpy_5fwdpy_10PopSampler_10__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5fwdpy_5fwdpy_PopSampler, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_PopSampler = {
  __pyx_pw_5fwdpy_5fwdpy_10PopSampler_10__len__, /*mp_length*/
  __pyx_pw_5fwdpy_5fwdpy_10PopSampler_8__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_PopSampler = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.PopSampler", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_PopSampler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_TemporalSampler, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_PopSampler, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PopSampler, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    A :class:`fwdpy.fwdpy.TemporalSampler` that takes a sample of size :math:`n \\leq N` from the population.\n\n    This type is a model of an iterable container.  Return values may be either yielded\n    or accessed via [i].\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5fwdpy_5fwdpy_10PopSampler_3__iter__, /*tp_iter*/
  __pyx_pw_5fwdpy_5fwdpy_10PopSampler_6__next__, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_PopSampler, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_PopSampler, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_VASampler __pyx_vtable_5fwdpy_5fwdpy_VASampler;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_VASampler(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5fwdpy_5fwdpy_VASampler *p;
  PyObject *o = __pyx_tp_new_5fwdpy_5fwdpy_TemporalSampler(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5fwdpy_5fwdpy_VASampler *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5fwdpy_5fwdpy_TemporalSampler*)__pyx_vtabptr_5fwdpy_5fwdpy_VASampler;
  if (unlikely(__pyx_pw_5fwdpy_5fwdpy_9VASampler_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}
static PyObject *__pyx_sq_item_5fwdpy_5fwdpy_VASampler(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_5fwdpy_5fwdpy_VASampler[] = {
  {"__next__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_9VASampler_6__next__, METH_NOARGS|METH_COEXIST, 0},
  {"get", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_9VASampler_12get, METH_NOARGS, __pyx_doc_5fwdpy_5fwdpy_9VASampler_11get},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_VASampler = {
  __pyx_pw_5fwdpy_5fwdpy_9VASampler_8__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5fwdpy_5fwdpy_VASampler, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VASampler = {
  __pyx_pw_5fwdpy_5fwdpy_9VASampler_8__len__, /*mp_length*/
  __pyx_pw_5fwdpy_5fwdpy_9VASampler_10__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_VASampler = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.VASampler", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_VASampler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_TemporalSampler, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_VASampler, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_VASampler, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    A :class:`fwdpy.fwdpy.TemporalSampler` that estimates the relationship between mutation frequency and total additive\n    genetic variance.\n\n    This type is a model of an iterable container.  Return values may be either yielded\n    or accessed via [i].\n\n    .. note:: This is not useful for the standard fwdpy population.  It only actually records anything meaningful in the qtrait and qtrait_mloc modules.  This will change in a future release.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5fwdpy_5fwdpy_9VASampler_3__iter__, /*tp_iter*/
  __pyx_pw_5fwdpy_5fwdpy_9VASampler_6__next__, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_VASampler, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_VASampler, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5fwdpy_5fwdpy_FreqSampler __pyx_vtable_5fwdpy_5fwdpy_FreqSampler;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy_FreqSampler(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *p;
  PyObject *o = __pyx_tp_new_5fwdpy_5fwdpy_TemporalSampler(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5fwdpy_5fwdpy_TemporalSampler*)__pyx_vtabptr_5fwdpy_5fwdpy_FreqSampler;
  if (unlikely(__pyx_pw_5fwdpy_5fwdpy_11FreqSampler_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}
static PyObject *__pyx_sq_item_5fwdpy_5fwdpy_FreqSampler(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_5fwdpy_5fwdpy_FreqSampler[] = {
  {"__next__", (PyCFunction)__pyx_pw_5fwdpy_5fwdpy_11FreqSampler_6__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_FreqSampler = {
  __pyx_pw_5fwdpy_5fwdpy_11FreqSampler_10__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5fwdpy_5fwdpy_FreqSampler, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_FreqSampler = {
  __pyx_pw_5fwdpy_5fwdpy_11FreqSampler_10__len__, /*mp_length*/
  __pyx_pw_5fwdpy_5fwdpy_11FreqSampler_8__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5fwdpy_5fwdpy_FreqSampler = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.FreqSampler", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy_TemporalSampler, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_FreqSampler, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_FreqSampler, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    A :class:`fwdpy.fwdpy.TemporalSampler` to track the frequencies of selected mutations over time.\n\n    This type is a model of an iterable container.  Return values may be either yielded\n    or accessed via [i].\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5fwdpy_5fwdpy_11FreqSampler_3__iter__, /*tp_iter*/
  __pyx_pw_5fwdpy_5fwdpy_11FreqSampler_6__next__, /*tp_iternext*/
  __pyx_methods_5fwdpy_5fwdpy_FreqSampler, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy_FreqSampler, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__ *__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct____iter__[8];
static int __pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct____iter__ = 0;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__)))) {
    o = (PyObject*)__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct____iter__[--__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct____iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct____iter__(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_x);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__)))) {
    __pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct____iter__[__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct____iter__++] = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_x) {
    e = (*v)(((PyObject*)p->__pyx_v_x), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct____iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_x);
  p->__pyx_v_x = ((struct __pyx_obj_5fwdpy_5fwdpy_Spop *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct____iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.__pyx_scope_struct____iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct____iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct____iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct____iter__, /*tp_traverse*/
  __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct____iter__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct____iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ *__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__[8];
static int __pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ = 0;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__)))) {
    o = (PyObject*)__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__[--__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_pi);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__)))) {
    __pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__[__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__++] = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ *)o;
  if (p->__pyx_v_pi) {
    e = (*v)(((PyObject*)p->__pyx_v_pi), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_pi);
  p->__pyx_v_pi = ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.__pyx_scope_struct_1___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__, /*tp_traverse*/
  __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ *__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__[8];
static int __pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ = 0;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__)))) {
    o = (PyObject*)__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__[--__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_pi);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__)))) {
    __pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__[__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__++] = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ *)o;
  if (p->__pyx_v_pi) {
    e = (*v)(((PyObject*)p->__pyx_v_pi), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_pi);
  p->__pyx_v_pi = ((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.__pyx_scope_struct_2___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__, /*tp_traverse*/
  __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ *__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__[8];
static int __pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ = 0;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__)))) {
    o = (PyObject*)__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__[--__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_pi);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__)))) {
    __pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__[__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__++] = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ *)o;
  if (p->__pyx_v_pi) {
    e = (*v)(((PyObject*)p->__pyx_v_pi), a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_pi);
  p->__pyx_v_pi = ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.__pyx_scope_struct_3___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__, /*tp_traverse*/
  __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ *__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__[8];
static int __pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ = 0;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__)))) {
    o = (PyObject*)__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__[--__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__)))) {
    __pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__[__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__++] = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5fwdpy_5fwdpy_QtraitStatsSampler *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.__pyx_scope_struct_4___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__, /*tp_traverse*/
  __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ *__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__[8];
static int __pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ = 0;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__)))) {
    o = (PyObject*)__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__[--__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__)))) {
    __pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__[__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__++] = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5fwdpy_5fwdpy_PopSampler *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.__pyx_scope_struct_5___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__, /*tp_traverse*/
  __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ *__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__[8];
static int __pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ = 0;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__)))) {
    o = (PyObject*)__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__[--__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__)))) {
    __pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__[__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__++] = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5fwdpy_5fwdpy_VASampler *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.__pyx_scope_struct_6___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__, /*tp_traverse*/
  __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ *__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__[8];
static int __pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ = 0;

static PyObject *__pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__)))) {
    o = (PyObject*)__pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__[--__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__(PyObject *o) {
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__)))) {
    __pyx_freelist_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__[__pyx_freecount_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__++] = ((struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5fwdpy_5fwdpy_FreqSampler *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.__pyx_scope_struct_7___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__, /*tp_traverse*/
  __pyx_tp_clear_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_array __pyx_vtable_array;

static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_array_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_array_obj *)o);
  p->__pyx_vtab = __pyx_vtabptr_array;
  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_array(PyObject *o) {
  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_array___dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->mode);
  Py_CLEAR(p->_format);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_array___setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
  PyObject *v = PyObject_GenericGetAttr(o, n);
  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
    PyErr_Clear();
    v = __pyx_array___getattr__(o, n);
  }
  return v;
}

static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
}

static PyMethodDef __pyx_methods_array[] = {
  {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_array[] = {
  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_array = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_array, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_array = {
  0, /*mp_length*/
  __pyx_array___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_array = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  __pyx_array_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_array = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.array", /*tp_name*/
  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_array, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  __pyx_tp_getattro_array, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_array, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_array, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_array, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_MemviewEnum_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_MemviewEnum_obj *)o);
  p->name = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_Enum(PyObject *o) {
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->name);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_Enum(PyObject *o) {
  PyObject* tmp;
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  tmp = ((PyObject*)p->name);
  p->name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

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

static PyTypeObject __pyx_type___pyx_MemviewEnum = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.Enum", /*tp_name*/
  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_MemviewEnum___repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_Enum, /*tp_traverse*/
  __pyx_tp_clear_Enum, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_Enum, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_MemviewEnum___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_Enum, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;

static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_memoryview_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_memoryview_obj *)o);
  p->__pyx_vtab = __pyx_vtabptr_memoryview;
  p->obj = Py_None; Py_INCREF(Py_None);
  p->_size = Py_None; Py_INCREF(Py_None);
  p->_array_interface = Py_None; Py_INCREF(Py_None);
  p->view.obj = NULL;
  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_memoryview(PyObject *o) {
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_memoryview___dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->obj);
  Py_CLEAR(p->_size);
  Py_CLEAR(p->_array_interface);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  if (p->obj) {
    e = (*v)(p->obj, a); if (e) return e;
  }
  if (p->_size) {
    e = (*v)(p->_size, a); if (e) return e;
  }
  if (p->_array_interface) {
    e = (*v)(p->_array_interface, a); if (e) return e;
  }
  if (p->view.obj) {
    e = (*v)(p->view.obj, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_memoryview(PyObject *o) {
  PyObject* tmp;
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  tmp = ((PyObject*)p->obj);
  p->obj = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_size);
  p->_size = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_array_interface);
  p->_array_interface = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  Py_CLEAR(p->view.obj);
  return 0;
}
static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_memoryview___setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
}

static PyMethodDef __pyx_methods_memoryview[] = {
  {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
  {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
  {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
  {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_memoryview[] = {
  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
  __pyx_memoryview___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_memoryview, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
  __pyx_memoryview___len__, /*mp_length*/
  __pyx_memoryview___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_memoryview = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy.memoryview", /*tp_name*/
  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_memoryview___repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_memoryview___str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_memoryview, /*tp_traverse*/
  __pyx_tp_clear_memoryview, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_memoryview, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_memoryview, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_memoryview, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;

static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_memoryviewslice_obj *p;
  PyObject *o = __pyx_tp_new_memoryview(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_memoryviewslice_obj *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
  p->from_object = Py_None; Py_INCREF(Py_None);
  p->from_slice.memview = NULL;
  return o;
}

static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_memoryviewslice___dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->from_object);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_memoryview(o);
}

static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
  if (p->from_object) {
    e = (*v)(p->from_object, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
  PyObject* tmp;
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  __pyx_tp_clear_memoryview(o);
  tmp = ((PyObject*)p->from_object);
  p->from_object = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
  return 0;
}

static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
}

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

static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type___pyx_memoryviewslice = {
  PyVarObject_HEAD_INIT(0, 0)
  "fwdpy.fwdpy._memoryviewslice", /*tp_name*/
  sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_memoryview___repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_memoryview___str__, /*tp_str*/
  #else
  0, /*tp_str*/
  #endif
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Internal class for passing memoryview slices to Python", /*tp_doc*/
  __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
  __pyx_tp_clear__memoryviewslice, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods__memoryviewslice, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets__memoryviewslice, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new__memoryviewslice, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

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

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

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_kp_s_9f, __pyx_k_9f, sizeof(__pyx_k_9f), 0, 0, 1, 0},
  {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
  {&__pyx_kp_u_Add_a_mutation_to_a_population, __pyx_k_Add_a_mutation_to_a_population, sizeof(__pyx_k_Add_a_mutation_to_a_population), 0, 1, 0, 0},
  {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
  {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
  {&__pyx_n_s_ConstantS, __pyx_k_ConstantS, sizeof(__pyx_k_ConstantS), 0, 0, 1, 1},
  {&__pyx_n_s_ConstantS___init, __pyx_k_ConstantS___init, sizeof(__pyx_k_ConstantS___init), 0, 0, 1, 1},
  {&__pyx_kp_u_ConstantS___init___line_189, __pyx_k_ConstantS___init___line_189, sizeof(__pyx_k_ConstantS___init___line_189), 0, 1, 0, 0},
  {&__pyx_n_s_ConstantS___str, __pyx_k_ConstantS___str, sizeof(__pyx_k_ConstantS___str), 0, 0, 1, 1},
  {&__pyx_kp_s_Constant_fixed_selection_coeffi, __pyx_k_Constant_fixed_selection_coeffi, sizeof(__pyx_k_Constant_fixed_selection_coeffi), 0, 0, 1, 0},
  {&__pyx_kp_s_Constant_s_DFE_s, __pyx_k_Constant_s_DFE_s, sizeof(__pyx_k_Constant_s_DFE_s), 0, 0, 1, 0},
  {&__pyx_kp_u_Constructor_param_beg_the_begin, __pyx_k_Constructor_param_beg_the_begin, sizeof(__pyx_k_Constructor_param_beg_the_begin), 0, 1, 0, 0},
  {&__pyx_kp_u_Constructor_param_beg_the_begin_2, __pyx_k_Constructor_param_beg_the_begin_2, sizeof(__pyx_k_Constructor_param_beg_the_begin_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Constructor_param_beg_the_begin_3, __pyx_k_Constructor_param_beg_the_begin_3, sizeof(__pyx_k_Constructor_param_beg_the_begin_3), 0, 1, 0, 0},
  {&__pyx_kp_u_Constructor_param_beg_the_begin_4, __pyx_k_Constructor_param_beg_the_begin_4, sizeof(__pyx_k_Constructor_param_beg_the_begin_4), 0, 1, 0, 0},
  {&__pyx_kp_u_Constructor_param_beg_the_begin_5, __pyx_k_Constructor_param_beg_the_begin_5, sizeof(__pyx_k_Constructor_param_beg_the_begin_5), 0, 1, 0, 0},
  {&__pyx_kp_u_Constructor_param_beg_the_begin_6, __pyx_k_Constructor_param_beg_the_begin_6, sizeof(__pyx_k_Constructor_param_beg_the_begin_6), 0, 1, 0, 0},
  {&__pyx_kp_u_Constructor_param_beg_the_begin_7, __pyx_k_Constructor_param_beg_the_begin_7, sizeof(__pyx_k_Constructor_param_beg_the_begin_7), 0, 1, 0, 0},
  {&__pyx_kp_u_Continue_to_evolve_a_region_wit, __pyx_k_Continue_to_evolve_a_region_wit, sizeof(__pyx_k_Continue_to_evolve_a_region_wit), 0, 1, 0, 0},
  {&__pyx_kp_u_Convenience_wrapper_around_func, __pyx_k_Convenience_wrapper_around_func, sizeof(__pyx_k_Convenience_wrapper_around_func), 0, 1, 0, 0},
  {&__pyx_kp_u_Convenience_wrapper_around_func_2, __pyx_k_Convenience_wrapper_around_func_2, sizeof(__pyx_k_Convenience_wrapper_around_func_2), 0, 1, 0, 0},
  {&__pyx_n_s_DataFrame, __pyx_k_DataFrame, sizeof(__pyx_k_DataFrame), 0, 0, 1, 1},
  {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
  {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
  {&__pyx_kp_u_Evolve_a_region_with_variable_m, __pyx_k_Evolve_a_region_with_variable_m, sizeof(__pyx_k_Evolve_a_region_with_variable_m), 0, 1, 0, 0},
  {&__pyx_n_s_ExpS, __pyx_k_ExpS, sizeof(__pyx_k_ExpS), 0, 0, 1, 1},
  {&__pyx_n_s_ExpS___init, __pyx_k_ExpS___init, sizeof(__pyx_k_ExpS___init), 0, 0, 1, 1},
  {&__pyx_kp_u_ExpS___init___line_286, __pyx_k_ExpS___init___line_286, sizeof(__pyx_k_ExpS___init___line_286), 0, 1, 0, 0},
  {&__pyx_n_s_ExpS___str, __pyx_k_ExpS___str, sizeof(__pyx_k_ExpS___str), 0, 0, 1, 1},
  {&__pyx_kp_s_Expecting_PopType, __pyx_k_Expecting_PopType, sizeof(__pyx_k_Expecting_PopType), 0, 0, 1, 0},
  {&__pyx_kp_s_Expecting_PopVec, __pyx_k_Expecting_PopVec, sizeof(__pyx_k_Expecting_PopVec), 0, 0, 1, 0},
  {&__pyx_kp_s_Exponential_DFE_mean, __pyx_k_Exponential_DFE_mean, sizeof(__pyx_k_Exponential_DFE_mean), 0, 0, 1, 0},
  {&__pyx_kp_s_Exponential_distribution_on_sel, __pyx_k_Exponential_distribution_on_sel, sizeof(__pyx_k_Exponential_distribution_on_sel), 0, 0, 1, 0},
  {&__pyx_n_s_FreqSampler___iter, __pyx_k_FreqSampler___iter, sizeof(__pyx_k_FreqSampler___iter), 0, 0, 1, 1},
  {&__pyx_n_s_GammaS, __pyx_k_GammaS, sizeof(__pyx_k_GammaS), 0, 0, 1, 1},
  {&__pyx_n_s_GammaS___init, __pyx_k_GammaS___init, sizeof(__pyx_k_GammaS___init), 0, 0, 1, 1},
  {&__pyx_kp_u_GammaS___init___line_139, __pyx_k_GammaS___init___line_139, sizeof(__pyx_k_GammaS___init___line_139), 0, 1, 0, 0},
  {&__pyx_n_s_GammaS___str, __pyx_k_GammaS___str, sizeof(__pyx_k_GammaS___str), 0, 0, 1, 1},
  {&__pyx_kp_s_Gamma_DFE_mean, __pyx_k_Gamma_DFE_mean, sizeof(__pyx_k_Gamma_DFE_mean), 0, 0, 1, 0},
  {&__pyx_kp_s_Gamma_distribution_of_fitness_e, __pyx_k_Gamma_distribution_of_fitness_e, sizeof(__pyx_k_Gamma_distribution_of_fitness_e), 0, 0, 1, 0},
  {&__pyx_n_s_GaussianS, __pyx_k_GaussianS, sizeof(__pyx_k_GaussianS), 0, 0, 1, 1},
  {&__pyx_n_s_GaussianS___init, __pyx_k_GaussianS___init, sizeof(__pyx_k_GaussianS___init), 0, 0, 1, 1},
  {&__pyx_kp_u_GaussianS___init___line_333, __pyx_k_GaussianS___init___line_333, sizeof(__pyx_k_GaussianS___init___line_333), 0, 1, 0, 0},
  {&__pyx_n_s_GaussianS___str, __pyx_k_GaussianS___str, sizeof(__pyx_k_GaussianS___str), 0, 0, 1, 1},
  {&__pyx_kp_s_Gaussian_DFE_s_d, __pyx_k_Gaussian_DFE_s_d, sizeof(__pyx_k_Gaussian_DFE_s_d), 0, 0, 1, 0},
  {&__pyx_kp_s_Gaussian_distribution_on_select, __pyx_k_Gaussian_distribution_on_select, sizeof(__pyx_k_Gaussian_distribution_on_select), 0, 0, 1, 0},
  {&__pyx_kp_u_Get_additional_details_for_popu, __pyx_k_Get_additional_details_for_popu, sizeof(__pyx_k_Get_additional_details_for_popu), 0, 1, 0, 0},
  {&__pyx_kp_u_Get_detailed_list_of_a_set_of_d, __pyx_k_Get_detailed_list_of_a_set_of_d, sizeof(__pyx_k_Get_detailed_list_of_a_set_of_d), 0, 1, 0, 0},
  {&__pyx_kp_u_Get_detailed_list_of_all_gamete, __pyx_k_Get_detailed_list_of_all_gamete, sizeof(__pyx_k_Get_detailed_list_of_all_gamete), 0, 1, 0, 0},
  {&__pyx_kp_u_Get_detailed_list_of_all_mutati, __pyx_k_Get_detailed_list_of_all_mutati, sizeof(__pyx_k_Get_detailed_list_of_all_mutati), 0, 1, 0, 0},
  {&__pyx_kp_u_Get_mutation_frequencies_param, __pyx_k_Get_mutation_frequencies_param, sizeof(__pyx_k_Get_mutation_frequencies_param), 0, 1, 0, 0},
  {&__pyx_kp_u_Get_the_number_of_derived_mutat, __pyx_k_Get_the_number_of_derived_mutat, sizeof(__pyx_k_Get_the_number_of_derived_mutat), 0, 1, 0, 0},
  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
  {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
  {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
  {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
  {&__pyx_n_s_MetaPopVec___iter, __pyx_k_MetaPopVec___iter, sizeof(__pyx_k_MetaPopVec___iter), 0, 0, 1, 1},
  {&__pyx_kp_s_MetaPopVec_deme_size_0_encounter, __pyx_k_MetaPopVec_deme_size_0_encounter, sizeof(__pyx_k_MetaPopVec_deme_size_0_encounter), 0, 0, 1, 0},
  {&__pyx_n_s_MlocusPopVec___iter, __pyx_k_MlocusPopVec___iter, sizeof(__pyx_k_MlocusPopVec___iter), 0, 0, 1, 1},
  {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
  {&__pyx_kp_s_Neutral_regions_must_be_defined, __pyx_k_Neutral_regions_must_be_defined, sizeof(__pyx_k_Neutral_regions_must_be_defined), 0, 0, 1, 0},
  {&__pyx_kp_s_No_value_specified_for_struct_at, __pyx_k_No_value_specified_for_struct_at, sizeof(__pyx_k_No_value_specified_for_struct_at), 0, 0, 1, 0},
  {&__pyx_kp_s_No_value_specified_for_struct_at_2, __pyx_k_No_value_specified_for_struct_at_2, sizeof(__pyx_k_No_value_specified_for_struct_at_2), 0, 0, 1, 0},
  {&__pyx_kp_s_No_value_specified_for_struct_at_3, __pyx_k_No_value_specified_for_struct_at_3, sizeof(__pyx_k_No_value_specified_for_struct_at_3), 0, 0, 1, 0},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_kp_s_Not_implemented_for_this_type, __pyx_k_Not_implemented_for_this_type, sizeof(__pyx_k_Not_implemented_for_this_type), 0, 0, 1, 0},
  {&__pyx_n_s_Ns, __pyx_k_Ns, sizeof(__pyx_k_Ns), 0, 0, 1, 1},
  {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
  {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
  {&__pyx_n_s_PopSampler___iter, __pyx_k_PopSampler___iter, sizeof(__pyx_k_PopSampler___iter), 0, 0, 1, 1},
  {&__pyx_kp_s_PopType_not_supported, __pyx_k_PopType_not_supported, sizeof(__pyx_k_PopType_not_supported), 0, 0, 1, 0},
  {&__pyx_kp_s_PopVec_PopType_type_not_supporte, __pyx_k_PopVec_PopType_type_not_supporte, sizeof(__pyx_k_PopVec_PopType_type_not_supporte), 0, 0, 1, 0},
  {&__pyx_n_s_QtraitStatsSampler___iter, __pyx_k_QtraitStatsSampler___iter, sizeof(__pyx_k_QtraitStatsSampler___iter), 0, 0, 1, 1},
  {&__pyx_kp_s_Recombination_regions_must_be_de, __pyx_k_Recombination_regions_must_be_de, sizeof(__pyx_k_Recombination_regions_must_be_de), 0, 0, 1, 0},
  {&__pyx_n_s_Region, __pyx_k_Region, sizeof(__pyx_k_Region), 0, 0, 1, 1},
  {&__pyx_n_s_Region___init, __pyx_k_Region___init, sizeof(__pyx_k_Region___init), 0, 0, 1, 1},
  {&__pyx_kp_u_Region___init___line_18, __pyx_k_Region___init___line_18, sizeof(__pyx_k_Region___init___line_18), 0, 1, 0, 0},
  {&__pyx_n_s_Region___str, __pyx_k_Region___str, sizeof(__pyx_k_Region___str), 0, 0, 1, 1},
  {&__pyx_kp_u_Remove_low_frequency_variants_f, __pyx_k_Remove_low_frequency_variants_f, sizeof(__pyx_k_Remove_low_frequency_variants_f), 0, 1, 0, 0},
  {&__pyx_kp_s_Representation_of_a_region_in_a, __pyx_k_Representation_of_a_region_in_a, sizeof(__pyx_k_Representation_of_a_region_in_a), 0, 0, 1, 0},
  {&__pyx_kp_s_Representation_of_a_region_in_a_2, __pyx_k_Representation_of_a_region_in_a_2, sizeof(__pyx_k_Representation_of_a_region_in_a_2), 0, 0, 1, 0},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_kp_s_Selected_regions_must_be_defined, __pyx_k_Selected_regions_must_be_defined, sizeof(__pyx_k_Selected_regions_must_be_defined), 0, 0, 1, 0},
  {&__pyx_n_s_SpopGenMutVec___iter, __pyx_k_SpopGenMutVec___iter, sizeof(__pyx_k_SpopGenMutVec___iter), 0, 0, 1, 1},
  {&__pyx_n_s_SpopVec___iter, __pyx_k_SpopVec___iter, sizeof(__pyx_k_SpopVec___iter), 0, 0, 1, 1},
  {&__pyx_n_s_Sregion, __pyx_k_Sregion, sizeof(__pyx_k_Sregion), 0, 0, 1, 1},
  {&__pyx_n_s_Sregion___init, __pyx_k_Sregion___init, sizeof(__pyx_k_Sregion___init), 0, 0, 1, 1},
  {&__pyx_kp_u_Sregion___init___line_91, __pyx_k_Sregion___init___line_91, sizeof(__pyx_k_Sregion___init___line_91), 0, 1, 0, 0},
  {&__pyx_n_s_Sregion___str, __pyx_k_Sregion___str, sizeof(__pyx_k_Sregion___str), 0, 0, 1, 1},
  {&__pyx_kp_u_Take_a_sample_from_a_set_of_sim, __pyx_k_Take_a_sample_from_a_set_of_sim, sizeof(__pyx_k_Take_a_sample_from_a_set_of_sim), 0, 1, 0, 0},
  {&__pyx_kp_u_Take_a_sample_from_a_set_of_sim_2, __pyx_k_Take_a_sample_from_a_set_of_sim_2, sizeof(__pyx_k_Take_a_sample_from_a_set_of_sim_2), 0, 1, 0, 0},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
  {&__pyx_n_s_UniformS, __pyx_k_UniformS, sizeof(__pyx_k_UniformS), 0, 0, 1, 1},
  {&__pyx_n_s_UniformS___init, __pyx_k_UniformS___init, sizeof(__pyx_k_UniformS___init), 0, 0, 1, 1},
  {&__pyx_kp_u_UniformS___init___line_235, __pyx_k_UniformS___init___line_235, sizeof(__pyx_k_UniformS___init___line_235), 0, 1, 0, 0},
  {&__pyx_n_s_UniformS___str, __pyx_k_UniformS___str, sizeof(__pyx_k_UniformS___str), 0, 0, 1, 1},
  {&__pyx_kp_s_Uniform_distribution_on_selecti, __pyx_k_Uniform_distribution_on_selecti, sizeof(__pyx_k_Uniform_distribution_on_selecti), 0, 0, 1, 0},
  {&__pyx_kp_s_Uniform_s_DFE_lo, __pyx_k_Uniform_s_DFE_lo, sizeof(__pyx_k_Uniform_s_DFE_lo), 0, 0, 1, 0},
  {&__pyx_n_s_VASampler___iter, __pyx_k_VASampler___iter, sizeof(__pyx_k_VASampler___iter), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_kp_s__26, __pyx_k__26, sizeof(__pyx_k__26), 0, 0, 1, 0},
  {&__pyx_kp_b__74, __pyx_k__74, sizeof(__pyx_k__74), 0, 0, 0, 0},
  {&__pyx_n_s_add_mutation, __pyx_k_add_mutation, sizeof(__pyx_k_add_mutation), 0, 0, 1, 1},
  {&__pyx_kp_u_add_mutation_line_3, __pyx_k_add_mutation_line_3, sizeof(__pyx_k_add_mutation_line_3), 0, 1, 0, 0},
  {&__pyx_n_b_additive, __pyx_k_additive, sizeof(__pyx_k_additive), 0, 0, 0, 1},
  {&__pyx_n_s_allele_ages, __pyx_k_allele_ages, sizeof(__pyx_k_allele_ages), 0, 0, 1, 1},
  {&__pyx_n_s_allgams, __pyx_k_allgams, sizeof(__pyx_k_allgams), 0, 0, 1, 1},
  {&__pyx_n_s_allmuts, __pyx_k_allmuts, sizeof(__pyx_k_allmuts), 0, 0, 1, 1},
  {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
  {&__pyx_n_s_ancestral, __pyx_k_ancestral, sizeof(__pyx_k_ancestral), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_append_details, __pyx_k_append_details, sizeof(__pyx_k_append_details), 0, 0, 1, 1},
  {&__pyx_n_s_apply_sampler, __pyx_k_apply_sampler, sizeof(__pyx_k_apply_sampler), 0, 0, 1, 1},
  {&__pyx_n_s_apply_sampler_single, __pyx_k_apply_sampler_single, sizeof(__pyx_k_apply_sampler_single), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
  {&__pyx_n_s_beg, __pyx_k_beg, sizeof(__pyx_k_beg), 0, 0, 1, 1},
  {&__pyx_kp_s_beg_2, __pyx_k_beg_2, sizeof(__pyx_k_beg_2), 0, 0, 1, 0},
  {&__pyx_n_s_boundaries, __pyx_k_boundaries, sizeof(__pyx_k_boundaries), 0, 0, 1, 1},
  {&__pyx_n_s_bstr, __pyx_k_bstr, sizeof(__pyx_k_bstr), 0, 0, 1, 1},
  {&__pyx_kp_s_but_deme, __pyx_k_but_deme, sizeof(__pyx_k_but_deme), 0, 0, 1, 0},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
  {&__pyx_n_s_check_input_params, __pyx_k_check_input_params, sizeof(__pyx_k_check_input_params), 0, 0, 1, 1},
  {&__pyx_n_s_check_popdata, __pyx_k_check_popdata, sizeof(__pyx_k_check_popdata), 0, 0, 1, 1},
  {&__pyx_n_s_check_popdata_metapop, __pyx_k_check_popdata_metapop, sizeof(__pyx_k_check_popdata_metapop), 0, 0, 1, 1},
  {&__pyx_n_s_check_popdata_mpopvec, __pyx_k_check_popdata_mpopvec, sizeof(__pyx_k_check_popdata_mpopvec), 0, 0, 1, 1},
  {&__pyx_n_s_check_popdata_popvec, __pyx_k_check_popdata_popvec, sizeof(__pyx_k_check_popdata_popvec), 0, 0, 1, 1},
  {&__pyx_n_s_check_popdata_singlepop, __pyx_k_check_popdata_singlepop, sizeof(__pyx_k_check_popdata_singlepop), 0, 0, 1, 1},
  {&__pyx_n_s_check_sum, __pyx_k_check_sum, sizeof(__pyx_k_check_sum), 0, 0, 1, 1},
  {&__pyx_n_s_chrom, __pyx_k_chrom, sizeof(__pyx_k_chrom), 0, 0, 1, 1},
  {&__pyx_n_s_chrom0, __pyx_k_chrom0, sizeof(__pyx_k_chrom0), 0, 0, 1, 1},
  {&__pyx_n_s_chrom1, __pyx_k_chrom1, sizeof(__pyx_k_chrom1), 0, 0, 1, 1},
  {&__pyx_n_s_cite, __pyx_k_cite, sizeof(__pyx_k_cite), 0, 0, 1, 1},
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  {&__pyx_n_s_clist, __pyx_k_clist, sizeof(__pyx_k_clist), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_concat, __pyx_k_concat, sizeof(__pyx_k_concat), 0, 0, 1, 1},
  {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
  {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
  {&__pyx_n_s_copypop, __pyx_k_copypop, sizeof(__pyx_k_copypop), 0, 0, 1, 1},
  {&__pyx_n_s_copypops, __pyx_k_copypops, sizeof(__pyx_k_copypops), 0, 0, 1, 1},
  {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1},
  {&__pyx_n_s_coupled, __pyx_k_coupled, sizeof(__pyx_k_coupled), 0, 0, 1, 1},
  {&__pyx_n_s_csum, __pyx_k_csum, sizeof(__pyx_k_csum), 0, 0, 1, 1},
  {&__pyx_n_s_dcount, __pyx_k_dcount, sizeof(__pyx_k_dcount), 0, 0, 1, 1},
  {&__pyx_n_s_deme, __pyx_k_deme, sizeof(__pyx_k_deme), 0, 0, 1, 1},
  {&__pyx_kp_s_deme_cannot_be_None, __pyx_k_deme_cannot_be_None, sizeof(__pyx_k_deme_cannot_be_None), 0, 0, 1, 0},
  {&__pyx_kp_s_deme_may_not_be_set_to_None_when, __pyx_k_deme_may_not_be_set_to_None_when, sizeof(__pyx_k_deme_may_not_be_set_to_None_when), 0, 0, 1, 0},
  {&__pyx_kp_s_deme_value_out_of_range, __pyx_k_deme_value_out_of_range, sizeof(__pyx_k_deme_value_out_of_range), 0, 0, 1, 0},
  {&__pyx_n_s_derived, __pyx_k_derived, sizeof(__pyx_k_derived), 0, 0, 1, 1},
  {&__pyx_n_s_deserialize_metapops, __pyx_k_deserialize_metapops, sizeof(__pyx_k_deserialize_metapops), 0, 0, 1, 1},
  {&__pyx_n_s_deserialize_singlepops, __pyx_k_deserialize_singlepops, sizeof(__pyx_k_deserialize_singlepops), 0, 0, 1, 1},
  {&__pyx_n_s_dfreq, __pyx_k_dfreq, sizeof(__pyx_k_dfreq), 0, 0, 1, 1},
  {&__pyx_n_s_dip, __pyx_k_dip, sizeof(__pyx_k_dip), 0, 0, 1, 1},
  {&__pyx_n_s_diploid_mloc_view_to_sample, __pyx_k_diploid_mloc_view_to_sample, sizeof(__pyx_k_diploid_mloc_view_to_sample), 0, 0, 1, 1},
  {&__pyx_kp_s_diploid_mloc_view_to_sample_fill, __pyx_k_diploid_mloc_view_to_sample_fill, sizeof(__pyx_k_diploid_mloc_view_to_sample_fill), 0, 0, 1, 0},
  {&__pyx_n_s_diploid_traits, __pyx_k_diploid_traits, sizeof(__pyx_k_diploid_traits), 0, 0, 1, 1},
  {&__pyx_n_s_diploid_view_to_sample, __pyx_k_diploid_view_to_sample, sizeof(__pyx_k_diploid_view_to_sample), 0, 0, 1, 1},
  {&__pyx_kp_s_diploid_view_to_sample_fill_cont, __pyx_k_diploid_view_to_sample_fill_cont, sizeof(__pyx_k_diploid_view_to_sample_fill_cont), 0, 0, 1, 0},
  {&__pyx_kp_s_diploid_view_to_sample_fill_cont_2, __pyx_k_diploid_view_to_sample_fill_cont_2, sizeof(__pyx_k_diploid_view_to_sample_fill_cont_2), 0, 0, 1, 0},
  {&__pyx_kp_s_diploid_view_to_sample_fill_cont_3, __pyx_k_diploid_view_to_sample_fill_cont_3, sizeof(__pyx_k_diploid_view_to_sample_fill_cont_3), 0, 0, 1, 0},
  {&__pyx_kp_s_diploid_view_unequal_container_s, __pyx_k_diploid_view_unequal_container_s, sizeof(__pyx_k_diploid_view_unequal_container_s), 0, 0, 1, 0},
  {&__pyx_kp_s_diploid_view_unequal_container_s_2, __pyx_k_diploid_view_unequal_container_s_2, sizeof(__pyx_k_diploid_view_unequal_container_s_2), 0, 0, 1, 0},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_donothing, __pyx_k_donothing, sizeof(__pyx_k_donothing), 0, 0, 1, 1},
  {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
  {&__pyx_n_s_dummy, __pyx_k_dummy, sizeof(__pyx_k_dummy), 0, 0, 1, 1},
  {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  {&__pyx_kp_s_end_2, __pyx_k_end_2, sizeof(__pyx_k_end_2), 0, 0, 1, 0},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_n_s_esize, __pyx_k_esize, sizeof(__pyx_k_esize), 0, 0, 1, 1},
  {&__pyx_n_s_estr, __pyx_k_estr, sizeof(__pyx_k_estr), 0, 0, 1, 1},
  {&__pyx_n_s_evolve_regions, __pyx_k_evolve_regions, sizeof(__pyx_k_evolve_regions), 0, 0, 1, 1},
  {&__pyx_kp_u_evolve_regions_line_29, __pyx_k_evolve_regions_line_29, sizeof(__pyx_k_evolve_regions_line_29), 0, 1, 0, 0},
  {&__pyx_n_s_evolve_regions_more, __pyx_k_evolve_regions_more, sizeof(__pyx_k_evolve_regions_more), 0, 0, 1, 1},
  {&__pyx_kp_u_evolve_regions_more_line_102, __pyx_k_evolve_regions_more_line_102, sizeof(__pyx_k_evolve_regions_more_line_102), 0, 1, 0, 0},
  {&__pyx_n_s_evolve_regions_sampler, __pyx_k_evolve_regions_sampler, sizeof(__pyx_k_evolve_regions_sampler), 0, 0, 1, 1},
  {&__pyx_n_s_evolve_regions_sampler_fitness, __pyx_k_evolve_regions_sampler_fitness, sizeof(__pyx_k_evolve_regions_sampler_fitness), 0, 0, 1, 1},
  {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
  {&__pyx_kp_s_f_0_will_be_treated_as_0, __pyx_k_f_0_will_be_treated_as_0, sizeof(__pyx_k_f_0_will_be_treated_as_0), 0, 0, 1, 0},
  {&__pyx_n_s_ffa, __pyx_k_ffa, sizeof(__pyx_k_ffa), 0, 0, 1, 1},
  {&__pyx_n_s_ffm, __pyx_k_ffm, sizeof(__pyx_k_ffm), 0, 0, 1, 1},
  {&__pyx_n_s_fitness, __pyx_k_fitness, sizeof(__pyx_k_fitness), 0, 0, 1, 1},
  {&__pyx_n_s_fitness_function, __pyx_k_fitness_function, sizeof(__pyx_k_fitness_function), 0, 0, 1, 1},
  {&__pyx_kp_s_fitness_must_be_either_multiplic, __pyx_k_fitness_must_be_either_multiplic, sizeof(__pyx_k_fitness_must_be_either_multiplic), 0, 0, 1, 0},
  {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
  {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
  {&__pyx_n_s_fpio, __pyx_k_fpio, sizeof(__pyx_k_fpio), 0, 0, 1, 1},
  {&__pyx_n_s_freq, __pyx_k_freq, sizeof(__pyx_k_freq), 0, 0, 1, 1},
  {&__pyx_n_s_freqfilter, __pyx_k_freqfilter, sizeof(__pyx_k_freqfilter), 0, 0, 1, 1},
  {&__pyx_kp_u_freqfilter_line_208, __pyx_k_freqfilter_line_208, sizeof(__pyx_k_freqfilter_line_208), 0, 1, 0, 0},
  {&__pyx_n_s_from_Spop, __pyx_k_from_Spop, sizeof(__pyx_k_from_Spop), 0, 0, 1, 1},
  {&__pyx_n_s_ftime, __pyx_k_ftime, sizeof(__pyx_k_ftime), 0, 0, 1, 1},
  {&__pyx_n_s_fwdpy, __pyx_k_fwdpy, sizeof(__pyx_k_fwdpy), 0, 0, 1, 1},
  {&__pyx_kp_s_fwdpy_ConstantS_s_not_a_number, __pyx_k_fwdpy_ConstantS_s_not_a_number, sizeof(__pyx_k_fwdpy_ConstantS_s_not_a_number), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_ConstantS_s_not_finite, __pyx_k_fwdpy_ConstantS_s_not_finite, sizeof(__pyx_k_fwdpy_ConstantS_s_not_finite), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_ExpS_mean_not_a_number, __pyx_k_fwdpy_ExpS_mean_not_a_number, sizeof(__pyx_k_fwdpy_ExpS_mean_not_a_number), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_ExpS_mean_not_finite, __pyx_k_fwdpy_ExpS_mean_not_finite, sizeof(__pyx_k_fwdpy_ExpS_mean_not_finite), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_GammaS_mean_not_a_number, __pyx_k_fwdpy_GammaS_mean_not_a_number, sizeof(__pyx_k_fwdpy_GammaS_mean_not_a_number), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_GammaS_mean_not_finite, __pyx_k_fwdpy_GammaS_mean_not_finite, sizeof(__pyx_k_fwdpy_GammaS_mean_not_finite), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_GammaS_shape_not_a_number, __pyx_k_fwdpy_GammaS_shape_not_a_number, sizeof(__pyx_k_fwdpy_GammaS_shape_not_a_number), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_GammaS_shape_not_finite, __pyx_k_fwdpy_GammaS_shape_not_finite, sizeof(__pyx_k_fwdpy_GammaS_shape_not_finite), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_GaussianS_sd_not_a_number, __pyx_k_fwdpy_GaussianS_sd_not_a_number, sizeof(__pyx_k_fwdpy_GaussianS_sd_not_a_number), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_GaussianS_sd_not_finite, __pyx_k_fwdpy_GaussianS_sd_not_finite, sizeof(__pyx_k_fwdpy_GaussianS_sd_not_finite), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_Region_beg_not_a_number, __pyx_k_fwdpy_Region_beg_not_a_number, sizeof(__pyx_k_fwdpy_Region_beg_not_a_number), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_Region_beg_not_finite, __pyx_k_fwdpy_Region_beg_not_finite, sizeof(__pyx_k_fwdpy_Region_beg_not_finite), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_Region_end_not_a_number, __pyx_k_fwdpy_Region_end_not_a_number, sizeof(__pyx_k_fwdpy_Region_end_not_a_number), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_Region_end_not_finite, __pyx_k_fwdpy_Region_end_not_finite, sizeof(__pyx_k_fwdpy_Region_end_not_finite), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_Region_weight_0_0, __pyx_k_fwdpy_Region_weight_0_0, sizeof(__pyx_k_fwdpy_Region_weight_0_0), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_Region_weight_not_a_number, __pyx_k_fwdpy_Region_weight_not_a_number, sizeof(__pyx_k_fwdpy_Region_weight_not_a_number), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_Region_weight_not_finite, __pyx_k_fwdpy_Region_weight_not_finite, sizeof(__pyx_k_fwdpy_Region_weight_not_finite), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_Segion_h_not_a_number, __pyx_k_fwdpy_Segion_h_not_a_number, sizeof(__pyx_k_fwdpy_Segion_h_not_a_number), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_Sregion_h_not_finite, __pyx_k_fwdpy_Sregion_h_not_finite, sizeof(__pyx_k_fwdpy_Sregion_h_not_finite), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_UniformS_hi_not_a_number, __pyx_k_fwdpy_UniformS_hi_not_a_number, sizeof(__pyx_k_fwdpy_UniformS_hi_not_a_number), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_UniformS_hi_not_finite, __pyx_k_fwdpy_UniformS_hi_not_finite, sizeof(__pyx_k_fwdpy_UniformS_hi_not_finite), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_UniformS_lo_not_a_number, __pyx_k_fwdpy_UniformS_lo_not_a_number, sizeof(__pyx_k_fwdpy_UniformS_lo_not_a_number), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_UniformS_lo_not_finite, __pyx_k_fwdpy_UniformS_lo_not_finite, sizeof(__pyx_k_fwdpy_UniformS_lo_not_finite), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_copypop_PopType, __pyx_k_fwdpy_copypop_PopType, sizeof(__pyx_k_fwdpy_copypop_PopType), 0, 0, 1, 0},
  {&__pyx_kp_s_fwdpy_copypopvec_popvec_type, __pyx_k_fwdpy_copypopvec_popvec_type, sizeof(__pyx_k_fwdpy_copypopvec_popvec_type), 0, 0, 1, 0},
  {&__pyx_n_s_fwdpy_fwdpy, __pyx_k_fwdpy_fwdpy, sizeof(__pyx_k_fwdpy_fwdpy), 0, 0, 1, 1},
  {&__pyx_n_s_fwdpyio, __pyx_k_fwdpyio, sizeof(__pyx_k_fwdpyio), 0, 0, 1, 1},
  {&__pyx_n_s_g, __pyx_k_g, sizeof(__pyx_k_g), 0, 0, 1, 1},
  {&__pyx_n_s_gams, __pyx_k_gams, sizeof(__pyx_k_gams), 0, 0, 1, 1},
  {&__pyx_n_s_gen, __pyx_k_gen, sizeof(__pyx_k_gen), 0, 0, 1, 1},
  {&__pyx_n_s_generation, __pyx_k_generation, sizeof(__pyx_k_generation), 0, 0, 1, 1},
  {&__pyx_n_s_get_sample_details, __pyx_k_get_sample_details, sizeof(__pyx_k_get_sample_details), 0, 0, 1, 1},
  {&__pyx_kp_u_get_sample_details_line_67, __pyx_k_get_sample_details_line_67, sizeof(__pyx_k_get_sample_details_line_67), 0, 1, 0, 0},
  {&__pyx_n_s_get_samples, __pyx_k_get_samples, sizeof(__pyx_k_get_samples), 0, 0, 1, 1},
  {&__pyx_kp_u_get_samples_line_30, __pyx_k_get_samples_line_30, sizeof(__pyx_k_get_samples_line_30), 0, 1, 0, 0},
  {&__pyx_n_s_getfreq, __pyx_k_getfreq, sizeof(__pyx_k_getfreq), 0, 0, 1, 1},
  {&__pyx_kp_u_getfreq_line_159, __pyx_k_getfreq_line_159, sizeof(__pyx_k_getfreq_line_159), 0, 1, 0, 0},
  {&__pyx_n_s_getfreqs, __pyx_k_getfreqs, sizeof(__pyx_k_getfreqs), 0, 0, 1, 1},
  {&__pyx_kp_u_getfreqs_line_187, __pyx_k_getfreqs_line_187, sizeof(__pyx_k_getfreqs_line_187), 0, 1, 0, 0},
  {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
  {&__pyx_kp_b_gz, __pyx_k_gz, sizeof(__pyx_k_gz), 0, 0, 0, 0},
  {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
  {&__pyx_kp_s_h_2, __pyx_k_h_2, sizeof(__pyx_k_h_2), 0, 0, 1, 0},
  {&__pyx_n_s_hi, __pyx_k_hi, sizeof(__pyx_k_hi), 0, 0, 1, 1},
  {&__pyx_kp_s_hi_2, __pyx_k_hi_2, sizeof(__pyx_k_hi_2), 0, 0, 1, 0},
  {&__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_add, __pyx_k_home_kevin_src_fwdpy_fwdpy_add, sizeof(__pyx_k_home_kevin_src_fwdpy_fwdpy_add), 0, 0, 1, 0},
  {&__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_ages, __pyx_k_home_kevin_src_fwdpy_fwdpy_ages, sizeof(__pyx_k_home_kevin_src_fwdpy_fwdpy_ages), 0, 0, 1, 0},
  {&__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_copy, __pyx_k_home_kevin_src_fwdpy_fwdpy_copy, sizeof(__pyx_k_home_kevin_src_fwdpy_fwdpy_copy), 0, 0, 1, 0},
  {&__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_debu, __pyx_k_home_kevin_src_fwdpy_fwdpy_debu, sizeof(__pyx_k_home_kevin_src_fwdpy_fwdpy_debu), 0, 0, 1, 0},
  {&__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_evol, __pyx_k_home_kevin_src_fwdpy_fwdpy_evol, sizeof(__pyx_k_home_kevin_src_fwdpy_fwdpy_evol), 0, 0, 1, 0},
  {&__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_fwdp, __pyx_k_home_kevin_src_fwdpy_fwdpy_fwdp, sizeof(__pyx_k_home_kevin_src_fwdpy_fwdpy_fwdp), 0, 0, 1, 0},
  {&__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_k_home_kevin_src_fwdpy_fwdpy_regi, sizeof(__pyx_k_home_kevin_src_fwdpy_fwdpy_regi), 0, 0, 1, 0},
  {&__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_samp, __pyx_k_home_kevin_src_fwdpy_fwdpy_samp, sizeof(__pyx_k_home_kevin_src_fwdpy_fwdpy_samp), 0, 0, 1, 0},
  {&__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_temp, __pyx_k_home_kevin_src_fwdpy_fwdpy_temp, sizeof(__pyx_k_home_kevin_src_fwdpy_fwdpy_temp), 0, 0, 1, 0},
  {&__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_k_home_kevin_src_fwdpy_fwdpy_view, sizeof(__pyx_k_home_kevin_src_fwdpy_fwdpy_view), 0, 0, 1, 0},
  {&__pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view_2, __pyx_k_home_kevin_src_fwdpy_fwdpy_view_2, sizeof(__pyx_k_home_kevin_src_fwdpy_fwdpy_view_2), 0, 0, 1, 0},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  {&__pyx_n_s_il, __pyx_k_il, sizeof(__pyx_k_il), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_ind, __pyx_k_ind, sizeof(__pyx_k_ind), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_kp_s_index_greater_than_deme_size, __pyx_k_index_greater_than_deme_size, sizeof(__pyx_k_index_greater_than_deme_size), 0, 0, 1, 0},
  {&__pyx_kp_s_index_greater_than_population_si, __pyx_k_index_greater_than_population_si, sizeof(__pyx_k_index_greater_than_population_si), 0, 0, 1, 0},
  {&__pyx_kp_s_index_out_of_range, __pyx_k_index_out_of_range, sizeof(__pyx_k_index_out_of_range), 0, 0, 1, 0},
  {&__pyx_n_s_indlist, __pyx_k_indlist, sizeof(__pyx_k_indlist), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_internal, __pyx_k_internal, sizeof(__pyx_k_internal), 0, 0, 1, 1},
  {&__pyx_kp_s_is_not_supported, __pyx_k_is_not_supported, sizeof(__pyx_k_is_not_supported), 0, 0, 1, 0},
  {&__pyx_n_s_isinf, __pyx_k_isinf, sizeof(__pyx_k_isinf), 0, 0, 1, 1},
  {&__pyx_n_s_isnan, __pyx_k_isnan, sizeof(__pyx_k_isnan), 0, 0, 1, 1},
  {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
  {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
  {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1},
  {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
  {&__pyx_n_s_label, __pyx_k_label, sizeof(__pyx_k_label), 0, 0, 1, 1},
  {&__pyx_kp_s_label_2, __pyx_k_label_2, sizeof(__pyx_k_label_2), 0, 0, 1, 0},
  {&__pyx_n_s_last_freq, __pyx_k_last_freq, sizeof(__pyx_k_last_freq), 0, 0, 1, 1},
  {&__pyx_n_s_listlen, __pyx_k_listlen, sizeof(__pyx_k_listlen), 0, 0, 1, 1},
  {&__pyx_n_s_lo, __pyx_k_lo, sizeof(__pyx_k_lo), 0, 0, 1, 1},
  {&__pyx_n_s_locus, __pyx_k_locus, sizeof(__pyx_k_locus), 0, 0, 1, 1},
  {&__pyx_n_s_locusBoundaries, __pyx_k_locusBoundaries, sizeof(__pyx_k_locusBoundaries), 0, 0, 1, 1},
  {&__pyx_n_s_locusID, __pyx_k_locusID, sizeof(__pyx_k_locusID), 0, 0, 1, 1},
  {&__pyx_n_s_lpds, __pyx_k_lpds, sizeof(__pyx_k_lpds), 0, 0, 1, 1},
  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_make_region_manager, __pyx_k_make_region_manager, sizeof(__pyx_k_make_region_manager), 0, 0, 1, 1},
  {&__pyx_n_s_map_itr, __pyx_k_map_itr, sizeof(__pyx_k_map_itr), 0, 0, 1, 1},
  {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1},
  {&__pyx_n_s_max_freq, __pyx_k_max_freq, sizeof(__pyx_k_max_freq), 0, 0, 1, 1},
  {&__pyx_n_s_mean, __pyx_k_mean, sizeof(__pyx_k_mean), 0, 0, 1, 1},
  {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
  {&__pyx_n_s_merge_trajectories, __pyx_k_merge_trajectories, sizeof(__pyx_k_merge_trajectories), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_min_freq, __pyx_k_min_freq, sizeof(__pyx_k_min_freq), 0, 0, 1, 1},
  {&__pyx_n_s_min_sojourn, __pyx_k_min_sojourn, sizeof(__pyx_k_min_sojourn), 0, 0, 1, 1},
  {&__pyx_n_s_minfreq, __pyx_k_minfreq, sizeof(__pyx_k_minfreq), 0, 0, 1, 1},
  {&__pyx_n_s_minsojourn, __pyx_k_minsojourn, sizeof(__pyx_k_minsojourn), 0, 0, 1, 1},
  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_ms_sample, __pyx_k_ms_sample, sizeof(__pyx_k_ms_sample), 0, 0, 1, 1},
  {&__pyx_kp_u_ms_sample_line_6, __pyx_k_ms_sample_line_6, sizeof(__pyx_k_ms_sample_line_6), 0, 1, 0, 0},
  {&__pyx_kp_s_ms_sample_unsupported_type_of_po, __pyx_k_ms_sample_unsupported_type_of_po, sizeof(__pyx_k_ms_sample_unsupported_type_of_po), 0, 0, 1, 0},
  {&__pyx_n_s_mu_neutral, __pyx_k_mu_neutral, sizeof(__pyx_k_mu_neutral), 0, 0, 1, 1},
  {&__pyx_n_s_mu_selected, __pyx_k_mu_selected, sizeof(__pyx_k_mu_selected), 0, 0, 1, 1},
  {&__pyx_n_b_multiplicative, __pyx_k_multiplicative, sizeof(__pyx_k_multiplicative), 0, 0, 0, 1},
  {&__pyx_kp_s_mutation_rate_to_neutral_variant, __pyx_k_mutation_rate_to_neutral_variant, sizeof(__pyx_k_mutation_rate_to_neutral_variant), 0, 0, 1, 0},
  {&__pyx_kp_s_mutation_rate_to_selected_varian, __pyx_k_mutation_rate_to_selected_varian, sizeof(__pyx_k_mutation_rate_to_selected_varian), 0, 0, 1, 0},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  {&__pyx_n_s_n0, __pyx_k_n0, sizeof(__pyx_k_n0), 0, 0, 1, 1},
  {&__pyx_n_s_n1, __pyx_k_n1, sizeof(__pyx_k_n1), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_ndemes, __pyx_k_ndemes, sizeof(__pyx_k_ndemes), 0, 0, 1, 1},
  {&__pyx_n_s_nderived, __pyx_k_nderived, sizeof(__pyx_k_nderived), 0, 0, 1, 1},
  {&__pyx_kp_u_nderived_line_142, __pyx_k_nderived_line_142, sizeof(__pyx_k_nderived_line_142), 0, 1, 0, 0},
  {&__pyx_n_s_nderived_site, __pyx_k_nderived_site, sizeof(__pyx_k_nderived_site), 0, 0, 1, 1},
  {&__pyx_kp_u_nderived_site_line_117, __pyx_k_nderived_site_line_117, sizeof(__pyx_k_nderived_site_line_117), 0, 1, 0, 0},
  {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
  {&__pyx_n_s_neutral, __pyx_k_neutral, sizeof(__pyx_k_neutral), 0, 0, 1, 1},
  {&__pyx_n_s_neutral_df, __pyx_k_neutral_df, sizeof(__pyx_k_neutral_df), 0, 0, 1, 1},
  {&__pyx_n_s_neutral_file, __pyx_k_neutral_file, sizeof(__pyx_k_neutral_file), 0, 0, 1, 1},
  {&__pyx_n_s_neutral_info, __pyx_k_neutral_info, sizeof(__pyx_k_neutral_info), 0, 0, 1, 1},
  {&__pyx_n_s_nlist, __pyx_k_nlist, sizeof(__pyx_k_nlist), 0, 0, 1, 1},
  {&__pyx_n_s_nloci, __pyx_k_nloci, sizeof(__pyx_k_nloci), 0, 0, 1, 1},
  {&__pyx_n_s_nmpops, __pyx_k_nmpops, sizeof(__pyx_k_nmpops), 0, 0, 1, 1},
  {&__pyx_kp_s_non_finite_value_encountered_for, __pyx_k_non_finite_value_encountered_for, sizeof(__pyx_k_non_finite_value_encountered_for), 0, 0, 1, 0},
  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  {&__pyx_n_s_npops, __pyx_k_npops, sizeof(__pyx_k_npops), 0, 0, 1, 1},
  {&__pyx_n_s_nregions, __pyx_k_nregions, sizeof(__pyx_k_nregions), 0, 0, 1, 1},
  {&__pyx_n_s_nsam, __pyx_k_nsam, sizeof(__pyx_k_nsam), 0, 0, 1, 1},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__pyx_n_s_o, __pyx_k_o, sizeof(__pyx_k_o), 0, 0, 1, 1},
  {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
  {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
  {&__pyx_kp_s_object_type_not_understood, __pyx_k_object_type_not_understood, sizeof(__pyx_k_object_type_not_understood), 0, 0, 1, 0},
  {&__pyx_n_s_optimum, __pyx_k_optimum, sizeof(__pyx_k_optimum), 0, 0, 1, 1},
  {&__pyx_n_s_origin, __pyx_k_origin, sizeof(__pyx_k_origin), 0, 0, 1, 1},
  {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
  {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
  {&__pyx_n_s_pandas, __pyx_k_pandas, sizeof(__pyx_k_pandas), 0, 0, 1, 1},
  {&__pyx_n_s_pd, __pyx_k_pd, sizeof(__pyx_k_pd), 0, 0, 1, 1},
  {&__pyx_n_s_pds, __pyx_k_pds, sizeof(__pyx_k_pds), 0, 0, 1, 1},
  {&__pyx_n_s_pkg_version, __pyx_k_pkg_version, sizeof(__pyx_k_pkg_version), 0, 0, 1, 1},
  {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
  {&__pyx_n_s_popdata_sane, __pyx_k_popdata_sane, sizeof(__pyx_k_popdata_sane), 0, 0, 1, 1},
  {&__pyx_n_s_pops, __pyx_k_pops, sizeof(__pyx_k_pops), 0, 0, 1, 1},
  {&__pyx_n_s_popsize, __pyx_k_popsize, sizeof(__pyx_k_popsize), 0, 0, 1, 1},
  {&__pyx_n_s_popsizes, __pyx_k_popsizes, sizeof(__pyx_k_popsizes), 0, 0, 1, 1},
  {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_ps, __pyx_k_ps, sizeof(__pyx_k_ps), 0, 0, 1, 1},
  {&__pyx_n_s_psizes, __pyx_k_psizes, sizeof(__pyx_k_psizes), 0, 0, 1, 1},
  {&__pyx_n_s_pss, __pyx_k_pss, sizeof(__pyx_k_pss), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_raf, __pyx_k_raf, sizeof(__pyx_k_raf), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_kp_s_recombination_rate_must_be_0, __pyx_k_recombination_rate_must_be_0, sizeof(__pyx_k_recombination_rate_must_be_0), 0, 0, 1, 0},
  {&__pyx_n_s_recordDetails, __pyx_k_recordDetails, sizeof(__pyx_k_recordDetails), 0, 0, 1, 1},
  {&__pyx_n_s_recordSamples, __pyx_k_recordSamples, sizeof(__pyx_k_recordSamples), 0, 0, 1, 1},
  {&__pyx_n_s_recrate, __pyx_k_recrate, sizeof(__pyx_k_recrate), 0, 0, 1, 1},
  {&__pyx_n_s_recregions, __pyx_k_recregions, sizeof(__pyx_k_recregions), 0, 0, 1, 1},
  {&__pyx_n_s_removeFixed, __pyx_k_removeFixed, sizeof(__pyx_k_removeFixed), 0, 0, 1, 1},
  {&__pyx_n_s_remove_arose_after, __pyx_k_remove_arose_after, sizeof(__pyx_k_remove_arose_after), 0, 0, 1, 1},
  {&__pyx_n_s_remove_gone_before, __pyx_k_remove_gone_before, sizeof(__pyx_k_remove_gone_before), 0, 0, 1, 1},
  {&__pyx_n_s_rgb, __pyx_k_rgb, sizeof(__pyx_k_rgb), 0, 0, 1, 1},
  {&__pyx_n_s_rmgr, __pyx_k_rmgr, sizeof(__pyx_k_rmgr), 0, 0, 1, 1},
  {&__pyx_n_s_rng, __pyx_k_rng, sizeof(__pyx_k_rng), 0, 0, 1, 1},
  {&__pyx_n_s_rv, __pyx_k_rv, sizeof(__pyx_k_rv), 0, 0, 1, 1},
  {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
  {&__pyx_n_s_sample, __pyx_k_sample, sizeof(__pyx_k_sample), 0, 0, 1, 1},
  {&__pyx_kp_s_sample_must_be_0, __pyx_k_sample_must_be_0, sizeof(__pyx_k_sample_must_be_0), 0, 0, 1, 0},
  {&__pyx_n_s_sampler, __pyx_k_sampler, sizeof(__pyx_k_sampler), 0, 0, 1, 1},
  {&__pyx_n_s_sane, __pyx_k_sane, sizeof(__pyx_k_sane), 0, 0, 1, 1},
  {&__pyx_n_s_scaling, __pyx_k_scaling, sizeof(__pyx_k_scaling), 0, 0, 1, 1},
  {&__pyx_n_s_sd, __pyx_k_sd, sizeof(__pyx_k_sd), 0, 0, 1, 1},
  {&__pyx_n_s_seed, __pyx_k_seed, sizeof(__pyx_k_seed), 0, 0, 1, 1},
  {&__pyx_n_s_selected, __pyx_k_selected, sizeof(__pyx_k_selected), 0, 0, 1, 1},
  {&__pyx_n_s_selectedOnly, __pyx_k_selectedOnly, sizeof(__pyx_k_selectedOnly), 0, 0, 1, 1},
  {&__pyx_n_s_selected_df, __pyx_k_selected_df, sizeof(__pyx_k_selected_df), 0, 0, 1, 1},
  {&__pyx_n_s_selected_file, __pyx_k_selected_file, sizeof(__pyx_k_selected_file), 0, 0, 1, 1},
  {&__pyx_n_s_selected_info, __pyx_k_selected_info, sizeof(__pyx_k_selected_info), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_serialize, __pyx_k_serialize, sizeof(__pyx_k_serialize), 0, 0, 1, 1},
  {&__pyx_n_s_set_index, __pyx_k_set_index, sizeof(__pyx_k_set_index), 0, 0, 1, 1},
  {&__pyx_n_s_sh0, __pyx_k_sh0, sizeof(__pyx_k_sh0), 0, 0, 1, 1},
  {&__pyx_n_s_sh1, __pyx_k_sh1, sizeof(__pyx_k_sh1), 0, 0, 1, 1},
  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
  {&__pyx_kp_s_shape_2, __pyx_k_shape_2, sizeof(__pyx_k_shape_2), 0, 0, 1, 0},
  {&__pyx_n_s_site, __pyx_k_site, sizeof(__pyx_k_site), 0, 0, 1, 1},
  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  {&__pyx_n_s_size_2, __pyx_k_size_2, sizeof(__pyx_k_size_2), 0, 0, 1, 1},
  {&__pyx_n_s_slist, __pyx_k_slist, sizeof(__pyx_k_slist), 0, 0, 1, 1},
  {&__pyx_n_s_sregions, __pyx_k_sregions, sizeof(__pyx_k_sregions), 0, 0, 1, 1},
  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  {&__pyx_n_s_stat, __pyx_k_stat, sizeof(__pyx_k_stat), 0, 0, 1, 1},
  {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
  {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
  {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1},
  {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
  {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
  {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
  {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
  {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
  {&__pyx_n_s_temp1, __pyx_k_temp1, sizeof(__pyx_k_temp1), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_kp_s_the_two_input_lists_must_be_the, __pyx_k_the_two_input_lists_must_be_the, sizeof(__pyx_k_the_two_input_lists_must_be_the), 0, 0, 1, 0},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_tidy_trajectories, __pyx_k_tidy_trajectories, sizeof(__pyx_k_tidy_trajectories), 0, 0, 1, 1},
  {&__pyx_n_s_tidy_trajectories_details, __pyx_k_tidy_trajectories_details, sizeof(__pyx_k_tidy_trajectories_details), 0, 0, 1, 1},
  {&__pyx_n_s_tlen, __pyx_k_tlen, sizeof(__pyx_k_tlen), 0, 0, 1, 1},
  {&__pyx_n_s_trajectories, __pyx_k_trajectories, sizeof(__pyx_k_trajectories), 0, 0, 1, 1},
  {&__pyx_n_s_trajectories1, __pyx_k_trajectories1, sizeof(__pyx_k_trajectories1), 0, 0, 1, 1},
  {&__pyx_n_s_trajectories2, __pyx_k_trajectories2, sizeof(__pyx_k_trajectories2), 0, 0, 1, 1},
  {&__pyx_n_s_ttl_nsam, __pyx_k_ttl_nsam, sizeof(__pyx_k_ttl_nsam), 0, 0, 1, 1},
  {&__pyx_n_s_ul, __pyx_k_ul, sizeof(__pyx_k_ul), 0, 0, 1, 1},
  {&__pyx_n_s_umuts, __pyx_k_umuts, sizeof(__pyx_k_umuts), 0, 0, 1, 1},
  {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
  {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
  {&__pyx_n_s_unique_gams, __pyx_k_unique_gams, sizeof(__pyx_k_unique_gams), 0, 0, 1, 1},
  {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
  {&__pyx_kp_s_unsupported_type, __pyx_k_unsupported_type, sizeof(__pyx_k_unsupported_type), 0, 0, 1, 0},
  {&__pyx_kp_s_unupported_PopType, __pyx_k_unupported_PopType, sizeof(__pyx_k_unupported_PopType), 0, 0, 1, 0},
  {&__pyx_kp_s_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 1, 0},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_kp_s_value_for_deme_out_of_range_len, __pyx_k_value_for_deme_out_of_range_len, sizeof(__pyx_k_value_for_deme_out_of_range_len), 0, 0, 1, 0},
  {&__pyx_kp_s_values_is_sample_must_be_tuples, __pyx_k_values_is_sample_must_be_tuples, sizeof(__pyx_k_values_is_sample_must_be_tuples), 0, 0, 1, 0},
  {&__pyx_n_s_view, __pyx_k_view, sizeof(__pyx_k_view), 0, 0, 1, 1},
  {&__pyx_n_s_view_diploids, __pyx_k_view_diploids, sizeof(__pyx_k_view_diploids), 0, 0, 1, 1},
  {&__pyx_kp_s_view_diploids_deme_index_out_of, __pyx_k_view_diploids_deme_index_out_of, sizeof(__pyx_k_view_diploids_deme_index_out_of), 0, 0, 1, 0},
  {&__pyx_kp_s_view_diploids_deme_index_require, __pyx_k_view_diploids_deme_index_require, sizeof(__pyx_k_view_diploids_deme_index_require), 0, 0, 1, 0},
  {&__pyx_kp_u_view_diploids_line_398, __pyx_k_view_diploids_line_398, sizeof(__pyx_k_view_diploids_line_398), 0, 1, 0, 0},
  {&__pyx_n_s_view_diploids_metapop, __pyx_k_view_diploids_metapop, sizeof(__pyx_k_view_diploids_metapop), 0, 0, 1, 1},
  {&__pyx_n_s_view_diploids_pd, __pyx_k_view_diploids_pd, sizeof(__pyx_k_view_diploids_pd), 0, 0, 1, 1},
  {&__pyx_n_s_view_diploids_pd_popvec, __pyx_k_view_diploids_pd_popvec, sizeof(__pyx_k_view_diploids_pd_popvec), 0, 0, 1, 1},
  {&__pyx_n_s_view_diploids_pd_singlepop, __pyx_k_view_diploids_pd_singlepop, sizeof(__pyx_k_view_diploids_pd_singlepop), 0, 0, 1, 1},
  {&__pyx_n_s_view_diploids_popvec, __pyx_k_view_diploids_popvec, sizeof(__pyx_k_view_diploids_popvec), 0, 0, 1, 1},
  {&__pyx_n_s_view_diploids_popvec_mloc, __pyx_k_view_diploids_popvec_mloc, sizeof(__pyx_k_view_diploids_popvec_mloc), 0, 0, 1, 1},
  {&__pyx_n_s_view_diploids_singlepop, __pyx_k_view_diploids_singlepop, sizeof(__pyx_k_view_diploids_singlepop), 0, 0, 1, 1},
  {&__pyx_n_s_view_diploids_singlepop_mloc, __pyx_k_view_diploids_singlepop_mloc, sizeof(__pyx_k_view_diploids_singlepop_mloc), 0, 0, 1, 1},
  {&__pyx_kp_s_view_diploids_unsupported_object, __pyx_k_view_diploids_unsupported_object, sizeof(__pyx_k_view_diploids_unsupported_object), 0, 0, 1, 0},
  {&__pyx_n_s_view_fixations, __pyx_k_view_fixations, sizeof(__pyx_k_view_fixations), 0, 0, 1, 1},
  {&__pyx_n_s_view_fixations_mlocuspopvec, __pyx_k_view_fixations_mlocuspopvec, sizeof(__pyx_k_view_fixations_mlocuspopvec), 0, 0, 1, 1},
  {&__pyx_n_s_view_fixations_popvec, __pyx_k_view_fixations_popvec, sizeof(__pyx_k_view_fixations_popvec), 0, 0, 1, 1},
  {&__pyx_n_s_view_gametes, __pyx_k_view_gametes, sizeof(__pyx_k_view_gametes), 0, 0, 1, 1},
  {&__pyx_kp_s_view_gametes_deme_cannot_be_None, __pyx_k_view_gametes_deme_cannot_be_None, sizeof(__pyx_k_view_gametes_deme_cannot_be_None), 0, 0, 1, 0},
  {&__pyx_kp_s_view_gametes_deme_index_out_of_r, __pyx_k_view_gametes_deme_index_out_of_r, sizeof(__pyx_k_view_gametes_deme_index_out_of_r), 0, 0, 1, 0},
  {&__pyx_kp_u_view_gametes_line_308, __pyx_k_view_gametes_line_308, sizeof(__pyx_k_view_gametes_line_308), 0, 1, 0, 0},
  {&__pyx_n_s_view_gametes_metapop, __pyx_k_view_gametes_metapop, sizeof(__pyx_k_view_gametes_metapop), 0, 0, 1, 1},
  {&__pyx_n_s_view_gametes_popvec, __pyx_k_view_gametes_popvec, sizeof(__pyx_k_view_gametes_popvec), 0, 0, 1, 1},
  {&__pyx_n_s_view_gametes_popvec_mloc, __pyx_k_view_gametes_popvec_mloc, sizeof(__pyx_k_view_gametes_popvec_mloc), 0, 0, 1, 1},
  {&__pyx_n_s_view_gametes_singlepop, __pyx_k_view_gametes_singlepop, sizeof(__pyx_k_view_gametes_singlepop), 0, 0, 1, 1},
  {&__pyx_n_s_view_gametes_singlepop_mloc, __pyx_k_view_gametes_singlepop_mloc, sizeof(__pyx_k_view_gametes_singlepop_mloc), 0, 0, 1, 1},
  {&__pyx_kp_s_view_gametes_unsupported_object, __pyx_k_view_gametes_unsupported_object, sizeof(__pyx_k_view_gametes_unsupported_object), 0, 0, 1, 0},
  {&__pyx_n_s_view_mutations, __pyx_k_view_mutations, sizeof(__pyx_k_view_mutations), 0, 0, 1, 1},
  {&__pyx_kp_s_view_mutations_deme_cannot_be_no, __pyx_k_view_mutations_deme_cannot_be_no, sizeof(__pyx_k_view_mutations_deme_cannot_be_no), 0, 0, 1, 0},
  {&__pyx_kp_s_view_mutations_deme_index_out_of, __pyx_k_view_mutations_deme_index_out_of, sizeof(__pyx_k_view_mutations_deme_index_out_of), 0, 0, 1, 0},
  {&__pyx_kp_u_view_mutations_line_218, __pyx_k_view_mutations_line_218, sizeof(__pyx_k_view_mutations_line_218), 0, 1, 0, 0},
  {&__pyx_n_s_view_mutations_metapop, __pyx_k_view_mutations_metapop, sizeof(__pyx_k_view_mutations_metapop), 0, 0, 1, 1},
  {&__pyx_n_s_view_mutations_popvec, __pyx_k_view_mutations_popvec, sizeof(__pyx_k_view_mutations_popvec), 0, 0, 1, 1},
  {&__pyx_n_s_view_mutations_popvec_mloc, __pyx_k_view_mutations_popvec_mloc, sizeof(__pyx_k_view_mutations_popvec_mloc), 0, 0, 1, 1},
  {&__pyx_n_s_view_mutations_singlepop, __pyx_k_view_mutations_singlepop, sizeof(__pyx_k_view_mutations_singlepop), 0, 0, 1, 1},
  {&__pyx_n_s_view_mutations_singlepop_mloc, __pyx_k_view_mutations_singlepop_mloc, sizeof(__pyx_k_view_mutations_singlepop_mloc), 0, 0, 1, 1},
  {&__pyx_kp_s_view_mutations_unsupported_objec, __pyx_k_view_mutations_unsupported_objec, sizeof(__pyx_k_view_mutations_unsupported_objec), 0, 0, 1, 0},
  {&__pyx_n_s_vneutral, __pyx_k_vneutral, sizeof(__pyx_k_vneutral), 0, 0, 1, 1},
  {&__pyx_n_s_vselected, __pyx_k_vselected, sizeof(__pyx_k_vselected), 0, 0, 1, 1},
  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1},
  {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1},
  {&__pyx_n_s_weight, __pyx_k_weight, sizeof(__pyx_k_weight), 0, 0, 1, 1},
  {&__pyx_kp_s_weight_2, __pyx_k_weight_2, sizeof(__pyx_k_weight_2), 0, 0, 1, 0},
  {&__pyx_n_s_wstr, __pyx_k_wstr, sizeof(__pyx_k_wstr), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 3, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 119, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 319, __pyx_L1_error)
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(2, 58, __pyx_L1_error)
  __pyx_builtin_sum = __Pyx_GetBuiltinName(__pyx_n_s_sum); if (!__pyx_builtin_sum) __PYX_ERR(2, 110, __pyx_L1_error)
  __pyx_builtin_format = __Pyx_GetBuiltinName(__pyx_n_s_format); if (!__pyx_builtin_format) __PYX_ERR(0, 66, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 120, __pyx_L1_error)
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(3, 194, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(4, 214, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(4, 244, __pyx_L1_error)
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(12, 107, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(13, 18, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(13, 149, __pyx_L1_error)
  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(13, 396, __pyx_L1_error)
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(13, 599, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

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

  /* "fwdpy/classes.pyx":319
 *         for i in range(len(Ns)):
 *             if Ns[i] < 0:
 *                 raise ValueError("MetaPopVec: deme size < 0 encountered")             # <<<<<<<<<<<<<<
 *         for i in range(nmpops):
 *             self.mpops.push_back(shared_ptr[metapop_t](new metapop_t(Ns)))
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_MetaPopVec_deme_size_0_encounter); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "fwdpy/sampling.pyx":28
 *         return sample_single[singlepop_t](rng.thisptr.get(),deref((<Spop>pop).pop.get()),nsam, int(removeFixed))
 *     else:
 *         raise ValueError("ms_sample: unsupported type of popcontainer")             # <<<<<<<<<<<<<<
 * 
 * def get_samples(GSLrng rng, PopType pop, int nsam, bint removeFixed = True, deme = None, locusBoundaries = None):
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_ms_sample_unsupported_type_of_po); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(2, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "fwdpy/sampling.pyx":58
 *     elif isinstance(pop,MetaPop):
 *         if deme is None:
 *             raise RuntimeError("deme may not be set to None when sampling from a meta-population")             # <<<<<<<<<<<<<<
 *         if deme >= len(pop):
 *             raise RuntimeError("value for deme out of range. len(pop) = "+str(len(pop))+", but deme = "+str(deme))
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_deme_may_not_be_set_to_None_when); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(2, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "fwdpy/sampling.pyx":65
 *         return sample_sep_single_mloc[multilocus_t](rng.thisptr.get(),deref((<MlocusPop>pop).pop.get()),nsam,removeFixed,locusBoundaries)
 *     else:
 *         raise ValueError("ms_sample: unsupported type of popcontainer")             # <<<<<<<<<<<<<<
 * 
 * def get_sample_details( sample_t ms_sample, PopType pop, locusID = None ):
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_ms_sample_unsupported_type_of_po); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "fwdpy/sampling.pyx":113
 *                (<MetaPop>pop).mpop.get().generation,0)
 *     else:
 *         raise RuntimeError("unupported PopType")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_unupported_PopType); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "fwdpy/sampling.pyx":140
 *     >>> for i in s[0]: ndi = fwdpy.nderived_site(i)
 *     """
 *     return str(site[1]).count('1')             # <<<<<<<<<<<<<<
 * 
 * def nderived( list sample ):
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_1); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "fwdpy/evolve_regions.pyx":14
 *     for i in [mu_neutral,mu_selected,recrate]:
 *         if math.isnan(i) or math.isinf(i):
 *             raise RuntimeError("non-finite value encountered for mutation and/or recombination rates")             # <<<<<<<<<<<<<<
 *     if mu_neutral < 0:
 *         raise RuntimeError("mutation rate to neutral variants must be >= 0.")
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_non_finite_value_encountered_for); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(5, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "fwdpy/evolve_regions.pyx":16
 *             raise RuntimeError("non-finite value encountered for mutation and/or recombination rates")
 *     if mu_neutral < 0:
 *         raise RuntimeError("mutation rate to neutral variants must be >= 0.")             # <<<<<<<<<<<<<<
 *     if mu_selected < 0:
 *         raise RuntimeError("mutation rate to selected variants must be >= 0.")
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_mutation_rate_to_neutral_variant); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(5, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "fwdpy/evolve_regions.pyx":18
 *         raise RuntimeError("mutation rate to neutral variants must be >= 0.")
 *     if mu_selected < 0:
 *         raise RuntimeError("mutation rate to selected variants must be >= 0.")             # <<<<<<<<<<<<<<
 *     if recrate < 0:
 *         raise RuntimeError("recombination rate must be >= 0.")
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_mutation_rate_to_selected_varian); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(5, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "fwdpy/evolve_regions.pyx":20
 *         raise RuntimeError("mutation rate to selected variants must be >= 0.")
 *     if recrate < 0:
 *         raise RuntimeError("recombination rate must be >= 0.")             # <<<<<<<<<<<<<<
 *     if mu_neutral > 0 and len(nregions)==0:
 *         raise RuntimeError("Neutral regions must be defined when mutation rate > 0")
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_recombination_rate_must_be_0); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(5, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "fwdpy/evolve_regions.pyx":22
 *         raise RuntimeError("recombination rate must be >= 0.")
 *     if mu_neutral > 0 and len(nregions)==0:
 *         raise RuntimeError("Neutral regions must be defined when mutation rate > 0")             # <<<<<<<<<<<<<<
 *     if mu_selected > 0 and len(sregions)==0:
 *         raise RuntimeError("Selected regions must be defined when mutation rate > 0")
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Neutral_regions_must_be_defined); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(5, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "fwdpy/evolve_regions.pyx":24
 *         raise RuntimeError("Neutral regions must be defined when mutation rate > 0")
 *     if mu_selected > 0 and len(sregions)==0:
 *         raise RuntimeError("Selected regions must be defined when mutation rate > 0")             # <<<<<<<<<<<<<<
 *     if recrate > 0 and len(recregions)==0:
 *         raise RuntimeError("Recombination regions must be defined when recombination rate > 0")
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Selected_regions_must_be_defined); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(5, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "fwdpy/evolve_regions.pyx":26
 *         raise RuntimeError("Selected regions must be defined when mutation rate > 0")
 *     if recrate > 0 and len(recregions)==0:
 *         raise RuntimeError("Recombination regions must be defined when recombination rate > 0")             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Recombination_regions_must_be_de); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(5, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "fwdpy/evolve_regions.pyx":202
 * 
 *     else:
 *         raise RuntimeError("fitness must be either multiplicative or additive")             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_fitness_must_be_either_multiplic); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(5, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "fwdpy/evolve_regions.pyx":237
 *     check_input_params(mu_neutral,mu_selected,recrate,nregions,sregions,recregions)
 *     if sample < 0:
 *         raise RuntimeError("sample must be >= 0")             # <<<<<<<<<<<<<<
 *     if f < 0.:
 *         warnings.warn("f < 0 will be treated as 0")
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_sample_must_be_0); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(5, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "fwdpy/evolve_regions.pyx":239
 *         raise RuntimeError("sample must be >= 0")
 *     if f < 0.:
 *         warnings.warn("f < 0 will be treated as 0")             # <<<<<<<<<<<<<<
 *         f=0
 *     rmgr = region_manager_wrapper()
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_f_0_will_be_treated_as_0); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(5, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "fwdpy/regions.pyx":42
 *         """
 *         if math.isinf(beg):
 *             raise ValueError("fwdpy.Region: beg not finite")             # <<<<<<<<<<<<<<
 *         if math.isinf(end):
 *             raise ValueError("fwdpy.Region: end not finite")
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_Region_beg_not_finite); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "fwdpy/regions.pyx":44
 *             raise ValueError("fwdpy.Region: beg not finite")
 *         if math.isinf(end):
 *             raise ValueError("fwdpy.Region: end not finite")             # <<<<<<<<<<<<<<
 *         if math.isinf(weight):
 *             raise ValueError("fwdpy.Region: weight not finite")
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_Region_end_not_finite); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "fwdpy/regions.pyx":46
 *             raise ValueError("fwdpy.Region: end not finite")
 *         if math.isinf(weight):
 *             raise ValueError("fwdpy.Region: weight not finite")             # <<<<<<<<<<<<<<
 *         if math.isnan(beg):
 *             raise ValueError("fwdpy.Region: beg not a number")
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_Region_weight_not_finite); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "fwdpy/regions.pyx":48
 *             raise ValueError("fwdpy.Region: weight not finite")
 *         if math.isnan(beg):
 *             raise ValueError("fwdpy.Region: beg not a number")             # <<<<<<<<<<<<<<
 *         if math.isnan(end):
 *             raise ValueError("fwdpy.Region: end not a number")
 */
  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_Region_beg_not_a_number); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "fwdpy/regions.pyx":50
 *             raise ValueError("fwdpy.Region: beg not a number")
 *         if math.isnan(end):
 *             raise ValueError("fwdpy.Region: end not a number")             # <<<<<<<<<<<<<<
 *         if math.isnan(weight):
 *             raise ValueError("fwdpy.Region: weight not a number")
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_Region_end_not_a_number); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "fwdpy/regions.pyx":52
 *             raise ValueError("fwdpy.Region: end not a number")
 *         if math.isnan(weight):
 *             raise ValueError("fwdpy.Region: weight not a number")             # <<<<<<<<<<<<<<
 *         if weight < 0.0:
 *             raise ValueError("fwdpy.Region: weight < 0.0")
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_Region_weight_not_a_number); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "fwdpy/regions.pyx":54
 *             raise ValueError("fwdpy.Region: weight not a number")
 *         if weight < 0.0:
 *             raise ValueError("fwdpy.Region: weight < 0.0")             # <<<<<<<<<<<<<<
 *         self.b=float(beg)
 *         self.e=float(end)
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_Region_weight_0_0); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "fwdpy/regions.pyx":116
 *         """
 *         if math.isinf(h):
 *             raise ValueError("fwdpy.Sregion: h not finite")             # <<<<<<<<<<<<<<
 *         if math.isnan(h):
 *             raise ValueError("fwdpy.Segion: h not a number")
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_Sregion_h_not_finite); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "fwdpy/regions.pyx":118
 *             raise ValueError("fwdpy.Sregion: h not finite")
 *         if math.isnan(h):
 *             raise ValueError("fwdpy.Segion: h not a number")             # <<<<<<<<<<<<<<
 *         self.h=float(h)
 *         super(Sregion,self).__init__(beg,end,weight,coupled,label)
 */
  __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_Segion_h_not_a_number); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "fwdpy/regions.pyx":162
 *         """
 *         if math.isinf(mean):
 *             raise ValueError("fwdpy.GammaS: mean not finite")             # <<<<<<<<<<<<<<
 *         if math.isinf(shape):
 *             raise ValueError("fwdpy.GammaS: shape not finite")
 */
  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_GammaS_mean_not_finite); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "fwdpy/regions.pyx":164
 *             raise ValueError("fwdpy.GammaS: mean not finite")
 *         if math.isinf(shape):
 *             raise ValueError("fwdpy.GammaS: shape not finite")             # <<<<<<<<<<<<<<
 *         if math.isnan(mean):
 *             raise ValueError("fwdpy.GammaS: mean not a number")
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_GammaS_shape_not_finite); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "fwdpy/regions.pyx":166
 *             raise ValueError("fwdpy.GammaS: shape not finite")
 *         if math.isnan(mean):
 *             raise ValueError("fwdpy.GammaS: mean not a number")             # <<<<<<<<<<<<<<
 *         if math.isnan(shape):
 *             raise ValueError("fwdpy.GammaS: shape not a number")
 */
  __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_GammaS_mean_not_a_number); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "fwdpy/regions.pyx":168
 *             raise ValueError("fwdpy.GammaS: mean not a number")
 *         if math.isnan(shape):
 *             raise ValueError("fwdpy.GammaS: shape not a number")             # <<<<<<<<<<<<<<
 *         self.mean=float(mean)
 *         self.shape=float(shape)
 */
  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_GammaS_shape_not_a_number); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "fwdpy/regions.pyx":212
 *         """
 *         if math.isinf(s):
 *             raise ValueError("fwdpy.ConstantS: s not finite")             # <<<<<<<<<<<<<<
 *         if math.isnan(s):
 *             raise ValueError("fwdpy.ConstantS: s not a number")
 */
  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_ConstantS_s_not_finite); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "fwdpy/regions.pyx":214
 *             raise ValueError("fwdpy.ConstantS: s not finite")
 *         if math.isnan(s):
 *             raise ValueError("fwdpy.ConstantS: s not a number")             # <<<<<<<<<<<<<<
 *         self.s=float(s)
 *         super(ConstantS,self).__init__(beg,end,weight,h,coupled,label)
 */
  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_ConstantS_s_not_a_number); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "fwdpy/regions.pyx":259
 *         """
 *         if math.isinf(lo):
 *             raise ValueError("fwdpy.UniformS: lo not finite")             # <<<<<<<<<<<<<<
 *         if math.isinf(hi):
 *             raise ValueError("fwdpy.UniformS: hi not finite")
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_UniformS_lo_not_finite); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "fwdpy/regions.pyx":261
 *             raise ValueError("fwdpy.UniformS: lo not finite")
 *         if math.isinf(hi):
 *             raise ValueError("fwdpy.UniformS: hi not finite")             # <<<<<<<<<<<<<<
 *         if math.isnan(lo):
 *             raise ValueError("fwdpy.UniformS: lo not a number")
 */
  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_UniformS_hi_not_finite); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "fwdpy/regions.pyx":263
 *             raise ValueError("fwdpy.UniformS: hi not finite")
 *         if math.isnan(lo):
 *             raise ValueError("fwdpy.UniformS: lo not a number")             # <<<<<<<<<<<<<<
 *         if math.isnan(hi):
 *             raise ValueError("fwdpy.UniformS: hi not a number")
 */
  __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_UniformS_lo_not_a_number); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "fwdpy/regions.pyx":265
 *             raise ValueError("fwdpy.UniformS: lo not a number")
 *         if math.isnan(hi):
 *             raise ValueError("fwdpy.UniformS: hi not a number")             # <<<<<<<<<<<<<<
 *         self.lo=float(lo)
 *         self.hi=float(hi)
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_UniformS_hi_not_a_number); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "fwdpy/regions.pyx":309
 *         """
 *         if math.isinf(mean):
 *             raise ValueError("fwdpy.ExpS: mean not finite")             # <<<<<<<<<<<<<<
 *         if math.isnan(mean):
 *             raise ValueError("fwdpy.ExpS: mean not a number")
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_ExpS_mean_not_finite); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "fwdpy/regions.pyx":311
 *             raise ValueError("fwdpy.ExpS: mean not finite")
 *         if math.isnan(mean):
 *             raise ValueError("fwdpy.ExpS: mean not a number")             # <<<<<<<<<<<<<<
 *         self.mean=float(mean)
 *         super(ExpS,self).__init__(beg,end,weight,h,coupled,label)
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_ExpS_mean_not_a_number); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "fwdpy/regions.pyx":356
 *         """
 *         if math.isinf(sd):
 *             raise ValueError("fwdpy.GaussianS: sd not finite")             # <<<<<<<<<<<<<<
 *         if math.isnan(sd):
 *             raise ValueError("fwdpy.GaussianS: sd not a number")
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_GaussianS_sd_not_finite); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "fwdpy/regions.pyx":358
 *             raise ValueError("fwdpy.GaussianS: sd not finite")
 *         if math.isnan(sd):
 *             raise ValueError("fwdpy.GaussianS: sd not a number")             # <<<<<<<<<<<<<<
 *         self.sd=float(sd)
 *         super(GaussianS,self).__init__(beg,end,weight,h,coupled,label)
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_s_fwdpy_GaussianS_sd_not_a_number); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "fwdpy/views.pyx":194
 * def view_mutations_metapop(MetaPop p,unsigned deme):
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_mutations: deme index out of range")             # <<<<<<<<<<<<<<
 *     #get the gametes from this population
 *     gams = view_gametes_metapop(p,deme)
 */
  __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_view_mutations_deme_index_out_of); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(3, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "fwdpy/views.pyx":252
 *     elif isinstance(p,MetaPop):
 *         if deme is None:
 *             raise RuntimeError("view_mutations: deme cannot be none for metapops")             # <<<<<<<<<<<<<<
 *         return view_mutations_metapop(p,deme)
 *     else:
 */
  __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_view_mutations_deme_cannot_be_no); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(3, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "fwdpy/views.pyx":255
 *         return view_mutations_metapop(p,deme)
 *     else:
 *         raise RuntimeError("view_mutations: unsupported object type")             # <<<<<<<<<<<<<<
 * 
 * def view_gametes_singlepop(Spop p):
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_view_mutations_unsupported_objec); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(3, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "fwdpy/views.pyx":287
 * def view_gametes_metapop(MetaPop p, unsigned deme):
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_gametes: deme index out of range")             # <<<<<<<<<<<<<<
 *     temp1 = view_diploids(p,list(range(p.mpop.get().diploids[deme].size())),deme)
 *     #Get unique list of haplotypes
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_view_gametes_deme_index_out_of_r); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(3, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "fwdpy/views.pyx":342
 *     elif isinstance(p,MetaPop):
 *         if deme is None:
 *             raise RuntimeError("view_gametes: deme cannot be None when p is a MetaPop")             # <<<<<<<<<<<<<<
 *         return view_gametes_metapop(p,deme)
 *     else:
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_view_gametes_deme_cannot_be_None); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(3, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "fwdpy/views.pyx":345
 *         return view_gametes_metapop(p,deme)
 *     else:
 *         raise RuntimeError("view_gametes: unsupported object type")             # <<<<<<<<<<<<<<
 * 
 * def view_diploids_singlepop(Spop p, list indlist):
 */
  __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_view_gametes_unsupported_object); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(3, 345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "fwdpy/views.pyx":350
 *     for i in indlist:
 *         if i >= p.popsize():
 *             raise IndexError("index greater than population size")             # <<<<<<<<<<<<<<
 *     return view_diploids_details(p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts,indlist)
 * 
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_index_greater_than_population_si); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(3, 350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "fwdpy/views.pyx":356
 *     for i in indlist:
 *         if i >= p.popsize():
 *             raise IndexError("index greater than population size")             # <<<<<<<<<<<<<<
 *     return view_diploids_details_mloc(p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts,indlist)
 * 
 */
  __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_s_index_greater_than_population_si); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(3, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "fwdpy/views.pyx":393
 *         for ps in psizes:
 *             if i >= ps:
 *                 raise IndexError("index greater than deme size")             # <<<<<<<<<<<<<<
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_diploids: deme index out of range")
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_s_index_greater_than_deme_size); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(3, 393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "fwdpy/views.pyx":395
 *                 raise IndexError("index greater than deme size")
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_diploids: deme index out of range")             # <<<<<<<<<<<<<<
 *     return view_diploids_details(p.mpop.get().diploids[deme],p.mpop.get().gametes,p.mpop.get().mutations,p.mpop.get().mcounts,indlist)
 * 
 */
  __pyx_tuple__50 = PyTuple_Pack(1, __pyx_kp_s_view_diploids_deme_index_out_of); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(3, 395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "fwdpy/views.pyx":428
 *     elif isinstance(p,MetaPop):
 *         if deme is None:
 *             raise RuntimeError("view_diploids: deme index required for metapopulation")             # <<<<<<<<<<<<<<
 *         return view_diploids_metapop(p,indlist,deme)
 *     elif isinstance(p,SpopVec):
 */
  __pyx_tuple__51 = PyTuple_Pack(1, __pyx_kp_s_view_diploids_deme_index_require); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(3, 428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "fwdpy/views.pyx":435
 *         return view_diploids_popvec_mloc(p,indlist)
 *     else:
 *         raise RuntimeError("view_diploids: unsupported object type")             # <<<<<<<<<<<<<<
 * 
 * cdef diploid_view_to_sample_init_containers(list mutations, map[double,string] * rmap, list info, const size_t ttl_nsam):
 */
  __pyx_tuple__52 = PyTuple_Pack(1, __pyx_kp_s_view_diploids_unsupported_object); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(3, 435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);

  /* "fwdpy/views.pyx":454
 *         map_itr = data.find(mut['pos'])
 *         if map_itr == data.end():
 *             raise RuntimeError("diploid_view_to_sample_fill_containers_details: fatal error due to mutation position not being found")             # <<<<<<<<<<<<<<
 *         if offset >= deref(map_itr).second.size():
 *             raise IndexError("diploid_view_to_sample_fill_containers_details: offset out of range")
 */
  __pyx_tuple__53 = PyTuple_Pack(1, __pyx_kp_s_diploid_view_to_sample_fill_cont); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(3, 454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);

  /* "fwdpy/views.pyx":456
 *             raise RuntimeError("diploid_view_to_sample_fill_containers_details: fatal error due to mutation position not being found")
 *         if offset >= deref(map_itr).second.size():
 *             raise IndexError("diploid_view_to_sample_fill_containers_details: offset out of range")             # <<<<<<<<<<<<<<
 *         deref(map_itr).second[offset]=derived
 * 
 */
  __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_s_diploid_view_to_sample_fill_cont_2); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(3, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);

  /* "fwdpy/views.pyx":469
 *         I+=1
 *     if <size_t>I != len(view):
 *         raise RuntimeError("diploid_view_to_sample_fill_containers: indexing incorrect")             # <<<<<<<<<<<<<<
 * 
 * cdef diploid_mloc_view_to_sample_fill_containers(list view, map[double,string] * neutral, map[double,string] * selected):
 */
  __pyx_tuple__55 = PyTuple_Pack(1, __pyx_kp_s_diploid_view_to_sample_fill_cont_3); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(3, 469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);

  /* "fwdpy/views.pyx":482
 *         I+=1
 *     if <size_t>I != len(view):
 *         raise RuntimeError("diploid_mloc_view_to_sample_fill_containers: indexing incorrect")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_s_diploid_mloc_view_to_sample_fill); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(3, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);

  /* "fwdpy/views.pyx":526
 *     cdef size_t size_ = len(neutral_info)
 *     if neutral.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")             # <<<<<<<<<<<<<<
 *     size_ = len(selected_info)
 *     if selected.size() != size_:
 */
  __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_s_diploid_view_unequal_container_s); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(3, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "fwdpy/views.pyx":529
 *     size_ = len(selected_info)
 *     if selected.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for selected mutations")             # <<<<<<<<<<<<<<
 *     diploid_view_to_sample_fill_containers(view,&neutral,&selected)
 * 
 */
  __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_s_diploid_view_unequal_container_s_2); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(3, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);

  /* "fwdpy/views.pyx":543
 *         neutral_df = pd.concat([pd.DataFrame(i,index=[0]) for i in neutral_info])
 *         neutral_df['index']=list(range(len(neutral_df.index)))
 *         neutral_df = neutral_df.set_index('index')             # <<<<<<<<<<<<<<
 * 
 *     selected_df = pd.DataFrame()
 */
  __pyx_tuple__59 = PyTuple_Pack(1, __pyx_n_s_index); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(3, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "fwdpy/views.pyx":549
 *         selected_df = pd.concat([pd.DataFrame(i,index=[0]) for i in selected_info])
 *         selected_df['index']=list(range(len(selected_df.index)))
 *         selected_df = selected_df.set_index('index')             # <<<<<<<<<<<<<<
 * 
 *     return {'neutral':vneutral,'selected':vselected,'neutral_info':neutral_df,'selected_info':selected_df}
 */
  __pyx_tuple__60 = PyTuple_Pack(1, __pyx_n_s_index); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(3, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);

  /* "fwdpy/views.pyx":587
 *     cdef size_t size_ = len(neutral_info)
 *     if neutral.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for neutral mutations")             # <<<<<<<<<<<<<<
 *     size_ = len(selected_info)
 *     if selected.size() != size_:
 */
  __pyx_tuple__61 = PyTuple_Pack(1, __pyx_kp_s_diploid_view_unequal_container_s); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(3, 587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);

  /* "fwdpy/views.pyx":590
 *     size_ = len(selected_info)
 *     if selected.size() != size_:
 *         raise RuntimeError("diploid_view: unequal container sizes for selected mutations")             # <<<<<<<<<<<<<<
 *     diploid_mloc_view_to_sample_fill_containers(view,&neutral,&selected)
 * 
 */
  __pyx_tuple__62 = PyTuple_Pack(1, __pyx_kp_s_diploid_view_unequal_container_s_2); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(3, 590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);

  /* "fwdpy/views.pyx":604
 *         neutral_df = pd.concat([pd.DataFrame(i,index=[0]) for i in neutral_info])
 *         neutral_df['index']=list(range(len(neutral_df.index)))
 *         neutral_df = neutral_df.set_index('index')             # <<<<<<<<<<<<<<
 * 
 *     selected_df = pd.DataFrame()
 */
  __pyx_tuple__63 = PyTuple_Pack(1, __pyx_n_s_index); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(3, 604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);

  /* "fwdpy/views.pyx":610
 *         selected_df = pd.concat([pd.DataFrame(i,index=[0]) for i in selected_info])
 *         selected_df['index']=list(range(len(selected_df.index)))
 *         selected_df = selected_df.set_index('index')             # <<<<<<<<<<<<<<
 * 
 *     return {'neutral':vneutral,'selected':vselected,'neutral_info':neutral_df,'selected_info':selected_df}
 */
  __pyx_tuple__64 = PyTuple_Pack(1, __pyx_n_s_index); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(3, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__64);
  __Pyx_GIVEREF(__pyx_tuple__64);

  /* "fwdpy/views.pyx":746
 * cdef diploid_traits_mpop(MetaPop m, deme):
 *     if deme > m.mpop.get().diploids.size():
 *         raise RuntimeError("deme value out of range")             # <<<<<<<<<<<<<<
 *     rv=[]
 *     for i in range(m.mpop.get().diploids[deme].size()):
 */
  __pyx_tuple__65 = PyTuple_Pack(1, __pyx_kp_s_deme_value_out_of_range); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(3, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);

  /* "fwdpy/views.pyx":766
 *     elif isinstance(p,MetaPop):
 *         if deme is None:
 *             raise RuntimeError("deme cannot be None")             # <<<<<<<<<<<<<<
 *         return diploid_traits_mpop(p,deme)
 *     if isinstance(p,SpopVec):
 */
  __pyx_tuple__66 = PyTuple_Pack(1, __pyx_kp_s_deme_cannot_be_None); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(3, 766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);

  /* "fwdpy/views.pyx":774
 *     elif isinstance(p,MetaPopVec):
 *         if deme is None:
 *             raise RuntimeError("deme cannot be None")             # <<<<<<<<<<<<<<
 *         return diploid_traits_mpopvec(p,deme)
 *     else:
 */
  __pyx_tuple__67 = PyTuple_Pack(1, __pyx_kp_s_deme_cannot_be_None); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(3, 774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);

  /* "fwdpy/views.pyx":777
 *         return diploid_traits_mpopvec(p,deme)
 *     else:
 *         raise ValueError("unsupported type")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__68 = PyTuple_Pack(1, __pyx_kp_s_unsupported_type); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(3, 777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);

  /* "fwdpy/view_fixations.pyx":66
 *         return view_fixations_mlocuspopvec(p)
 *     else:
 *         raise ValueError("unsupported type")             # <<<<<<<<<<<<<<
 * 
 */
  __pyx_tuple__69 = PyTuple_Pack(1, __pyx_kp_s_unsupported_type); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(7, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__69);
  __Pyx_GIVEREF(__pyx_tuple__69);

  /* "fwdpy/debug.pyx":41
 *         return check_popdata_metapop(p)
 *     else:
 *         raise RuntimeError("object type not understood")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__70 = PyTuple_Pack(1, __pyx_kp_s_object_type_not_understood); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(8, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__70);
  __Pyx_GIVEREF(__pyx_tuple__70);

  /* "fwdpy/ages.pyx":25
 *     """
 *     if len(trajectories1) != len(trajectories2):
 *         raise RuntimeError("the two input lists must be the same length")             # <<<<<<<<<<<<<<
 *     return merge_trajectories_details(trajectories1,trajectories2)
 *     #rv = []
 */
  __pyx_tuple__71 = PyTuple_Pack(1, __pyx_kp_s_the_two_input_lists_must_be_the); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(9, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);

  /* "fwdpy/temporal_samplers.pyx":63
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")             # <<<<<<<<<<<<<<
 *         return (<pop_properties*>(self.vec[i].get())).final()
 *     def get(self):
 */
  __pyx_tuple__72 = PyTuple_Pack(1, __pyx_kp_s_index_out_of_range); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(4, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);

  /* "fwdpy/temporal_samplers.pyx":116
 *                 nfile.clear()
 *                 if selected_file is not None:
 *                     temp=selected_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'             # <<<<<<<<<<<<<<
 *                     sfile=temp
 *                 if neutral_file is not None:
 */
  __pyx_tuple__73 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(4, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);
  __pyx_tuple__75 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(4, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);

  /* "fwdpy/temporal_samplers.pyx":119
 *                     sfile=temp
 *                 if neutral_file is not None:
 *                     temp=neutral_file.encode('utf-8')+b'.'+str(i).encode('utf-8')+b'.gz'             # <<<<<<<<<<<<<<
 *                     nfile=temp
 *                 self.vec.push_back(<unique_ptr[sampler_base]>unique_ptr[sample_n](new
 */
  __pyx_tuple__76 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(4, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__76);
  __Pyx_GIVEREF(__pyx_tuple__76);
  __pyx_tuple__77 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(4, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);

  /* "fwdpy/temporal_samplers.pyx":130
 *     def __getitem__(self, int i):
 *         if i>= self.vec.size():
 *             raise IndexError("index out of range")             # <<<<<<<<<<<<<<
 *         return (<sample_n*>self.vec[i].get()).final()
 *     def __len__(self):
 */
  __pyx_tuple__78 = PyTuple_Pack(1, __pyx_kp_s_index_out_of_range); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(4, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__78);
  __Pyx_GIVEREF(__pyx_tuple__78);

  /* "fwdpy/temporal_samplers.pyx":162
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")             # <<<<<<<<<<<<<<
 *         return (<additive_variance*>(self.vec[i].get())).final()
 *     def get(self):
 */
  __pyx_tuple__79 = PyTuple_Pack(1, __pyx_kp_s_index_out_of_range); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(4, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__79);
  __Pyx_GIVEREF(__pyx_tuple__79);

  /* "fwdpy/temporal_samplers.pyx":198
 *     def __getitem__(self,i):
 *         if i>=self.vec.size():
 *             raise IndexError("index out of range")             # <<<<<<<<<<<<<<
 *         return (<selected_mut_tracker*>self.vec[i].get()).final()
 *     def __len__(self):
 */
  __pyx_tuple__80 = PyTuple_Pack(1, __pyx_kp_s_index_out_of_range); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(4, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__80);
  __Pyx_GIVEREF(__pyx_tuple__80);

  /* "fwdpy/temporal_samplers.pyx":214
 * 
 *     if not isinstance(pops,PopVec):
 *         raise TypeError("Expecting PopVec.")             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(pops,SpopVec):
 */
  __pyx_tuple__81 = PyTuple_Pack(1, __pyx_kp_s_Expecting_PopVec); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(4, 214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__81);
  __Pyx_GIVEREF(__pyx_tuple__81);

  /* "fwdpy/temporal_samplers.pyx":223
 *         apply_sampler_cpp[multilocus_t]((<MlocusPopVec>pops).pops,sampler.vec)
 *     else:
 *         raise RuntimeError("PopVec/PopType type not supported")             # <<<<<<<<<<<<<<
 * 
 * def apply_sampler_single(PopType pop,TemporalSampler sampler):
 */
  __pyx_tuple__82 = PyTuple_Pack(1, __pyx_kp_s_PopVec_PopType_type_not_supporte); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(4, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__82);
  __Pyx_GIVEREF(__pyx_tuple__82);

  /* "fwdpy/temporal_samplers.pyx":236
 *     """
 *     if not isinstance(pop,PopType):
 *         raise TypeError("Expecting PopType.")             # <<<<<<<<<<<<<<
 *     if isinstance(pop,Spop):
 *         apply_sampler_single_cpp[singlepop_t]((<Spop>pop).pop.get(),sampler.vec)
 */
  __pyx_tuple__83 = PyTuple_Pack(1, __pyx_kp_s_Expecting_PopType); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(4, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__83);
  __Pyx_GIVEREF(__pyx_tuple__83);

  /* "fwdpy/temporal_samplers.pyx":244
 *         apply_sampler_single_cpp[metapop_t]((<MetaPop>pop).mpop.get(),sampler.vec)
 *     else:
 *         raise NotImplementedError("Not implemented for this type")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__84 = PyTuple_Pack(1, __pyx_kp_s_Not_implemented_for_this_type); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(4, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__84);
  __Pyx_GIVEREF(__pyx_tuple__84);

  /* "fwdpy/add_mutations.pyx":38
 *         return add_mutation_cpp((<Spop>p).pop.get(),indlist,clist,pos,s,h)
 *     else:
 *         raise RuntimeError("PopType not supported")             # <<<<<<<<<<<<<<
 * 
 */
  __pyx_tuple__85 = PyTuple_Pack(1, __pyx_kp_s_PopType_not_supported); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(10, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__85);
  __Pyx_GIVEREF(__pyx_tuple__85);

  /* "FromPyStructUtility":19
 *         value = obj['pos']
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'pos'")             # <<<<<<<<<<<<<<
 *     result.pos = value
 *     try:
 */
  __pyx_tuple__86 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(13, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__86);
  __Pyx_GIVEREF(__pyx_tuple__86);

  /* "FromPyStructUtility":24
 *         value = obj['esize']
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'esize'")             # <<<<<<<<<<<<<<
 *     result.esize = value
 *     try:
 */
  __pyx_tuple__87 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_2); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(13, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__87);
  __Pyx_GIVEREF(__pyx_tuple__87);

  /* "FromPyStructUtility":29
 *         value = obj['origin']
 *     except KeyError:
 *         raise ValueError("No value specified for struct attribute 'origin'")             # <<<<<<<<<<<<<<
 *     result.origin = value
 *     return result
 */
  __pyx_tuple__88 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_3); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(13, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__88);
  __Pyx_GIVEREF(__pyx_tuple__88);

  /* "View.MemoryView":131
 * 
 *         if not self.ndim:
 *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if itemsize <= 0:
 */
  __pyx_tuple__89 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(13, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__89);
  __Pyx_GIVEREF(__pyx_tuple__89);

  /* "View.MemoryView":134
 * 
 *         if itemsize <= 0:
 *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(format, bytes):
 */
  __pyx_tuple__90 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(13, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__90);
  __Pyx_GIVEREF(__pyx_tuple__90);

  /* "View.MemoryView":137
 * 
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format
 */
  __pyx_tuple__91 = PyTuple_Pack(1, __pyx_n_s_ASCII); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(13, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);

  /* "View.MemoryView":146
 * 
 *         if not self._shape:
 *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__92 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(13, 146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__92);
  __Pyx_GIVEREF(__pyx_tuple__92);

  /* "View.MemoryView":174
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
 * 
 *             if self.dtype_is_object:
 */
  __pyx_tuple__93 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(13, 174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__93);
  __Pyx_GIVEREF(__pyx_tuple__93);

  /* "View.MemoryView":190
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
 *         info.buf = self.data
 *         info.len = self.len
 */
  __pyx_tuple__94 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(13, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__94);
  __Pyx_GIVEREF(__pyx_tuple__94);

  /* "View.MemoryView":484
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
 *         else:
 *             if len(self.view.format) == 1:
 */
  __pyx_tuple__95 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(13, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__95);
  __Pyx_GIVEREF(__pyx_tuple__95);

  /* "View.MemoryView":556
 *         if self.view.strides == NULL:
 * 
 *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 */
  __pyx_tuple__96 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(13, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);

  /* "View.MemoryView":563
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 */
  __pyx_tuple__97 = PyTuple_New(1); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(13, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__97);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_tuple__97, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_tuple__97);

  /* "View.MemoryView":668
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
 *                 seen_ellipsis = True
 *             else:
 */
  __pyx_slice__98 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__98)) __PYX_ERR(13, 668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__98);
  __Pyx_GIVEREF(__pyx_slice__98);

  /* "View.MemoryView":671
 *                 seen_ellipsis = True
 *             else:
 *                 result.append(slice(None))             # <<<<<<<<<<<<<<
 *             have_slices = True
 *         else:
 */
  __pyx_slice__99 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__99)) __PYX_ERR(13, 671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__99);
  __Pyx_GIVEREF(__pyx_slice__99);

  /* "View.MemoryView":682
 *     nslices = ndim - len(result)
 *     if nslices:
 *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
 * 
 *     return have_slices or nslices, tuple(result)
 */
  __pyx_slice__100 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__100)) __PYX_ERR(13, 682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__100);
  __Pyx_GIVEREF(__pyx_slice__100);

  /* "View.MemoryView":689
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__101 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(13, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__101);
  __Pyx_GIVEREF(__pyx_tuple__101);

  /* "fwdpy/sampling.pyx":6
 * import pandas as pd
 * 
 * def ms_sample(GSLrng rng, PopType pop, int nsam, bint removeFixed = True):             # <<<<<<<<<<<<<<
 *     """
 *     Take a sample from a set of simulated populations.
 */
  __pyx_tuple__102 = PyTuple_Pack(4, __pyx_n_s_rng, __pyx_n_s_pop, __pyx_n_s_nsam, __pyx_n_s_removeFixed); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(2, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__102);
  __Pyx_GIVEREF(__pyx_tuple__102);
  __pyx_codeobj__103 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__102, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_samp, __pyx_n_s_ms_sample, 6, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__103)) __PYX_ERR(2, 6, __pyx_L1_error)

  /* "fwdpy/sampling.pyx":30
 *         raise ValueError("ms_sample: unsupported type of popcontainer")
 * 
 * def get_samples(GSLrng rng, PopType pop, int nsam, bint removeFixed = True, deme = None, locusBoundaries = None):             # <<<<<<<<<<<<<<
 *     """
 *     Take a sample from a set of simulated populations.
 */
  __pyx_tuple__104 = PyTuple_Pack(6, __pyx_n_s_rng, __pyx_n_s_pop, __pyx_n_s_nsam, __pyx_n_s_removeFixed, __pyx_n_s_deme, __pyx_n_s_locusBoundaries); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__104);
  __Pyx_GIVEREF(__pyx_tuple__104);
  __pyx_codeobj__105 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__104, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_samp, __pyx_n_s_get_samples, 30, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__105)) __PYX_ERR(2, 30, __pyx_L1_error)

  /* "fwdpy/sampling.pyx":67
 *         raise ValueError("ms_sample: unsupported type of popcontainer")
 * 
 * def get_sample_details( sample_t ms_sample, PopType pop, locusID = None ):             # <<<<<<<<<<<<<<
 *     """
 *     Get additional details for population samples
 */
  __pyx_tuple__106 = PyTuple_Pack(3, __pyx_n_s_ms_sample, __pyx_n_s_pop, __pyx_n_s_locusID); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(2, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__106);
  __Pyx_GIVEREF(__pyx_tuple__106);
  __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_samp, __pyx_n_s_get_sample_details, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(2, 67, __pyx_L1_error)

  /* "fwdpy/sampling.pyx":117
 * 
 * ###### Functions for manipulating samples.
 * def nderived_site(tuple site):             # <<<<<<<<<<<<<<
 *     """
 *     Get the number of derived mutations at a site.
 */
  __pyx_tuple__108 = PyTuple_Pack(1, __pyx_n_s_site); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(2, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__108);
  __Pyx_GIVEREF(__pyx_tuple__108);
  __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_samp, __pyx_n_s_nderived_site, 117, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(2, 117, __pyx_L1_error)

  /* "fwdpy/sampling.pyx":142
 *     return str(site[1]).count('1')
 * 
 * def nderived( list sample ):             # <<<<<<<<<<<<<<
 *     """
 *     Convenience wrapper around :func:`fwdpy.fwdpy.nderived`
 */
  __pyx_tuple__110 = PyTuple_Pack(2, __pyx_n_s_sample, __pyx_n_s_i); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(2, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__110);
  __Pyx_GIVEREF(__pyx_tuple__110);
  __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_samp, __pyx_n_s_nderived, 142, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(2, 142, __pyx_L1_error)

  /* "fwdpy/sampling.pyx":159
 *     return [nderived_site(i) for i in sample]
 * 
 * def getfreq(tuple site,bint derived = True):             # <<<<<<<<<<<<<<
 *     """
 *     Get mutation frequencies
 */
  __pyx_tuple__112 = PyTuple_Pack(4, __pyx_n_s_site, __pyx_n_s_derived, __pyx_n_s_o, __pyx_n_s_dfreq); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(2, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__112);
  __Pyx_GIVEREF(__pyx_tuple__112);
  __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_samp, __pyx_n_s_getfreq, 159, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(2, 159, __pyx_L1_error)

  /* "fwdpy/sampling.pyx":187
 *     return min(dfreq,1.0-dfreq)
 * 
 * def getfreqs(list sample,bint derived = True):             # <<<<<<<<<<<<<<
 *     """
 *     Convenience wrapper around :func:`fwdpy.fwdpy.getfreq`
 */
  __pyx_tuple__114 = PyTuple_Pack(3, __pyx_n_s_sample, __pyx_n_s_derived, __pyx_n_s_i); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(2, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__114);
  __Pyx_GIVEREF(__pyx_tuple__114);
  __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_samp, __pyx_n_s_getfreqs, 187, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(2, 187, __pyx_L1_error)

  /* "fwdpy/sampling.pyx":208
 *     return [getfreq(i,derived) for i in sample]
 * 
 * def freqfilter( list sample,             # <<<<<<<<<<<<<<
 *                 float minfreq,
 *                 bint derived = True ):
 */
  __pyx_tuple__116 = PyTuple_Pack(5, __pyx_n_s_sample, __pyx_n_s_minfreq, __pyx_n_s_derived, __pyx_n_s_rv, __pyx_n_s_i); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(2, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__116);
  __Pyx_GIVEREF(__pyx_tuple__116);
  __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_samp, __pyx_n_s_freqfilter, 208, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(2, 208, __pyx_L1_error)

  /* "fwdpy/evolve_regions.pyx":10
 * from fitness cimport SpopAdditive,SpopMult,SpopFitness
 * 
 * def check_input_params(double mu_neutral, double mu_selected, double recrate,             # <<<<<<<<<<<<<<
 *                        list nregions, list sregions, list recregions) :
 *     for i in [mu_neutral,mu_selected,recrate]:
 */
  __pyx_tuple__118 = PyTuple_Pack(7, __pyx_n_s_mu_neutral, __pyx_n_s_mu_selected, __pyx_n_s_recrate, __pyx_n_s_nregions, __pyx_n_s_sregions, __pyx_n_s_recregions, __pyx_n_s_i); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(5, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__118);
  __Pyx_GIVEREF(__pyx_tuple__118);
  __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_evol, __pyx_n_s_check_input_params, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(5, 10, __pyx_L1_error)

  /* "fwdpy/evolve_regions.pyx":29
 * 
 * @cython.boundscheck(False)
 * def evolve_regions(GSLrng rng,             # <<<<<<<<<<<<<<
 *                    int npops,
 *                    int N,
 */
  __pyx_tuple__120 = PyTuple_Pack(15, __pyx_n_s_rng, __pyx_n_s_npops, __pyx_n_s_N, __pyx_n_s_nlist, __pyx_n_s_mu_neutral, __pyx_n_s_mu_selected, __pyx_n_s_recrate, __pyx_n_s_nregions, __pyx_n_s_sregions, __pyx_n_s_recregions, __pyx_n_s_f, __pyx_n_s_scaling, __pyx_n_s_fitness, __pyx_n_s_pops, __pyx_n_s_donothing); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(5, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__120);
  __Pyx_GIVEREF(__pyx_tuple__120);
  __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(13, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__120, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_evol, __pyx_n_s_evolve_regions, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) __PYX_ERR(5, 29, __pyx_L1_error)

  /* "fwdpy/evolve_regions.pyx":102
 * 
 * @cython.boundscheck(False)
 * def evolve_regions_more(GSLrng rng,             # <<<<<<<<<<<<<<
 *                         SpopVec pops,
 *                         unsigned[:] nlist,
 */
  __pyx_tuple__122 = PyTuple_Pack(13, __pyx_n_s_rng, __pyx_n_s_pops, __pyx_n_s_nlist, __pyx_n_s_mu_neutral, __pyx_n_s_mu_selected, __pyx_n_s_recrate, __pyx_n_s_nregions, __pyx_n_s_sregions, __pyx_n_s_recregions, __pyx_n_s_f, __pyx_n_s_scaling, __pyx_n_s_fitness, __pyx_n_s_donothing); if (unlikely(!__pyx_tuple__122)) __PYX_ERR(5, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__122);
  __Pyx_GIVEREF(__pyx_tuple__122);
  __pyx_codeobj__123 = (PyObject*)__Pyx_PyCode_New(12, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_evol, __pyx_n_s_evolve_regions_more, 102, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__123)) __PYX_ERR(5, 102, __pyx_L1_error)

  /* "fwdpy/evolve_regions.pyx":155
 * 
 * @cython.boundscheck(False)
 * def evolve_regions_sampler(GSLrng rng,             # <<<<<<<<<<<<<<
 *                            SpopVec pops,
 *                            TemporalSampler slist,
 */
  __pyx_tuple__124 = PyTuple_Pack(16, __pyx_n_s_rng, __pyx_n_s_pops, __pyx_n_s_slist, __pyx_n_s_nlist, __pyx_n_s_mu_neutral, __pyx_n_s_mu_selected, __pyx_n_s_recrate, __pyx_n_s_nregions, __pyx_n_s_sregions, __pyx_n_s_recregions, __pyx_n_s_sample, __pyx_n_s_f, __pyx_n_s_scaling, __pyx_n_s_fitness, __pyx_n_s_ffm, __pyx_n_s_ffa); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(5, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__124);
  __Pyx_GIVEREF(__pyx_tuple__124);
  __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(14, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_evol, __pyx_n_s_evolve_regions_sampler, 155, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(5, 155, __pyx_L1_error)

  /* "fwdpy/evolve_regions.pyx":205
 * 
 * @cython.boundscheck(False)
 * def evolve_regions_sampler_fitness(GSLrng rng,             # <<<<<<<<<<<<<<
 *                                    SpopVec pops,
 *                                    TemporalSampler slist,
 */
  __pyx_tuple__126 = PyTuple_Pack(15, __pyx_n_s_rng, __pyx_n_s_pops, __pyx_n_s_slist, __pyx_n_s_fitness_function, __pyx_n_s_nlist, __pyx_n_s_mu_neutral, __pyx_n_s_mu_selected, __pyx_n_s_recrate, __pyx_n_s_nregions, __pyx_n_s_sregions, __pyx_n_s_recregions, __pyx_n_s_sample, __pyx_n_s_f, __pyx_n_s_rmgr, __pyx_n_s_listlen); if (unlikely(!__pyx_tuple__126)) __PYX_ERR(5, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__126);
  __Pyx_GIVEREF(__pyx_tuple__126);
  __pyx_codeobj__127 = (PyObject*)__Pyx_PyCode_New(13, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_evol, __pyx_n_s_evolve_regions_sampler_fitness, 205, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__127)) __PYX_ERR(5, 205, __pyx_L1_error)

  /* "fwdpy/regions.pyx":18
 *         * :class:`fwdpy.fwdpy.Sregion`
 *     """
 *     def __init__(self,float beg,float end,float weight,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
  __pyx_tuple__128 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_beg, __pyx_n_s_end, __pyx_n_s_weight, __pyx_n_s_coupled, __pyx_n_s_label); if (unlikely(!__pyx_tuple__128)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__128);
  __Pyx_GIVEREF(__pyx_tuple__128);
  __pyx_codeobj__129 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__128, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_n_s_init, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__129)) __PYX_ERR(0, 18, __pyx_L1_error)

  /* "fwdpy/regions.pyx":62
 *         if self.c is True:
 *             self.w = (self.e-self.b)*self.w
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         bstr="{:.9f}".format(self.b)
 *         estr="{:.9f}".format(self.e)
 */
  __pyx_tuple__130 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_bstr, __pyx_n_s_estr, __pyx_n_s_wstr); if (unlikely(!__pyx_tuple__130)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__130);
  __Pyx_GIVEREF(__pyx_tuple__130);
  __pyx_codeobj__131 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_n_s_str, 62, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__131)) __PYX_ERR(0, 62, __pyx_L1_error)

  /* "fwdpy/regions.pyx":91
 *        :class:`fwdpy.fwdpy.GaussianS`
 *     """
 *     def __init__(self,float beg,float end,float weight,float h=1.0,coupled=True,uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
  __pyx_tuple__132 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_beg, __pyx_n_s_end, __pyx_n_s_weight, __pyx_n_s_h, __pyx_n_s_coupled, __pyx_n_s_label); if (unlikely(!__pyx_tuple__132)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__132);
  __Pyx_GIVEREF(__pyx_tuple__132);
  __pyx_codeobj__133 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__132, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_n_s_init, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__133)) __PYX_ERR(0, 91, __pyx_L1_error)

  /* "fwdpy/regions.pyx":121
 *         self.h=float(h)
 *         super(Sregion,self).__init__(beg,end,weight,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "h = "+"{:.9f}".format(self.h)+", "+super(Sregion,self).__str__()
 * 
 */
  __pyx_tuple__134 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__134)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__134);
  __Pyx_GIVEREF(__pyx_tuple__134);
  __pyx_codeobj__135 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__134, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_n_s_str, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__135)) __PYX_ERR(0, 121, __pyx_L1_error)

  /* "fwdpy/regions.pyx":139
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float mean,float shape,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
  __pyx_tuple__136 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_beg, __pyx_n_s_end, __pyx_n_s_weight, __pyx_n_s_mean, __pyx_n_s_shape, __pyx_n_s_h, __pyx_n_s_coupled, __pyx_n_s_label); if (unlikely(!__pyx_tuple__136)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__136);
  __Pyx_GIVEREF(__pyx_tuple__136);
  __pyx_codeobj__137 = (PyObject*)__Pyx_PyCode_New(9, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__136, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_n_s_init, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__137)) __PYX_ERR(0, 139, __pyx_L1_error)

  /* "fwdpy/regions.pyx":172
 *         self.shape=float(shape)
 *         super(GammaS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Gamma DFE, mean = "+"{:.9f}".format(self.mean)+", shape = "+"{:.9f}".format(self.shape)+", "+super(GammaS,self).__str__()
 * 
 */
  __pyx_tuple__138 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__138)) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__138);
  __Pyx_GIVEREF(__pyx_tuple__138);
  __pyx_codeobj__139 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__138, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_n_s_str, 172, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__139)) __PYX_ERR(0, 172, __pyx_L1_error)

  /* "fwdpy/regions.pyx":189
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float s,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
  __pyx_tuple__140 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_beg, __pyx_n_s_end, __pyx_n_s_weight, __pyx_n_s_s, __pyx_n_s_h, __pyx_n_s_coupled, __pyx_n_s_label); if (unlikely(!__pyx_tuple__140)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__140);
  __Pyx_GIVEREF(__pyx_tuple__140);
  __pyx_codeobj__141 = (PyObject*)__Pyx_PyCode_New(8, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_n_s_init, 189, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__141)) __PYX_ERR(0, 189, __pyx_L1_error)

  /* "fwdpy/regions.pyx":217
 *         self.s=float(s)
 *         super(ConstantS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Constant s DFE, s = "+"{:.9f}".format(self.s)+", "+super(ConstantS,self).__str__()
 * 
 */
  __pyx_tuple__142 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__142)) __PYX_ERR(0, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__142);
  __Pyx_GIVEREF(__pyx_tuple__142);
  __pyx_codeobj__143 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_n_s_str, 217, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__143)) __PYX_ERR(0, 217, __pyx_L1_error)

  /* "fwdpy/regions.pyx":235
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float lo,float hi,float h=1.0,coupled=True):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
  __pyx_tuple__144 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_beg, __pyx_n_s_end, __pyx_n_s_weight, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_h, __pyx_n_s_coupled); if (unlikely(!__pyx_tuple__144)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__144);
  __Pyx_GIVEREF(__pyx_tuple__144);
  __pyx_codeobj__145 = (PyObject*)__Pyx_PyCode_New(8, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__144, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_n_s_init, 235, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__145)) __PYX_ERR(0, 235, __pyx_L1_error)

  /* "fwdpy/regions.pyx":269
 *         self.hi=float(hi)
 *         super(UniformS,self).__init__(beg,end,weight,h,coupled)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Uniform s DFE, lo = "+"{:.9f}".format(self.lo)+", hi = "+"{:.9f}".format(self.hi)+", "+super(UniformS,self).__str__()
 * 
 */
  __pyx_tuple__146 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__146)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__146);
  __Pyx_GIVEREF(__pyx_tuple__146);
  __pyx_codeobj__147 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__146, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_n_s_str, 269, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__147)) __PYX_ERR(0, 269, __pyx_L1_error)

  /* "fwdpy/regions.pyx":286
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float mean,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
  __pyx_tuple__148 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_beg, __pyx_n_s_end, __pyx_n_s_weight, __pyx_n_s_mean, __pyx_n_s_h, __pyx_n_s_coupled, __pyx_n_s_label); if (unlikely(!__pyx_tuple__148)) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__148);
  __Pyx_GIVEREF(__pyx_tuple__148);
  __pyx_codeobj__149 = (PyObject*)__Pyx_PyCode_New(8, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__148, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_n_s_init, 286, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__149)) __PYX_ERR(0, 286, __pyx_L1_error)

  /* "fwdpy/regions.pyx":314
 *         self.mean=float(mean)
 *         super(ExpS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Exponential DFE, mean = "+"{:.9f}".format(self.mean)+", "+super(ExpS,self).__str__()
 * 
 */
  __pyx_tuple__150 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__150)) __PYX_ERR(0, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__150);
  __Pyx_GIVEREF(__pyx_tuple__150);
  __pyx_codeobj__151 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__150, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_n_s_str, 314, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__151)) __PYX_ERR(0, 314, __pyx_L1_error)

  /* "fwdpy/regions.pyx":333
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float sd,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
  __pyx_tuple__152 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_beg, __pyx_n_s_end, __pyx_n_s_weight, __pyx_n_s_sd, __pyx_n_s_h, __pyx_n_s_coupled, __pyx_n_s_label); if (unlikely(!__pyx_tuple__152)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__152);
  __Pyx_GIVEREF(__pyx_tuple__152);
  __pyx_codeobj__153 = (PyObject*)__Pyx_PyCode_New(8, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__152, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_n_s_init, 333, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__153)) __PYX_ERR(0, 333, __pyx_L1_error)

  /* "fwdpy/regions.pyx":361
 *         self.sd=float(sd)
 *         super(GaussianS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Gaussian DFE, s.d. = "+"{:.9f}".format(self.sd)+", "+super(GaussianS,self).__str__()
 */
  __pyx_tuple__154 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__154)) __PYX_ERR(0, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__154);
  __Pyx_GIVEREF(__pyx_tuple__154);
  __pyx_codeobj__155 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__154, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_regi, __pyx_n_s_str, 361, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__155)) __PYX_ERR(0, 361, __pyx_L1_error)

  /* "fwdpy/copy.pyx":3
 * import fwdpyio as fpio
 * 
 * def copypop(PopType pop):             # <<<<<<<<<<<<<<
 *     """
 *     Copy a population
 */
  __pyx_tuple__156 = PyTuple_Pack(2, __pyx_n_s_pop, __pyx_n_s_s); if (unlikely(!__pyx_tuple__156)) __PYX_ERR(6, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__156);
  __Pyx_GIVEREF(__pyx_tuple__156);
  __pyx_codeobj__157 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__156, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_copy, __pyx_n_s_copypop, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__157)) __PYX_ERR(6, 3, __pyx_L1_error)

  /* "fwdpy/copy.pyx":21
 *         raise RuntimeError("fwdpy.copypop: PopType "+str(type(pop))+" is not supported")
 * 
 * def copypops(PopVec pops):             # <<<<<<<<<<<<<<
 *     """
 *     Copy a population
 */
  __pyx_tuple__158 = PyTuple_Pack(3, __pyx_n_s_pops, __pyx_n_s_s, __pyx_n_s_pop); if (unlikely(!__pyx_tuple__158)) __PYX_ERR(6, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__158);
  __Pyx_GIVEREF(__pyx_tuple__158);
  __pyx_codeobj__159 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__158, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_copy, __pyx_n_s_copypops, 21, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__159)) __PYX_ERR(6, 21, __pyx_L1_error)

  /* "fwdpy/views.pyx":152
 *     return rv
 * 
 * def view_mutations_singlepop(Spop p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg = p.pop.get().mutations.begin()
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()
 */
  __pyx_tuple__160 = PyTuple_Pack(4, __pyx_n_s_p, __pyx_n_s_beg, __pyx_n_s_end, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__160)) __PYX_ERR(3, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__160);
  __Pyx_GIVEREF(__pyx_tuple__160);
  __pyx_codeobj__161 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__160, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_mutations_singlepop, 152, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__161)) __PYX_ERR(3, 152, __pyx_L1_error)

  /* "fwdpy/views.pyx":160
 *     return rv
 * 
 * def view_mutations_singlepop_mloc(MlocusPop p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg = p.pop.get().mutations.begin()
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()
 */
  __pyx_tuple__162 = PyTuple_Pack(4, __pyx_n_s_p, __pyx_n_s_beg, __pyx_n_s_end, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__162)) __PYX_ERR(3, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__162);
  __Pyx_GIVEREF(__pyx_tuple__162);
  __pyx_codeobj__163 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__162, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_mutations_singlepop_mloc, 160, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__163)) __PYX_ERR(3, 160, __pyx_L1_error)

  /* "fwdpy/views.pyx":168
 *     return rv
 * 
 * def view_mutations_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg,end
 *     cdef vector[vector[popgen_mut_data]] rv
 */
  __pyx_tuple__164 = PyTuple_Pack(6, __pyx_n_s_p, __pyx_n_s_beg, __pyx_n_s_end, __pyx_n_s_rv, __pyx_n_s_npops, __pyx_n_s_i); if (unlikely(!__pyx_tuple__164)) __PYX_ERR(3, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__164);
  __Pyx_GIVEREF(__pyx_tuple__164);
  __pyx_codeobj__165 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__164, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_mutations_popvec, 168, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__165)) __PYX_ERR(3, 168, __pyx_L1_error)

  /* "fwdpy/views.pyx":180
 *     return rv
 * 
 * def view_mutations_popvec_mloc(MlocusPopVec p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg,end
 *     cdef vector[vector[popgen_mut_data]] rv
 */
  __pyx_tuple__166 = PyTuple_Pack(6, __pyx_n_s_p, __pyx_n_s_beg, __pyx_n_s_end, __pyx_n_s_rv, __pyx_n_s_npops, __pyx_n_s_i); if (unlikely(!__pyx_tuple__166)) __PYX_ERR(3, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__166);
  __Pyx_GIVEREF(__pyx_tuple__166);
  __pyx_codeobj__167 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__166, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_mutations_popvec_mloc, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__167)) __PYX_ERR(3, 180, __pyx_L1_error)

  /* "fwdpy/views.pyx":192
 *     return rv
 * 
 * def view_mutations_metapop(MetaPop p,unsigned deme):             # <<<<<<<<<<<<<<
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_mutations: deme index out of range")
 */
  __pyx_tuple__168 = PyTuple_Pack(10, __pyx_n_s_p, __pyx_n_s_deme, __pyx_n_s_gams, __pyx_n_s_allmuts, __pyx_n_s_umuts, __pyx_n_s_g, __pyx_n_s_m, __pyx_n_s_rv, __pyx_n_s_dummy, __pyx_n_s_i); if (unlikely(!__pyx_tuple__168)) __PYX_ERR(3, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__168);
  __Pyx_GIVEREF(__pyx_tuple__168);
  __pyx_codeobj__169 = (PyObject*)__Pyx_PyCode_New(2, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__168, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_mutations_metapop, 192, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__169)) __PYX_ERR(3, 192, __pyx_L1_error)

  /* "fwdpy/views.pyx":218
 *     return rv
 * 
 * def view_mutations(object p, deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Get detailed list of all mutations in the population
 */
  __pyx_tuple__170 = PyTuple_Pack(2, __pyx_n_s_p, __pyx_n_s_deme); if (unlikely(!__pyx_tuple__170)) __PYX_ERR(3, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__170);
  __Pyx_GIVEREF(__pyx_tuple__170);
  __pyx_codeobj__171 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__170, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_mutations, 218, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__171)) __PYX_ERR(3, 218, __pyx_L1_error)

  /* "fwdpy/views.pyx":257
 *         raise RuntimeError("view_mutations: unsupported object type")
 * 
 * def view_gametes_singlepop(Spop p):             # <<<<<<<<<<<<<<
 *     return view_gametes_details(p.pop.get())
 * 
 */
  __pyx_tuple__172 = PyTuple_Pack(1, __pyx_n_s_p); if (unlikely(!__pyx_tuple__172)) __PYX_ERR(3, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__172);
  __Pyx_GIVEREF(__pyx_tuple__172);
  __pyx_codeobj__173 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__172, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_gametes_singlepop, 257, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__173)) __PYX_ERR(3, 257, __pyx_L1_error)

  /* "fwdpy/views.pyx":260
 *     return view_gametes_details(p.pop.get())
 * 
 * def view_gametes_singlepop_mloc(MlocusPop p):             # <<<<<<<<<<<<<<
 *     return view_gametes_details_mloc(p.pop.get())
 * 
 */
  __pyx_tuple__174 = PyTuple_Pack(1, __pyx_n_s_p); if (unlikely(!__pyx_tuple__174)) __PYX_ERR(3, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__174);
  __Pyx_GIVEREF(__pyx_tuple__174);
  __pyx_codeobj__175 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_gametes_singlepop_mloc, 260, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__175)) __PYX_ERR(3, 260, __pyx_L1_error)

  /* "fwdpy/views.pyx":263
 *     return view_gametes_details_mloc(p.pop.get())
 * 
 * def view_gametes_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     cdef:
 *         gcont_t_itr beg,end
 */
  __pyx_tuple__176 = PyTuple_Pack(6, __pyx_n_s_p, __pyx_n_s_beg, __pyx_n_s_end, __pyx_n_s_npops, __pyx_n_s_i, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__176)) __PYX_ERR(3, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__176);
  __Pyx_GIVEREF(__pyx_tuple__176);
  __pyx_codeobj__177 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__176, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_gametes_popvec, 263, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__177)) __PYX_ERR(3, 263, __pyx_L1_error)

  /* "fwdpy/views.pyx":274
 *     return rv
 * 
 * def view_gametes_popvec_mloc(MlocusPopVec p):             # <<<<<<<<<<<<<<
 *     cdef:
 *         gcont_t_itr beg,end
 */
  __pyx_tuple__178 = PyTuple_Pack(6, __pyx_n_s_p, __pyx_n_s_beg, __pyx_n_s_end, __pyx_n_s_npops, __pyx_n_s_i, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__178)) __PYX_ERR(3, 274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__178);
  __Pyx_GIVEREF(__pyx_tuple__178);
  __pyx_codeobj__179 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__178, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_gametes_popvec_mloc, 274, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__179)) __PYX_ERR(3, 274, __pyx_L1_error)

  /* "fwdpy/views.pyx":285
 *     return rv
 * 
 * def view_gametes_metapop(MetaPop p, unsigned deme):             # <<<<<<<<<<<<<<
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_gametes: deme index out of range")
 */
  __pyx_tuple__180 = PyTuple_Pack(7, __pyx_n_s_p, __pyx_n_s_deme, __pyx_n_s_temp1, __pyx_n_s_unique_gams, __pyx_n_s_allgams, __pyx_n_s_i, __pyx_n_s_dummy); if (unlikely(!__pyx_tuple__180)) __PYX_ERR(3, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__180);
  __Pyx_GIVEREF(__pyx_tuple__180);
  __pyx_codeobj__181 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__180, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_gametes_metapop, 285, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__181)) __PYX_ERR(3, 285, __pyx_L1_error)

  /* "fwdpy/views.pyx":308
 *     return temp1
 * 
 * def view_gametes(object p ,deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Get detailed list of all gametes in the population
 */
  __pyx_tuple__182 = PyTuple_Pack(2, __pyx_n_s_p, __pyx_n_s_deme); if (unlikely(!__pyx_tuple__182)) __PYX_ERR(3, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__182);
  __Pyx_GIVEREF(__pyx_tuple__182);
  __pyx_codeobj__183 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__182, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_gametes, 308, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__183)) __PYX_ERR(3, 308, __pyx_L1_error)

  /* "fwdpy/views.pyx":347
 *         raise RuntimeError("view_gametes: unsupported object type")
 * 
 * def view_diploids_singlepop(Spop p, list indlist):             # <<<<<<<<<<<<<<
 *     for i in indlist:
 *         if i >= p.popsize():
 */
  __pyx_tuple__184 = PyTuple_Pack(3, __pyx_n_s_p, __pyx_n_s_indlist, __pyx_n_s_i); if (unlikely(!__pyx_tuple__184)) __PYX_ERR(3, 347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__184);
  __Pyx_GIVEREF(__pyx_tuple__184);
  __pyx_codeobj__185 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__184, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_diploids_singlepop, 347, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__185)) __PYX_ERR(3, 347, __pyx_L1_error)

  /* "fwdpy/views.pyx":353
 *     return view_diploids_details(p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts,indlist)
 * 
 * def view_diploids_singlepop_mloc(MlocusPop p, list indlist):             # <<<<<<<<<<<<<<
 *     for i in indlist:
 *         if i >= p.popsize():
 */
  __pyx_tuple__186 = PyTuple_Pack(3, __pyx_n_s_p, __pyx_n_s_indlist, __pyx_n_s_i); if (unlikely(!__pyx_tuple__186)) __PYX_ERR(3, 353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__186);
  __Pyx_GIVEREF(__pyx_tuple__186);
  __pyx_codeobj__187 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__186, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_diploids_singlepop_mloc, 353, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__187)) __PYX_ERR(3, 353, __pyx_L1_error)

  /* "fwdpy/views.pyx":360
 * 
 * 
 * def view_diploids_popvec(SpopVec p, list indlist):             # <<<<<<<<<<<<<<
 *     cdef size_t npops = len(p),i
 *     cdef vector[vector[diploid_data]] rv
 */
  __pyx_tuple__188 = PyTuple_Pack(6, __pyx_n_s_p, __pyx_n_s_indlist, __pyx_n_s_npops, __pyx_n_s_i, __pyx_n_s_rv, __pyx_n_s_il); if (unlikely(!__pyx_tuple__188)) __PYX_ERR(3, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__188);
  __Pyx_GIVEREF(__pyx_tuple__188);
  __pyx_codeobj__189 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__188, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_diploids_popvec, 360, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__189)) __PYX_ERR(3, 360, __pyx_L1_error)

  /* "fwdpy/views.pyx":374
 *     return rv
 * 
 * def view_diploids_popvec_mloc(MlocusPopVec p, list indlist):             # <<<<<<<<<<<<<<
 *     cdef size_t npops = len(p),i
 *     cdef vector[vector[diploid_mloc_data]] rv
 */
  __pyx_tuple__190 = PyTuple_Pack(6, __pyx_n_s_p, __pyx_n_s_indlist, __pyx_n_s_npops, __pyx_n_s_i, __pyx_n_s_rv, __pyx_n_s_il); if (unlikely(!__pyx_tuple__190)) __PYX_ERR(3, 374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__190);
  __Pyx_GIVEREF(__pyx_tuple__190);
  __pyx_codeobj__191 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__190, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_diploids_popvec_mloc, 374, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__191)) __PYX_ERR(3, 374, __pyx_L1_error)

  /* "fwdpy/views.pyx":388
 *     return rv
 * 
 * def view_diploids_metapop(MetaPop p, list indlist, unsigned deme):             # <<<<<<<<<<<<<<
 *     psizes = p.popsizes()
 *     for i in indlist:
 */
  __pyx_tuple__192 = PyTuple_Pack(6, __pyx_n_s_p, __pyx_n_s_indlist, __pyx_n_s_deme, __pyx_n_s_psizes, __pyx_n_s_i, __pyx_n_s_ps); if (unlikely(!__pyx_tuple__192)) __PYX_ERR(3, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__192);
  __Pyx_GIVEREF(__pyx_tuple__192);
  __pyx_codeobj__193 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__192, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_diploids_metapop, 388, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__193)) __PYX_ERR(3, 388, __pyx_L1_error)

  /* "fwdpy/views.pyx":398
 *     return view_diploids_details(p.mpop.get().diploids[deme],p.mpop.get().gametes,p.mpop.get().mutations,p.mpop.get().mcounts,indlist)
 * 
 * def view_diploids(object p, list indlist, deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Get detailed list of a set of diploids in the population
 */
  __pyx_tuple__194 = PyTuple_Pack(3, __pyx_n_s_p, __pyx_n_s_indlist, __pyx_n_s_deme); if (unlikely(!__pyx_tuple__194)) __PYX_ERR(3, 398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__194);
  __Pyx_GIVEREF(__pyx_tuple__194);
  __pyx_codeobj__195 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__194, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_diploids, 398, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__195)) __PYX_ERR(3, 398, __pyx_L1_error)

  /* "fwdpy/views.pyx":493
 *     move[map[double,string].iterator,back_insert_itr](m.begin(),m.end(),back_inserter[fwdpy_sample_t](v))
 * 
 * def diploid_view_to_sample(list view):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a "view" of diploids into the data types returned from :func:`fwdpy.fwdpy.get_samples`
 */
  __pyx_tuple__196 = PyTuple_Pack(16, __pyx_n_s_view, __pyx_n_s_ttl_nsam, __pyx_n_s_neutral, __pyx_n_s_selected, __pyx_n_s_map_itr, __pyx_n_s_neutral_info, __pyx_n_s_selected_info, __pyx_n_s_ancestral, __pyx_n_s_derived, __pyx_n_s_dip, __pyx_n_s_size_2, __pyx_n_s_vneutral, __pyx_n_s_vselected, __pyx_n_s_neutral_df, __pyx_n_s_selected_df, __pyx_n_s_i); if (unlikely(!__pyx_tuple__196)) __PYX_ERR(3, 493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__196);
  __Pyx_GIVEREF(__pyx_tuple__196);
  __pyx_codeobj__197 = (PyObject*)__Pyx_PyCode_New(1, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__196, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_diploid_view_to_sample, 493, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__197)) __PYX_ERR(3, 493, __pyx_L1_error)

  /* "fwdpy/views.pyx":553
 *     return {'neutral':vneutral,'selected':vselected,'neutral_info':neutral_df,'selected_info':selected_df}
 * 
 * def diploid_mloc_view_to_sample(list view):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a "view" of diploids into the data types returned from :func:`fwdpy.fwdpy.get_samples`
 */
  __pyx_tuple__198 = PyTuple_Pack(16, __pyx_n_s_view, __pyx_n_s_ttl_nsam, __pyx_n_s_neutral, __pyx_n_s_selected, __pyx_n_s_map_itr, __pyx_n_s_neutral_info, __pyx_n_s_selected_info, __pyx_n_s_ancestral, __pyx_n_s_derived, __pyx_n_s_dip, __pyx_n_s_i, __pyx_n_s_size_2, __pyx_n_s_vneutral, __pyx_n_s_vselected, __pyx_n_s_neutral_df, __pyx_n_s_selected_df); if (unlikely(!__pyx_tuple__198)) __PYX_ERR(3, 553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__198);
  __Pyx_GIVEREF(__pyx_tuple__198);
  __pyx_codeobj__199 = (PyObject*)__Pyx_PyCode_New(1, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__198, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_diploid_mloc_view_to_sample, 553, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__199)) __PYX_ERR(3, 553, __pyx_L1_error)

  /* "fwdpy/views.pyx":685
 *         inc(beg)
 * 
 * def view_diploids_pd_popvec(SpopVec p,             # <<<<<<<<<<<<<<
 *                             vector[unsigned] & indlist,
 *                             bint selectedOnly):
 */
  __pyx_tuple__200 = PyTuple_Pack(6, __pyx_n_s_p, __pyx_n_s_indlist, __pyx_n_s_selectedOnly, __pyx_n_s_npops, __pyx_n_s_i, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__200)) __PYX_ERR(3, 685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__200);
  __Pyx_GIVEREF(__pyx_tuple__200);
  __pyx_codeobj__201 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__200, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_diploids_pd_popvec, 685, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__201)) __PYX_ERR(3, 685, __pyx_L1_error)

  /* "fwdpy/views.pyx":696
 *     return rv
 * 
 * def view_diploids_pd_singlepop(Spop p,             # <<<<<<<<<<<<<<
 *                                vector[unsigned] & indlist,
 *                                bint selectedOnly):
 */
  __pyx_tuple__202 = PyTuple_Pack(3, __pyx_n_s_p, __pyx_n_s_indlist, __pyx_n_s_selectedOnly); if (unlikely(!__pyx_tuple__202)) __PYX_ERR(3, 696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__202);
  __Pyx_GIVEREF(__pyx_tuple__202);
  __pyx_codeobj__203 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__202, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_diploids_pd_singlepop, 696, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__203)) __PYX_ERR(3, 696, __pyx_L1_error)

  /* "fwdpy/views.pyx":701
 *     return view_diploids_pd_details(p.pop.get(),indlist,selectedOnly)
 * 
 * def view_diploids_pd(object p,             # <<<<<<<<<<<<<<
 *                      list indlist,
 *                      bint selectedOnly = True):
 */
  __pyx_tuple__204 = PyTuple_Pack(4, __pyx_n_s_p, __pyx_n_s_indlist, __pyx_n_s_selectedOnly, __pyx_n_s_i); if (unlikely(!__pyx_tuple__204)) __PYX_ERR(3, 701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__204);
  __Pyx_GIVEREF(__pyx_tuple__204);
  __pyx_codeobj__205 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__204, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_view_diploids_pd, 701, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__205)) __PYX_ERR(3, 701, __pyx_L1_error)

  /* "fwdpy/views.pyx":756
 *     return [diploid_traits_mpop(i,deme) for i in p]
 * 
 * def diploid_traits(object p, deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Return genetic value (g), environmental value (e), and fitness (w) for all diploids.
 */
  __pyx_tuple__206 = PyTuple_Pack(2, __pyx_n_s_p, __pyx_n_s_deme); if (unlikely(!__pyx_tuple__206)) __PYX_ERR(3, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__206);
  __Pyx_GIVEREF(__pyx_tuple__206);
  __pyx_codeobj__207 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__206, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view, __pyx_n_s_diploid_traits, 756, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__207)) __PYX_ERR(3, 756, __pyx_L1_error)

  /* "fwdpy/view_fixations.pyx":27
 *     return rv
 * 
 * def view_fixations_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     cdef vector[vector[popgen_mut_data]] rv
 *     cdef size_t npops=p.pops.size()
 */
  __pyx_tuple__208 = PyTuple_Pack(4, __pyx_n_s_p, __pyx_n_s_rv, __pyx_n_s_npops, __pyx_n_s_i); if (unlikely(!__pyx_tuple__208)) __PYX_ERR(7, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__208);
  __Pyx_GIVEREF(__pyx_tuple__208);
  __pyx_codeobj__209 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__208, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view_2, __pyx_n_s_view_fixations_popvec, 27, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__209)) __PYX_ERR(7, 27, __pyx_L1_error)

  /* "fwdpy/view_fixations.pyx":36
 *     return rv
 * 
 * def view_fixations_mlocuspopvec(MlocusPopVec p):             # <<<<<<<<<<<<<<
 *     cdef vector[vector[popgen_mut_data]] rv
 *     cdef size_t npops=p.pops.size()
 */
  __pyx_tuple__210 = PyTuple_Pack(4, __pyx_n_s_p, __pyx_n_s_rv, __pyx_n_s_npops, __pyx_n_s_i); if (unlikely(!__pyx_tuple__210)) __PYX_ERR(7, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__210);
  __Pyx_GIVEREF(__pyx_tuple__210);
  __pyx_codeobj__211 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__210, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view_2, __pyx_n_s_view_fixations_mlocuspopvec, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__211)) __PYX_ERR(7, 36, __pyx_L1_error)

  /* "fwdpy/view_fixations.pyx":45
 *     return rv
 * 
 * def view_fixations(object p):             # <<<<<<<<<<<<<<
 *     """
 *     Return information on fixed variants
 */
  __pyx_tuple__212 = PyTuple_Pack(1, __pyx_n_s_p); if (unlikely(!__pyx_tuple__212)) __PYX_ERR(7, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__212);
  __Pyx_GIVEREF(__pyx_tuple__212);
  __pyx_codeobj__213 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__212, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_view_2, __pyx_n_s_view_fixations, 45, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__213)) __PYX_ERR(7, 45, __pyx_L1_error)

  /* "fwdpy/debug.pyx":1
 * def check_popdata_singlepop(Spop p):             # <<<<<<<<<<<<<<
 *     cdef bint csum = check_sum[gcont_t](p.pop.get().gametes,2*(<unsigned>p.pop.get().diploids.size()))
 *     cdef bint pds = popdata_sane[dipvector_t,gcont_t,mcont_t](p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts)
 */
  __pyx_tuple__214 = PyTuple_Pack(3, __pyx_n_s_p, __pyx_n_s_csum, __pyx_n_s_pds); if (unlikely(!__pyx_tuple__214)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__214);
  __Pyx_GIVEREF(__pyx_tuple__214);
  __pyx_codeobj__215 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__214, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_debu, __pyx_n_s_check_popdata_singlepop, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__215)) __PYX_ERR(8, 1, __pyx_L1_error)

  /* "fwdpy/debug.pyx":6
 *     return {'check_sum':csum,'popdata_sane':pds}
 * 
 * def check_popdata_metapop(MetaPop p):             # <<<<<<<<<<<<<<
 *     cdef bint csum = check_sum[gcont_t](p.mpop.get().gametes,2*(<unsigned>p.mpop.get().diploids.size()))
 *     lpds=[]
 */
  __pyx_tuple__216 = PyTuple_Pack(6, __pyx_n_s_p, __pyx_n_s_csum, __pyx_n_s_lpds, __pyx_n_s_pds, __pyx_n_s_i, __pyx_n_s_ndemes); if (unlikely(!__pyx_tuple__216)) __PYX_ERR(8, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__216);
  __Pyx_GIVEREF(__pyx_tuple__216);
  __pyx_codeobj__217 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__216, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_debu, __pyx_n_s_check_popdata_metapop, 6, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__217)) __PYX_ERR(8, 6, __pyx_L1_error)

  /* "fwdpy/debug.pyx":18
 *     return {'check_sum':csum,'popdata_sane':lpds}
 * 
 * def check_popdata_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     return [check_popdata_singlepop(i) for i in p]
 * 
 */
  __pyx_tuple__218 = PyTuple_Pack(2, __pyx_n_s_p, __pyx_n_s_i); if (unlikely(!__pyx_tuple__218)) __PYX_ERR(8, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__218);
  __Pyx_GIVEREF(__pyx_tuple__218);
  __pyx_codeobj__219 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__218, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_debu, __pyx_n_s_check_popdata_popvec, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__219)) __PYX_ERR(8, 18, __pyx_L1_error)

  /* "fwdpy/debug.pyx":21
 *     return [check_popdata_singlepop(i) for i in p]
 * 
 * def check_popdata_mpopvec(MetaPopVec p):             # <<<<<<<<<<<<<<
 *     return [check_popdata_metapop(i) for i in p]
 * 
 */
  __pyx_tuple__220 = PyTuple_Pack(2, __pyx_n_s_p, __pyx_n_s_i); if (unlikely(!__pyx_tuple__220)) __PYX_ERR(8, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__220);
  __Pyx_GIVEREF(__pyx_tuple__220);
  __pyx_codeobj__221 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__220, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_debu, __pyx_n_s_check_popdata_mpopvec, 21, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__221)) __PYX_ERR(8, 21, __pyx_L1_error)

  /* "fwdpy/debug.pyx":24
 *     return [check_popdata_metapop(i) for i in p]
 * 
 * def check_popdata(object p):             # <<<<<<<<<<<<<<
 *     """
 *     Apply fwdpp's debugging functions to population containers.
 */
  __pyx_tuple__222 = PyTuple_Pack(1, __pyx_n_s_p); if (unlikely(!__pyx_tuple__222)) __PYX_ERR(8, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__222);
  __Pyx_GIVEREF(__pyx_tuple__222);
  __pyx_codeobj__223 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__222, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_debu, __pyx_n_s_check_popdata, 24, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__223)) __PYX_ERR(8, 24, __pyx_L1_error)

  /* "fwdpy/ages.pyx":5
 * from libcpp.limits cimport numeric_limits
 * 
 * def allele_ages( list trajectories, double minfreq = 0.0, unsigned minsojourn = 1 ):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate allele age information from mutation frequency trajectories.
 */
  __pyx_tuple__224 = PyTuple_Pack(3, __pyx_n_s_trajectories, __pyx_n_s_minfreq, __pyx_n_s_minsojourn); if (unlikely(!__pyx_tuple__224)) __PYX_ERR(9, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__224);
  __Pyx_GIVEREF(__pyx_tuple__224);
  __pyx_codeobj__225 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__224, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_ages, __pyx_n_s_allele_ages, 5, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__225)) __PYX_ERR(9, 5, __pyx_L1_error)

  /* "fwdpy/ages.pyx":14
 *     return  allele_ages_details(trajectories,minfreq,minsojourn)
 * 
 * def merge_trajectories(list trajectories1, list trajectories2):             # <<<<<<<<<<<<<<
 * 
 *     """
 */
  __pyx_tuple__226 = PyTuple_Pack(2, __pyx_n_s_trajectories1, __pyx_n_s_trajectories2); if (unlikely(!__pyx_tuple__226)) __PYX_ERR(9, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__226);
  __Pyx_GIVEREF(__pyx_tuple__226);
  __pyx_codeobj__227 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__226, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_ages, __pyx_n_s_merge_trajectories, 14, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__227)) __PYX_ERR(9, 14, __pyx_L1_error)

  /* "fwdpy/ages.pyx":38
 * #    return rv
 * #
 * def tidy_trajectories_details(list trajectories,unsigned min_sojourn, double min_freq,             # <<<<<<<<<<<<<<
 *         unsigned remove_arose_after,unsigned remove_gone_before):
 *     return tidy_trajectory_info(trajectories,min_sojourn,min_freq,remove_gone_before,remove_arose_after)
 */
  __pyx_tuple__228 = PyTuple_Pack(5, __pyx_n_s_trajectories, __pyx_n_s_min_sojourn, __pyx_n_s_min_freq, __pyx_n_s_remove_arose_after, __pyx_n_s_remove_gone_before); if (unlikely(!__pyx_tuple__228)) __PYX_ERR(9, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__228);
  __Pyx_GIVEREF(__pyx_tuple__228);
  __pyx_codeobj__229 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__228, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_ages, __pyx_n_s_tidy_trajectories_details, 38, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__229)) __PYX_ERR(9, 38, __pyx_L1_error)

  /* "fwdpy/ages.pyx":47
 * #        yield tidy_trajectory_info((<freqTrajectories>i).thisptr,min_sojourn,min_freq,remove_gone_before,remove_arose_after)
 * 
 * def tidy_trajectories(trajectories, unsigned min_sojourn = 0, double min_freq = 0.0,             # <<<<<<<<<<<<<<
 *         remove_arose_after = None,remove_gone_before = None):
 *     """
 */
  __pyx_tuple__230 = PyTuple_Pack(8, __pyx_n_s_trajectories, __pyx_n_s_min_sojourn, __pyx_n_s_min_freq, __pyx_n_s_remove_arose_after, __pyx_n_s_remove_gone_before, __pyx_n_s_ul, __pyx_n_s_raf, __pyx_n_s_rgb); if (unlikely(!__pyx_tuple__230)) __PYX_ERR(9, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__230);
  __Pyx_GIVEREF(__pyx_tuple__230);
  __pyx_codeobj__231 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__230, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_ages, __pyx_n_s_tidy_trajectories, 47, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__231)) __PYX_ERR(9, 47, __pyx_L1_error)

  /* "fwdpy/temporal_samplers.pyx":203
 *         return self.vec.size()
 * 
 * def apply_sampler(PopVec pops,TemporalSampler sampler):             # <<<<<<<<<<<<<<
 *     """
 *     Apply a temporal sampler to a container of populations.
 */
  __pyx_tuple__232 = PyTuple_Pack(2, __pyx_n_s_pops, __pyx_n_s_sampler); if (unlikely(!__pyx_tuple__232)) __PYX_ERR(4, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__232);
  __Pyx_GIVEREF(__pyx_tuple__232);
  __pyx_codeobj__233 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__232, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_temp, __pyx_n_s_apply_sampler, 203, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__233)) __PYX_ERR(4, 203, __pyx_L1_error)

  /* "fwdpy/temporal_samplers.pyx":225
 *         raise RuntimeError("PopVec/PopType type not supported")
 * 
 * def apply_sampler_single(PopType pop,TemporalSampler sampler):             # <<<<<<<<<<<<<<
 *     """
 *     Apply a temporal sampler to an indivudal :class:`fwdpy.fwdpy.PopType`
 */
  __pyx_tuple__234 = PyTuple_Pack(2, __pyx_n_s_pop, __pyx_n_s_sampler); if (unlikely(!__pyx_tuple__234)) __PYX_ERR(4, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__234);
  __Pyx_GIVEREF(__pyx_tuple__234);
  __pyx_codeobj__235 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__234, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_temp, __pyx_n_s_apply_sampler_single, 225, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__235)) __PYX_ERR(4, 225, __pyx_L1_error)

  /* "fwdpy/add_mutations.pyx":3
 * ##Code for adding a mutation into a population
 * 
 * def add_mutation(PopType p,             # <<<<<<<<<<<<<<
 *                  const vector[size_t] & indlist,
 *                  const vector[short] & clist,
 */
  __pyx_tuple__236 = PyTuple_Pack(6, __pyx_n_s_p, __pyx_n_s_indlist, __pyx_n_s_clist, __pyx_n_s_pos, __pyx_n_s_s, __pyx_n_s_h); if (unlikely(!__pyx_tuple__236)) __PYX_ERR(10, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__236);
  __Pyx_GIVEREF(__pyx_tuple__236);
  __pyx_codeobj__237 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__236, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_add, __pyx_n_s_add_mutation, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__237)) __PYX_ERR(10, 3, __pyx_L1_error)

  /* "fwdpy/fwdpy.pyx":21
 * include "add_mutations.pyx"
 * 
 * def pkg_version():             # <<<<<<<<<<<<<<
 *     """
 *     Return version numbers of this package
 */
  __pyx_tuple__238 = PyTuple_Pack(1, __pyx_n_s_v); if (unlikely(!__pyx_tuple__238)) __PYX_ERR(11, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__238);
  __Pyx_GIVEREF(__pyx_tuple__238);
  __pyx_codeobj__239 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__238, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_fwdp, __pyx_n_s_pkg_version, 21, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__239)) __PYX_ERR(11, 21, __pyx_L1_error)

  /* "fwdpy/fwdpy.pyx":32
 *     return ({'fwdpy':v[0]})
 * 
 * def cite():             # <<<<<<<<<<<<<<
 *     """
 *     Returns how to cite this package
 */
  __pyx_codeobj__240 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_kevin_src_fwdpy_fwdpy_fwdp, __pyx_n_s_cite, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__240)) __PYX_ERR(11, 32, __pyx_L1_error)

  /* "View.MemoryView":282
 *         return self.name
 * 
 * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")
 */
  __pyx_tuple__241 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__241)) __PYX_ERR(13, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__241);
  __Pyx_GIVEREF(__pyx_tuple__241);

  /* "View.MemoryView":283
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
 * cdef indirect = Enum("<strided and indirect>")
 * 
 */
  __pyx_tuple__242 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__242)) __PYX_ERR(13, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__242);
  __Pyx_GIVEREF(__pyx_tuple__242);

  /* "View.MemoryView":284
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__243 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__243)) __PYX_ERR(13, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__243);
  __Pyx_GIVEREF(__pyx_tuple__243);

  /* "View.MemoryView":287
 * 
 * 
 * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
 * 
 */
  __pyx_tuple__244 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__244)) __PYX_ERR(13, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__244);
  __Pyx_GIVEREF(__pyx_tuple__244);

  /* "View.MemoryView":288
 * 
 * cdef contiguous = Enum("<contiguous and direct>")
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__245 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__245)) __PYX_ERR(13, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__245);
  __Pyx_GIVEREF(__pyx_tuple__245);
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  /* InitThreads.init */
  #ifdef WITH_THREAD
PyEval_InitThreads();
#endif

if (unlikely(PyErr_Occurred())) __PYX_ERR(11, 1, __pyx_L1_error)

  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(11, 1, __pyx_L1_error);
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(11, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(11, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(11, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initfwdpy(void); /*proto*/
PyMODINIT_FUNC initfwdpy(void)
#else
PyMODINIT_FUNC PyInit_fwdpy(void); /*proto*/
PyMODINIT_FUNC PyInit_fwdpy(void)
#endif
{
  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;
  static PyThread_type_lock __pyx_t_7[8];
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_fwdpy(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(11, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(11, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(11, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(11, 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 PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("fwdpy", __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(11, 1, __pyx_L1_error)
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(11, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(11, 1, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(11, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(11, 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(11, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_fwdpy__fwdpy) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(11, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "fwdpy.fwdpy")) {
      if (unlikely(PyDict_SetItemString(modules, "fwdpy.fwdpy", __pyx_m) < 0)) __PYX_ERR(11, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  /*--- Global init code ---*/
  generic = Py_None; Py_INCREF(Py_None);
  strided = Py_None; Py_INCREF(Py_None);
  indirect = Py_None; Py_INCREF(Py_None);
  contiguous = Py_None; Py_INCREF(Py_None);
  indirect_contiguous = Py_None; Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("get_mutation", (void (*)(void))__pyx_f_5fwdpy_5fwdpy_get_mutation, "struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data (KTfwd::popgenmut const &, size_t)") < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("get_gamete", (void (*)(void))__pyx_f_5fwdpy_5fwdpy_get_gamete, "struct __pyx_t_5fwdpy_5fwdpy_gamete_data (fwdpy::gamete_t const &, fwdpy::mcont_t const &, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &)") < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("get_diploid", (void (*)(void))__pyx_f_5fwdpy_5fwdpy_get_diploid, "struct __pyx_t_5fwdpy_5fwdpy_diploid_data (fwdpy::diploid_t const &, fwdpy::gcont_t const &, fwdpy::mcont_t const &, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &)") < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("get_diploid_mloc", (void (*)(void))__pyx_f_5fwdpy_5fwdpy_get_diploid_mloc, "struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data (fwdpy::dipvector_t const &, fwdpy::gcont_t const &, fwdpy::mcont_t const &, __pyx_t_5fwdpy_5fwdpy_mcounts_cont_t const &)") < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_PopType) < 0) __PYX_ERR(14, 124, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_PopType.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "PopType", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_PopType) < 0) __PYX_ERR(14, 124, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_PopType = &__pyx_type_5fwdpy_5fwdpy_PopType;
  __pyx_vtabptr_5fwdpy_5fwdpy_Spop = &__pyx_vtable_5fwdpy_5fwdpy_Spop;
  __pyx_vtable_5fwdpy_5fwdpy_Spop.gen = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_Spop *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_4Spop_gen;
  __pyx_vtable_5fwdpy_5fwdpy_Spop.popsize = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_Spop *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_4Spop_popsize;
  __pyx_vtable_5fwdpy_5fwdpy_Spop.sane = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_Spop *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_4Spop_sane;
  __pyx_type_5fwdpy_5fwdpy_Spop.tp_base = __pyx_ptype_5fwdpy_5fwdpy_PopType;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_Spop) < 0) __PYX_ERR(1, 4, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_Spop.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5fwdpy_5fwdpy_Spop.tp_dict, __pyx_vtabptr_5fwdpy_5fwdpy_Spop) < 0) __PYX_ERR(1, 4, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Spop", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_Spop) < 0) __PYX_ERR(1, 4, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_Spop = &__pyx_type_5fwdpy_5fwdpy_Spop;
  __pyx_vtabptr_5fwdpy_5fwdpy_MetaPop = &__pyx_vtable_5fwdpy_5fwdpy_MetaPop;
  __pyx_vtable_5fwdpy_5fwdpy_MetaPop.gen = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_7MetaPop_gen;
  __pyx_vtable_5fwdpy_5fwdpy_MetaPop.popsizes = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_7MetaPop_popsizes;
  __pyx_vtable_5fwdpy_5fwdpy_MetaPop.sane = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_7MetaPop_sane;
  __pyx_vtable_5fwdpy_5fwdpy_MetaPop.from_Spop = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_MetaPop *, struct __pyx_obj_5fwdpy_5fwdpy_Spop *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_7MetaPop_from_Spop;
  __pyx_type_5fwdpy_5fwdpy_MetaPop.tp_base = __pyx_ptype_5fwdpy_5fwdpy_PopType;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_MetaPop) < 0) __PYX_ERR(1, 266, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_MetaPop.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5fwdpy_5fwdpy_MetaPop.tp_dict, __pyx_vtabptr_5fwdpy_5fwdpy_MetaPop) < 0) __PYX_ERR(1, 266, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "MetaPop", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_MetaPop) < 0) __PYX_ERR(1, 266, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_MetaPop = &__pyx_type_5fwdpy_5fwdpy_MetaPop;
  __pyx_vtabptr_5fwdpy_5fwdpy_MlocusPop = &__pyx_vtable_5fwdpy_5fwdpy_MlocusPop;
  __pyx_vtable_5fwdpy_5fwdpy_MlocusPop.gen = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_9MlocusPop_gen;
  __pyx_vtable_5fwdpy_5fwdpy_MlocusPop.popsize = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_9MlocusPop_popsize;
  __pyx_vtable_5fwdpy_5fwdpy_MlocusPop.sane = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPop *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_9MlocusPop_sane;
  __pyx_type_5fwdpy_5fwdpy_MlocusPop.tp_base = __pyx_ptype_5fwdpy_5fwdpy_PopType;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_MlocusPop) < 0) __PYX_ERR(1, 70, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_MlocusPop.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5fwdpy_5fwdpy_MlocusPop.tp_dict, __pyx_vtabptr_5fwdpy_5fwdpy_MlocusPop) < 0) __PYX_ERR(1, 70, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "MlocusPop", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_MlocusPop) < 0) __PYX_ERR(1, 70, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_MlocusPop = &__pyx_type_5fwdpy_5fwdpy_MlocusPop;
  __pyx_vtabptr_5fwdpy_5fwdpy_SpopGenMut = &__pyx_vtable_5fwdpy_5fwdpy_SpopGenMut;
  __pyx_vtable_5fwdpy_5fwdpy_SpopGenMut.gen = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_10SpopGenMut_gen;
  __pyx_vtable_5fwdpy_5fwdpy_SpopGenMut.popsize = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_10SpopGenMut_popsize;
  __pyx_vtable_5fwdpy_5fwdpy_SpopGenMut.sane = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMut *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_10SpopGenMut_sane;
  __pyx_type_5fwdpy_5fwdpy_SpopGenMut.tp_base = __pyx_ptype_5fwdpy_5fwdpy_PopType;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_SpopGenMut) < 0) __PYX_ERR(1, 36, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_SpopGenMut.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5fwdpy_5fwdpy_SpopGenMut.tp_dict, __pyx_vtabptr_5fwdpy_5fwdpy_SpopGenMut) < 0) __PYX_ERR(1, 36, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "SpopGenMut", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_SpopGenMut) < 0) __PYX_ERR(1, 36, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_SpopGenMut = &__pyx_type_5fwdpy_5fwdpy_SpopGenMut;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_PopVec) < 0) __PYX_ERR(14, 157, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_PopVec.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "PopVec", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_PopVec) < 0) __PYX_ERR(14, 157, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_PopVec = &__pyx_type_5fwdpy_5fwdpy_PopVec;
  __pyx_vtabptr_5fwdpy_5fwdpy_SpopVec = &__pyx_vtable_5fwdpy_5fwdpy_SpopVec;
  __pyx_vtable_5fwdpy_5fwdpy_SpopVec.size = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_7SpopVec_size;
  __pyx_vtable_5fwdpy_5fwdpy_SpopVec.reset = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *, std::vector<std::shared_ptr<fwdpy::singlepop_t> >  const ))__pyx_f_5fwdpy_5fwdpy_7SpopVec_reset;
  __pyx_vtable_5fwdpy_5fwdpy_SpopVec.append = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *, struct __pyx_obj_5fwdpy_5fwdpy_SpopVec *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_7SpopVec_append;
  __pyx_type_5fwdpy_5fwdpy_SpopVec.tp_base = __pyx_ptype_5fwdpy_5fwdpy_PopVec;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_SpopVec) < 0) __PYX_ERR(1, 102, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_SpopVec.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5fwdpy_5fwdpy_SpopVec.tp_dict, __pyx_vtabptr_5fwdpy_5fwdpy_SpopVec) < 0) __PYX_ERR(1, 102, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "SpopVec", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_SpopVec) < 0) __PYX_ERR(1, 102, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_SpopVec = &__pyx_type_5fwdpy_5fwdpy_SpopVec;
  __pyx_vtabptr_5fwdpy_5fwdpy_SpopGenMutVec = &__pyx_vtable_5fwdpy_5fwdpy_SpopGenMutVec;
  __pyx_vtable_5fwdpy_5fwdpy_SpopGenMutVec.size = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_13SpopGenMutVec_size;
  __pyx_vtable_5fwdpy_5fwdpy_SpopGenMutVec.reset = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_SpopGenMutVec *, std::vector<std::shared_ptr<fwdpy::singlepop_gm_vec_t> >  const ))__pyx_f_5fwdpy_5fwdpy_13SpopGenMutVec_reset;
  __pyx_type_5fwdpy_5fwdpy_SpopGenMutVec.tp_base = __pyx_ptype_5fwdpy_5fwdpy_PopVec;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_SpopGenMutVec) < 0) __PYX_ERR(1, 224, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_SpopGenMutVec.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5fwdpy_5fwdpy_SpopGenMutVec.tp_dict, __pyx_vtabptr_5fwdpy_5fwdpy_SpopGenMutVec) < 0) __PYX_ERR(1, 224, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "SpopGenMutVec", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_SpopGenMutVec) < 0) __PYX_ERR(1, 224, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_SpopGenMutVec = &__pyx_type_5fwdpy_5fwdpy_SpopGenMutVec;
  __pyx_vtabptr_5fwdpy_5fwdpy_MetaPopVec = &__pyx_vtable_5fwdpy_5fwdpy_MetaPopVec;
  __pyx_vtable_5fwdpy_5fwdpy_MetaPopVec.size = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_10MetaPopVec_size;
  __pyx_vtable_5fwdpy_5fwdpy_MetaPopVec.reset = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *, std::vector<std::shared_ptr<fwdpy::metapop_t> >  const &))__pyx_f_5fwdpy_5fwdpy_10MetaPopVec_reset;
  __pyx_vtable_5fwdpy_5fwdpy_MetaPopVec.append = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *, struct __pyx_obj_5fwdpy_5fwdpy_MetaPopVec *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_10MetaPopVec_append;
  __pyx_type_5fwdpy_5fwdpy_MetaPopVec.tp_base = __pyx_ptype_5fwdpy_5fwdpy_PopVec;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_MetaPopVec) < 0) __PYX_ERR(1, 301, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_MetaPopVec.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5fwdpy_5fwdpy_MetaPopVec.tp_dict, __pyx_vtabptr_5fwdpy_5fwdpy_MetaPopVec) < 0) __PYX_ERR(1, 301, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "MetaPopVec", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_MetaPopVec) < 0) __PYX_ERR(1, 301, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_MetaPopVec = &__pyx_type_5fwdpy_5fwdpy_MetaPopVec;
  __pyx_vtabptr_5fwdpy_5fwdpy_MlocusPopVec = &__pyx_vtable_5fwdpy_5fwdpy_MlocusPopVec;
  __pyx_vtable_5fwdpy_5fwdpy_MlocusPopVec.size = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_12MlocusPopVec_size;
  __pyx_vtable_5fwdpy_5fwdpy_MlocusPopVec.reset = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *, std::vector<std::shared_ptr<fwdpy::multilocus_t> >  const ))__pyx_f_5fwdpy_5fwdpy_12MlocusPopVec_reset;
  __pyx_vtable_5fwdpy_5fwdpy_MlocusPopVec.append = (PyObject *(*)(struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *, struct __pyx_obj_5fwdpy_5fwdpy_MlocusPopVec *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_12MlocusPopVec_append;
  __pyx_type_5fwdpy_5fwdpy_MlocusPopVec.tp_base = __pyx_ptype_5fwdpy_5fwdpy_PopVec;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_MlocusPopVec) < 0) __PYX_ERR(1, 162, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_MlocusPopVec.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5fwdpy_5fwdpy_MlocusPopVec.tp_dict, __pyx_vtabptr_5fwdpy_5fwdpy_MlocusPopVec) < 0) __PYX_ERR(1, 162, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "MlocusPopVec", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_MlocusPopVec) < 0) __PYX_ERR(1, 162, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_MlocusPopVec = &__pyx_type_5fwdpy_5fwdpy_MlocusPopVec;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_GSLrng) < 0) __PYX_ERR(1, 363, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_GSLrng.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "GSLrng", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_GSLrng) < 0) __PYX_ERR(1, 363, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_GSLrng = &__pyx_type_5fwdpy_5fwdpy_GSLrng;
  __pyx_vtabptr_5fwdpy_5fwdpy_TemporalSampler = &__pyx_vtable_5fwdpy_5fwdpy_TemporalSampler;
  __pyx_vtable_5fwdpy_5fwdpy_TemporalSampler.size = (size_t (*)(struct __pyx_obj_5fwdpy_5fwdpy_TemporalSampler *, int __pyx_skip_dispatch))__pyx_f_5fwdpy_5fwdpy_15TemporalSampler_size;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_TemporalSampler) < 0) __PYX_ERR(4, 5, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_TemporalSampler.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5fwdpy_5fwdpy_TemporalSampler.tp_dict, __pyx_vtabptr_5fwdpy_5fwdpy_TemporalSampler) < 0) __PYX_ERR(4, 5, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "TemporalSampler", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_TemporalSampler) < 0) __PYX_ERR(4, 5, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_TemporalSampler = &__pyx_type_5fwdpy_5fwdpy_TemporalSampler;
  __pyx_vtabptr_5fwdpy_5fwdpy_NothingSampler = &__pyx_vtable_5fwdpy_5fwdpy_NothingSampler;
  __pyx_vtable_5fwdpy_5fwdpy_NothingSampler.__pyx_base = *__pyx_vtabptr_5fwdpy_5fwdpy_TemporalSampler;
  __pyx_type_5fwdpy_5fwdpy_NothingSampler.tp_base = __pyx_ptype_5fwdpy_5fwdpy_TemporalSampler;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_NothingSampler) < 0) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_NothingSampler.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5fwdpy_5fwdpy_NothingSampler.tp_dict, __pyx_vtabptr_5fwdpy_5fwdpy_NothingSampler) < 0) __PYX_ERR(4, 13, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "NothingSampler", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_NothingSampler) < 0) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_NothingSampler = &__pyx_type_5fwdpy_5fwdpy_NothingSampler;
  __pyx_vtabptr_5fwdpy_5fwdpy_QtraitStatsSampler = &__pyx_vtable_5fwdpy_5fwdpy_QtraitStatsSampler;
  __pyx_vtable_5fwdpy_5fwdpy_QtraitStatsSampler.__pyx_base = *__pyx_vtabptr_5fwdpy_5fwdpy_TemporalSampler;
  __pyx_type_5fwdpy_5fwdpy_QtraitStatsSampler.tp_base = __pyx_ptype_5fwdpy_5fwdpy_TemporalSampler;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_QtraitStatsSampler) < 0) __PYX_ERR(4, 36, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_QtraitStatsSampler.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5fwdpy_5fwdpy_QtraitStatsSampler.tp_dict, __pyx_vtabptr_5fwdpy_5fwdpy_QtraitStatsSampler) < 0) __PYX_ERR(4, 36, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "QtraitStatsSampler", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_QtraitStatsSampler) < 0) __PYX_ERR(4, 36, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_QtraitStatsSampler = &__pyx_type_5fwdpy_5fwdpy_QtraitStatsSampler;
  __pyx_vtabptr_5fwdpy_5fwdpy_PopSampler = &__pyx_vtable_5fwdpy_5fwdpy_PopSampler;
  __pyx_vtable_5fwdpy_5fwdpy_PopSampler.__pyx_base = *__pyx_vtabptr_5fwdpy_5fwdpy_TemporalSampler;
  __pyx_type_5fwdpy_5fwdpy_PopSampler.tp_base = __pyx_ptype_5fwdpy_5fwdpy_TemporalSampler;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_PopSampler) < 0) __PYX_ERR(4, 77, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_PopSampler.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5fwdpy_5fwdpy_PopSampler.tp_dict, __pyx_vtabptr_5fwdpy_5fwdpy_PopSampler) < 0) __PYX_ERR(4, 77, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "PopSampler", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_PopSampler) < 0) __PYX_ERR(4, 77, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_PopSampler = &__pyx_type_5fwdpy_5fwdpy_PopSampler;
  __pyx_vtabptr_5fwdpy_5fwdpy_VASampler = &__pyx_vtable_5fwdpy_5fwdpy_VASampler;
  __pyx_vtable_5fwdpy_5fwdpy_VASampler.__pyx_base = *__pyx_vtabptr_5fwdpy_5fwdpy_TemporalSampler;
  __pyx_type_5fwdpy_5fwdpy_VASampler.tp_base = __pyx_ptype_5fwdpy_5fwdpy_TemporalSampler;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_VASampler) < 0) __PYX_ERR(4, 135, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_VASampler.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5fwdpy_5fwdpy_VASampler.tp_dict, __pyx_vtabptr_5fwdpy_5fwdpy_VASampler) < 0) __PYX_ERR(4, 135, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "VASampler", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_VASampler) < 0) __PYX_ERR(4, 135, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_VASampler = &__pyx_type_5fwdpy_5fwdpy_VASampler;
  __pyx_vtabptr_5fwdpy_5fwdpy_FreqSampler = &__pyx_vtable_5fwdpy_5fwdpy_FreqSampler;
  __pyx_vtable_5fwdpy_5fwdpy_FreqSampler.__pyx_base = *__pyx_vtabptr_5fwdpy_5fwdpy_TemporalSampler;
  __pyx_type_5fwdpy_5fwdpy_FreqSampler.tp_base = __pyx_ptype_5fwdpy_5fwdpy_TemporalSampler;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy_FreqSampler) < 0) __PYX_ERR(4, 176, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy_FreqSampler.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5fwdpy_5fwdpy_FreqSampler.tp_dict, __pyx_vtabptr_5fwdpy_5fwdpy_FreqSampler) < 0) __PYX_ERR(4, 176, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "FreqSampler", (PyObject *)&__pyx_type_5fwdpy_5fwdpy_FreqSampler) < 0) __PYX_ERR(4, 176, __pyx_L1_error)
  __pyx_ptype_5fwdpy_5fwdpy_FreqSampler = &__pyx_type_5fwdpy_5fwdpy_FreqSampler;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct____iter__) < 0) __PYX_ERR(1, 123, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct____iter__.tp_print = 0;
  __pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct____iter__ = &__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct____iter__;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__) < 0) __PYX_ERR(1, 184, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__.tp_print = 0;
  __pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__ = &__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_1___iter__;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__) < 0) __PYX_ERR(1, 236, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__.tp_print = 0;
  __pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__ = &__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_2___iter__;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__) < 0) __PYX_ERR(1, 324, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__.tp_print = 0;
  __pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__ = &__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_3___iter__;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__) < 0) __PYX_ERR(4, 54, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__.tp_print = 0;
  __pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__ = &__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_4___iter__;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__) < 0) __PYX_ERR(4, 123, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__.tp_print = 0;
  __pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__ = &__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_5___iter__;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__) < 0) __PYX_ERR(4, 153, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__.tp_print = 0;
  __pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__ = &__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_6___iter__;
  if (PyType_Ready(&__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__) < 0) __PYX_ERR(4, 191, __pyx_L1_error)
  __pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__.tp_print = 0;
  __pyx_ptype_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__ = &__pyx_type_5fwdpy_5fwdpy___pyx_scope_struct_7___iter__;
  __pyx_vtabptr_array = &__pyx_vtable_array;
  __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
  if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(13, 103, __pyx_L1_error)
  __pyx_type___pyx_array.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(13, 103, __pyx_L1_error)
  __pyx_array_type = &__pyx_type___pyx_array;
  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(13, 275, __pyx_L1_error)
  __pyx_type___pyx_MemviewEnum.tp_print = 0;
  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
  __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
  __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
  __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
  __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
  __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
  __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
  __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
  __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
  if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(13, 326, __pyx_L1_error)
  __pyx_type___pyx_memoryview.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(13, 326, __pyx_L1_error)
  __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
  __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
  __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
  __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
  __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
  __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
  if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(13, 951, __pyx_L1_error)
  __pyx_type___pyx_memoryviewslice.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(13, 951, __pyx_L1_error)
  __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
  /*--- Type import code ---*/
  __pyx_ptype_5fwdpy_8internal_8internal_shwrappervec = __Pyx_ImportType("fwdpy.internal.internal", "shwrappervec", sizeof(struct __pyx_obj_5fwdpy_8internal_8internal_shwrappervec), 1); if (unlikely(!__pyx_ptype_5fwdpy_8internal_8internal_shwrappervec)) __PYX_ERR(15, 7, __pyx_L1_error)
  __pyx_ptype_5fwdpy_8internal_8internal_region_manager_wrapper = __Pyx_ImportType("fwdpy.internal.internal", "region_manager_wrapper", sizeof(struct __pyx_obj_5fwdpy_8internal_8internal_region_manager_wrapper), 1); if (unlikely(!__pyx_ptype_5fwdpy_8internal_8internal_region_manager_wrapper)) __PYX_ERR(15, 17, __pyx_L1_error)
  __pyx_ptype_5fwdpy_7fitness_SpopFitness = __Pyx_ImportType("fwdpy.fitness", "SpopFitness", sizeof(struct __pyx_obj_5fwdpy_7fitness_SpopFitness), 1); if (unlikely(!__pyx_ptype_5fwdpy_7fitness_SpopFitness)) __PYX_ERR(16, 108, __pyx_L1_error)
  __pyx_ptype_5fwdpy_7fitness_SpopAdditive = __Pyx_ImportType("fwdpy.fitness", "SpopAdditive", sizeof(struct __pyx_obj_5fwdpy_7fitness_SpopAdditive), 1); if (unlikely(!__pyx_ptype_5fwdpy_7fitness_SpopAdditive)) __PYX_ERR(16, 114, __pyx_L1_error)
  __pyx_ptype_5fwdpy_7fitness_SpopMult = __Pyx_ImportType("fwdpy.fitness", "SpopMult", sizeof(struct __pyx_obj_5fwdpy_7fitness_SpopMult), 1); if (unlikely(!__pyx_ptype_5fwdpy_7fitness_SpopMult)) __PYX_ERR(16, 117, __pyx_L1_error)
  __pyx_ptype_5fwdpy_7fitness_MlocusFitness = __Pyx_ImportType("fwdpy.fitness", "MlocusFitness", sizeof(struct __pyx_obj_5fwdpy_7fitness_MlocusFitness), 1); if (unlikely(!__pyx_ptype_5fwdpy_7fitness_MlocusFitness)) __PYX_ERR(16, 120, __pyx_L1_error)
  __pyx_ptype_5fwdpy_7fitness_MlocusAdditive = __Pyx_ImportType("fwdpy.fitness", "MlocusAdditive", sizeof(struct __pyx_obj_5fwdpy_7fitness_MlocusAdditive), 1); if (unlikely(!__pyx_ptype_5fwdpy_7fitness_MlocusAdditive)) __PYX_ERR(16, 126, __pyx_L1_error)
  __pyx_ptype_5fwdpy_7fitness_MlocusMult = __Pyx_ImportType("fwdpy.fitness", "MlocusMult", sizeof(struct __pyx_obj_5fwdpy_7fitness_MlocusMult), 1); if (unlikely(!__pyx_ptype_5fwdpy_7fitness_MlocusMult)) __PYX_ERR(16, 129, __pyx_L1_error)
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
  #if CYTHON_COMPILING_IN_PYPY
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(17, 9, __pyx_L1_error)
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) __PYX_ERR(18, 8, __pyx_L1_error)
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) __PYX_ERR(19, 15, __pyx_L1_error)
  __pyx_ptype_7cpython_5array_array = __Pyx_ImportType("array", "array", sizeof(arrayobject), 0); if (unlikely(!__pyx_ptype_7cpython_5array_array)) __PYX_ERR(12, 58, __pyx_L1_error)
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  #endif

  /* "fwdpy/fwdpy.pyx":7
 * from libcpp.string cimport string
 * ## for DataFrame
 * import pandas             # <<<<<<<<<<<<<<
 * 
 * include "classes.pyx"
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pandas, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pandas, __pyx_t_1) < 0) __PYX_ERR(11, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/sampling.pyx":3
 * from cython.operator cimport dereference as deref
 * from fwdpy.fwdpp cimport sep_sample_t,sample_t,gsl_rng
 * import numpy as np             # <<<<<<<<<<<<<<
 * import pandas as pd
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/sampling.pyx":4
 * from fwdpy.fwdpp cimport sep_sample_t,sample_t,gsl_rng
 * import numpy as np
 * import pandas as pd             # <<<<<<<<<<<<<<
 * 
 * def ms_sample(GSLrng rng, PopType pop, int nsam, bint removeFixed = True):
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pandas, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pd, __pyx_t_1) < 0) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/sampling.pyx":6
 * import pandas as pd
 * 
 * def ms_sample(GSLrng rng, PopType pop, int nsam, bint removeFixed = True):             # <<<<<<<<<<<<<<
 *     """
 *     Take a sample from a set of simulated populations.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_1ms_sample, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ms_sample, __pyx_t_1) < 0) __PYX_ERR(2, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/sampling.pyx":30
 *         raise ValueError("ms_sample: unsupported type of popcontainer")
 * 
 * def get_samples(GSLrng rng, PopType pop, int nsam, bint removeFixed = True, deme = None, locusBoundaries = None):             # <<<<<<<<<<<<<<
 *     """
 *     Take a sample from a set of simulated populations.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_3get_samples, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_samples, __pyx_t_1) < 0) __PYX_ERR(2, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/sampling.pyx":67
 *         raise ValueError("ms_sample: unsupported type of popcontainer")
 * 
 * def get_sample_details( sample_t ms_sample, PopType pop, locusID = None ):             # <<<<<<<<<<<<<<
 *     """
 *     Get additional details for population samples
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_5get_sample_details, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_sample_details, __pyx_t_1) < 0) __PYX_ERR(2, 67, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/sampling.pyx":117
 * 
 * ###### Functions for manipulating samples.
 * def nderived_site(tuple site):             # <<<<<<<<<<<<<<
 *     """
 *     Get the number of derived mutations at a site.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_7nderived_site, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_nderived_site, __pyx_t_1) < 0) __PYX_ERR(2, 117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/sampling.pyx":142
 *     return str(site[1]).count('1')
 * 
 * def nderived( list sample ):             # <<<<<<<<<<<<<<
 *     """
 *     Convenience wrapper around :func:`fwdpy.fwdpy.nderived`
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_9nderived, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_nderived, __pyx_t_1) < 0) __PYX_ERR(2, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/sampling.pyx":159
 *     return [nderived_site(i) for i in sample]
 * 
 * def getfreq(tuple site,bint derived = True):             # <<<<<<<<<<<<<<
 *     """
 *     Get mutation frequencies
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_11getfreq, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getfreq, __pyx_t_1) < 0) __PYX_ERR(2, 159, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/sampling.pyx":187
 *     return min(dfreq,1.0-dfreq)
 * 
 * def getfreqs(list sample,bint derived = True):             # <<<<<<<<<<<<<<
 *     """
 *     Convenience wrapper around :func:`fwdpy.fwdpy.getfreq`
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_13getfreqs, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getfreqs, __pyx_t_1) < 0) __PYX_ERR(2, 187, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/sampling.pyx":208
 *     return [getfreq(i,derived) for i in sample]
 * 
 * def freqfilter( list sample,             # <<<<<<<<<<<<<<
 *                 float minfreq,
 *                 bint derived = True ):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_15freqfilter, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_freqfilter, __pyx_t_1) < 0) __PYX_ERR(2, 208, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/evolve_regions.pyx":5
 * from cpython cimport array
 * from cython.operator cimport dereference as deref
 * import warnings,math             # <<<<<<<<<<<<<<
 * cimport cython
 * import internal
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_1) < 0) __PYX_ERR(5, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_math, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_math, __pyx_t_1) < 0) __PYX_ERR(5, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/evolve_regions.pyx":7
 * import warnings,math
 * cimport cython
 * import internal             # <<<<<<<<<<<<<<
 * from fitness cimport SpopAdditive,SpopMult,SpopFitness
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_internal, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_internal, __pyx_t_1) < 0) __PYX_ERR(5, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/evolve_regions.pyx":10
 * from fitness cimport SpopAdditive,SpopMult,SpopFitness
 * 
 * def check_input_params(double mu_neutral, double mu_selected, double recrate,             # <<<<<<<<<<<<<<
 *                        list nregions, list sregions, list recregions) :
 *     for i in [mu_neutral,mu_selected,recrate]:
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_17check_input_params, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_input_params, __pyx_t_1) < 0) __PYX_ERR(5, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/evolve_regions.pyx":29
 * 
 * @cython.boundscheck(False)
 * def evolve_regions(GSLrng rng,             # <<<<<<<<<<<<<<
 *                    int npops,
 *                    int N,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_19evolve_regions, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evolve_regions, __pyx_t_1) < 0) __PYX_ERR(5, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/evolve_regions.pyx":102
 * 
 * @cython.boundscheck(False)
 * def evolve_regions_more(GSLrng rng,             # <<<<<<<<<<<<<<
 *                         SpopVec pops,
 *                         unsigned[:] nlist,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_21evolve_regions_more, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evolve_regions_more, __pyx_t_1) < 0) __PYX_ERR(5, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/evolve_regions.pyx":155
 * 
 * @cython.boundscheck(False)
 * def evolve_regions_sampler(GSLrng rng,             # <<<<<<<<<<<<<<
 *                            SpopVec pops,
 *                            TemporalSampler slist,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_23evolve_regions_sampler, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evolve_regions_sampler, __pyx_t_1) < 0) __PYX_ERR(5, 155, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/evolve_regions.pyx":205
 * 
 * @cython.boundscheck(False)
 * def evolve_regions_sampler_fitness(GSLrng rng,             # <<<<<<<<<<<<<<
 *                                    SpopVec pops,
 *                                    TemporalSampler slist,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_25evolve_regions_sampler_fitness, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evolve_regions_sampler_fitness, __pyx_t_1) < 0) __PYX_ERR(5, 205, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":1
 * import math             # <<<<<<<<<<<<<<
 * 
 * class Region(object):
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_math, 0, -1); 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_math, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":3
 * import math
 * 
 * class Region(object):             # <<<<<<<<<<<<<<
 *     """
 *     Representation of a "region" in a simulation.
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_Region, __pyx_n_s_Region, (PyObject *) NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_kp_s_Representation_of_a_region_in_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "fwdpy/regions.pyx":18
 *         * :class:`fwdpy.fwdpy.Sregion`
 *     """
 *     def __init__(self,float beg,float end,float weight,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
  __pyx_t_4 = __Pyx_PyInt_From_uint16_t(((uint16_t)0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)Py_True));
  __Pyx_GIVEREF(((PyObject *)Py_True));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_True));
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_6Region_1__init__, 0, __pyx_n_s_Region___init, NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_d, ((PyObject *)__pyx_codeobj__129)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "fwdpy/regions.pyx":62
 *         if self.c is True:
 *             self.w = (self.e-self.b)*self.w
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         bstr="{:.9f}".format(self.b)
 *         estr="{:.9f}".format(self.e)
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_6Region_3__str__, 0, __pyx_n_s_Region___str, NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_d, ((PyObject *)__pyx_codeobj__131)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_str, __pyx_t_4) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "fwdpy/regions.pyx":3
 * import math
 * 
 * class Region(object):             # <<<<<<<<<<<<<<
 *     """
 *     Representation of a "region" in a simulation.
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Region, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Region, __pyx_t_4) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":68
 *         return "beg = " +bstr+ ", end = " + estr+ ", weight = "+wstr+", label = "+format(self.l)
 * 
 * class Sregion(Region):             # <<<<<<<<<<<<<<
 *     """
 *     Representation of a "region" in a simulation with a dominance term.
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Region); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_Sregion, __pyx_n_s_Sregion, (PyObject *) NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_kp_s_Representation_of_a_region_in_a_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "fwdpy/regions.pyx":91
 *        :class:`fwdpy.fwdpy.GaussianS`
 *     """
 *     def __init__(self,float beg,float end,float weight,float h=1.0,coupled=True,uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
  __pyx_t_4 = PyFloat_FromDouble(((double)1.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_uint16_t(((uint16_t)0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __Pyx_INCREF(((PyObject *)Py_True));
  __Pyx_GIVEREF(((PyObject *)Py_True));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)Py_True));
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_7Sregion_1__init__, 0, __pyx_n_s_Sregion___init, NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_d, ((PyObject *)__pyx_codeobj__133)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_5) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "fwdpy/regions.pyx":121
 *         self.h=float(h)
 *         super(Sregion,self).__init__(beg,end,weight,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "h = "+"{:.9f}".format(self.h)+", "+super(Sregion,self).__str__()
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_7Sregion_3__str__, 0, __pyx_n_s_Sregion___str, NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_d, ((PyObject *)__pyx_codeobj__135)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_str, __pyx_t_5) < 0) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "fwdpy/regions.pyx":68
 *         return "beg = " +bstr+ ", end = " + estr+ ", weight = "+wstr+", label = "+format(self.l)
 * 
 * class Sregion(Region):             # <<<<<<<<<<<<<<
 *     """
 *     Representation of a "region" in a simulation with a dominance term.
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_Sregion, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Sregion, __pyx_t_5) < 0) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "fwdpy/regions.pyx":124
 *         return "h = "+"{:.9f}".format(self.h)+", "+super(Sregion,self).__str__()
 * 
 * class GammaS(Sregion):             # <<<<<<<<<<<<<<
 *     """
 *     Gamma distribution of fitness effects
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Sregion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_GammaS, __pyx_n_s_GammaS, (PyObject *) NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_kp_s_Gamma_distribution_of_fitness_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "fwdpy/regions.pyx":139
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float mean,float shape,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
  __pyx_t_5 = PyFloat_FromDouble(((double)1.0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_uint16_t(((uint16_t)0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_INCREF(((PyObject *)Py_True));
  __Pyx_GIVEREF(((PyObject *)Py_True));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)Py_True));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_6);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_6GammaS_1__init__, 0, __pyx_n_s_GammaS___init, NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_d, ((PyObject *)__pyx_codeobj__137)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_6) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "fwdpy/regions.pyx":172
 *         self.shape=float(shape)
 *         super(GammaS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Gamma DFE, mean = "+"{:.9f}".format(self.mean)+", shape = "+"{:.9f}".format(self.shape)+", "+super(GammaS,self).__str__()
 * 
 */
  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_6GammaS_3__str__, 0, __pyx_n_s_GammaS___str, NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_d, ((PyObject *)__pyx_codeobj__139)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_str, __pyx_t_6) < 0) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "fwdpy/regions.pyx":124
 *         return "h = "+"{:.9f}".format(self.h)+", "+super(Sregion,self).__str__()
 * 
 * class GammaS(Sregion):             # <<<<<<<<<<<<<<
 *     """
 *     Gamma distribution of fitness effects
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_GammaS, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_GammaS, __pyx_t_6) < 0) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":175
 *         return "Gamma DFE, mean = "+"{:.9f}".format(self.mean)+", shape = "+"{:.9f}".format(self.shape)+", "+super(GammaS,self).__str__()
 * 
 * class ConstantS(Sregion):             # <<<<<<<<<<<<<<
 *     """
 *     Constant/fixed selection coefficient
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Sregion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_ConstantS, __pyx_n_s_ConstantS, (PyObject *) NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_kp_s_Constant_fixed_selection_coeffi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "fwdpy/regions.pyx":189
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float s,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
  __pyx_t_6 = PyFloat_FromDouble(((double)1.0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyInt_From_uint16_t(((uint16_t)0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __Pyx_INCREF(((PyObject *)Py_True));
  __Pyx_GIVEREF(((PyObject *)Py_True));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)Py_True));
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __pyx_t_6 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_9ConstantS_1__init__, 0, __pyx_n_s_ConstantS___init, NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_d, ((PyObject *)__pyx_codeobj__141)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "fwdpy/regions.pyx":217
 *         self.s=float(s)
 *         super(ConstantS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Constant s DFE, s = "+"{:.9f}".format(self.s)+", "+super(ConstantS,self).__str__()
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_9ConstantS_3__str__, 0, __pyx_n_s_ConstantS___str, NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_d, ((PyObject *)__pyx_codeobj__143)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_str, __pyx_t_4) < 0) __PYX_ERR(0, 217, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "fwdpy/regions.pyx":175
 *         return "Gamma DFE, mean = "+"{:.9f}".format(self.mean)+", shape = "+"{:.9f}".format(self.shape)+", "+super(GammaS,self).__str__()
 * 
 * class ConstantS(Sregion):             # <<<<<<<<<<<<<<
 *     """
 *     Constant/fixed selection coefficient
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_ConstantS, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ConstantS, __pyx_t_4) < 0) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "fwdpy/regions.pyx":220
 *         return "Constant s DFE, s = "+"{:.9f}".format(self.s)+", "+super(ConstantS,self).__str__()
 * 
 * class UniformS(Sregion):             # <<<<<<<<<<<<<<
 *     """
 *     Uniform distribution on selection coefficients
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Sregion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_UniformS, __pyx_n_s_UniformS, (PyObject *) NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_kp_s_Uniform_distribution_on_selecti); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "fwdpy/regions.pyx":235
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float lo,float hi,float h=1.0,coupled=True):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
  __pyx_t_4 = PyFloat_FromDouble(((double)1.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_INCREF(((PyObject *)Py_True));
  __Pyx_GIVEREF(((PyObject *)Py_True));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)Py_True));
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_8UniformS_1__init__, 0, __pyx_n_s_UniformS___init, NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_d, ((PyObject *)__pyx_codeobj__145)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "fwdpy/regions.pyx":269
 *         self.hi=float(hi)
 *         super(UniformS,self).__init__(beg,end,weight,h,coupled)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Uniform s DFE, lo = "+"{:.9f}".format(self.lo)+", hi = "+"{:.9f}".format(self.hi)+", "+super(UniformS,self).__str__()
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_8UniformS_3__str__, 0, __pyx_n_s_UniformS___str, NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_d, ((PyObject *)__pyx_codeobj__147)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_str, __pyx_t_4) < 0) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "fwdpy/regions.pyx":220
 *         return "Constant s DFE, s = "+"{:.9f}".format(self.s)+", "+super(ConstantS,self).__str__()
 * 
 * class UniformS(Sregion):             # <<<<<<<<<<<<<<
 *     """
 *     Uniform distribution on selection coefficients
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_UniformS, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_UniformS, __pyx_t_4) < 0) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/regions.pyx":272
 *         return "Uniform s DFE, lo = "+"{:.9f}".format(self.lo)+", hi = "+"{:.9f}".format(self.hi)+", "+super(UniformS,self).__str__()
 * 
 * class ExpS(Sregion):             # <<<<<<<<<<<<<<
 *     """
 *     Exponential distribution on selection coefficients
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Sregion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_ExpS, __pyx_n_s_ExpS, (PyObject *) NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_kp_s_Exponential_distribution_on_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "fwdpy/regions.pyx":286
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float mean,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
  __pyx_t_4 = PyFloat_FromDouble(((double)1.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_uint16_t(((uint16_t)0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __Pyx_INCREF(((PyObject *)Py_True));
  __Pyx_GIVEREF(((PyObject *)Py_True));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)Py_True));
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_4ExpS_1__init__, 0, __pyx_n_s_ExpS___init, NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_d, ((PyObject *)__pyx_codeobj__149)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_5) < 0) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "fwdpy/regions.pyx":314
 *         self.mean=float(mean)
 *         super(ExpS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Exponential DFE, mean = "+"{:.9f}".format(self.mean)+", "+super(ExpS,self).__str__()
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_4ExpS_3__str__, 0, __pyx_n_s_ExpS___str, NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_d, ((PyObject *)__pyx_codeobj__151)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_str, __pyx_t_5) < 0) __PYX_ERR(0, 314, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "fwdpy/regions.pyx":272
 *         return "Uniform s DFE, lo = "+"{:.9f}".format(self.lo)+", hi = "+"{:.9f}".format(self.hi)+", "+super(UniformS,self).__str__()
 * 
 * class ExpS(Sregion):             # <<<<<<<<<<<<<<
 *     """
 *     Exponential distribution on selection coefficients
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_ExpS, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ExpS, __pyx_t_5) < 0) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "fwdpy/regions.pyx":317
 *         return "Exponential DFE, mean = "+"{:.9f}".format(self.mean)+", "+super(ExpS,self).__str__()
 * 
 * class GaussianS(Sregion):             # <<<<<<<<<<<<<<
 *     """
 *     Gaussian distribution on selection coefficients (effect sizes for sims of quantitative traits)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Sregion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_GaussianS, __pyx_n_s_GaussianS, (PyObject *) NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_kp_s_Gaussian_distribution_on_select); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "fwdpy/regions.pyx":333
 *     See :func:`evolve_regions` for how this class may be used to parameterize a simulation
 *     """
 *     def __init__(self,float beg,float end,float weight,float sd,float h=1.0,coupled=True, uint16_t label = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor
 */
  __pyx_t_5 = PyFloat_FromDouble(((double)1.0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_uint16_t(((uint16_t)0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_INCREF(((PyObject *)Py_True));
  __Pyx_GIVEREF(((PyObject *)Py_True));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)Py_True));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_6);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_9GaussianS_1__init__, 0, __pyx_n_s_GaussianS___init, NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_d, ((PyObject *)__pyx_codeobj__153)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_6) < 0) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "fwdpy/regions.pyx":361
 *         self.sd=float(sd)
 *         super(GaussianS,self).__init__(beg,end,weight,h,coupled,label)
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "Gaussian DFE, s.d. = "+"{:.9f}".format(self.sd)+", "+super(GaussianS,self).__str__()
 */
  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_9GaussianS_3__str__, 0, __pyx_n_s_GaussianS___str, NULL, __pyx_n_s_fwdpy_fwdpy, __pyx_d, ((PyObject *)__pyx_codeobj__155)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_str, __pyx_t_6) < 0) __PYX_ERR(0, 361, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "fwdpy/regions.pyx":317
 *         return "Exponential DFE, mean = "+"{:.9f}".format(self.mean)+", "+super(ExpS,self).__str__()
 * 
 * class GaussianS(Sregion):             # <<<<<<<<<<<<<<
 *     """
 *     Gaussian distribution on selection coefficients (effect sizes for sims of quantitative traits)
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_GaussianS, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_GaussianS, __pyx_t_6) < 0) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/copy.pyx":1
 * import fwdpyio as fpio             # <<<<<<<<<<<<<<
 * 
 * def copypop(PopType pop):
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_fwdpyio, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_fpio, __pyx_t_1) < 0) __PYX_ERR(6, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/copy.pyx":3
 * import fwdpyio as fpio
 * 
 * def copypop(PopType pop):             # <<<<<<<<<<<<<<
 *     """
 *     Copy a population
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_27copypop, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_copypop, __pyx_t_1) < 0) __PYX_ERR(6, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/copy.pyx":21
 *         raise RuntimeError("fwdpy.copypop: PopType "+str(type(pop))+" is not supported")
 * 
 * def copypops(PopVec pops):             # <<<<<<<<<<<<<<
 *     """
 *     Copy a population
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_29copypops, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_copypops, __pyx_t_1) < 0) __PYX_ERR(6, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":4
 * from cython.parallel import parallel, prange
 * from libcpp.limits cimport numeric_limits
 * import pandas as pd             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "<algorithm>" namespace "std":
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pandas, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pd, __pyx_t_1) < 0) __PYX_ERR(3, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":152
 *     return rv
 * 
 * def view_mutations_singlepop(Spop p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg = p.pop.get().mutations.begin()
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_31view_mutations_singlepop, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_mutations_singlepop, __pyx_t_1) < 0) __PYX_ERR(3, 152, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":160
 *     return rv
 * 
 * def view_mutations_singlepop_mloc(MlocusPop p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg = p.pop.get().mutations.begin()
 *     cdef mcont_t_itr end = p.pop.get().mutations.end()
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_33view_mutations_singlepop_mloc, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_mutations_singlepop_mloc, __pyx_t_1) < 0) __PYX_ERR(3, 160, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":168
 *     return rv
 * 
 * def view_mutations_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg,end
 *     cdef vector[vector[popgen_mut_data]] rv
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_35view_mutations_popvec, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_mutations_popvec, __pyx_t_1) < 0) __PYX_ERR(3, 168, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":180
 *     return rv
 * 
 * def view_mutations_popvec_mloc(MlocusPopVec p):             # <<<<<<<<<<<<<<
 *     cdef mcont_t_itr beg,end
 *     cdef vector[vector[popgen_mut_data]] rv
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_37view_mutations_popvec_mloc, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_mutations_popvec_mloc, __pyx_t_1) < 0) __PYX_ERR(3, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":192
 *     return rv
 * 
 * def view_mutations_metapop(MetaPop p,unsigned deme):             # <<<<<<<<<<<<<<
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_mutations: deme index out of range")
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_39view_mutations_metapop, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_mutations_metapop, __pyx_t_1) < 0) __PYX_ERR(3, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":218
 *     return rv
 * 
 * def view_mutations(object p, deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Get detailed list of all mutations in the population
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_41view_mutations, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_mutations, __pyx_t_1) < 0) __PYX_ERR(3, 218, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":257
 *         raise RuntimeError("view_mutations: unsupported object type")
 * 
 * def view_gametes_singlepop(Spop p):             # <<<<<<<<<<<<<<
 *     return view_gametes_details(p.pop.get())
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_43view_gametes_singlepop, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_gametes_singlepop, __pyx_t_1) < 0) __PYX_ERR(3, 257, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":260
 *     return view_gametes_details(p.pop.get())
 * 
 * def view_gametes_singlepop_mloc(MlocusPop p):             # <<<<<<<<<<<<<<
 *     return view_gametes_details_mloc(p.pop.get())
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_45view_gametes_singlepop_mloc, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_gametes_singlepop_mloc, __pyx_t_1) < 0) __PYX_ERR(3, 260, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":263
 *     return view_gametes_details_mloc(p.pop.get())
 * 
 * def view_gametes_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     cdef:
 *         gcont_t_itr beg,end
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_47view_gametes_popvec, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_gametes_popvec, __pyx_t_1) < 0) __PYX_ERR(3, 263, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":274
 *     return rv
 * 
 * def view_gametes_popvec_mloc(MlocusPopVec p):             # <<<<<<<<<<<<<<
 *     cdef:
 *         gcont_t_itr beg,end
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_49view_gametes_popvec_mloc, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_gametes_popvec_mloc, __pyx_t_1) < 0) __PYX_ERR(3, 274, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":285
 *     return rv
 * 
 * def view_gametes_metapop(MetaPop p, unsigned deme):             # <<<<<<<<<<<<<<
 *     if deme >= len(p.popsizes()):
 *         raise IndexError("view_gametes: deme index out of range")
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_51view_gametes_metapop, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_gametes_metapop, __pyx_t_1) < 0) __PYX_ERR(3, 285, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":308
 *     return temp1
 * 
 * def view_gametes(object p ,deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Get detailed list of all gametes in the population
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_53view_gametes, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_gametes, __pyx_t_1) < 0) __PYX_ERR(3, 308, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":347
 *         raise RuntimeError("view_gametes: unsupported object type")
 * 
 * def view_diploids_singlepop(Spop p, list indlist):             # <<<<<<<<<<<<<<
 *     for i in indlist:
 *         if i >= p.popsize():
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_55view_diploids_singlepop, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_diploids_singlepop, __pyx_t_1) < 0) __PYX_ERR(3, 347, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":353
 *     return view_diploids_details(p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts,indlist)
 * 
 * def view_diploids_singlepop_mloc(MlocusPop p, list indlist):             # <<<<<<<<<<<<<<
 *     for i in indlist:
 *         if i >= p.popsize():
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_57view_diploids_singlepop_mloc, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_diploids_singlepop_mloc, __pyx_t_1) < 0) __PYX_ERR(3, 353, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":360
 * 
 * 
 * def view_diploids_popvec(SpopVec p, list indlist):             # <<<<<<<<<<<<<<
 *     cdef size_t npops = len(p),i
 *     cdef vector[vector[diploid_data]] rv
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_59view_diploids_popvec, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_diploids_popvec, __pyx_t_1) < 0) __PYX_ERR(3, 360, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":374
 *     return rv
 * 
 * def view_diploids_popvec_mloc(MlocusPopVec p, list indlist):             # <<<<<<<<<<<<<<
 *     cdef size_t npops = len(p),i
 *     cdef vector[vector[diploid_mloc_data]] rv
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_61view_diploids_popvec_mloc, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_diploids_popvec_mloc, __pyx_t_1) < 0) __PYX_ERR(3, 374, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":388
 *     return rv
 * 
 * def view_diploids_metapop(MetaPop p, list indlist, unsigned deme):             # <<<<<<<<<<<<<<
 *     psizes = p.popsizes()
 *     for i in indlist:
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_63view_diploids_metapop, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_diploids_metapop, __pyx_t_1) < 0) __PYX_ERR(3, 388, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":398
 *     return view_diploids_details(p.mpop.get().diploids[deme],p.mpop.get().gametes,p.mpop.get().mutations,p.mpop.get().mcounts,indlist)
 * 
 * def view_diploids(object p, list indlist, deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Get detailed list of a set of diploids in the population
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_65view_diploids, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_diploids, __pyx_t_1) < 0) __PYX_ERR(3, 398, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":493
 *     move[map[double,string].iterator,back_insert_itr](m.begin(),m.end(),back_inserter[fwdpy_sample_t](v))
 * 
 * def diploid_view_to_sample(list view):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a "view" of diploids into the data types returned from :func:`fwdpy.fwdpy.get_samples`
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_67diploid_view_to_sample, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_diploid_view_to_sample, __pyx_t_1) < 0) __PYX_ERR(3, 493, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":553
 *     return {'neutral':vneutral,'selected':vselected,'neutral_info':neutral_df,'selected_info':selected_df}
 * 
 * def diploid_mloc_view_to_sample(list view):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a "view" of diploids into the data types returned from :func:`fwdpy.fwdpy.get_samples`
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_69diploid_mloc_view_to_sample, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_diploid_mloc_view_to_sample, __pyx_t_1) < 0) __PYX_ERR(3, 553, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":685
 *         inc(beg)
 * 
 * def view_diploids_pd_popvec(SpopVec p,             # <<<<<<<<<<<<<<
 *                             vector[unsigned] & indlist,
 *                             bint selectedOnly):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_71view_diploids_pd_popvec, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_diploids_pd_popvec, __pyx_t_1) < 0) __PYX_ERR(3, 685, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":696
 *     return rv
 * 
 * def view_diploids_pd_singlepop(Spop p,             # <<<<<<<<<<<<<<
 *                                vector[unsigned] & indlist,
 *                                bint selectedOnly):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_73view_diploids_pd_singlepop, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_diploids_pd_singlepop, __pyx_t_1) < 0) __PYX_ERR(3, 696, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":701
 *     return view_diploids_pd_details(p.pop.get(),indlist,selectedOnly)
 * 
 * def view_diploids_pd(object p,             # <<<<<<<<<<<<<<
 *                      list indlist,
 *                      bint selectedOnly = True):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_75view_diploids_pd, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_diploids_pd, __pyx_t_1) < 0) __PYX_ERR(3, 701, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/views.pyx":756
 *     return [diploid_traits_mpop(i,deme) for i in p]
 * 
 * def diploid_traits(object p, deme = None):             # <<<<<<<<<<<<<<
 *     """
 *     Return genetic value (g), environmental value (e), and fitness (w) for all diploids.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_77diploid_traits, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_diploid_traits, __pyx_t_1) < 0) __PYX_ERR(3, 756, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/view_fixations.pyx":27
 *     return rv
 * 
 * def view_fixations_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     cdef vector[vector[popgen_mut_data]] rv
 *     cdef size_t npops=p.pops.size()
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_79view_fixations_popvec, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_fixations_popvec, __pyx_t_1) < 0) __PYX_ERR(7, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/view_fixations.pyx":36
 *     return rv
 * 
 * def view_fixations_mlocuspopvec(MlocusPopVec p):             # <<<<<<<<<<<<<<
 *     cdef vector[vector[popgen_mut_data]] rv
 *     cdef size_t npops=p.pops.size()
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_81view_fixations_mlocuspopvec, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_fixations_mlocuspopvec, __pyx_t_1) < 0) __PYX_ERR(7, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/view_fixations.pyx":45
 *     return rv
 * 
 * def view_fixations(object p):             # <<<<<<<<<<<<<<
 *     """
 *     Return information on fixed variants
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_83view_fixations, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_view_fixations, __pyx_t_1) < 0) __PYX_ERR(7, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/debug.pyx":1
 * def check_popdata_singlepop(Spop p):             # <<<<<<<<<<<<<<
 *     cdef bint csum = check_sum[gcont_t](p.pop.get().gametes,2*(<unsigned>p.pop.get().diploids.size()))
 *     cdef bint pds = popdata_sane[dipvector_t,gcont_t,mcont_t](p.pop.get().diploids,p.pop.get().gametes,p.pop.get().mutations,p.pop.get().mcounts)
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_85check_popdata_singlepop, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_popdata_singlepop, __pyx_t_1) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/debug.pyx":6
 *     return {'check_sum':csum,'popdata_sane':pds}
 * 
 * def check_popdata_metapop(MetaPop p):             # <<<<<<<<<<<<<<
 *     cdef bint csum = check_sum[gcont_t](p.mpop.get().gametes,2*(<unsigned>p.mpop.get().diploids.size()))
 *     lpds=[]
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_87check_popdata_metapop, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_popdata_metapop, __pyx_t_1) < 0) __PYX_ERR(8, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/debug.pyx":18
 *     return {'check_sum':csum,'popdata_sane':lpds}
 * 
 * def check_popdata_popvec(SpopVec p):             # <<<<<<<<<<<<<<
 *     return [check_popdata_singlepop(i) for i in p]
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_89check_popdata_popvec, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_popdata_popvec, __pyx_t_1) < 0) __PYX_ERR(8, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/debug.pyx":21
 *     return [check_popdata_singlepop(i) for i in p]
 * 
 * def check_popdata_mpopvec(MetaPopVec p):             # <<<<<<<<<<<<<<
 *     return [check_popdata_metapop(i) for i in p]
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_91check_popdata_mpopvec, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_popdata_mpopvec, __pyx_t_1) < 0) __PYX_ERR(8, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/debug.pyx":24
 *     return [check_popdata_metapop(i) for i in p]
 * 
 * def check_popdata(object p):             # <<<<<<<<<<<<<<
 *     """
 *     Apply fwdpp's debugging functions to population containers.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_93check_popdata, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_popdata, __pyx_t_1) < 0) __PYX_ERR(8, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/ages.pyx":5
 * from libcpp.limits cimport numeric_limits
 * 
 * def allele_ages( list trajectories, double minfreq = 0.0, unsigned minsojourn = 1 ):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate allele age information from mutation frequency trajectories.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_95allele_ages, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_allele_ages, __pyx_t_1) < 0) __PYX_ERR(9, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/ages.pyx":14
 *     return  allele_ages_details(trajectories,minfreq,minsojourn)
 * 
 * def merge_trajectories(list trajectories1, list trajectories2):             # <<<<<<<<<<<<<<
 * 
 *     """
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_97merge_trajectories, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_merge_trajectories, __pyx_t_1) < 0) __PYX_ERR(9, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/ages.pyx":38
 * #    return rv
 * #
 * def tidy_trajectories_details(list trajectories,unsigned min_sojourn, double min_freq,             # <<<<<<<<<<<<<<
 *         unsigned remove_arose_after,unsigned remove_gone_before):
 *     return tidy_trajectory_info(trajectories,min_sojourn,min_freq,remove_gone_before,remove_arose_after)
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_99tidy_trajectories_details, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tidy_trajectories_details, __pyx_t_1) < 0) __PYX_ERR(9, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/ages.pyx":47
 * #        yield tidy_trajectory_info((<freqTrajectories>i).thisptr,min_sojourn,min_freq,remove_gone_before,remove_arose_after)
 * 
 * def tidy_trajectories(trajectories, unsigned min_sojourn = 0, double min_freq = 0.0,             # <<<<<<<<<<<<<<
 *         remove_arose_after = None,remove_gone_before = None):
 *     """
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_101tidy_trajectories, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_tidy_trajectories, __pyx_t_1) < 0) __PYX_ERR(9, 47, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/temporal_samplers.pyx":203
 *         return self.vec.size()
 * 
 * def apply_sampler(PopVec pops,TemporalSampler sampler):             # <<<<<<<<<<<<<<
 *     """
 *     Apply a temporal sampler to a container of populations.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_103apply_sampler, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_apply_sampler, __pyx_t_1) < 0) __PYX_ERR(4, 203, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/temporal_samplers.pyx":225
 *         raise RuntimeError("PopVec/PopType type not supported")
 * 
 * def apply_sampler_single(PopType pop,TemporalSampler sampler):             # <<<<<<<<<<<<<<
 *     """
 *     Apply a temporal sampler to an indivudal :class:`fwdpy.fwdpy.PopType`
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_105apply_sampler_single, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_apply_sampler_single, __pyx_t_1) < 0) __PYX_ERR(4, 225, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/add_mutations.pyx":3
 * ##Code for adding a mutation into a population
 * 
 * def add_mutation(PopType p,             # <<<<<<<<<<<<<<
 *                  const vector[size_t] & indlist,
 *                  const vector[short] & clist,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_107add_mutation, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_add_mutation, __pyx_t_1) < 0) __PYX_ERR(10, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/fwdpy.pyx":21
 * include "add_mutations.pyx"
 * 
 * def pkg_version():             # <<<<<<<<<<<<<<
 *     """
 *     Return version numbers of this package
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_109pkg_version, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pkg_version, __pyx_t_1) < 0) __PYX_ERR(11, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/fwdpy.pyx":32
 *     return ({'fwdpy':v[0]})
 * 
 * def cite():             # <<<<<<<<<<<<<<
 *     """
 *     Returns how to cite this package
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5fwdpy_5fwdpy_111cite, NULL, __pyx_n_s_fwdpy_fwdpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_cite, __pyx_t_1) < 0) __PYX_ERR(11, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "fwdpy/fwdpy.pyx":1
 * # distutils: language = c++             # <<<<<<<<<<<<<<
 * # distutils: sources = fwdpy/fwdpy/sample.cc fwdpy/fwdpy/deps.cc
 * from libcpp.vector cimport vector
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_ms_sample_line_6, __pyx_kp_u_Take_a_sample_from_a_set_of_sim) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_get_samples_line_30, __pyx_kp_u_Take_a_sample_from_a_set_of_sim_2) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_get_sample_details_line_67, __pyx_kp_u_Get_additional_details_for_popu) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_nderived_site_line_117, __pyx_kp_u_Get_the_number_of_derived_mutat) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_nderived_line_142, __pyx_kp_u_Convenience_wrapper_around_func) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_getfreq_line_159, __pyx_kp_u_Get_mutation_frequencies_param) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_getfreqs_line_187, __pyx_kp_u_Convenience_wrapper_around_func_2) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_freqfilter_line_208, __pyx_kp_u_Remove_low_frequency_variants_f) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_evolve_regions_line_29, __pyx_kp_u_Evolve_a_region_with_variable_m) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_evolve_regions_more_line_102, __pyx_kp_u_Continue_to_evolve_a_region_wit) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_Region___init___line_18, __pyx_kp_u_Constructor_param_beg_the_begin) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_Sregion___init___line_91, __pyx_kp_u_Constructor_param_beg_the_begin_2) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_GammaS___init___line_139, __pyx_kp_u_Constructor_param_beg_the_begin_3) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_ConstantS___init___line_189, __pyx_kp_u_Constructor_param_beg_the_begin_4) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_UniformS___init___line_235, __pyx_kp_u_Constructor_param_beg_the_begin_5) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_ExpS___init___line_286, __pyx_kp_u_Constructor_param_beg_the_begin_6) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_GaussianS___init___line_333, __pyx_kp_u_Constructor_param_beg_the_begin_7) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_view_mutations_line_218, __pyx_kp_u_Get_detailed_list_of_all_mutati) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_view_gametes_line_308, __pyx_kp_u_Get_detailed_list_of_all_gamete) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_view_diploids_line_398, __pyx_kp_u_Get_detailed_list_of_a_set_of_d) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_add_mutation_line_3, __pyx_kp_u_Add_a_mutation_to_a_population) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(11, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":207
 *         info.obj = self
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(array self):
 */
  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(13, 207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_array_type);

  /* "View.MemoryView":282
 *         return self.name
 * 
 * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__241, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(generic);
  __Pyx_DECREF_SET(generic, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":283
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
 * cdef indirect = Enum("<strided and indirect>")
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__242, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(strided);
  __Pyx_DECREF_SET(strided, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":284
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__243, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(indirect);
  __Pyx_DECREF_SET(indirect, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":287
 * 
 * 
 * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__244, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(contiguous);
  __Pyx_DECREF_SET(contiguous, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":288
 * 
 * cdef contiguous = Enum("<contiguous and direct>")
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__245, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(indirect_contiguous);
  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":312
 * 
 * DEF THREAD_LOCKS_PREALLOCATED = 8
 * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
 *     PyThread_allocate_lock(),
 */
  __pyx_memoryview_thread_locks_used = 0;

  /* "View.MemoryView":313
 * DEF THREAD_LOCKS_PREALLOCATED = 8
 * cdef int __pyx_memoryview_thread_locks_used = 0
 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
 *     PyThread_allocate_lock(),
 *     PyThread_allocate_lock(),
 */
  __pyx_t_7[0] = PyThread_allocate_lock();
  __pyx_t_7[1] = PyThread_allocate_lock();
  __pyx_t_7[2] = PyThread_allocate_lock();
  __pyx_t_7[3] = PyThread_allocate_lock();
  __pyx_t_7[4] = PyThread_allocate_lock();
  __pyx_t_7[5] = PyThread_allocate_lock();
  __pyx_t_7[6] = PyThread_allocate_lock();
  __pyx_t_7[7] = PyThread_allocate_lock();
  memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_7, sizeof(__pyx_memoryview_thread_locks[0]) * (8));

  /* "View.MemoryView":535
 *         info.obj = self
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(13, 535, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_memoryview_type);

  /* "View.MemoryView":981
 *         return self.from_object
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(13, 981, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_memoryviewslice_type);

  /* "View.MemoryView":1391
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                               Py_ssize_t *strides, int ndim,
 *                               size_t itemsize, void *item) nogil:
 */

  /*--- Wrapped vars code ---*/

  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_5);
  __Pyx_XDECREF(__pyx_t_6);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init fwdpy.fwdpy", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init fwdpy.fwdpy");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #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((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

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

/* 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);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)));
    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());
    return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
}
#endif  // CYTHON_FAST_PYCCALL

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
#include "frameobject.h"
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = PyThreadState_GET();
    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 = f->f_localsplus;
    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, int 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, nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif  // CPython < 3.6
#endif  // CYTHON_FAST_PYCALL

/* 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

/* 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
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        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) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#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

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

/* IterNext */
    static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
    PyObject* next;
    iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
#if CYTHON_USE_TYPE_SLOTS
    if (unlikely(!iternext)) {
#else
    if (unlikely(!iternext) || unlikely(!PyIter_Check(iterator))) {
#endif
        PyErr_Format(PyExc_TypeError,
            "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name);
        return NULL;
    }
    next = iternext(iterator);
    if (likely(next))
        return next;
#if CYTHON_USE_TYPE_SLOTS
#if PY_VERSION_HEX >= 0x02070000
    if (unlikely(iternext == &_PyObject_NextNotImplemented))
        return NULL;
#endif
#endif
    if (defval) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
            if (unlikely(exc_type != PyExc_StopIteration) &&
                    !PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))
                return NULL;
            PyErr_Clear();
        }
        Py_INCREF(defval);
        return defval;
    }
    if (!PyErr_Occurred())
        PyErr_SetNone(PyExc_StopIteration);
    return NULL;
}

/* ArgTypeTest */
      static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
}
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (likely(Py_TYPE(obj) == type)) return 1;
        #if PY_MAJOR_VERSION == 2
        else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(PyObject_TypeCheck(obj, type))) return 1;
    }
    __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
    return 0;
}

/* GetModuleGlobalName */
      static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

/* 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 PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            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 = PyThreadState_GET();
        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

/* GetItemInt */
          static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     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((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        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));
}

/* pyobject_as_double */
          static double __Pyx__PyObject_AsDouble(PyObject* obj) {
    PyObject* float_value;
#if !CYTHON_USE_TYPE_SLOTS
    float_value = PyNumber_Float(obj);  if (0) goto bad;
#else
    PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
    if (likely(nb) && likely(nb->nb_float)) {
        float_value = nb->nb_float(obj);
        if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
            PyErr_Format(PyExc_TypeError,
                "__float__ returned non-float (type %.200s)",
                Py_TYPE(float_value)->tp_name);
            Py_DECREF(float_value);
            goto bad;
        }
    } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
#if PY_MAJOR_VERSION >= 3
        float_value = PyFloat_FromString(obj);
#else
        float_value = PyFloat_FromString(obj, 0);
#endif
    } else {
        PyObject* args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        PyTuple_SET_ITEM(args, 0, obj);
        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
        PyTuple_SET_ITEM(args, 0, 0);
        Py_DECREF(args);
    }
#endif
    if (likely(float_value)) {
        double value = PyFloat_AS_DOUBLE(float_value);
        Py_DECREF(float_value);
        return value;
    }
bad:
    return (double)-1;
}

/* BufferFormatCheck */
          static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
  unsigned int n = 1;
  return *(unsigned char*)(&n) != 0;
}
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->new_packmode = '@';
  ctx->enc_packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  ctx->is_valid_array = 0;
  ctx->struct_alignment = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t < '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}
static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
    int number = __Pyx_BufFmt_ParseNumber(ts);
    if (number == -1)
        PyErr_Format(PyExc_ValueError,\
                     "Does not understand character buffer dtype format string ('%c')", **ts);
    return number;
}
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  PyErr_Format(PyExc_ValueError,
               "Unexpected format string character: '%c'", ch);
}
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case 'c': return "'char'";
    case 'b': return "'signed char'";
    case 'B': return "'unsigned char'";
    case 'h': return "'short'";
    case 'H': return "'unsigned short'";
    case 'i': return "'int'";
    case 'I': return "'unsigned int'";
    case 'l': return "'long'";
    case 'L': return "'unsigned long'";
    case 'q': return "'long long'";
    case 'Q': return "'unsigned long long'";
    case 'f': return (is_complex ? "'complex float'" : "'float'");
    case 'd': return (is_complex ? "'complex double'" : "'double'");
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    case 's': case 'p': return "a string";
    case 0: return "end";
    default: return "unparseable format string";
  }
}
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    #ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    #endif
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
/* These are for computing the padding at the end of the struct to align
   on the first member of the struct. This will probably the same as above,
   but we don't have any guarantees.
 */
typedef struct { short x; char c; } __Pyx_pad_short;
typedef struct { int x; char c; } __Pyx_pad_int;
typedef struct { long x; char c; } __Pyx_pad_long;
typedef struct { float x; char c; } __Pyx_pad_float;
typedef struct { double x; char c; } __Pyx_pad_double;
typedef struct { long double x; char c; } __Pyx_pad_longdouble;
typedef struct { void *x; char c; } __Pyx_pad_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  switch (ch) {
    case 'c':
        return 'H';
    case 'b': case 'h': case 'i':
    case 'l': case 'q': case 's': case 'p':
        return 'I';
    case 'B': case 'H': case 'I': case 'L': case 'Q':
        return 'U';
    case 'f': case 'd': case 'g':
        return (is_complex ? 'C' : 'R');
    case 'O':
        return 'O';
    case 'P':
        return 'P';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset, arraysize = 1;
  if (ctx->enc_type == 0) return 0;
  if (ctx->head->field->type->arraysize[0]) {
    int i, ndim = 0;
    if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
        ctx->is_valid_array = ctx->head->field->type->ndim == 1;
        ndim = 1;
        if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
            PyErr_Format(PyExc_ValueError,
                         "Expected a dimension of size %zu, got %zu",
                         ctx->head->field->type->arraysize[0], ctx->enc_count);
            return -1;
        }
    }
    if (!ctx->is_valid_array) {
      PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
                   ctx->head->field->type->ndim, ndim);
      return -1;
    }
    for (i = 0; i < ctx->head->field->type->ndim; i++) {
      arraysize *= ctx->head->field->type->arraysize[i];
    }
    ctx->is_valid_array = 0;
    ctx->enc_count = 1;
  }
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_TypeInfo* type = field->type;
    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->enc_packmode == '@') {
      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      size_t align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
      if (ctx->struct_alignment == 0)
          ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
                                                                 ctx->is_complex);
    }
    if (type->size != size || type->typegroup != group) {
      if (type->typegroup == 'C' && type->fields != NULL) {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        ++ctx->head;
        ctx->head->field = type->fields;
        ctx->head->parent_offset = parent_offset;
        continue;
      }
      if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
      } else {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
      }
    }
    offset = ctx->head->parent_offset + field->offset;
    if (ctx->fmt_offset != offset) {
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
      return -1;
    }
    ctx->fmt_offset += size;
    if (arraysize)
      ctx->fmt_offset += (arraysize - 1) * size;
    --ctx->enc_count;
    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 CYTHON_INLINE PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
{
    const char *ts = *tsp;
    int i = 0, number;
    int ndim = ctx->head->field->type->ndim;
;
    ++ts;
    if (ctx->new_count != 1) {
        PyErr_SetString(PyExc_ValueError,
                        "Cannot handle repeated arrays in format string");
        return NULL;
    }
    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
    while (*ts && *ts != ')') {
        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_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        ctx->new_packmode = *ts++;
        break;
      case 'T':
        {
          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;
        }
      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;
        }
      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;
        }
    }
  }
}
static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
  buf->buf = NULL;
  buf->obj = NULL;
  buf->strides = __Pyx_zeros;
  buf->shape = __Pyx_zeros;
  buf->suboffsets = __Pyx_minusones;
}
static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
{
  if (obj == Py_None || obj == NULL) {
    __Pyx_ZeroBuffer(buf);
    return 0;
  }
  buf->buf = NULL;
  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
  if (buf->ndim != nd) {
    PyErr_Format(PyExc_ValueError,
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
                 nd, buf->ndim);
    goto fail;
  }
  if (!cast) {
    __Pyx_BufFmt_Context ctx;
    __Pyx_BufFmt_Init(&ctx, stack, dtype);
    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  }
  if ((unsigned)buf->itemsize != dtype->size) {
    PyErr_Format(PyExc_ValueError,
      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
    goto fail;
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_ZeroBuffer(buf);
  return -1;
}
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  if (info->buf == NULL) return;
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  __Pyx_ReleaseBuffer(info);
}

/* MemviewSliceInit */
            static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                        int ndim,
                        __Pyx_memviewslice *memviewslice,
                        int memview_is_new_reference)
{
    __Pyx_RefNannyDeclarations
    int i, retval=-1;
    Py_buffer *buf = &memview->view;
    __Pyx_RefNannySetupContext("init_memviewslice", 0);
    if (!buf) {
        PyErr_SetString(PyExc_ValueError,
            "buf is NULL.");
        goto fail;
    } else if (memviewslice->memview || memviewslice->data) {
        PyErr_SetString(PyExc_ValueError,
            "memviewslice is already initialized!");
        goto fail;
    }
    if (buf->strides) {
        for (i = 0; i < ndim; i++) {
            memviewslice->strides[i] = buf->strides[i];
        }
    } else {
        Py_ssize_t stride = buf->itemsize;
        for (i = ndim - 1; i >= 0; i--) {
            memviewslice->strides[i] = stride;
            stride *= buf->shape[i];
        }
    }
    for (i = 0; i < ndim; i++) {
        memviewslice->shape[i]   = buf->shape[i];
        if (buf->suboffsets) {
            memviewslice->suboffsets[i] = buf->suboffsets[i];
        } else {
            memviewslice->suboffsets[i] = -1;
        }
    }
    memviewslice->memview = memview;
    memviewslice->data = (char *)buf->buf;
    if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
        Py_INCREF(memview);
    }
    retval = 0;
    goto no_fail;
fail:
    memviewslice->memview = 0;
    memviewslice->data = 0;
    retval = -1;
no_fail:
    __Pyx_RefNannyFinishContext();
    return retval;
}
static CYTHON_INLINE void __pyx_fatalerror(const char *fmt, ...) {
    va_list vargs;
    char msg[200];
#ifdef HAVE_STDARG_PROTOTYPES
    va_start(vargs, fmt);
#else
    va_start(vargs);
#endif
    vsnprintf(msg, 200, fmt, vargs);
    Py_FatalError(msg);
    va_end(vargs);
}
static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
                                   PyThread_type_lock lock)
{
    int result;
    PyThread_acquire_lock(lock, 1);
    result = (*acquisition_count)++;
    PyThread_release_lock(lock);
    return result;
}
static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
                                   PyThread_type_lock lock)
{
    int result;
    PyThread_acquire_lock(lock, 1);
    result = (*acquisition_count)--;
    PyThread_release_lock(lock);
    return result;
}
static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
{
    int first_time;
    struct __pyx_memoryview_obj *memview = memslice->memview;
    if (!memview || (PyObject *) memview == Py_None)
        return;
    if (__pyx_get_slice_count(memview) < 0)
        __pyx_fatalerror("Acquisition count is %d (line %d)",
                         __pyx_get_slice_count(memview), lineno);
    first_time = __pyx_add_acquisition_count(memview) == 0;
    if (first_time) {
        if (have_gil) {
            Py_INCREF((PyObject *) memview);
        } else {
            PyGILState_STATE _gilstate = PyGILState_Ensure();
            Py_INCREF((PyObject *) memview);
            PyGILState_Release(_gilstate);
        }
    }
}
static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
                                             int have_gil, int lineno) {
    int last_time;
    struct __pyx_memoryview_obj *memview = memslice->memview;
    if (!memview ) {
        return;
    } else if ((PyObject *) memview == Py_None) {
        memslice->memview = NULL;
        return;
    }
    if (__pyx_get_slice_count(memview) <= 0)
        __pyx_fatalerror("Acquisition count is %d (line %d)",
                         __pyx_get_slice_count(memview), lineno);
    last_time = __pyx_sub_acquisition_count(memview) == 1;
    memslice->data = NULL;
    if (last_time) {
        if (have_gil) {
            Py_CLEAR(memslice->memview);
        } else {
            PyGILState_STATE _gilstate = PyGILState_Ensure();
            Py_CLEAR(memslice->memview);
            PyGILState_Release(_gilstate);
        }
    } else {
        memslice->memview = NULL;
    }
}

/* 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 = 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
}

/* WriteUnraisableException */
            static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* PyIntBinop */
            #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) {
            Py_RETURN_TRUE;
        } else {
            Py_RETURN_FALSE;
        }
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a;
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15
                default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ);
                #else
                default: Py_RETURN_FALSE;
                #endif
            }
        }
            if (a == b) {
                Py_RETURN_TRUE;
            } else {
                Py_RETURN_FALSE;
            }
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            if ((double)a == (double)b) {
                Py_RETURN_TRUE;
            } else {
                Py_RETURN_FALSE;
            }
    }
    return PyObject_RichCompare(op1, op2, Py_EQ);
}
#endif

/* PyIntBinop */
            #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* PyObjectCallMethod1 */
            static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method, *result = NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto done;
#if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *args;
            PyObject *function = PyMethod_GET_FUNCTION(method);
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyCFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            args = PyTuple_New(2);
            if (unlikely(!args)) goto done;
            Py_INCREF(self);
            PyTuple_SET_ITEM(args, 0, self);
            Py_INCREF(arg);
            PyTuple_SET_ITEM(args, 1, arg);
            Py_INCREF(function);
            Py_DECREF(method); method = NULL;
            result = __Pyx_PyObject_Call(function, args, NULL);
            Py_DECREF(args);
            Py_DECREF(function);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallOneArg(method, arg);
done:
    Py_XDECREF(method);
    return result;
}

/* 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(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* 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 = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || 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;
}

/* SaveResetException */
            #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    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;
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrExceptionMatches */
            #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    return 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
    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;
    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;
}

/* 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;
        }
        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_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 Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
    Py_ssize_t q = a / b;
    Py_ssize_t r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

/* GetAttr */
              static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_COMPILING_IN_CPYTHON
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* decode_c_string */
              static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        size_t slen = strlen(cstring);
        if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
            PyErr_SetString(PyExc_OverflowError,
                            "c-string too long to convert to Python");
            return NULL;
        }
        length = (Py_ssize_t) slen;
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    length = stop - start;
    if (unlikely(length <= 0))
        return PyUnicode_FromUnicode(NULL, 0);
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

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

/* SwapException */
              #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    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;
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#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_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* None */
              static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* None */
              static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

/* SetVTable */
              static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* CalculateMetaclass */
              static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* FetchCommonType */
              static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunction */
              static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0 = PySequence_ITEM(arg, 0);
                if (unlikely(!arg0)) return NULL;
                result = (*meth)(self, arg0);
                Py_DECREF(arg0);
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (__pyx_CyFunctionType == NULL) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (!m->defaults)
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* Py3ClassCreate */
                  static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* 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;
    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(
        PyThreadState_GET(), /*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 (PyObject_TypeCheck(obj, __pyx_ptype_7cpython_5array_array)) return __pyx_pw_7cpython_5array_5array_1__getbuffer__(obj, view, flags);
        if (PyObject_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
        if (PyObject_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
    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 (PyObject_TypeCheck(obj, __pyx_ptype_7cpython_5array_array)) { __pyx_pw_7cpython_5array_5array_3__releasebuffer__(obj, view); return; }
    Py_DECREF(obj);
    view->obj = NULL;
}
#endif


                  /* MemviewSliceIsContig */
                  static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs,
                             char order, int ndim)
{
    int i, index, step, start;
    Py_ssize_t itemsize = mvs.memview->view.itemsize;
    if (order == 'F') {
        step = 1;
        start = 0;
    } else {
        step = -1;
        start = ndim - 1;
    }
    for (i = 0; i < ndim; i++) {
        index = start + step * i;
        if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
            return 0;
        itemsize *= mvs.shape[index];
    }
    return 1;
}

/* OverlappingSlices */
                  static void
__pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
                               void **out_start, void **out_end,
                               int ndim, size_t itemsize)
{
    char *start, *end;
    int i;
    start = end = slice->data;
    for (i = 0; i < ndim; i++) {
        Py_ssize_t stride = slice->strides[i];
        Py_ssize_t extent = slice->shape[i];
        if (extent == 0) {
            *out_start = *out_end = start;
            return;
        } else {
            if (stride > 0)
                end += stride * (extent - 1);
            else
                start += stride * (extent - 1);
        }
    }
    *out_start = start;
    *out_end = end + itemsize;
}
static int
__pyx_slices_overlap(__Pyx_memviewslice *slice1,
                     __Pyx_memviewslice *slice2,
                     int ndim, size_t itemsize)
{
    void *start1, *end1, *start2, *end2;
    __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
    __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
    return (start1 < end2) && (start2 < end1);
}

/* Capsule */
                  static CYTHON_INLINE PyObject *
__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
{
    PyObject *cobj;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(p, sig, NULL);
#else
    cobj = PyCObject_FromVoidPtr(p, NULL);
#endif
    return cobj;
}

/* 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;\
    }

/* TypeInfoCompare */
                  static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
{
    int i;
    if (!a || !b)
        return 0;
    if (a == b)
        return 1;
    if (a->size != b->size || a->typegroup != b->typegroup ||
            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
        if (a->typegroup == 'H' || b->typegroup == 'H') {
            return a->size == b->size;
        } else {
            return 0;
        }
    }
    if (a->ndim) {
        for (i = 0; i < a->ndim; i++)
            if (a->arraysize[i] != b->arraysize[i])
                return 0;
    }
    if (a->typegroup == 'S') {
        if (a->flags != b->flags)
            return 0;
        if (a->fields || b->fields) {
            if (!(a->fields && b->fields))
                return 0;
            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
                __Pyx_StructField *field_a = a->fields + i;
                __Pyx_StructField *field_b = b->fields + i;
                if (field_a->offset != field_b->offset ||
                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
                    return 0;
            }
            return !a->fields[i].type && !b->fields[i].type;
        }
    }
    return 1;
}

/* MemviewSliceValidateAndInit */
                  static int
__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
{
    if (buf->shape[dim] <= 1)
        return 1;
    if (buf->strides) {
        if (spec & __Pyx_MEMVIEW_CONTIG) {
            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
                if (buf->strides[dim] != sizeof(void *)) {
                    PyErr_Format(PyExc_ValueError,
                                 "Buffer is not indirectly contiguous "
                                 "in dimension %d.", dim);
                    goto fail;
                }
            } else if (buf->strides[dim] != buf->itemsize) {
                PyErr_SetString(PyExc_ValueError,
                                "Buffer and memoryview are not contiguous "
                                "in the same dimension.");
                goto fail;
            }
        }
        if (spec & __Pyx_MEMVIEW_FOLLOW) {
            Py_ssize_t stride = buf->strides[dim];
            if (stride < 0)
                stride = -stride;
            if (stride < buf->itemsize) {
                PyErr_SetString(PyExc_ValueError,
                                "Buffer and memoryview are not contiguous "
                                "in the same dimension.");
                goto fail;
            }
        }
    } else {
        if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
            PyErr_Format(PyExc_ValueError,
                         "C-contiguous buffer is not contiguous in "
                         "dimension %d", dim);
            goto fail;
        } else if (spec & (__Pyx_MEMVIEW_PTR)) {
            PyErr_Format(PyExc_ValueError,
                         "C-contiguous buffer is not indirect in "
                         "dimension %d", dim);
            goto fail;
        } else if (buf->suboffsets) {
            PyErr_SetString(PyExc_ValueError,
                            "Buffer exposes suboffsets but no strides");
            goto fail;
        }
    }
    return 1;
fail:
    return 0;
}
static int
__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
{
    if (spec & __Pyx_MEMVIEW_DIRECT) {
        if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
            PyErr_Format(PyExc_ValueError,
                         "Buffer not compatible with direct access "
                         "in dimension %d.", dim);
            goto fail;
        }
    }
    if (spec & __Pyx_MEMVIEW_PTR) {
        if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) {
            PyErr_Format(PyExc_ValueError,
                         "Buffer is not indirectly accessible "
                         "in dimension %d.", dim);
            goto fail;
        }
    }
    return 1;
fail:
    return 0;
}
static int
__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
{
    int i;
    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
        Py_ssize_t stride = 1;
        for (i = 0; i < ndim; i++) {
            if (stride * buf->itemsize != buf->strides[i] &&
                    buf->shape[i] > 1)
            {
                PyErr_SetString(PyExc_ValueError,
                    "Buffer not fortran contiguous.");
                goto fail;
            }
            stride = stride * buf->shape[i];
        }
    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
        Py_ssize_t stride = 1;
        for (i = ndim - 1; i >- 1; i--) {
            if (stride * buf->itemsize != buf->strides[i] &&
                    buf->shape[i] > 1) {
                PyErr_SetString(PyExc_ValueError,
                    "Buffer not C contiguous.");
                goto fail;
            }
            stride = stride * buf->shape[i];
        }
    }
    return 1;
fail:
    return 0;
}
static int __Pyx_ValidateAndInit_memviewslice(
                int *axes_specs,
                int c_or_f_flag,
                int buf_flags,
                int ndim,
                __Pyx_TypeInfo *dtype,
                __Pyx_BufFmt_StackElem stack[],
                __Pyx_memviewslice *memviewslice,
                PyObject *original_obj)
{
    struct __pyx_memoryview_obj *memview, *new_memview;
    __Pyx_RefNannyDeclarations
    Py_buffer *buf;
    int i, spec = 0, retval = -1;
    __Pyx_BufFmt_Context ctx;
    int from_memoryview = __pyx_memoryview_check(original_obj);
    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
                                                            original_obj)->typeinfo)) {
        memview = (struct __pyx_memoryview_obj *) original_obj;
        new_memview = NULL;
    } else {
        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
                                            original_obj, buf_flags, 0, dtype);
        new_memview = memview;
        if (unlikely(!memview))
            goto fail;
    }
    buf = &memview->view;
    if (buf->ndim != ndim) {
        PyErr_Format(PyExc_ValueError,
                "Buffer has wrong number of dimensions (expected %d, got %d)",
                ndim, buf->ndim);
        goto fail;
    }
    if (new_memview) {
        __Pyx_BufFmt_Init(&ctx, stack, dtype);
        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
    }
    if ((unsigned) buf->itemsize != dtype->size) {
        PyErr_Format(PyExc_ValueError,
                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
                     buf->itemsize,
                     (buf->itemsize > 1) ? "s" : "",
                     dtype->name,
                     dtype->size,
                     (dtype->size > 1) ? "s" : "");
        goto fail;
    }
    for (i = 0; i < ndim; i++) {
        spec = axes_specs[i];
        if (!__pyx_check_strides(buf, i, ndim, spec))
            goto fail;
        if (!__pyx_check_suboffsets(buf, i, ndim, spec))
            goto fail;
    }
    if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
        goto fail;
    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
                                         new_memview != NULL) == -1)) {
        goto fail;
    }
    retval = 0;
    goto no_fail;
fail:
    Py_XDECREF(new_memview);
    retval = -1;
no_fail:
    __Pyx_RefNannyFinishContext();
    return retval;
}

/* ObjectToMemviewSlice */
                  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_int(PyObject *obj) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                 PyBUF_RECORDS, 1,
                                                 &__Pyx_TypeInfo_unsigned_int, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* CIntToPy */
                  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint16_t(uint16_t value) {
    const uint16_t neg_one = (uint16_t) -1, const_zero = (uint16_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint16_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint16_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint16_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint16_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint16_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(uint16_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) {
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned 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(unsigned int),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (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);
    }
}

static PyObject* __pyx_convert__to_py_struct__fwdpy_3a__3a_popsample_details(struct fwdpy::popsample_details s) {
                    PyObject* res;
                    PyObject* member;
                    res = PyDict_New(); if (unlikely(!res)) return NULL;
                    member = __pyx_convert_vector_to_py_double(s.s); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_s, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_double(s.h); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_h, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_double(s.p); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_p, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_unsigned_int(s.dcount); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_dcount, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_unsigned_int(s.origin); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_origin, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_unsigned_int(s.generation); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_generation, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_unsigned_int(s.ftime); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_ftime, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_unsigned_int(s.locus); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_locus, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_uint16_t(s.label); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_label, member) < 0)) goto bad;
                    Py_DECREF(member);
                    return res;
                    bad:
                    Py_XDECREF(member);
                    Py_DECREF(res);
                    return NULL;
                  }
                  /* CIntToPy */
                  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (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);
    }
}

/* MemviewDtypeToObject */
                  static CYTHON_INLINE PyObject *__pyx_memview_get_unsigned_int(const char *itemp) {
    return (PyObject *) __Pyx_PyInt_From_unsigned_int(*(unsigned int *) itemp);
}
static CYTHON_INLINE int __pyx_memview_set_unsigned_int(const char *itemp, PyObject *obj) {
    unsigned int value = __Pyx_PyInt_As_unsigned_int(obj);
    if ((value == (unsigned int)-1) && PyErr_Occurred())
        return 0;
    *(unsigned int *) itemp = value;
    return 1;
}

static PyObject* __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data(struct __pyx_t_5fwdpy_5fwdpy_popgen_mut_data s) {
                    PyObject* res;
                    PyObject* member;
                    res = PyDict_New(); if (unlikely(!res)) return NULL;
                    member = PyFloat_FromDouble(s.pos); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_pos, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.s); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_s, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.h); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_h, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_unsigned_int(s.n); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_n, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_unsigned_int(s.g); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_g, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_unsigned_int(s.ftime); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_ftime, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyBool_FromLong(s.neutral); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_neutral, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_uint16_t(s.label); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_label, member) < 0)) goto bad;
                    Py_DECREF(member);
                    return res;
                    bad:
                    Py_XDECREF(member);
                    Py_DECREF(res);
                    return NULL;
                  }
                  static PyObject* __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data(struct __pyx_t_5fwdpy_5fwdpy_gamete_data s) {
                    PyObject* res;
                    PyObject* member;
                    res = PyDict_New(); if (unlikely(!res)) return NULL;
                    member = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data(s.neutral); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_neutral, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_popgen_mut_data(s.selected); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_selected, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_unsigned_int(s.n); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_n, member) < 0)) goto bad;
                    Py_DECREF(member);
                    return res;
                    bad:
                    Py_XDECREF(member);
                    Py_DECREF(res);
                    return NULL;
                  }
                  static PyObject* __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_data(struct __pyx_t_5fwdpy_5fwdpy_diploid_data s) {
                    PyObject* res;
                    PyObject* member;
                    res = PyDict_New(); if (unlikely(!res)) return NULL;
                    member = __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data(s.chrom0); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_chrom0, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data(s.chrom1); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_chrom1, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.g); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_g, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.e); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_e, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.w); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_w, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.sh0); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_sh0, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.sh1); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_sh1, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_int(s.n0); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_n0, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_int(s.n1); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_n1, member) < 0)) goto bad;
                    Py_DECREF(member);
                    return res;
                    bad:
                    Py_XDECREF(member);
                    Py_DECREF(res);
                    return NULL;
                  }
                  static PyObject* __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_mloc_data(struct __pyx_t_5fwdpy_5fwdpy_diploid_mloc_data s) {
                    PyObject* res;
                    PyObject* member;
                    res = PyDict_New(); if (unlikely(!res)) return NULL;
                    member = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data(s.chrom0); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_chrom0, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_struct____pyx_t_5fwdpy_5fwdpy_gamete_data(s.chrom1); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_chrom1, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.g); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_g, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.e); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_e, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.w); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_w, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_double(s.sh0); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_sh0, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_double(s.sh1); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_sh1, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_int(s.n0); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_n0, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_int(s.n1); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_n1, member) < 0)) goto bad;
                    Py_DECREF(member);
                    return res;
                    bad:
                    Py_XDECREF(member);
                    Py_DECREF(res);
                    return NULL;
                  }
                  static PyObject* __pyx_convert__to_py_struct____pyx_t_5fwdpy_5fwdpy_diploid_view_data(struct __pyx_t_5fwdpy_5fwdpy_diploid_view_data s) {
                    PyObject* res;
                    PyObject* member;
                    res = PyDict_New(); if (unlikely(!res)) return NULL;
                    member = __pyx_convert_vector_to_py_double(s.s); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_s, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_double(s.h); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_h, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_unsigned_int(s.n); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_n, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_unsigned_int(s.g); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_g, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_unsigned_int(s.ind); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_ind, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __pyx_convert_vector_to_py_unsigned_int(s.chrom); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_chrom, member) < 0)) goto bad;
                    Py_DECREF(member);
                    return res;
                    bad:
                    Py_XDECREF(member);
                    Py_DECREF(res);
                    return NULL;
                  }
                  static PyObject* __pyx_convert__to_py_struct__fwdpy_3a__3a_allele_age_data_t(struct fwdpy::allele_age_data_t s) {
                    PyObject* res;
                    PyObject* member;
                    res = PyDict_New(); if (unlikely(!res)) return NULL;
                    member = PyFloat_FromDouble(s.esize); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_esize, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.max_freq); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_max_freq, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.last_freq); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_last_freq, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_unsigned_int(s.origin); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_origin, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_unsigned_int(s.tlen); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_tlen, member) < 0)) goto bad;
                    Py_DECREF(member);
                    return res;
                    bad:
                    Py_XDECREF(member);
                    Py_DECREF(res);
                    return NULL;
                  }
                  static PyObject* __pyx_convert__to_py_struct__fwdpy_3a__3a_selected_mut_data(struct fwdpy::selected_mut_data s) {
                    PyObject* res;
                    PyObject* member;
                    res = PyDict_New(); if (unlikely(!res)) return NULL;
                    member = PyFloat_FromDouble(s.pos); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_pos, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.esize); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_esize, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_unsigned_int(s.origin); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_origin, member) < 0)) goto bad;
                    Py_DECREF(member);
                    return res;
                    bad:
                    Py_XDECREF(member);
                    Py_DECREF(res);
                    return NULL;
                  }
                  static PyObject* __pyx_convert__to_py_struct__fwdpy_3a__3a_selected_mut_data_tidy(struct fwdpy::selected_mut_data_tidy s) {
                    PyObject* res;
                    PyObject* member;
                    res = PyDict_New(); if (unlikely(!res)) return NULL;
                    member = PyFloat_FromDouble(s.pos); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_pos, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.esize); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_esize, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.freq); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_freq, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_unsigned_int(s.origin); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_origin, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_unsigned_int(s.generation); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_generation, member) < 0)) goto bad;
                    Py_DECREF(member);
                    return res;
                    bad:
                    Py_XDECREF(member);
                    Py_DECREF(res);
                    return NULL;
                  }
                  static PyObject* __pyx_convert__to_py_struct__fwdpy_3a__3a_qtrait_stats_cython(struct fwdpy::qtrait_stats_cython s) {
                    PyObject* res;
                    PyObject* member;
                    res = PyDict_New(); if (unlikely(!res)) return NULL;
                    member = __pyx_convert_PyObject_string_to_py_std__in_string(s.stat); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_stat, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.value); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_value, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_unsigned_int(s.generation); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_generation, member) < 0)) goto bad;
                    Py_DECREF(member);
                    return res;
                    bad:
                    Py_XDECREF(member);
                    Py_DECREF(res);
                    return NULL;
                  }
                  static PyObject* __pyx_convert__to_py_struct__fwdpy_3a__3a_VAcum(struct fwdpy::VAcum s) {
                    PyObject* res;
                    PyObject* member;
                    res = PyDict_New(); if (unlikely(!res)) return NULL;
                    member = PyFloat_FromDouble(s.freq); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_freq, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = PyFloat_FromDouble(s.pss); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_pss, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_unsigned_int(s.generation); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_generation, member) < 0)) goto bad;
                    Py_DECREF(member);
                    member = __Pyx_PyInt_From_unsigned_int(s.N); if (unlikely(!member)) goto bad;
                    if (unlikely(PyDict_SetItem(res, __pyx_n_s_N, member) < 0)) goto bad;
                    Py_DECREF(member);
                    return res;
                    bad:
                    Py_XDECREF(member);
                    Py_DECREF(res);
                    return NULL;
                  }
                  /* MemviewSliceCopyTemplate */
                  static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
                                 const char *mode, int ndim,
                                 size_t sizeof_dtype, int contig_flag,
                                 int dtype_is_object)
{
    __Pyx_RefNannyDeclarations
    int i;
    __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
    struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
    Py_buffer *buf = &from_memview->view;
    PyObject *shape_tuple = NULL;
    PyObject *temp_int = NULL;
    struct __pyx_array_obj *array_obj = NULL;
    struct __pyx_memoryview_obj *memview_obj = NULL;
    __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
    for (i = 0; i < ndim; i++) {
        if (from_mvs->suboffsets[i] >= 0) {
            PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
                                           "indirect dimensions (axis %d)", i);
            goto fail;
        }
    }
    shape_tuple = PyTuple_New(ndim);
    if (unlikely(!shape_tuple)) {
        goto fail;
    }
    __Pyx_GOTREF(shape_tuple);
    for(i = 0; i < ndim; i++) {
        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
        if(unlikely(!temp_int)) {
            goto fail;
        } else {
            PyTuple_SET_ITEM(shape_tuple, i, temp_int);
            temp_int = NULL;
        }
    }
    array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
    if (unlikely(!array_obj)) {
        goto fail;
    }
    __Pyx_GOTREF(array_obj);
    memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
                                    (PyObject *) array_obj, contig_flag,
                                    dtype_is_object,
                                    from_mvs->memview->typeinfo);
    if (unlikely(!memview_obj))
        goto fail;
    if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
        goto fail;
    if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
                                                dtype_is_object) < 0))
        goto fail;
    goto no_fail;
fail:
    __Pyx_XDECREF(new_mvs.memview);
    new_mvs.memview = NULL;
    new_mvs.data = NULL;
no_fail:
    __Pyx_XDECREF(shape_tuple);
    __Pyx_XDECREF(temp_int);
    __Pyx_XDECREF(array_obj);
    __Pyx_RefNannyFinishContext();
    return new_mvs;
}

/* CIntFromPy */
                  static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(unsigned int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (unsigned 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 (unsigned int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, digits[0])
                case 2:
                    if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) {
                            return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) {
                            return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned int) >= 4 * PyLong_SHIFT) {
                            return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned 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 (unsigned int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(unsigned int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned 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 (unsigned int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(unsigned int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned int) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned int) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(unsigned int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned 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
            unsigned 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 (unsigned int) -1;
        }
    } else {
        unsigned int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (unsigned int) -1;
        val = __Pyx_PyInt_As_unsigned_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned int");
    return (unsigned int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned int");
    return (unsigned int) -1;
}

/* CIntFromPy */
                  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (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 uint16_t __Pyx_PyInt_As_uint16_t(PyObject *x) {
    const uint16_t neg_one = (uint16_t) -1, const_zero = (uint16_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(uint16_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(uint16_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (uint16_t) 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 (uint16_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(uint16_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(uint16_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint16_t) >= 2 * PyLong_SHIFT) {
                            return (uint16_t) (((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(uint16_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint16_t) >= 3 * PyLong_SHIFT) {
                            return (uint16_t) (((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(uint16_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint16_t, 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(uint16_t) >= 4 * PyLong_SHIFT) {
                            return (uint16_t) (((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)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 (uint16_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(uint16_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint16_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(uint16_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint16_t, 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 (uint16_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(uint16_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(uint16_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(uint16_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT) {
                            return (uint16_t) (((uint16_t)-1)*(((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(uint16_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT) {
                            return (uint16_t) ((((((uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(uint16_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint16_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT) {
                            return (uint16_t) (((uint16_t)-1)*(((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(uint16_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT) {
                            return (uint16_t) ((((((((uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(uint16_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint16_t, 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(uint16_t) - 1 > 4 * PyLong_SHIFT) {
                            return (uint16_t) (((uint16_t)-1)*(((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(uint16_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(uint16_t, 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(uint16_t) - 1 > 4 * PyLong_SHIFT) {
                            return (uint16_t) ((((((((((uint16_t)digits[3]) << PyLong_SHIFT) | (uint16_t)digits[2]) << PyLong_SHIFT) | (uint16_t)digits[1]) << PyLong_SHIFT) | (uint16_t)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(uint16_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint16_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(uint16_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(uint16_t, 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
            uint16_t 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 (uint16_t) -1;
        }
    } else {
        uint16_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (uint16_t) -1;
        val = __Pyx_PyInt_As_uint16_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to uint16_t");
    return (uint16_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to uint16_t");
    return (uint16_t) -1;
}

/* CIntFromPy */
                  static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) 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 (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, 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(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_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
#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 (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, 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 (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, 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(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((((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(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, 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(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_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
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, 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
            size_t 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 (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* CIntFromPy */
                  static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *x) {
    const short neg_one = (short) -1, const_zero = (short) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(short) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(short, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (short) 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 (short) 0;
                case  1: __PYX_VERIFY_RETURN_INT(short, digit, digits[0])
                case 2:
                    if (8 * sizeof(short) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) >= 2 * PyLong_SHIFT) {
                            return (short) (((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(short) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) >= 3 * PyLong_SHIFT) {
                            return (short) (((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(short) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, 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(short) >= 4 * PyLong_SHIFT) {
                            return (short) (((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)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 (short) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(short) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(short) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, 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 (short) 0;
                case -1: __PYX_VERIFY_RETURN_INT(short, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(short,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(short) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
                            return (short) (((short)-1)*(((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(short) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
                            return (short) ((((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
                            return (short) (((short)-1)*(((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(short) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
                            return (short) ((((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, 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(short) - 1 > 4 * PyLong_SHIFT) {
                            return (short) (((short)-1)*(((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(short) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, 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(short) - 1 > 4 * PyLong_SHIFT) {
                            return (short) ((((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(short) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(short) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, 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
            short 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 (short) -1;
        }
    } else {
        short val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (short) -1;
        val = __Pyx_PyInt_As_short(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to short");
    return (short) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to short");
    return (short) -1;
}

/* CIntFromPy */
                  static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
    const char neg_one = (char) -1, const_zero = (char) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(char) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (char) 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 (char) 0;
                case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
                case 2:
                    if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
                            return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
                            return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, 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(char) >= 4 * PyLong_SHIFT) {
                            return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)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 (char) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(char) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, 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 (char) 0;
                case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                            return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                            return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, 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(char) - 1 > 4 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, 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(char) - 1 > 4 * PyLong_SHIFT) {
                            return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(char) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, 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
            char 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 (char) -1;
        }
    } else {
        char val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (char) -1;
        val = __Pyx_PyInt_As_char(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to char");
    return (char) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to char");
    return (char) -1;
}

/* CIntFromPy */
                  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (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;
}

/* CoroutineBase */
                  #include <structmember.h>
#include <frameobject.h>
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#if PY_VERSION_HEX >= 0x030300A0
        else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
        }
#endif
        else if (unlikely(PyTuple_Check(ev))) {
            if (PyTuple_GET_SIZE(ev) >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#else
                value = PySequence_ITEM(ev, 0);
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
#endif
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__pyx_CoroutineObject *self) {
    PyObject *exc_type = self->exc_type;
    PyObject *exc_value = self->exc_value;
    PyObject *exc_traceback = self->exc_traceback;
    self->exc_type = NULL;
    self->exc_value = NULL;
    self->exc_traceback = NULL;
    Py_XDECREF(exc_type);
    Py_XDECREF(exc_value);
    Py_XDECREF(exc_traceback);
}
static CYTHON_INLINE
int __Pyx_Coroutine_CheckRunning(__pyx_CoroutineObject *gen) {
    if (unlikely(gen->is_running)) {
        PyErr_SetString(PyExc_ValueError,
                        "generator already executing");
        return 1;
    }
    return 0;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value) {
    PyObject *retval;
    __Pyx_PyThreadState_declare
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            PyErr_SetString(PyExc_TypeError,
                            "can't send non-None value to a "
                            "just-started generator");
            return NULL;
        }
    }
    if (unlikely(self->resume_label == -1)) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    __Pyx_PyThreadState_assign
    if (value) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        if (self->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_XINCREF(__pyx_tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = __pyx_tstate->frame;
        }
#endif
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(self);
    }
    self->is_running = 1;
    retval = self->body((PyObject *) self, value);
    self->is_running = 0;
    if (retval) {
        __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value,
                            &self->exc_traceback);
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        if (self->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_CLEAR(f->f_back);
        }
#endif
    } else {
        __Pyx_Coroutine_ExceptionClear(self);
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(PyObject *retval) {
    if (unlikely(!retval && !PyErr_Occurred())) {
        PyErr_SetNone(PyExc_StopIteration);
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen_FetchStopIterationValue(&val);
    ret = __Pyx_Coroutine_SendEx(gen, val);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = Py_TYPE(yf)->tp_iternext(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value);
    }
    return __Pyx_Coroutine_MethodReturn(retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
            ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Coroutine_SendEx(gen, NULL);
    if (retval) {
        Py_DECREF(retval);
        PyErr_SetString(PyExc_RuntimeError,
                        "generator ignored GeneratorExit");
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (!raised_exception
        || raised_exception == PyExc_StopIteration
        || raised_exception == PyExc_GeneratorExit
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
        || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
    {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *typ;
    PyObject *tb = NULL;
    PyObject *val = NULL;
    PyObject *yf = gen->yieldfrom;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    if (unlikely(__Pyx_Coroutine_CheckRunning(gen)))
        return NULL;
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL));
            goto throw_here;
        }
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Throw(yf, args);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Throw(yf, args);
        } else
        #endif
        {
            PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            ret = PyObject_CallObject(meth, args);
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL));
}
static int __Pyx_Coroutine_traverse(PyObject *self, visitproc visit, void *arg) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    Py_VISIT(gen->exc_type);
    Py_VISIT(gen->exc_value);
    Py_VISIT(gen->exc_traceback);
    return 0;
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    Py_CLEAR(gen->exc_type);
    Py_CLEAR(gen->exc_value);
    Py_CLEAR(gen->exc_traceback);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label > 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (self->ob_refcnt > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
    __Pyx_Coroutine_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *res;
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label <= 0)
        return ;
#if PY_VERSION_HEX < 0x030400a1
    assert(self->ob_refcnt == 0);
    self->ob_refcnt = 1;
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
    res = __Pyx_Coroutine_Close(self);
    if (res == NULL)
        PyErr_WriteUnraisable(self);
    else
        Py_DECREF(res);
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if PY_VERSION_HEX < 0x030400a1
    assert(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        self->ob_refcnt = refcnt;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self)
{
    PyObject *name = self->gi_name;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self)
{
    PyObject *name = self->gi_qualname;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (gen == NULL)
        return NULL;
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->exc_type = NULL;
    gen->exc_value = NULL;
    gen->exc_traceback = NULL;
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    PyObject_GC_Track(gen);
    return gen;
}

/* PatchModuleWithCoroutine */
                      static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
                      #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (!abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_VERSION_HEX >= 0x03030000) ? "collections.abc" : "collections");
        if (!module) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_VERSION_HEX >= 0x03030000) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if (0) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Generator */
                      static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
    0,
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if PY_VERSION_HEX >= 0x030400a1
    __Pyx_Coroutine_del,
#endif
};
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (unlikely(!__pyx_GeneratorType)) {
        return -1;
    }
    return 0;
}

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

/* FunctionExport */
                      static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* ModuleImport */
                      #ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

/* TypeImport */
                      #ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.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 (!strict && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
            module_name, class_name, basicsize, size);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    else if ((size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
            module_name, class_name, basicsize, size);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

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

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 char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else
        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (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
    } 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 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 (PyInt_Check(x) || PyLong_Check(x))
#else
  if (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 = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
  #else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
  #endif
#else
  res = PyNumber_Int(x);
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#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(x);
  }
#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_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
