/* Generated by Cython 0.29.33 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [],
        "include_dirs": [
            "/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-build-env-ykxdc412/overlay/lib/python3.9/site-packages/brainpy/_c"
        ],
        "name": "ms_deisotope._c.averagine",
        "sources": [
            "src/ms_deisotope/_c/averagine.pyx"
        ]
    },
    "module_name": "ms_deisotope._c.averagine"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_33"
#define CYTHON_HEX_VERSION 0x001D21F0
#define CYTHON_FUTURE_DIVISION 0
#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
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_NOGIL 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_NOGIL 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  #endif
#elif defined(PY_NOGIL)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_NOGIL 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #ifndef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #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
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE 1
  #endif
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #define CYTHON_COMPILING_IN_NOGIL 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
    #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
  #if PY_VERSION_HEX >= 0x030B00A4
    #undef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 0
  #elif !defined(CYTHON_FAST_THREAD_STATE)
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #if PY_VERSION_HEX >= 0x030B00A4
    #undef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK 0
  #elif !defined(CYTHON_USE_EXC_INFO_STACK)
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
    #define CYTHON_UPDATE_DESCRIPTOR_DOC 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
  #if PY_MAJOR_VERSION < 3
    #include "longintrepr.h"
  #endif
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<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)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_DefaultClassType PyType_Type
#if PY_VERSION_HEX >= 0x030B00A1
    static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f,
                                                    PyObject *code, PyObject *c, PyObject* n, PyObject *v,
                                                    PyObject *fv, PyObject *cell, PyObject* fn,
                                                    PyObject *name, int fline, PyObject *lnos) {
        PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
        PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
        const char *fn_cstr=NULL;
        const char *name_cstr=NULL;
        PyCodeObject* co=NULL;
        PyObject *type, *value, *traceback;
        PyErr_Fetch(&type, &value, &traceback);
        if (!(kwds=PyDict_New())) goto end;
        if (!(argcount=PyLong_FromLong(a))) goto end;
        if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end;
        if (!(posonlyargcount=PyLong_FromLong(0))) goto end;
        if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end;
        if (!(kwonlyargcount=PyLong_FromLong(k))) goto end;
        if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end;
        if (!(nlocals=PyLong_FromLong(l))) goto end;
        if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end;
        if (!(stacksize=PyLong_FromLong(s))) goto end;
        if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end;
        if (!(flags=PyLong_FromLong(f))) goto end;
        if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end;
        if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end;
        if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end;
        if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end;
        if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end;
        if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too;
        if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here
        if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too;
        Py_XDECREF((PyObject*)co);
        co = (PyCodeObject*)call_result;
        call_result = NULL;
        if (0) {
            cleanup_code_too:
            Py_XDECREF((PyObject*)co);
            co = NULL;
        }
        end:
        Py_XDECREF(kwds);
        Py_XDECREF(argcount);
        Py_XDECREF(posonlyargcount);
        Py_XDECREF(kwonlyargcount);
        Py_XDECREF(nlocals);
        Py_XDECREF(stacksize);
        Py_XDECREF(replace);
        Py_XDECREF(call_result);
        Py_XDECREF(empty);
        if (type) {
            PyErr_Restore(type, value, traceback);
        }
        return co;
    }
#else
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_READY(op)       (0)
  #else
    #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                                0 : _PyUnicode_Ready((PyObject *)(op)))
  #endif
  #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)
  #if PY_VERSION_HEX >= 0x030C0000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #else
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
    #else
    #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
    #endif
  #endif
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#ifndef PyObject_Unicode
  #define PyObject_Unicode             PyObject_Str
#endif
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsHash_t
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   __Pyx_PyIndex_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  #if !defined(_USE_MATH_DEFINES)
    #define _USE_MATH_DEFINES
  #endif
#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_MARK_ERR_POS(f_index, lineno) \
    { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

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

#define __PYX_HAVE__ms_deisotope___c__averagine
#define __PYX_HAVE_API__ms_deisotope___c__averagine
/* Early includes */
#include <string.h>
#include <stdio.h>
#include "pythread.h"
#include <math.h>
#include <stdlib.h>
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <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)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "src/ms_deisotope/_c/averagine.pyx",
  "src/ms_deisotope/_c/averagine.pxd",
  "composition.pxd",
  "isotopic_distribution.pxd",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
  "_speedup.pxd",
  "peak_set.pxd",
};

/* "brainpy/_c/composition.pxd":3
 * from brainpy.mass_dict import nist_mass as __nist_mass
 * 
 * ctypedef long count_type             # <<<<<<<<<<<<<<
 * 
 * cdef dict nist_mass
 */

#line 3 "brainpy/_c/composition.pxd"
typedef long __pyx_t_7brainpy_2_c_11composition_count_type;

/*--- Type declarations ---*/
struct __pyx_obj_7brainpy_2_c_11composition_PyComposition;
struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak;
struct __pyx_obj_7brainpy_8_speedup_Element;
struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakBase;
struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak;
struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet;
struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed;
struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine;
struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern;
struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache;
struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__;
struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr;
struct __pyx_opt_args_7brainpy_2_c_11composition_neutral_mass;
struct __pyx_opt_args_7brainpy_2_c_11composition_mass_charge_ratio;
struct __pyx_t_7brainpy_2_c_11composition_Isotope;
struct __pyx_t_7brainpy_2_c_11composition_IsotopeMap;
struct __pyx_t_7brainpy_2_c_11composition_Element;
struct __pyx_t_7brainpy_2_c_11composition_ElementHashBucket;
struct __pyx_t_7brainpy_2_c_11composition_ElementHashTable;
struct __pyx_t_7brainpy_2_c_11composition_Composition;
struct __pyx_opt_args_7brainpy_2_c_11composition_13PyComposition__set_impl;
struct __pyx_opt_args_7brainpy_2_c_11composition_13PyComposition_pop;

/* "brainpy/_c/composition.pxd":10
 * cdef double PROTON = nist_mass["H+"][0][0]
 * 
 * cdef double neutral_mass(double mz,  int z, double charge_carrier=*) nogil             # <<<<<<<<<<<<<<
 * cdef double mass_charge_ratio(double neutral_mass, int z, double charge_carrier=*) nogil
 * cdef char* _parse_isotope_string(char* label, int* isotope_num, char* element_name) nogil
 */

#line 10 "brainpy/_c/composition.pxd"
struct __pyx_opt_args_7brainpy_2_c_11composition_neutral_mass {

#line 10 "brainpy/_c/composition.pxd"
  int __pyx_n;

#line 10 "brainpy/_c/composition.pxd"
  double charge_carrier;

#line 10 "brainpy/_c/composition.pxd"
};

/* "brainpy/_c/composition.pxd":11
 * 
 * cdef double neutral_mass(double mz,  int z, double charge_carrier=*) nogil
 * cdef double mass_charge_ratio(double neutral_mass, int z, double charge_carrier=*) nogil             # <<<<<<<<<<<<<<
 * cdef char* _parse_isotope_string(char* label, int* isotope_num, char* element_name) nogil
 * 
 */

#line 11 "brainpy/_c/composition.pxd"
struct __pyx_opt_args_7brainpy_2_c_11composition_mass_charge_ratio {

#line 11 "brainpy/_c/composition.pxd"
  int __pyx_n;

#line 11 "brainpy/_c/composition.pxd"
  double charge_carrier;

#line 11 "brainpy/_c/composition.pxd"
};

/* "brainpy/_c/composition.pxd":17
 * # Isotope and IsotopeMap Declarations
 * 
 * cdef struct Isotope:             # <<<<<<<<<<<<<<
 *     double mass
 *     double abundance
 */

#line 17 "brainpy/_c/composition.pxd"
struct __pyx_t_7brainpy_2_c_11composition_Isotope {

#line 17 "brainpy/_c/composition.pxd"
  double mass;

#line 17 "brainpy/_c/composition.pxd"
  double abundance;

#line 17 "brainpy/_c/composition.pxd"
  int neutrons;

#line 17 "brainpy/_c/composition.pxd"
  int neutron_shift;

#line 17 "brainpy/_c/composition.pxd"
};

/* "brainpy/_c/composition.pxd":23
 *     int neutron_shift
 * 
 * cdef struct IsotopeMap:             # <<<<<<<<<<<<<<
 *     Isotope* bins
 *     size_t size
 */

#line 23 "brainpy/_c/composition.pxd"
struct __pyx_t_7brainpy_2_c_11composition_IsotopeMap {

#line 23 "brainpy/_c/composition.pxd"
  struct __pyx_t_7brainpy_2_c_11composition_Isotope *bins;

#line 23 "brainpy/_c/composition.pxd"
  size_t size;

#line 23 "brainpy/_c/composition.pxd"
};

/* "brainpy/_c/composition.pxd":36
 * # Element Declarations
 * 
 * cdef struct Element:             # <<<<<<<<<<<<<<
 *     char* symbol
 *     IsotopeMap* isotopes
 */

#line 36 "brainpy/_c/composition.pxd"
struct __pyx_t_7brainpy_2_c_11composition_Element {

#line 36 "brainpy/_c/composition.pxd"
  char *symbol;

#line 36 "brainpy/_c/composition.pxd"
  struct __pyx_t_7brainpy_2_c_11composition_IsotopeMap *isotopes;

#line 36 "brainpy/_c/composition.pxd"
  int monoisotopic_isotope_index;

#line 36 "brainpy/_c/composition.pxd"
};

/* "brainpy/_c/composition.pxd":56
 * # ElementHashTable and ElementHashBucket Declarations
 * 
 * cdef struct ElementHashBucket:             # <<<<<<<<<<<<<<
 *     Element** elements
 *     size_t used
 */

#line 56 "brainpy/_c/composition.pxd"
struct __pyx_t_7brainpy_2_c_11composition_ElementHashBucket {

#line 56 "brainpy/_c/composition.pxd"
  struct __pyx_t_7brainpy_2_c_11composition_Element **elements;

#line 56 "brainpy/_c/composition.pxd"
  size_t used;

#line 56 "brainpy/_c/composition.pxd"
  size_t size;

#line 56 "brainpy/_c/composition.pxd"
};

/* "brainpy/_c/composition.pxd":65
 * 
 * 
 * cdef struct ElementHashTable:             # <<<<<<<<<<<<<<
 *     ElementHashBucket* buckets
 *     size_t size
 */

#line 65 "brainpy/_c/composition.pxd"
struct __pyx_t_7brainpy_2_c_11composition_ElementHashTable {

#line 65 "brainpy/_c/composition.pxd"
  struct __pyx_t_7brainpy_2_c_11composition_ElementHashBucket *buckets;

#line 65 "brainpy/_c/composition.pxd"
  size_t size;

#line 65 "brainpy/_c/composition.pxd"
};

/* "brainpy/_c/composition.pxd":94
 * # Composition Declarations
 * 
 * cdef struct Composition:             # <<<<<<<<<<<<<<
 *     char** elements
 *     count_type* counts
 */

#line 94 "brainpy/_c/composition.pxd"
struct __pyx_t_7brainpy_2_c_11composition_Composition {

#line 94 "brainpy/_c/composition.pxd"
  char **elements;

#line 94 "brainpy/_c/composition.pxd"
  __pyx_t_7brainpy_2_c_11composition_count_type *counts;

#line 94 "brainpy/_c/composition.pxd"
  size_t size;

#line 94 "brainpy/_c/composition.pxd"
  size_t used;

#line 94 "brainpy/_c/composition.pxd"
  int max_variants;

#line 94 "brainpy/_c/composition.pxd"
};

/* "brainpy/_c/composition.pxd":130
 *     @staticmethod
 *     cdef PyComposition _create(Composition* base)
 *     cdef void _set_impl(self, Composition* composition, bint free_existing=*)             # <<<<<<<<<<<<<<
 * 
 *     cdef void _initialize_from_formula(self, str formula)
 */

#line 130 "brainpy/_c/composition.pxd"
struct __pyx_opt_args_7brainpy_2_c_11composition_13PyComposition__set_impl {

#line 130 "brainpy/_c/composition.pxd"
  int __pyx_n;

#line 130 "brainpy/_c/composition.pxd"
  int free_existing;

#line 130 "brainpy/_c/composition.pxd"
};

/* "brainpy/_c/composition.pxd":144
 *     cpdef list items(self)
 * 
 *     cpdef pop(self, str key, object default=*)             # <<<<<<<<<<<<<<
 * 
 *     cdef count_type getitem(self, str key)
 */

#line 144 "brainpy/_c/composition.pxd"
struct __pyx_opt_args_7brainpy_2_c_11composition_13PyComposition_pop {

#line 144 "brainpy/_c/composition.pxd"
  int __pyx_n;

#line 144 "brainpy/_c/composition.pxd"
  PyObject *__pyx_default;

#line 144 "brainpy/_c/composition.pxd"
};

#line 144 "brainpy/_c/composition.pxd"
struct __pyx_t_7brainpy_2_c_13double_vector_DoubleVector;

/* "brainpy/_c/double_vector.pxd":1
 * cdef struct DoubleVector:             # <<<<<<<<<<<<<<
 *     double* v
 *     size_t used
 */

#line 1 "brainpy/_c/double_vector.pxd"
struct __pyx_t_7brainpy_2_c_13double_vector_DoubleVector {

#line 1 "brainpy/_c/double_vector.pxd"
  double *v;

#line 1 "brainpy/_c/double_vector.pxd"
  size_t used;

#line 1 "brainpy/_c/double_vector.pxd"
  size_t size;

#line 1 "brainpy/_c/double_vector.pxd"
};

#line 1 "brainpy/_c/double_vector.pxd"
struct __pyx_t_7brainpy_2_c_18isotopic_constants_PolynomialParameters;

#line 1 "brainpy/_c/double_vector.pxd"
struct __pyx_t_7brainpy_2_c_18isotopic_constants_PhiConstants;

#line 1 "brainpy/_c/double_vector.pxd"
struct __pyx_t_7brainpy_2_c_18isotopic_constants_IsotopicConstants;

/* "brainpy/_c/isotopic_constants.pxd":6
 * from brainpy._c.double_vector cimport DoubleVector
 * 
 * ctypedef DoubleVector dvec             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 6 "brainpy/_c/isotopic_constants.pxd"
typedef struct __pyx_t_7brainpy_2_c_13double_vector_DoubleVector __pyx_t_7brainpy_2_c_18isotopic_constants_dvec;

/* "brainpy/_c/isotopic_constants.pxd":9
 * 
 * 
 * cdef struct PolynomialParameters:             # <<<<<<<<<<<<<<
 *     dvec* elementary_symmetric_polynomial
 *     dvec* power_sum
 */

#line 9 "brainpy/_c/isotopic_constants.pxd"
struct __pyx_t_7brainpy_2_c_18isotopic_constants_PolynomialParameters {

#line 9 "brainpy/_c/isotopic_constants.pxd"
  __pyx_t_7brainpy_2_c_18isotopic_constants_dvec *elementary_symmetric_polynomial;

#line 9 "brainpy/_c/isotopic_constants.pxd"
  __pyx_t_7brainpy_2_c_18isotopic_constants_dvec *power_sum;

#line 9 "brainpy/_c/isotopic_constants.pxd"
};

/* "brainpy/_c/isotopic_constants.pxd":14
 * 
 * 
 * cdef struct PhiConstants:             # <<<<<<<<<<<<<<
 *     int order
 *     Element* element
 */

#line 14 "brainpy/_c/isotopic_constants.pxd"
struct __pyx_t_7brainpy_2_c_18isotopic_constants_PhiConstants {

#line 14 "brainpy/_c/isotopic_constants.pxd"
  int order;

#line 14 "brainpy/_c/isotopic_constants.pxd"
  struct __pyx_t_7brainpy_2_c_11composition_Element *element;

#line 14 "brainpy/_c/isotopic_constants.pxd"
  struct __pyx_t_7brainpy_2_c_18isotopic_constants_PolynomialParameters *element_coefficients;

#line 14 "brainpy/_c/isotopic_constants.pxd"
  struct __pyx_t_7brainpy_2_c_18isotopic_constants_PolynomialParameters *mass_coefficients;

#line 14 "brainpy/_c/isotopic_constants.pxd"
};

/* "brainpy/_c/isotopic_constants.pxd":21
 * 
 * 
 * cdef struct IsotopicConstants:             # <<<<<<<<<<<<<<
 *     int order
 *     PhiConstants** constants
 */

#line 21 "brainpy/_c/isotopic_constants.pxd"
struct __pyx_t_7brainpy_2_c_18isotopic_constants_IsotopicConstants {

#line 21 "brainpy/_c/isotopic_constants.pxd"
  int order;

#line 21 "brainpy/_c/isotopic_constants.pxd"
  struct __pyx_t_7brainpy_2_c_18isotopic_constants_PhiConstants **constants;

#line 21 "brainpy/_c/isotopic_constants.pxd"
  size_t size;

#line 21 "brainpy/_c/isotopic_constants.pxd"
  size_t used;

#line 21 "brainpy/_c/isotopic_constants.pxd"
};

#line 21 "brainpy/_c/isotopic_constants.pxd"
struct __pyx_t_7brainpy_2_c_21isotopic_distribution_Peak;

#line 21 "brainpy/_c/isotopic_constants.pxd"
struct __pyx_t_7brainpy_2_c_21isotopic_distribution_PeakList;

#line 21 "brainpy/_c/isotopic_constants.pxd"
struct __pyx_t_7brainpy_2_c_21isotopic_distribution_ElementCache;

#line 21 "brainpy/_c/isotopic_constants.pxd"
struct __pyx_t_7brainpy_2_c_21isotopic_distribution_IsotopicDistribution;

#line 21 "brainpy/_c/isotopic_constants.pxd"
struct __pyx_opt_args_7brainpy_2_c_21isotopic_distribution_make_isotopic_distribution;

#line 21 "brainpy/_c/isotopic_constants.pxd"
struct __pyx_opt_args_7brainpy_2_c_21isotopic_distribution_guess_npeaks;

#line 21 "brainpy/_c/isotopic_constants.pxd"
struct __pyx_opt_args_7brainpy_2_c_21isotopic_distribution__isotopic_variants;

#line 21 "brainpy/_c/isotopic_constants.pxd"
struct __pyx_opt_args_7brainpy_2_c_21isotopic_distribution_isotopic_variants;

#line 21 "brainpy/_c/isotopic_constants.pxd"
struct __pyx_opt_args_7brainpy_2_c_21isotopic_distribution_max_variants_approx;

/* "brainpy/_c/isotopic_distribution.pxd":7
 * 
 * 
 * cdef struct Peak:             # <<<<<<<<<<<<<<
 *     double mz
 *     double intensity
 */

#line 7 "brainpy/_c/isotopic_distribution.pxd"
struct __pyx_t_7brainpy_2_c_21isotopic_distribution_Peak {

#line 7 "brainpy/_c/isotopic_distribution.pxd"
  double mz;

#line 7 "brainpy/_c/isotopic_distribution.pxd"
  double intensity;

#line 7 "brainpy/_c/isotopic_distribution.pxd"
  int charge;

#line 7 "brainpy/_c/isotopic_distribution.pxd"
};

/* "brainpy/_c/isotopic_distribution.pxd":13
 * 
 * 
 * cdef struct PeakList:             # <<<<<<<<<<<<<<
 *     Peak* peaks
 *     size_t used
 */

#line 13 "brainpy/_c/isotopic_distribution.pxd"
struct __pyx_t_7brainpy_2_c_21isotopic_distribution_PeakList {

#line 13 "brainpy/_c/isotopic_distribution.pxd"
  struct __pyx_t_7brainpy_2_c_21isotopic_distribution_Peak *peaks;

#line 13 "brainpy/_c/isotopic_distribution.pxd"
  size_t used;

#line 13 "brainpy/_c/isotopic_distribution.pxd"
  size_t size;

#line 13 "brainpy/_c/isotopic_distribution.pxd"
};

/* "brainpy/_c/isotopic_distribution.pxd":35
 * 
 * 
 * cdef struct ElementCache:             # <<<<<<<<<<<<<<
 *     Element** elements
 *     size_t used
 */

#line 35 "brainpy/_c/isotopic_distribution.pxd"
struct __pyx_t_7brainpy_2_c_21isotopic_distribution_ElementCache {

#line 35 "brainpy/_c/isotopic_distribution.pxd"
  struct __pyx_t_7brainpy_2_c_11composition_Element **elements;

#line 35 "brainpy/_c/isotopic_distribution.pxd"
  size_t used;

#line 35 "brainpy/_c/isotopic_distribution.pxd"
  size_t size;

#line 35 "brainpy/_c/isotopic_distribution.pxd"
  struct __pyx_t_7brainpy_2_c_11composition_ElementHashTable *source;

#line 35 "brainpy/_c/isotopic_distribution.pxd"
};

/* "brainpy/_c/isotopic_distribution.pxd":49
 * 
 * 
 * cdef struct IsotopicDistribution:             # <<<<<<<<<<<<<<
 *     Composition* composition
 *     IsotopicConstants* _isotopic_constants
 */

#line 49 "brainpy/_c/isotopic_distribution.pxd"
struct __pyx_t_7brainpy_2_c_21isotopic_distribution_IsotopicDistribution {

#line 49 "brainpy/_c/isotopic_distribution.pxd"
  struct __pyx_t_7brainpy_2_c_11composition_Composition *composition;

#line 49 "brainpy/_c/isotopic_distribution.pxd"
  struct __pyx_t_7brainpy_2_c_18isotopic_constants_IsotopicConstants *_isotopic_constants;

#line 49 "brainpy/_c/isotopic_distribution.pxd"
  int order;

#line 49 "brainpy/_c/isotopic_distribution.pxd"
  double average_mass;

#line 49 "brainpy/_c/isotopic_distribution.pxd"
  struct __pyx_t_7brainpy_2_c_21isotopic_distribution_Peak *monoisotopic_peak;

#line 49 "brainpy/_c/isotopic_distribution.pxd"
  struct __pyx_t_7brainpy_2_c_21isotopic_distribution_ElementCache *cache;

#line 49 "brainpy/_c/isotopic_distribution.pxd"
};

/* "brainpy/_c/isotopic_distribution.pxd":58
 * 
 * 
 * cdef IsotopicDistribution* make_isotopic_distribution(Composition* composition, int order, ElementCache* cache=*) nogil             # <<<<<<<<<<<<<<
 * cdef void free_isotopic_distribution(IsotopicDistribution* distribution)  nogil
 * 
 */

#line 58 "brainpy/_c/isotopic_distribution.pxd"
struct __pyx_opt_args_7brainpy_2_c_21isotopic_distribution_make_isotopic_distribution {

#line 58 "brainpy/_c/isotopic_distribution.pxd"
  int __pyx_n;

#line 58 "brainpy/_c/isotopic_distribution.pxd"
  struct __pyx_t_7brainpy_2_c_21isotopic_distribution_ElementCache *cache;

#line 58 "brainpy/_c/isotopic_distribution.pxd"
};

/* "brainpy/_c/isotopic_distribution.pxd":77
 * 
 * cdef int max_variants(Composition* composition, ElementCache* cache) nogil
 * cdef int guess_npeaks(Composition* composition_struct, size_t max_npeaks, ElementCache* cache=*) nogil             # <<<<<<<<<<<<<<
 * 
 * cpdef list _isotopic_variants(object composition, object npeaks=*, int charge=*, double charge_carrier=*)
 */

#line 77 "brainpy/_c/isotopic_distribution.pxd"
struct __pyx_opt_args_7brainpy_2_c_21isotopic_distribution_guess_npeaks {

#line 77 "brainpy/_c/isotopic_distribution.pxd"
  int __pyx_n;

#line 77 "brainpy/_c/isotopic_distribution.pxd"
  struct __pyx_t_7brainpy_2_c_21isotopic_distribution_ElementCache *cache;

#line 77 "brainpy/_c/isotopic_distribution.pxd"
};

/* "brainpy/_c/isotopic_distribution.pxd":79
 * cdef int guess_npeaks(Composition* composition_struct, size_t max_npeaks, ElementCache* cache=*) nogil
 * 
 * cpdef list _isotopic_variants(object composition, object npeaks=*, int charge=*, double charge_carrier=*)             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 79 "brainpy/_c/isotopic_distribution.pxd"
struct __pyx_opt_args_7brainpy_2_c_21isotopic_distribution__isotopic_variants {

#line 79 "brainpy/_c/isotopic_distribution.pxd"
  int __pyx_n;

#line 79 "brainpy/_c/isotopic_distribution.pxd"
  PyObject *npeaks;

#line 79 "brainpy/_c/isotopic_distribution.pxd"
  int charge;

#line 79 "brainpy/_c/isotopic_distribution.pxd"
  double charge_carrier;

#line 79 "brainpy/_c/isotopic_distribution.pxd"
};

/* "brainpy/_c/isotopic_distribution.pxd":82
 * 
 * 
 * cdef PeakList* isotopic_variants(Composition* composition, int npeaks, int charge=*, double charge_carrier=*) nogil             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 82 "brainpy/_c/isotopic_distribution.pxd"
struct __pyx_opt_args_7brainpy_2_c_21isotopic_distribution_isotopic_variants {

#line 82 "brainpy/_c/isotopic_distribution.pxd"
  int __pyx_n;

#line 82 "brainpy/_c/isotopic_distribution.pxd"
  int charge;

#line 82 "brainpy/_c/isotopic_distribution.pxd"
  double charge_carrier;

#line 82 "brainpy/_c/isotopic_distribution.pxd"
};

/* "brainpy/_c/isotopic_distribution.pxd":85
 * 
 * 
 * cdef size_t max_variants_approx(double mass, double lambda_factor=*, size_t maxiter=*, double threshold=*) nogil             # <<<<<<<<<<<<<<
 */

#line 85 "brainpy/_c/isotopic_distribution.pxd"
struct __pyx_opt_args_7brainpy_2_c_21isotopic_distribution_max_variants_approx {

#line 85 "brainpy/_c/isotopic_distribution.pxd"
  int __pyx_n;

#line 85 "brainpy/_c/isotopic_distribution.pxd"
  double lambda_factor;

#line 85 "brainpy/_c/isotopic_distribution.pxd"
  size_t maxiter;

#line 85 "brainpy/_c/isotopic_distribution.pxd"
  double threshold;

#line 85 "brainpy/_c/isotopic_distribution.pxd"
};

#line 85 "brainpy/_c/isotopic_distribution.pxd"
struct __pyx_opt_args_7brainpy_8_speedup_neutral_mass;

#line 85 "brainpy/_c/isotopic_distribution.pxd"
struct __pyx_opt_args_7brainpy_8_speedup_mass_charge_ratio;

#line 85 "brainpy/_c/isotopic_distribution.pxd"
struct __pyx_opt_args_7brainpy_8_speedup_calculate_mass;

/* "brainpy/_speedup.pxd":6
 * 
 * 
 * cdef double neutral_mass(double mz,  int z, double charge_carrier=*)             # <<<<<<<<<<<<<<
 * cdef double mass_charge_ratio(double neutral_mass, int z, double charge_carrier=*)
 * 
 */

#line 6 "brainpy/_speedup.pxd"
struct __pyx_opt_args_7brainpy_8_speedup_neutral_mass {

#line 6 "brainpy/_speedup.pxd"
  int __pyx_n;

#line 6 "brainpy/_speedup.pxd"
  double charge_carrier;

#line 6 "brainpy/_speedup.pxd"
};

/* "brainpy/_speedup.pxd":7
 * 
 * cdef double neutral_mass(double mz,  int z, double charge_carrier=*)
 * cdef double mass_charge_ratio(double neutral_mass, int z, double charge_carrier=*)             # <<<<<<<<<<<<<<
 * 
 * cdef double calculate_mass(dict composition, dict mass_data=*)
 */

#line 7 "brainpy/_speedup.pxd"
struct __pyx_opt_args_7brainpy_8_speedup_mass_charge_ratio {

#line 7 "brainpy/_speedup.pxd"
  int __pyx_n;

#line 7 "brainpy/_speedup.pxd"
  double charge_carrier;

#line 7 "brainpy/_speedup.pxd"
};

/* "brainpy/_speedup.pxd":9
 * cdef double mass_charge_ratio(double neutral_mass, int z, double charge_carrier=*)
 * 
 * cdef double calculate_mass(dict composition, dict mass_data=*)             # <<<<<<<<<<<<<<
 * 
 * cpdef Element make_fixed_isotope_element(Element element, int isotope_shift)
 */

#line 9 "brainpy/_speedup.pxd"
struct __pyx_opt_args_7brainpy_8_speedup_calculate_mass {

#line 9 "brainpy/_speedup.pxd"
  int __pyx_n;

#line 9 "brainpy/_speedup.pxd"
  PyObject *mass_data;

#line 9 "brainpy/_speedup.pxd"
};

#line 9 "brainpy/_speedup.pxd"
struct __pyx_opt_args_14ms_peak_picker_2_c_8peak_set_7PeakSet__has_peak;

#line 9 "brainpy/_speedup.pxd"
struct __pyx_opt_args_14ms_peak_picker_2_c_8peak_set_7PeakSet_all_peaks_for;

#line 9 "brainpy/_speedup.pxd"
struct __pyx_t_14ms_peak_picker_2_c_8peak_set_index_cell;

#line 9 "brainpy/_speedup.pxd"
struct __pyx_t_14ms_peak_picker_2_c_8peak_set_index_list;

#line 9 "brainpy/_speedup.pxd"
struct __pyx_opt_args_14ms_peak_picker_2_c_8peak_set_14PeakSetIndexed_has_peak_hinted;

/* "ms_peak_picker/_c/peak_set.pxd":42
 *     cdef FittedPeak _get_nearest_peak(self, double mz, double* errout)
 * 
 *     cdef FittedPeak _has_peak(self, double mz, double tolerance=*)             # <<<<<<<<<<<<<<
 * 
 *     cpdef PeakSet clone(self)
 */

#line 42 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_14ms_peak_picker_2_c_8peak_set_7PeakSet__has_peak {

#line 42 "ms_peak_picker/_c/peak_set.pxd"
  int __pyx_n;

#line 42 "ms_peak_picker/_c/peak_set.pxd"
  double tolerance;

#line 42 "ms_peak_picker/_c/peak_set.pxd"
};

/* "ms_peak_picker/_c/peak_set.pxd":50
 *     cdef int _between_bounds(self, double m1, double m2, size_t* startp, size_t* endp)
 * 
 *     cpdef tuple all_peaks_for(self, double mz, double error_tolerance=*)             # <<<<<<<<<<<<<<
 * 
 *     cdef FittedPeak getitem(self, size_t i)
 */

#line 50 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_14ms_peak_picker_2_c_8peak_set_7PeakSet_all_peaks_for {

#line 50 "ms_peak_picker/_c/peak_set.pxd"
  int __pyx_n;

#line 50 "ms_peak_picker/_c/peak_set.pxd"
  double error_tolerance;

#line 50 "ms_peak_picker/_c/peak_set.pxd"
};

/* "ms_peak_picker/_c/peak_set.pxd":64
 * 
 * 
 * cdef struct index_cell:             # <<<<<<<<<<<<<<
 *     double center_value
 *     size_t start
 */

#line 64 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_t_14ms_peak_picker_2_c_8peak_set_index_cell {

#line 64 "ms_peak_picker/_c/peak_set.pxd"
  double center_value;

#line 64 "ms_peak_picker/_c/peak_set.pxd"
  size_t start;

#line 64 "ms_peak_picker/_c/peak_set.pxd"
  size_t end;

#line 64 "ms_peak_picker/_c/peak_set.pxd"
};

/* "ms_peak_picker/_c/peak_set.pxd":70
 * 
 * 
 * cdef struct index_list:             # <<<<<<<<<<<<<<
 *     index_cell* index
 *     size_t size
 */

#line 70 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_t_14ms_peak_picker_2_c_8peak_set_index_list {

#line 70 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_t_14ms_peak_picker_2_c_8peak_set_index_cell *index;

#line 70 "ms_peak_picker/_c/peak_set.pxd"
  size_t size;

#line 70 "ms_peak_picker/_c/peak_set.pxd"
  double low;

#line 70 "ms_peak_picker/_c/peak_set.pxd"
  double high;

#line 70 "ms_peak_picker/_c/peak_set.pxd"
};

/* "ms_peak_picker/_c/peak_set.pxd":90
 *     cpdef _allocate_index(self, size_t interval_index_size)
 * 
 *     cpdef FittedPeak has_peak_hinted(self, double mz, double tolerance=*, size_t hint_start=*, size_t hint_end=*)             # <<<<<<<<<<<<<<
 * 
 * cdef size_t double_binary_search_ppm(double* array, double value, double tolerance, size_t n)
 */

#line 90 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_14ms_peak_picker_2_c_8peak_set_14PeakSetIndexed_has_peak_hinted {

#line 90 "ms_peak_picker/_c/peak_set.pxd"
  int __pyx_n;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
  double tolerance;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
  size_t hint_start;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
  size_t hint_end;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
};

#line 90 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_mass_charge_ratio;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_neutral_mass;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_scale;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_isotopic_cluster;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine__isotopic_cluster;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_ignore_below;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_truncate_after;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__scale;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_has_mz_charge_pair;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_isotopic_shift;

#line 90 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_poisson_approximate;

/* "ms_deisotope/_c/averagine.pxd":7
 * cdef double PROTON
 * 
 * cdef double mass_charge_ratio(double neutral_mass, int z, double charge_carrier=*)             # <<<<<<<<<<<<<<
 * cdef double neutral_mass(double mz,  int z, double charge_carrier=*)
 * cdef void slide(double mz, list peaklist)
 */

#line 7 "ms_deisotope/_c/averagine.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_mass_charge_ratio {

#line 7 "ms_deisotope/_c/averagine.pxd"
  int __pyx_n;

#line 7 "ms_deisotope/_c/averagine.pxd"
  double charge_carrier;

#line 7 "ms_deisotope/_c/averagine.pxd"
};

/* "ms_deisotope/_c/averagine.pxd":8
 * 
 * cdef double mass_charge_ratio(double neutral_mass, int z, double charge_carrier=*)
 * cdef double neutral_mass(double mz,  int z, double charge_carrier=*)             # <<<<<<<<<<<<<<
 * cdef void slide(double mz, list peaklist)
 * cdef dict scale_dict(dict data, double factor)
 */

#line 8 "ms_deisotope/_c/averagine.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_neutral_mass {

#line 8 "ms_deisotope/_c/averagine.pxd"
  int __pyx_n;

#line 8 "ms_deisotope/_c/averagine.pxd"
  double charge_carrier;

#line 8 "ms_deisotope/_c/averagine.pxd"
};

/* "ms_deisotope/_c/averagine.pxd":17
 *         public dict base_composition
 * 
 *     cpdef dict scale(self, double mz, int charge=*, double charge_carrier=*)             # <<<<<<<<<<<<<<
 *     cpdef TheoreticalIsotopicPattern isotopic_cluster(self, double mz, int charge=*, double charge_carrier=*, double truncate_after=*, double ignore_below=*)
 *     cdef TheoreticalIsotopicPattern _isotopic_cluster(self, double mz, int charge=*, double charge_carrier=*, double truncate_after=*, double ignore_below=*)
 */

#line 17 "ms_deisotope/_c/averagine.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_scale {

#line 17 "ms_deisotope/_c/averagine.pxd"
  int __pyx_n;

#line 17 "ms_deisotope/_c/averagine.pxd"
  int charge;

#line 17 "ms_deisotope/_c/averagine.pxd"
  double charge_carrier;

#line 17 "ms_deisotope/_c/averagine.pxd"
};

/* "ms_deisotope/_c/averagine.pxd":18
 * 
 *     cpdef dict scale(self, double mz, int charge=*, double charge_carrier=*)
 *     cpdef TheoreticalIsotopicPattern isotopic_cluster(self, double mz, int charge=*, double charge_carrier=*, double truncate_after=*, double ignore_below=*)             # <<<<<<<<<<<<<<
 *     cdef TheoreticalIsotopicPattern _isotopic_cluster(self, double mz, int charge=*, double charge_carrier=*, double truncate_after=*, double ignore_below=*)
 * 
 */

#line 18 "ms_deisotope/_c/averagine.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_isotopic_cluster {

#line 18 "ms_deisotope/_c/averagine.pxd"
  int __pyx_n;

#line 18 "ms_deisotope/_c/averagine.pxd"
  int charge;

#line 18 "ms_deisotope/_c/averagine.pxd"
  double charge_carrier;

#line 18 "ms_deisotope/_c/averagine.pxd"
  double truncate_after;

#line 18 "ms_deisotope/_c/averagine.pxd"
  double ignore_below;

#line 18 "ms_deisotope/_c/averagine.pxd"
};

/* "ms_deisotope/_c/averagine.pxd":19
 *     cpdef dict scale(self, double mz, int charge=*, double charge_carrier=*)
 *     cpdef TheoreticalIsotopicPattern isotopic_cluster(self, double mz, int charge=*, double charge_carrier=*, double truncate_after=*, double ignore_below=*)
 *     cdef TheoreticalIsotopicPattern _isotopic_cluster(self, double mz, int charge=*, double charge_carrier=*, double truncate_after=*, double ignore_below=*)             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 19 "ms_deisotope/_c/averagine.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine__isotopic_cluster {

#line 19 "ms_deisotope/_c/averagine.pxd"
  int __pyx_n;

#line 19 "ms_deisotope/_c/averagine.pxd"
  int charge;

#line 19 "ms_deisotope/_c/averagine.pxd"
  double charge_carrier;

#line 19 "ms_deisotope/_c/averagine.pxd"
  double truncate_after;

#line 19 "ms_deisotope/_c/averagine.pxd"
  double ignore_below;

#line 19 "ms_deisotope/_c/averagine.pxd"
};

/* "ms_deisotope/_c/averagine.pxd":39
 *     cdef bint _eq_inst(self, TheoreticalIsotopicPattern other)
 * 
 *     cpdef TheoreticalIsotopicPattern ignore_below(self, double ignore_below=*)             # <<<<<<<<<<<<<<
 *     cpdef TheoreticalIsotopicPattern truncate_after(self, double truncate_after=*)
 *     cpdef TheoreticalIsotopicPattern shift(self, double mz)
 */

#line 39 "ms_deisotope/_c/averagine.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_ignore_below {

#line 39 "ms_deisotope/_c/averagine.pxd"
  int __pyx_n;

#line 39 "ms_deisotope/_c/averagine.pxd"
  double ignore_below;

#line 39 "ms_deisotope/_c/averagine.pxd"
};

/* "ms_deisotope/_c/averagine.pxd":40
 * 
 *     cpdef TheoreticalIsotopicPattern ignore_below(self, double ignore_below=*)
 *     cpdef TheoreticalIsotopicPattern truncate_after(self, double truncate_after=*)             # <<<<<<<<<<<<<<
 *     cpdef TheoreticalIsotopicPattern shift(self, double mz)
 *     cpdef TheoreticalIsotopicPattern scale(self, list experimental_distribution, str method=*)
 */

#line 40 "ms_deisotope/_c/averagine.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_truncate_after {

#line 40 "ms_deisotope/_c/averagine.pxd"
  int __pyx_n;

#line 40 "ms_deisotope/_c/averagine.pxd"
  double truncate_after;

#line 40 "ms_deisotope/_c/averagine.pxd"
};

/* "ms_deisotope/_c/averagine.pxd":42
 *     cpdef TheoreticalIsotopicPattern truncate_after(self, double truncate_after=*)
 *     cpdef TheoreticalIsotopicPattern shift(self, double mz)
 *     cpdef TheoreticalIsotopicPattern scale(self, list experimental_distribution, str method=*)             # <<<<<<<<<<<<<<
 *     cpdef TheoreticalIsotopicPattern scale_raw(self, double scale_factor)
 *     cpdef double drop_last_peak(self)
 */

#line 42 "ms_deisotope/_c/averagine.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale {

#line 42 "ms_deisotope/_c/averagine.pxd"
  int __pyx_n;

#line 42 "ms_deisotope/_c/averagine.pxd"
  PyObject *method;

#line 42 "ms_deisotope/_c/averagine.pxd"
};

/* "ms_deisotope/_c/averagine.pxd":53
 * 
 *     @cython.final
 *     cdef inline TheoreticalIsotopicPattern _scale(self, list experimental_distribution, str method=*)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */

#line 53 "ms_deisotope/_c/averagine.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__scale {

#line 53 "ms_deisotope/_c/averagine.pxd"
  int __pyx_n;

#line 53 "ms_deisotope/_c/averagine.pxd"
  PyObject *method;

#line 53 "ms_deisotope/_c/averagine.pxd"
};

/* "ms_deisotope/_c/averagine.pxd":88
 *     cdef double _make_cache_key(self, double mz)
 * 
 *     cdef TheoreticalIsotopicPattern has_mz_charge_pair(self, double mz, int charge=*, double charge_carrier=*, double truncate_after=*, double ignore_below=*)             # <<<<<<<<<<<<<<
 *     cpdef TheoreticalIsotopicPattern isotopic_cluster(self, double mz, int charge=*, double charge_carrier=*, double truncate_after=*, double ignore_below=*)
 * 
 */

#line 88 "ms_deisotope/_c/averagine.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_has_mz_charge_pair {

#line 88 "ms_deisotope/_c/averagine.pxd"
  int __pyx_n;

#line 88 "ms_deisotope/_c/averagine.pxd"
  int charge;

#line 88 "ms_deisotope/_c/averagine.pxd"
  double charge_carrier;

#line 88 "ms_deisotope/_c/averagine.pxd"
  double truncate_after;

#line 88 "ms_deisotope/_c/averagine.pxd"
  double ignore_below;

#line 88 "ms_deisotope/_c/averagine.pxd"
};

/* "ms_deisotope/_c/averagine.pxd":89
 * 
 *     cdef TheoreticalIsotopicPattern has_mz_charge_pair(self, double mz, int charge=*, double charge_carrier=*, double truncate_after=*, double ignore_below=*)
 *     cpdef TheoreticalIsotopicPattern isotopic_cluster(self, double mz, int charge=*, double charge_carrier=*, double truncate_after=*, double ignore_below=*)             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 89 "ms_deisotope/_c/averagine.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster {

#line 89 "ms_deisotope/_c/averagine.pxd"
  int __pyx_n;

#line 89 "ms_deisotope/_c/averagine.pxd"
  int charge;

#line 89 "ms_deisotope/_c/averagine.pxd"
  double charge_carrier;

#line 89 "ms_deisotope/_c/averagine.pxd"
  double truncate_after;

#line 89 "ms_deisotope/_c/averagine.pxd"
  double ignore_below;

#line 89 "ms_deisotope/_c/averagine.pxd"
};

/* "ms_deisotope/_c/averagine.pxd":92
 * 
 * 
 * cpdef double isotopic_shift(int charge=*)             # <<<<<<<<<<<<<<
 * 
 * cpdef TheoreticalIsotopicPattern poisson_approximate(double mass, size_t n_peaks, double lambda_factor=*, int charge=*)
 */

#line 92 "ms_deisotope/_c/averagine.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_isotopic_shift {

#line 92 "ms_deisotope/_c/averagine.pxd"
  int __pyx_n;

#line 92 "ms_deisotope/_c/averagine.pxd"
  int charge;

#line 92 "ms_deisotope/_c/averagine.pxd"
};

/* "ms_deisotope/_c/averagine.pxd":94
 * cpdef double isotopic_shift(int charge=*)
 * 
 * cpdef TheoreticalIsotopicPattern poisson_approximate(double mass, size_t n_peaks, double lambda_factor=*, int charge=*)             # <<<<<<<<<<<<<<
 */

#line 94 "ms_deisotope/_c/averagine.pxd"
struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_poisson_approximate {

#line 94 "ms_deisotope/_c/averagine.pxd"
  int __pyx_n;

#line 94 "ms_deisotope/_c/averagine.pxd"
  double lambda_factor;

#line 94 "ms_deisotope/_c/averagine.pxd"
  int charge;

#line 94 "ms_deisotope/_c/averagine.pxd"
};

/* "brainpy/_c/composition.pxd":123
 * 
 * 
 * cdef class PyComposition(object):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Composition* impl
 */

#line 123 "brainpy/_c/composition.pxd"
struct __pyx_obj_7brainpy_2_c_11composition_PyComposition {

#line 123 "brainpy/_c/composition.pxd"
  PyObject_HEAD

#line 123 "brainpy/_c/composition.pxd"
  struct __pyx_vtabstruct_7brainpy_2_c_11composition_PyComposition *__pyx_vtab;

#line 123 "brainpy/_c/composition.pxd"
  struct __pyx_t_7brainpy_2_c_11composition_Composition *impl;

#line 123 "brainpy/_c/composition.pxd"
  double cached_mass;

#line 123 "brainpy/_c/composition.pxd"
  int _clean;

#line 123 "brainpy/_c/composition.pxd"
};

#line 123 "brainpy/_c/composition.pxd"


/* "brainpy/_c/isotopic_distribution.pxd":63
 * 
 * @freelist(100000)
 * cdef class TheoreticalPeak(object):             # <<<<<<<<<<<<<<
 *     cdef:
 *         public double mz
 */

#line 63 "brainpy/_c/isotopic_distribution.pxd"
struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak {

#line 63 "brainpy/_c/isotopic_distribution.pxd"
  PyObject_HEAD

#line 63 "brainpy/_c/isotopic_distribution.pxd"
  struct __pyx_vtabstruct_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_vtab;

#line 63 "brainpy/_c/isotopic_distribution.pxd"
  double mz;

#line 63 "brainpy/_c/isotopic_distribution.pxd"
  double intensity;

#line 63 "brainpy/_c/isotopic_distribution.pxd"
  int charge;

#line 63 "brainpy/_c/isotopic_distribution.pxd"
};

#line 63 "brainpy/_c/isotopic_distribution.pxd"


/* "brainpy/_speedup.pxd":13
 * cpdef Element make_fixed_isotope_element(Element element, int isotope_shift)
 * 
 * cdef class Element:             # <<<<<<<<<<<<<<
 *     cdef:
 *         public str symbol
 */

#line 13 "brainpy/_speedup.pxd"
struct __pyx_obj_7brainpy_8_speedup_Element {

#line 13 "brainpy/_speedup.pxd"
  PyObject_HEAD

#line 13 "brainpy/_speedup.pxd"
  struct __pyx_vtabstruct_7brainpy_8_speedup_Element *__pyx_vtab;

#line 13 "brainpy/_speedup.pxd"
  PyObject *symbol;

#line 13 "brainpy/_speedup.pxd"
  PyObject *isotopes;

#line 13 "brainpy/_speedup.pxd"
  double _monoisotopic_mass;

#line 13 "brainpy/_speedup.pxd"
  int _max_neutron_shift;

#line 13 "brainpy/_speedup.pxd"
  int _min_neutron_shift;

#line 13 "brainpy/_speedup.pxd"
  PyObject *_no_mass_elementary_symmetric_polynomial_cache;

#line 13 "brainpy/_speedup.pxd"
  PyObject *_no_mass_power_sum_cache;

#line 13 "brainpy/_speedup.pxd"
  PyObject *_mass_elementary_symmetric_polynomial_cache;

#line 13 "brainpy/_speedup.pxd"
  PyObject *_mass_power_sum_cache;

#line 13 "brainpy/_speedup.pxd"
};

#line 13 "brainpy/_speedup.pxd"


/* "ms_peak_picker/_c/peak_set.pxd":2
 * 
 * cdef class PeakBase(object):             # <<<<<<<<<<<<<<
 *     cdef:
 *         public double mz
 */

#line 2 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakBase {

#line 2 "ms_peak_picker/_c/peak_set.pxd"
  PyObject_HEAD

#line 2 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_PeakBase *__pyx_vtab;

#line 2 "ms_peak_picker/_c/peak_set.pxd"
  double mz;

#line 2 "ms_peak_picker/_c/peak_set.pxd"
  double intensity;

#line 2 "ms_peak_picker/_c/peak_set.pxd"
  double area;

#line 2 "ms_peak_picker/_c/peak_set.pxd"
};

#line 2 "ms_peak_picker/_c/peak_set.pxd"


/* "ms_peak_picker/_c/peak_set.pxd":12
 * 
 * 
 * cdef class FittedPeak(PeakBase):             # <<<<<<<<<<<<<<
 *     cdef:
 *         public double signal_to_noise
 */

#line 12 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak {

#line 12 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakBase __pyx_base;

#line 12 "ms_peak_picker/_c/peak_set.pxd"
  double signal_to_noise;

#line 12 "ms_peak_picker/_c/peak_set.pxd"
  double full_width_at_half_max;

#line 12 "ms_peak_picker/_c/peak_set.pxd"
  double left_width;

#line 12 "ms_peak_picker/_c/peak_set.pxd"
  double right_width;

#line 12 "ms_peak_picker/_c/peak_set.pxd"
  long peak_count;

#line 12 "ms_peak_picker/_c/peak_set.pxd"
  long index;

#line 12 "ms_peak_picker/_c/peak_set.pxd"
};

#line 12 "ms_peak_picker/_c/peak_set.pxd"


/* "ms_peak_picker/_c/peak_set.pxd":29
 *                             double area)
 * 
 * cdef class PeakSet(object):             # <<<<<<<<<<<<<<
 *     cdef:
 *         public tuple peaks
 */

#line 29 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet {

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  PyObject_HEAD

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_PeakSet *__pyx_vtab;

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  PyObject *peaks;

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  int indexed;

#line 29 "ms_peak_picker/_c/peak_set.pxd"
};

#line 29 "ms_peak_picker/_c/peak_set.pxd"


/* "ms_peak_picker/_c/peak_set.pxd":83
 * 
 * 
 * cdef class PeakSetIndexed(PeakSet):             # <<<<<<<<<<<<<<
 *     cdef:
 *         double* mz_index
 */

#line 83 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed {

#line 83 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet __pyx_base;

#line 83 "ms_peak_picker/_c/peak_set.pxd"
  double *mz_index;

#line 83 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_t_14ms_peak_picker_2_c_8peak_set_index_list *interval_index;

#line 83 "ms_peak_picker/_c/peak_set.pxd"
};

#line 83 "ms_peak_picker/_c/peak_set.pxd"


/* "ms_deisotope/_c/averagine.pxd":12
 * cdef dict scale_dict(dict data, double factor)
 * 
 * cdef class Averagine(object):             # <<<<<<<<<<<<<<
 *     cdef:
 *         public double base_mass
 */

#line 12 "ms_deisotope/_c/averagine.pxd"
struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine {

#line 12 "ms_deisotope/_c/averagine.pxd"
  PyObject_HEAD

#line 12 "ms_deisotope/_c/averagine.pxd"
  struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_Averagine *__pyx_vtab;

#line 12 "ms_deisotope/_c/averagine.pxd"
  double base_mass;

#line 12 "ms_deisotope/_c/averagine.pxd"
  PyObject *base_composition;

#line 12 "ms_deisotope/_c/averagine.pxd"
};

#line 12 "ms_deisotope/_c/averagine.pxd"


/* "ms_deisotope/_c/averagine.pxd":23
 * 
 * @cython.final
 * cdef class TheoreticalIsotopicPattern(object):             # <<<<<<<<<<<<<<
 *     cdef:
 *         public list peaklist
 */

#line 23 "ms_deisotope/_c/averagine.pxd"
struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern {

#line 23 "ms_deisotope/_c/averagine.pxd"
  PyObject_HEAD

#line 23 "ms_deisotope/_c/averagine.pxd"
  struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_vtab;

#line 23 "ms_deisotope/_c/averagine.pxd"
  PyObject *peaklist;

#line 23 "ms_deisotope/_c/averagine.pxd"
  double origin;

#line 23 "ms_deisotope/_c/averagine.pxd"
  double offset;

#line 23 "ms_deisotope/_c/averagine.pxd"
};

#line 23 "ms_deisotope/_c/averagine.pxd"


/* "ms_deisotope/_c/averagine.pxd":79
 * 
 * @cython.final
 * cdef class AveragineCache(object):             # <<<<<<<<<<<<<<
 *     cdef:
 *         public dict backend
 */

#line 79 "ms_deisotope/_c/averagine.pxd"
struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache {

#line 79 "ms_deisotope/_c/averagine.pxd"
  PyObject_HEAD

#line 79 "ms_deisotope/_c/averagine.pxd"
  struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_vtab;

#line 79 "ms_deisotope/_c/averagine.pxd"
  PyObject *backend;

#line 79 "ms_deisotope/_c/averagine.pxd"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *averagine;

#line 79 "ms_deisotope/_c/averagine.pxd"
  double cache_truncation;

#line 79 "ms_deisotope/_c/averagine.pxd"
  int enabled;

#line 79 "ms_deisotope/_c/averagine.pxd"
};

#line 79 "ms_deisotope/_c/averagine.pxd"


/* "ms_deisotope/_c/averagine.pyx":752
 *         return total
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "TheoreticalIsotopicPattern(%0.4f, charge=%d, (%s))" % (
 *             self.monoisotopic_mz,
 */

#line 752 "ms_deisotope/_c/averagine.pyx"
struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ {

#line 752 "ms_deisotope/_c/averagine.pyx"
  PyObject_HEAD

#line 752 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self;

#line 752 "ms_deisotope/_c/averagine.pyx"
};

#line 752 "ms_deisotope/_c/averagine.pyx"


/* "ms_deisotope/_c/averagine.pyx":756
 *             self.monoisotopic_mz,
 *             self.peaklist[0].charge,
 *             ', '.join("%0.3f" % p.intensity for p in self.peaklist))             # <<<<<<<<<<<<<<
 * 
 *     cpdef bint _eq(self, object other):
 */

#line 756 "ms_deisotope/_c/averagine.pyx"
struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr {

#line 756 "ms_deisotope/_c/averagine.pyx"
  PyObject_HEAD

#line 756 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ *__pyx_outer_scope;

#line 756 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_v_p;

#line 756 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_0;

#line 756 "ms_deisotope/_c/averagine.pyx"
  Py_ssize_t __pyx_t_1;

#line 756 "ms_deisotope/_c/averagine.pyx"
};

#line 756 "ms_deisotope/_c/averagine.pyx"


#line 756 "ms_deisotope/_c/averagine.pyx"


/* "brainpy/_c/composition.pxd":123
 * 
 * 
 * cdef class PyComposition(object):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Composition* impl
 */

#line 123 "brainpy/_c/composition.pxd"


#line 123 "brainpy/_c/composition.pxd"
struct __pyx_vtabstruct_7brainpy_2_c_11composition_PyComposition {

#line 123 "brainpy/_c/composition.pxd"
  struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *(*_create)(struct __pyx_t_7brainpy_2_c_11composition_Composition *);

#line 123 "brainpy/_c/composition.pxd"
  void (*_set_impl)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, struct __pyx_t_7brainpy_2_c_11composition_Composition *, struct __pyx_opt_args_7brainpy_2_c_11composition_13PyComposition__set_impl *__pyx_optional_args);

#line 123 "brainpy/_c/composition.pxd"
  void (*_initialize_from_formula)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, PyObject *);

#line 123 "brainpy/_c/composition.pxd"
  double (*mass)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, int __pyx_skip_dispatch);

#line 123 "brainpy/_c/composition.pxd"
  int (*__pyx___equality_pycomposition)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, int __pyx_skip_dispatch);

#line 123 "brainpy/_c/composition.pxd"
  int (*__pyx___equality_dict)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, PyObject *, int __pyx_skip_dispatch);

#line 123 "brainpy/_c/composition.pxd"
  struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *(*copy)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, int __pyx_skip_dispatch);

#line 123 "brainpy/_c/composition.pxd"
  PyObject *(*update)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, PyObject *, int __pyx_skip_dispatch);

#line 123 "brainpy/_c/composition.pxd"
  PyObject *(*keys)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, int __pyx_skip_dispatch);

#line 123 "brainpy/_c/composition.pxd"
  PyObject *(*values)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, int __pyx_skip_dispatch);

#line 123 "brainpy/_c/composition.pxd"
  PyObject *(*items)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, int __pyx_skip_dispatch);

#line 123 "brainpy/_c/composition.pxd"
  PyObject *(*pop)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7brainpy_2_c_11composition_13PyComposition_pop *__pyx_optional_args);

#line 123 "brainpy/_c/composition.pxd"
  __pyx_t_7brainpy_2_c_11composition_count_type (*getitem)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, PyObject *);

#line 123 "brainpy/_c/composition.pxd"
  void (*setitem)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, PyObject *, __pyx_t_7brainpy_2_c_11composition_count_type);

#line 123 "brainpy/_c/composition.pxd"
  void (*increment)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, PyObject *, __pyx_t_7brainpy_2_c_11composition_count_type);

#line 123 "brainpy/_c/composition.pxd"
  void (*add_from)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *);

#line 123 "brainpy/_c/composition.pxd"
  void (*subtract_from)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *);

#line 123 "brainpy/_c/composition.pxd"
  void (*scale_by)(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition *, long);

#line 123 "brainpy/_c/composition.pxd"
};

#line 123 "brainpy/_c/composition.pxd"
static struct __pyx_vtabstruct_7brainpy_2_c_11composition_PyComposition *__pyx_vtabptr_7brainpy_2_c_11composition_PyComposition;

#line 123 "brainpy/_c/composition.pxd"


/* "brainpy/_c/isotopic_distribution.pxd":63
 * 
 * @freelist(100000)
 * cdef class TheoreticalPeak(object):             # <<<<<<<<<<<<<<
 *     cdef:
 *         public double mz
 */

#line 63 "brainpy/_c/isotopic_distribution.pxd"


#line 63 "brainpy/_c/isotopic_distribution.pxd"
struct __pyx_vtabstruct_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak {

#line 63 "brainpy/_c/isotopic_distribution.pxd"
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *(*_create)(double, double, int);

#line 63 "brainpy/_c/isotopic_distribution.pxd"
  int (*_eq)(struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *, struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *, int __pyx_skip_dispatch);

#line 63 "brainpy/_c/isotopic_distribution.pxd"
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *(*clone)(struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *, int __pyx_skip_dispatch);

#line 63 "brainpy/_c/isotopic_distribution.pxd"
};

#line 63 "brainpy/_c/isotopic_distribution.pxd"
static struct __pyx_vtabstruct_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_vtabptr_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak;

#line 63 "brainpy/_c/isotopic_distribution.pxd"


/* "brainpy/_speedup.pxd":13
 * cpdef Element make_fixed_isotope_element(Element element, int isotope_shift)
 * 
 * cdef class Element:             # <<<<<<<<<<<<<<
 *     cdef:
 *         public str symbol
 */

#line 13 "brainpy/_speedup.pxd"


#line 13 "brainpy/_speedup.pxd"
struct __pyx_vtabstruct_7brainpy_8_speedup_Element {

#line 13 "brainpy/_speedup.pxd"
  double (*monoisotopic_mass)(struct __pyx_obj_7brainpy_8_speedup_Element *, int __pyx_skip_dispatch);

#line 13 "brainpy/_speedup.pxd"
};

#line 13 "brainpy/_speedup.pxd"
static struct __pyx_vtabstruct_7brainpy_8_speedup_Element *__pyx_vtabptr_7brainpy_8_speedup_Element;

#line 13 "brainpy/_speedup.pxd"


/* "ms_peak_picker/_c/peak_set.pxd":2
 * 
 * cdef class PeakBase(object):             # <<<<<<<<<<<<<<
 *     cdef:
 *         public double mz
 */

#line 2 "ms_peak_picker/_c/peak_set.pxd"


#line 2 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_PeakBase {

#line 2 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakBase *(*clone)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakBase *, int __pyx_skip_dispatch);

#line 2 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakBase *(*copy)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakBase *, int __pyx_skip_dispatch);

#line 2 "ms_peak_picker/_c/peak_set.pxd"
};

#line 2 "ms_peak_picker/_c/peak_set.pxd"
static struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_PeakBase *__pyx_vtabptr_14ms_peak_picker_2_c_8peak_set_PeakBase;

#line 2 "ms_peak_picker/_c/peak_set.pxd"


/* "ms_peak_picker/_c/peak_set.pxd":12
 * 
 * 
 * cdef class FittedPeak(PeakBase):             # <<<<<<<<<<<<<<
 *     cdef:
 *         public double signal_to_noise
 */

#line 12 "ms_peak_picker/_c/peak_set.pxd"


#line 12 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_FittedPeak {

#line 12 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_PeakBase __pyx_base;

#line 12 "ms_peak_picker/_c/peak_set.pxd"
  int (*_eq)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *, struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *, int __pyx_skip_dispatch);

#line 12 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *(*_create)(double, double, double, double, double, double, long, long, double);

#line 12 "ms_peak_picker/_c/peak_set.pxd"
};

#line 12 "ms_peak_picker/_c/peak_set.pxd"
static struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_FittedPeak *__pyx_vtabptr_14ms_peak_picker_2_c_8peak_set_FittedPeak;

#line 12 "ms_peak_picker/_c/peak_set.pxd"


/* "ms_peak_picker/_c/peak_set.pxd":29
 *                             double area)
 * 
 * cdef class PeakSet(object):             # <<<<<<<<<<<<<<
 *     cdef:
 *         public tuple peaks
 */

#line 29 "ms_peak_picker/_c/peak_set.pxd"


#line 29 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_PeakSet {

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *(*_create)(PyObject *);

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  PyObject *(*reindex)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *, int __pyx_skip_dispatch);

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  size_t (*_index)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *, int __pyx_skip_dispatch);

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *(*_get_nearest_peak)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *, double, double *);

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *(*_has_peak)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *, double, struct __pyx_opt_args_14ms_peak_picker_2_c_8peak_set_7PeakSet__has_peak *__pyx_optional_args);

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *(*clone)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *, int __pyx_skip_dispatch);

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *(*copy)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *, int __pyx_skip_dispatch);

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *(*_between)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *, double, double);

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  int (*_between_bounds)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *, double, double, size_t *, size_t *);

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  PyObject *(*all_peaks_for)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *, double, int __pyx_skip_dispatch, struct __pyx_opt_args_14ms_peak_picker_2_c_8peak_set_7PeakSet_all_peaks_for *__pyx_optional_args);

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *(*getitem)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *, size_t);

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  size_t (*get_size)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *);

#line 29 "ms_peak_picker/_c/peak_set.pxd"
  int (*_eq)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *, struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet *, int __pyx_skip_dispatch);

#line 29 "ms_peak_picker/_c/peak_set.pxd"
};

#line 29 "ms_peak_picker/_c/peak_set.pxd"
static struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_PeakSet *__pyx_vtabptr_14ms_peak_picker_2_c_8peak_set_PeakSet;

#line 29 "ms_peak_picker/_c/peak_set.pxd"


/* "ms_peak_picker/_c/peak_set.pxd":83
 * 
 * 
 * cdef class PeakSetIndexed(PeakSet):             # <<<<<<<<<<<<<<
 *     cdef:
 *         double* mz_index
 */

#line 83 "ms_peak_picker/_c/peak_set.pxd"


#line 83 "ms_peak_picker/_c/peak_set.pxd"
struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed {

#line 83 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_PeakSet __pyx_base;

#line 83 "ms_peak_picker/_c/peak_set.pxd"
  PyObject *(*_allocate_index)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed *, size_t, int __pyx_skip_dispatch);

#line 83 "ms_peak_picker/_c/peak_set.pxd"
  struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *(*has_peak_hinted)(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed *, double, int __pyx_skip_dispatch, struct __pyx_opt_args_14ms_peak_picker_2_c_8peak_set_14PeakSetIndexed_has_peak_hinted *__pyx_optional_args);

#line 83 "ms_peak_picker/_c/peak_set.pxd"
};

#line 83 "ms_peak_picker/_c/peak_set.pxd"
static struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed *__pyx_vtabptr_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed;

#line 83 "ms_peak_picker/_c/peak_set.pxd"


/* "ms_deisotope/_c/averagine.pyx":104
 * 
 * 
 * cdef class Averagine(object):             # <<<<<<<<<<<<<<
 *     """An isotopic model which can be used to interpolate the composition
 *     of a class of molecule given an average monomer composition and a theoretical
 */

#line 104 "ms_deisotope/_c/averagine.pyx"


#line 104 "ms_deisotope/_c/averagine.pyx"
struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_Averagine {

#line 104 "ms_deisotope/_c/averagine.pyx"
  PyObject *(*scale)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *, double, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_scale *__pyx_optional_args);

#line 104 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*isotopic_cluster)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *, double, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_isotopic_cluster *__pyx_optional_args);

#line 104 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*_isotopic_cluster)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *, double, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine__isotopic_cluster *__pyx_optional_args);

#line 104 "ms_deisotope/_c/averagine.pyx"
};

#line 104 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_Averagine *__pyx_vtabptr_12ms_deisotope_2_c_9averagine_Averagine;

#line 104 "ms_deisotope/_c/averagine.pyx"


/* "ms_deisotope/_c/averagine.pyx":338
 * @cython.freelist(1000000)
 * @cython.final
 * cdef class TheoreticalIsotopicPattern(object):             # <<<<<<<<<<<<<<
 *     """Represent a theoretical isotopic peak list
 * 
 */

#line 338 "ms_deisotope/_c/averagine.pyx"


#line 338 "ms_deisotope/_c/averagine.pyx"
struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern {

#line 338 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*_create)(PyObject *, double, double);

#line 338 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*clone)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
  int (*_eq)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, PyObject *, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
  int (*_eq_inst)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *);

#line 338 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*ignore_below)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_ignore_below *__pyx_optional_args);

#line 338 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*truncate_after)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_truncate_after *__pyx_optional_args);

#line 338 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*shift)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, double, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*scale)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale *__pyx_optional_args);

#line 338 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*scale_raw)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, double, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
  double (*drop_last_peak)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
  double (*total)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*normalize)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*_scale)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, PyObject *, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__scale *__pyx_optional_args);

#line 338 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*clone_shift)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, double);

#line 338 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *(*get)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, Py_ssize_t);

#line 338 "ms_deisotope/_c/averagine.pyx"
  size_t (*get_size)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *);

#line 338 "ms_deisotope/_c/averagine.pyx"
  double (*get_monoisotopic_mz)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *);

#line 338 "ms_deisotope/_c/averagine.pyx"
  PyObject *(*get_processed_peaks)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *);

#line 338 "ms_deisotope/_c/averagine.pyx"
  size_t (*basepeak_index)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
  PyObject *(*incremental_truncation)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, double, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*clone_drop_last)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *);

#line 338 "ms_deisotope/_c/averagine.pyx"
};

#line 338 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_vtabptr_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern;

#line 338 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__create(PyObject *, double, double);

#line 338 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
static int __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__eq(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, PyObject *, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
static int __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__eq_inst(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *);

#line 338 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_ignore_below(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_ignore_below *__pyx_optional_args);

#line 338 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_truncate_after(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_truncate_after *__pyx_optional_args);

#line 338 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_shift(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, double, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale *__pyx_optional_args);

#line 338 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale_raw(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, double, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
static double __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_drop_last_peak(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
static double __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_total(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_normalize(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
static CYTHON_INLINE struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__scale(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, PyObject *, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__scale *__pyx_optional_args);

#line 338 "ms_deisotope/_c/averagine.pyx"
static CYTHON_INLINE struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone_shift(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, double);

#line 338 "ms_deisotope/_c/averagine.pyx"
static CYTHON_INLINE struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, Py_ssize_t);

#line 338 "ms_deisotope/_c/averagine.pyx"
static CYTHON_INLINE size_t __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *);

#line 338 "ms_deisotope/_c/averagine.pyx"
static CYTHON_INLINE double __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_monoisotopic_mz(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *);

#line 338 "ms_deisotope/_c/averagine.pyx"
static CYTHON_INLINE PyObject *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_processed_peaks(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *);

#line 338 "ms_deisotope/_c/averagine.pyx"
static size_t __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_basepeak_index(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_incremental_truncation(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, double, int __pyx_skip_dispatch);

#line 338 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone_drop_last(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *);

#line 338 "ms_deisotope/_c/averagine.pyx"


/* "ms_deisotope/_c/averagine.pyx":838
 * 
 * 
 * cdef class AveragineCache(object):             # <<<<<<<<<<<<<<
 *     """A wrapper around a :class:`Averagine` instance which will cache isotopic patterns
 *     produced for new (m/z, charge) pairs and reuses it for nearby m/z values
 */

#line 838 "ms_deisotope/_c/averagine.pyx"


#line 838 "ms_deisotope/_c/averagine.pyx"
struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_AveragineCache {

#line 838 "ms_deisotope/_c/averagine.pyx"
  double (*_make_cache_key)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *, double);

#line 838 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*has_mz_charge_pair)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *, double, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_has_mz_charge_pair *__pyx_optional_args);

#line 838 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*isotopic_cluster)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *, double, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster *__pyx_optional_args);

#line 838 "ms_deisotope/_c/averagine.pyx"
};

#line 838 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_vtabptr_12ms_deisotope_2_c_9averagine_AveragineCache;

#line 838 "ms_deisotope/_c/averagine.pyx"
static double __pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache__make_cache_key(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *, double);

#line 838 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache_has_mz_charge_pair(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *, double, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_has_mz_charge_pair *__pyx_optional_args);

#line 838 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *, double, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster *__pyx_optional_args);

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

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

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

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

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

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

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

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
#if CYTHON_FAST_PYCALL
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif // CYTHON_FAST_PYCALL
#endif

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

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

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

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

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

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

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* py_dict_keys.proto */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d);

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod0.proto */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CallUnboundCMethod0(cfunc, self)\
    (likely((cfunc)->func) ?\
        (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
         (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
            (PY_VERSION_HEX >= 0x030700A0 ?\
                (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
                (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
          (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
            (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
            (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
               ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
               __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
        __Pyx__CallUnboundCMethod0(cfunc, self))
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* py_dict_values.proto */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d);

/* py_dict_items.proto */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);

/* pyfrozenset_new.proto */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* 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);
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

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

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

/* UnicodeEquals.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* StrEquals.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

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

/* StringJoin.proto */
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyString_Join __Pyx_PyBytes_Join
#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
#else
#define __Pyx_PyString_Join PyUnicode_Join
#define __Pyx_PyBaseString_Join PyUnicode_Join
#endif
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION < 3
    #define __Pyx_PyBytes_Join _PyString_Join
    #else
    #define __Pyx_PyBytes_Join _PyBytes_Join
    #endif
#else
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
#endif

/* py_dict_clear.proto */
#define __Pyx_PyDict_Clear(d) (PyDict_Clear(d), 0)

/* py_abs.proto */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
#define __Pyx_PyNumber_Absolute(x)\
    ((likely(PyLong_CheckExact(x))) ?\
         (likely(Py_SIZE(x) >= 0) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
         PyNumber_Absolute(x))
#else
#define __Pyx_PyNumber_Absolute(x)  PyNumber_Absolute(x)
#endif

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

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif

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

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

/* GetVTable.proto */
static void* __Pyx_GetVtable(PyObject *dict);

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

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  do {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  do {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
} while(0)
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* GCCDiagnostics.proto */
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

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

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

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

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

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

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

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

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

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyObjectGetMethod.proto */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    PyObject *gi_frame;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
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);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);

/* 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, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, 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);

/* VoidPtrExport.proto */
static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig);

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

/* VoidPtrImport.proto */
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig);

/* FunctionImport.proto */
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);

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

static PyObject *__pyx_f_12ms_deisotope_2_c_9averagine_9Averagine_scale(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, double __pyx_v_mz, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_scale *__pyx_optional_args); /* proto*/
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_9Averagine__isotopic_cluster(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, double __pyx_v_mz, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine__isotopic_cluster *__pyx_optional_args); /* proto*/
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_9Averagine_isotopic_cluster(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, double __pyx_v_mz, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_isotopic_cluster *__pyx_optional_args); /* proto*/
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__create(PyObject *__pyx_v_peaklist, double __pyx_v_origin, double __pyx_v_offset); /* proto*/
static CYTHON_INLINE struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, Py_ssize_t __pyx_v_i); /* proto*/
static CYTHON_INLINE size_t __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto*/
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static CYTHON_INLINE PyObject *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_processed_peaks(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto*/
static CYTHON_INLINE double __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_monoisotopic_mz(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto*/
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_ignore_below(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_ignore_below *__pyx_optional_args); /* proto*/
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_shift(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_mz, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static CYTHON_INLINE struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone_shift(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_mz); /* proto*/
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_truncate_after(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_truncate_after *__pyx_optional_args); /* proto*/
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_experimental_distribution, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale *__pyx_optional_args); /* proto*/
static CYTHON_INLINE struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__scale(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_experimental_distribution, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__scale *__pyx_optional_args); /* proto*/
static size_t __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_basepeak_index(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_normalize(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale_raw(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_scale_factor, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static double __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_drop_last_peak(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone_drop_last(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto*/
static double __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_total(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static int __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__eq(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_other, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static int __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__eq_inst(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_other); /* proto*/
static PyObject *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_incremental_truncation(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_threshold, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static double __pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache__make_cache_key(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, double __pyx_v_mz); /* proto*/
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache_has_mz_charge_pair(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, double __pyx_v_mz, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_has_mz_charge_pair *__pyx_optional_args); /* proto*/
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, double __pyx_v_mz, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster *__pyx_optional_args); /* proto*/

/* Module declarations from 'cython' */

/* Module declarations from 'brainpy._c.composition' */
static PyTypeObject *__pyx_ptype_7brainpy_2_c_11composition_PyComposition = 0;
static PyObject **__pyx_vp_7brainpy_2_c_11composition_nist_mass = 0;
#define __pyx_v_7brainpy_2_c_11composition_nist_mass (*__pyx_vp_7brainpy_2_c_11composition_nist_mass)
static double *__pyx_vp_7brainpy_2_c_11composition_PROTON = 0;
#define __pyx_v_7brainpy_2_c_11composition_PROTON (*__pyx_vp_7brainpy_2_c_11composition_PROTON)
static struct __pyx_t_7brainpy_2_c_11composition_ElementHashTable **__pyx_vp_7brainpy_2_c_11composition__ElementTable = 0;
#define __pyx_v_7brainpy_2_c_11composition__ElementTable (*__pyx_vp_7brainpy_2_c_11composition__ElementTable)

/* Module declarations from 'brainpy._c.double_vector' */

/* Module declarations from 'brainpy._c.isotopic_constants' */
static size_t *__pyx_vp_7brainpy_2_c_18isotopic_constants_DEFAULT_ISOTOPIC_CONSTANTS_SIZE = 0;
#define __pyx_v_7brainpy_2_c_18isotopic_constants_DEFAULT_ISOTOPIC_CONSTANTS_SIZE (*__pyx_vp_7brainpy_2_c_18isotopic_constants_DEFAULT_ISOTOPIC_CONSTANTS_SIZE)

/* Module declarations from 'brainpy._c.isotopic_distribution' */
static PyTypeObject *__pyx_ptype_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak = 0;
static PyObject *(*__pyx_f_7brainpy_2_c_21isotopic_distribution__isotopic_variants)(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7brainpy_2_c_21isotopic_distribution__isotopic_variants *__pyx_optional_args); /*proto*/

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

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

/* Module declarations from '__builtin__' */

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

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

/* 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 'cpython.object' */

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

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

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

/* Module declarations from 'brainpy._speedup' */
static PyTypeObject *__pyx_ptype_7brainpy_8_speedup_Element = 0;
static PyObject **__pyx_vp_7brainpy_8_speedup_nist_mass = 0;
#define __pyx_v_7brainpy_8_speedup_nist_mass (*__pyx_vp_7brainpy_8_speedup_nist_mass)
static double *__pyx_vp_7brainpy_8_speedup_PROTON = 0;
#define __pyx_v_7brainpy_8_speedup_PROTON (*__pyx_vp_7brainpy_8_speedup_PROTON)
static PyObject **__pyx_vp_7brainpy_8_speedup_periodic_table = 0;
#define __pyx_v_7brainpy_8_speedup_periodic_table (*__pyx_vp_7brainpy_8_speedup_periodic_table)
static double (*__pyx_f_7brainpy_8_speedup_calculate_mass)(PyObject *, struct __pyx_opt_args_7brainpy_8_speedup_calculate_mass *__pyx_optional_args); /*proto*/

/* Module declarations from 'ms_peak_picker._c.peak_set' */
static PyTypeObject *__pyx_ptype_14ms_peak_picker_2_c_8peak_set_PeakBase = 0;
static PyTypeObject *__pyx_ptype_14ms_peak_picker_2_c_8peak_set_FittedPeak = 0;
static PyTypeObject *__pyx_ptype_14ms_peak_picker_2_c_8peak_set_PeakSet = 0;
static PyTypeObject *__pyx_ptype_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed = 0;
static size_t *__pyx_vp_14ms_peak_picker_2_c_8peak_set_INTERVAL_INDEX_SIZE = 0;
#define __pyx_v_14ms_peak_picker_2_c_8peak_set_INTERVAL_INDEX_SIZE (*__pyx_vp_14ms_peak_picker_2_c_8peak_set_INTERVAL_INDEX_SIZE)

/* Module declarations from 'ms_deisotope._c.averagine' */
static PyTypeObject *__pyx_ptype_12ms_deisotope_2_c_9averagine_Averagine = 0;
static PyTypeObject *__pyx_ptype_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern = 0;
static PyTypeObject *__pyx_ptype_12ms_deisotope_2_c_9averagine_AveragineCache = 0;
static PyTypeObject *__pyx_ptype_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ = 0;
static PyTypeObject *__pyx_ptype_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr = 0;
static double __pyx_v_12ms_deisotope_2_c_9averagine_PROTON;
static double __pyx_v_12ms_deisotope_2_c_9averagine__neutron_shift;
static double __pyx_f_12ms_deisotope_2_c_9averagine_mass_charge_ratio(double, int, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_mass_charge_ratio *__pyx_optional_args); /*proto*/
static double __pyx_f_12ms_deisotope_2_c_9averagine_neutral_mass(double, int, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_neutral_mass *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_12ms_deisotope_2_c_9averagine_scale_dict(PyObject *, double); /*proto*/
static double __pyx_f_12ms_deisotope_2_c_9averagine_isotopic_shift(int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_isotopic_shift *__pyx_optional_args); /*proto*/
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_poisson_approximate(double, size_t, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_poisson_approximate *__pyx_optional_args); /*proto*/
static double *__pyx_f_12ms_deisotope_2_c_9averagine__cumulative(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *); /*proto*/
static CYTHON_INLINE double __pyx_f_12ms_deisotope_2_c_9averagine__round(double); /*proto*/
static double __pyx_f_12ms_deisotope_2_c_9averagine_sum_intensity(PyObject *, size_t); /*proto*/
static double __pyx_f_12ms_deisotope_2_c_9averagine_top3_scale_factor(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "ms_deisotope._c.averagine"
extern int __pyx_module_is_main_ms_deisotope___c__averagine;
int __pyx_module_is_main_ms_deisotope___c__averagine = 0;

/* Implementation of 'ms_deisotope._c.averagine' */
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_NotImplemented;
static const char __pyx_k_H[] = "H";
static const char __pyx_k__7[] = ", ";
static const char __pyx_k_mz[] = "mz";
static const char __pyx_k_max[] = "max";
static const char __pyx_k_sum[] = "sum";
static const char __pyx_k_0_3f[] = "%0.3f";
static const char __pyx_k_C_12[] = "C[12]";
static const char __pyx_k_C_13[] = "C[13]";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_join[] = "join";
static const char __pyx_k_keys[] = "keys";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mass[] = "mass";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_top3[] = "top3";
static const char __pyx_k_class[] = "__class__";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_scale[] = "scale";
static const char __pyx_k_store[] = "store";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_PROTON[] = "PROTON";
static const char __pyx_k_charge[] = "charge";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_max_mz[] = "max_mz";
static const char __pyx_k_method[] = "method";
static const char __pyx_k_min_mz[] = "min_mz";
static const char __pyx_k_offset[] = "offset";
static const char __pyx_k_origin[] = "origin";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_backend[] = "backend";
static const char __pyx_k_brainpy[] = "brainpy";
static const char __pyx_k_genexpr[] = "genexpr";
static const char __pyx_k_n_peaks[] = "n_peaks";
static const char __pyx_k_PROTON_2[] = "_PROTON";
static const char __pyx_k_basepeak[] = "basepeak";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_peaklist[] = "peaklist";
static const char __pyx_k_pyx_capi[] = "__pyx_capi__";
static const char __pyx_k_Averagine[] = "Averagine";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_averagine[] = "averagine";
static const char __pyx_k_intensity[] = "intensity";
static const char __pyx_k_meanscale[] = "meanscale";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_max_charge[] = "max_charge";
static const char __pyx_k_min_charge[] = "min_charge";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_Averagine_r[] = "Averagine(%r)";
static const char __pyx_k_IGNORE_BELOW[] = "IGNORE_BELOW";
static const char __pyx_k_ignore_below[] = "ignore_below";
static const char __pyx_k_lambda_factor[] = "lambda_factor";
static const char __pyx_k_AveragineCache[] = "AveragineCache";
static const char __pyx_k_NotImplemented[] = "NotImplemented";
static const char __pyx_k_TRUNCATE_AFTER[] = "TRUNCATE_AFTER";
static const char __pyx_k_calculate_mass[] = "calculate_mass";
static const char __pyx_k_charge_carrier[] = "charge_carrier";
static const char __pyx_k_truncate_after[] = "truncate_after";
static const char __pyx_k_monoisotopic_mz[] = "monoisotopic_mz";
static const char __pyx_k_AveragineCache_r[] = "AveragineCache(%r)";
static const char __pyx_k_base_composition[] = "base_composition";
static const char __pyx_k_cache_truncation[] = "cache_truncation";
static const char __pyx_k_isotopic_cluster[] = "isotopic_cluster";
static const char __pyx_k_py_calculate_mass[] = "_py_calculate_mass";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_repr___locals_genexpr[] = "__repr__.<locals>.genexpr";
static const char __pyx_k_ms_deisotope_constants[] = "ms_deisotope.constants";
static const char __pyx_k_experimental_distribution[] = "experimental_distribution";
static const char __pyx_k_ms_deisotope__c_averagine[] = "ms_deisotope._c.averagine";
static const char __pyx_k_TheoreticalIsotopicPattern[] = "TheoreticalIsotopicPattern";
static const char __pyx_k_Isotopic_Pattern_has_length_0_f[] = "Isotopic Pattern has length 0 (%f, %r)";
static const char __pyx_k_The_polarity_of_min_charge_must[] = "The polarity of min_charge must match the polarity of max_charge";
static const char __pyx_k_TheoreticalIsotopicPattern_0_4f[] = "TheoreticalIsotopicPattern(%0.4f, charge=%d, (%s))";
static PyObject *__pyx_kp_s_0_3f;
static PyObject *__pyx_n_s_Averagine;
static PyObject *__pyx_n_s_AveragineCache;
static PyObject *__pyx_kp_s_AveragineCache_r;
static PyObject *__pyx_kp_s_Averagine_r;
static PyObject *__pyx_kp_s_C_12;
static PyObject *__pyx_kp_s_C_13;
static PyObject *__pyx_n_s_H;
static PyObject *__pyx_n_s_IGNORE_BELOW;
static PyObject *__pyx_kp_s_Isotopic_Pattern_has_length_0_f;
static PyObject *__pyx_n_s_NotImplemented;
static PyObject *__pyx_n_s_PROTON;
static PyObject *__pyx_n_s_PROTON_2;
static PyObject *__pyx_n_s_TRUNCATE_AFTER;
static PyObject *__pyx_kp_s_The_polarity_of_min_charge_must;
static PyObject *__pyx_n_s_TheoreticalIsotopicPattern;
static PyObject *__pyx_kp_s_TheoreticalIsotopicPattern_0_4f;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_kp_s__7;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_averagine;
static PyObject *__pyx_n_s_backend;
static PyObject *__pyx_n_s_base_composition;
static PyObject *__pyx_n_s_basepeak;
static PyObject *__pyx_n_s_brainpy;
static PyObject *__pyx_n_s_cache_truncation;
static PyObject *__pyx_n_s_calculate_mass;
static PyObject *__pyx_n_s_charge;
static PyObject *__pyx_n_s_charge_carrier;
static PyObject *__pyx_n_s_class;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_n_s_experimental_distribution;
static PyObject *__pyx_n_s_genexpr;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_ignore_below;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_intensity;
static PyObject *__pyx_n_s_isotopic_cluster;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_keys;
static PyObject *__pyx_n_s_lambda_factor;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_mass;
static PyObject *__pyx_n_s_max;
static PyObject *__pyx_n_s_max_charge;
static PyObject *__pyx_n_s_max_mz;
static PyObject *__pyx_n_s_meanscale;
static PyObject *__pyx_n_s_method;
static PyObject *__pyx_n_s_min_charge;
static PyObject *__pyx_n_s_min_mz;
static PyObject *__pyx_n_s_monoisotopic_mz;
static PyObject *__pyx_n_s_ms_deisotope__c_averagine;
static PyObject *__pyx_n_s_ms_deisotope_constants;
static PyObject *__pyx_n_s_mz;
static PyObject *__pyx_n_s_n_peaks;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_offset;
static PyObject *__pyx_n_s_origin;
static PyObject *__pyx_n_s_peaklist;
static PyObject *__pyx_n_s_py_calculate_mass;
static PyObject *__pyx_n_s_pyx_capi;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_repr___locals_genexpr;
static PyObject *__pyx_n_s_scale;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_store;
static PyObject *__pyx_n_s_sum;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_top3;
static PyObject *__pyx_n_s_truncate_after;
static PyObject *__pyx_n_s_values;
static int __pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine___init__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, PyObject *__pyx_v_base_composition); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_2__reduce__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_4__getstate__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_6__setstate__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, PyObject *__pyx_v_state); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_8__call__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, double __pyx_v_mz, int __pyx_v_charge, double __pyx_v_charge_carrier, double __pyx_v_truncate_after, double __pyx_v_ignore_below); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_10scale(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, double __pyx_v_mz, int __pyx_v_charge, double __pyx_v_charge_carrier); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_12isotopic_cluster(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, double __pyx_v_mz, int __pyx_v_charge, double __pyx_v_charge_carrier, double __pyx_v_truncate_after, double __pyx_v_ignore_below); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_14__getitem__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_16__iter__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_18keys(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_20values(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_22items(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_24__repr__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_26__richcmp__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_code); /* proto */
static Py_hash_t __pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_28__hash__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_9base_mass___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_9base_mass_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_4__del__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern___init__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_peaklist, PyObject *__pyx_v_origin, PyObject *__pyx_v_offset); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_2__getitem__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_i); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_4__iter__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6__len__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8clone(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_10__reduce__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_15monoisotopic_mz___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_12ignore_below(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_ignore_below); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_14shift(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_mz); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_16truncate_after(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_truncate_after); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_18scale(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_experimental_distribution, PyObject *__pyx_v_method); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_20basepeak_index(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_22normalize(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_24scale_raw(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_scale_factor); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_26drop_last_peak(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_28total(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8__repr___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_30__repr__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_32_eq(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_34__richcmp__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_code); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_36incremental_truncation(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_threshold); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_4__del__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6origin___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6origin_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6offset___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6offset_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache___init__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_averagine, PyObject *__pyx_v_backend, double __pyx_v_cache_truncation); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_2__reduce__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_4__getstate__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_6__setstate__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_state); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_8make_cache_key(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, double __pyx_v_mz); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_10isotopic_cluster(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, double __pyx_v_mz, int __pyx_v_charge, double __pyx_v_charge_carrier, double __pyx_v_truncate_after, double __pyx_v_ignore_below); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_12__call__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, double __pyx_v_mz, int __pyx_v_charge, double __pyx_v_charge_carrier, double __pyx_v_truncate_after, double __pyx_v_ignore_below); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_14__getitem__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_16__iter__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_18keys(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_20values(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_22items(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_24__repr__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_26clear(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_28populate(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_min_mz, PyObject *__pyx_v_max_mz, PyObject *__pyx_v_min_charge, PyObject *__pyx_v_max_charge, PyObject *__pyx_v_charge_carrier, PyObject *__pyx_v_truncate_after, PyObject *__pyx_v_ignore_below); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_30__richcmp__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_code); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_4__del__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_4__del__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_16cache_truncation___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_16cache_truncation_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7enabled___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self); /* proto */
static int __pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7enabled_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_isotopic_shift(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_charge); /* proto */
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_2poisson_approximate(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_mass, size_t __pyx_v_n_peaks, double __pyx_v_lambda_factor, int __pyx_v_charge); /* proto */
static PyObject *__pyx_tp_new_12ms_deisotope_2_c_9averagine_Averagine(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12ms_deisotope_2_c_9averagine_AveragineCache(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, &__pyx_n_s_keys, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values = {0, &__pyx_n_s_values, 0, 0, 0};
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_3005;
static double __pyx_k_;
static double __pyx_k__2;
static double __pyx_k__3;
static double __pyx_k__4;
static double __pyx_k__5;
static double __pyx_k__6;
static double __pyx_k__8;
static double __pyx_k__9;
static double __pyx_k__10;
static PyObject *__pyx_k__11;
static PyObject *__pyx_k__12;
static PyObject *__pyx_k__13;
/* Late includes */

/* "ms_deisotope/_c/averagine.pyx":40
 * 
 * @cython.boundscheck(False)
 * cdef double* _cumulative(TheoreticalIsotopicPattern self):             # <<<<<<<<<<<<<<
 *     cdef:
 *         size_t i, n
 */

#line 40 "ms_deisotope/_c/averagine.pyx"


#line 40 "ms_deisotope/_c/averagine.pyx"
static double *__pyx_f_12ms_deisotope_2_c_9averagine__cumulative(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {
  size_t __pyx_v_i
#line 40 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 40 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_total
#line 40 "ms_deisotope/_c/averagine.pyx"
;
  double *__pyx_v_cumulative_intensities
#line 40 "ms_deisotope/_c/averagine.pyx"
;

#line 40 "ms_deisotope/_c/averagine.pyx"
  double *__pyx_r;

#line 40 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 40 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_1;

#line 40 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 40 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 40 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 40 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 40 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 40 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 40 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("_cumulative", 0);

  /* "ms_deisotope/_c/averagine.pyx":46
 *         double* cumulative_intensities
 * 
 *     n = self.get_size()             # <<<<<<<<<<<<<<
 *     cumulative_intensities = <double*>malloc(sizeof(double) * n)
 *     total = 0.0
 */

#line 46 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":47
 * 
 *     n = self.get_size()
 *     cumulative_intensities = <double*>malloc(sizeof(double) * n)             # <<<<<<<<<<<<<<
 *     total = 0.0
 *     for i in range(n):
 */

#line 47 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_cumulative_intensities = ((double *)malloc(((sizeof(double)) * __pyx_v_n)));

  /* "ms_deisotope/_c/averagine.pyx":48
 *     n = self.get_size()
 *     cumulative_intensities = <double*>malloc(sizeof(double) * n)
 *     total = 0.0             # <<<<<<<<<<<<<<
 *     for i in range(n):
 *         total += self.get(i).intensity
 */

#line 48 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_total = 0.0;

  /* "ms_deisotope/_c/averagine.pyx":49
 *     cumulative_intensities = <double*>malloc(sizeof(double) * n)
 *     total = 0.0
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         total += self.get(i).intensity
 *         cumulative_intensities[i] = total
 */

#line 49 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_v_n;

#line 49 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_t_1;

#line 49 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {

#line 49 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_3;

    /* "ms_deisotope/_c/averagine.pyx":50
 *     total = 0.0
 *     for i in range(n):
 *         total += self.get(i).intensity             # <<<<<<<<<<<<<<
 *         cumulative_intensities[i] = total
 *     return cumulative_intensities
 */

#line 50 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error)

#line 50 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_4);

#line 50 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_total = (__pyx_v_total + ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_4)->intensity);

#line 50 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "ms_deisotope/_c/averagine.pyx":51
 *     for i in range(n):
 *         total += self.get(i).intensity
 *         cumulative_intensities[i] = total             # <<<<<<<<<<<<<<
 *     return cumulative_intensities
 * 
 */

#line 51 "ms_deisotope/_c/averagine.pyx"
    (__pyx_v_cumulative_intensities[__pyx_v_i]) = __pyx_v_total;

#line 51 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":52
 *         total += self.get(i).intensity
 *         cumulative_intensities[i] = total
 *     return cumulative_intensities             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 52 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_cumulative_intensities;

#line 52 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":40
 * 
 * @cython.boundscheck(False)
 * cdef double* _cumulative(TheoreticalIsotopicPattern self):             # <<<<<<<<<<<<<<
 *     cdef:
 *         size_t i, n
 */

#line 40 "ms_deisotope/_c/averagine.pyx"


#line 40 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 40 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 40 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 40 "ms_deisotope/_c/averagine.pyx"
  __Pyx_WriteUnraisable("ms_deisotope._c.averagine._cumulative", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);

#line 40 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 40 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 40 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 40 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 40 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":59
 * 
 * 
 * cdef inline double _round(double x):             # <<<<<<<<<<<<<<
 *     return floor(x + 0.5)
 * 
 */

#line 59 "ms_deisotope/_c/averagine.pyx"


#line 59 "ms_deisotope/_c/averagine.pyx"
static CYTHON_INLINE double __pyx_f_12ms_deisotope_2_c_9averagine__round(double __pyx_v_x) {

#line 59 "ms_deisotope/_c/averagine.pyx"
  double __pyx_r;

#line 59 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 59 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("_round", 0);

  /* "ms_deisotope/_c/averagine.pyx":60
 * 
 * cdef inline double _round(double x):
 *     return floor(x + 0.5)             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 60 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = floor((__pyx_v_x + 0.5));

#line 60 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":59
 * 
 * 
 * cdef inline double _round(double x):             # <<<<<<<<<<<<<<
 *     return floor(x + 0.5)
 * 
 */

#line 59 "ms_deisotope/_c/averagine.pyx"


#line 59 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 59 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 59 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 59 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 59 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":63
 * 
 * 
 * cdef double neutral_mass(double mz,  int z, double charge_carrier=PROTON):             # <<<<<<<<<<<<<<
 *     return (mz * abs(z)) - (z * charge_carrier)
 * 
 */

#line 63 "ms_deisotope/_c/averagine.pyx"


#line 63 "ms_deisotope/_c/averagine.pyx"
static double __pyx_f_12ms_deisotope_2_c_9averagine_neutral_mass(double __pyx_v_mz, int __pyx_v_z, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_neutral_mass *__pyx_optional_args) {

#line 63 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_charge_carrier = __pyx_k_;

#line 63 "ms_deisotope/_c/averagine.pyx"
  double __pyx_r;

#line 63 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 63 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_1;

#line 63 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 63 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 63 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 63 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("neutral_mass", 0);

#line 63 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_optional_args) {

#line 63 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_optional_args->__pyx_n > 0) {

#line 63 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge_carrier = __pyx_optional_args->charge_carrier;

#line 63 "ms_deisotope/_c/averagine.pyx"
    }

#line 63 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":64
 * 
 * cdef double neutral_mass(double mz,  int z, double charge_carrier=PROTON):
 *     return (mz * abs(z)) - (z * charge_carrier)             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 64 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = abs(__pyx_v_z); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 64, __pyx_L1_error)

#line 64 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = ((__pyx_v_mz * __pyx_t_1) - (__pyx_v_z * __pyx_v_charge_carrier));

#line 64 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":63
 * 
 * 
 * cdef double neutral_mass(double mz,  int z, double charge_carrier=PROTON):             # <<<<<<<<<<<<<<
 *     return (mz * abs(z)) - (z * charge_carrier)
 * 
 */

#line 63 "ms_deisotope/_c/averagine.pyx"


#line 63 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 63 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 63 "ms_deisotope/_c/averagine.pyx"
  __Pyx_WriteUnraisable("ms_deisotope._c.averagine.neutral_mass", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);

#line 63 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 63 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 63 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 63 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 63 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":68
 * 
 * @cython.cdivision
 * cdef double mass_charge_ratio(double neutral_mass, int z, double charge_carrier=PROTON):             # <<<<<<<<<<<<<<
 *     return (neutral_mass + (z * charge_carrier)) / abs(z)
 * 
 */

#line 68 "ms_deisotope/_c/averagine.pyx"


#line 68 "ms_deisotope/_c/averagine.pyx"
static double __pyx_f_12ms_deisotope_2_c_9averagine_mass_charge_ratio(double __pyx_v_neutral_mass, int __pyx_v_z, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_mass_charge_ratio *__pyx_optional_args) {

#line 68 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_charge_carrier = __pyx_k__2;

#line 68 "ms_deisotope/_c/averagine.pyx"
  double __pyx_r;

#line 68 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 68 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_1;

#line 68 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 68 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 68 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 68 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("mass_charge_ratio", 0);

#line 68 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_optional_args) {

#line 68 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_optional_args->__pyx_n > 0) {

#line 68 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge_carrier = __pyx_optional_args->charge_carrier;

#line 68 "ms_deisotope/_c/averagine.pyx"
    }

#line 68 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":69
 * @cython.cdivision
 * cdef double mass_charge_ratio(double neutral_mass, int z, double charge_carrier=PROTON):
 *     return (neutral_mass + (z * charge_carrier)) / abs(z)             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 69 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = abs(__pyx_v_z); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 69, __pyx_L1_error)

#line 69 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = ((__pyx_v_neutral_mass + (__pyx_v_z * __pyx_v_charge_carrier)) / __pyx_t_1);

#line 69 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":68
 * 
 * @cython.cdivision
 * cdef double mass_charge_ratio(double neutral_mass, int z, double charge_carrier=PROTON):             # <<<<<<<<<<<<<<
 *     return (neutral_mass + (z * charge_carrier)) / abs(z)
 * 
 */

#line 68 "ms_deisotope/_c/averagine.pyx"


#line 68 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 68 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 68 "ms_deisotope/_c/averagine.pyx"
  __Pyx_WriteUnraisable("ms_deisotope._c.averagine.mass_charge_ratio", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);

#line 68 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 68 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 68 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 68 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 68 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":72
 * 
 * 
 * cdef void slide(double mz, list peaklist):             # <<<<<<<<<<<<<<
 *     cdef:
 *         size_t n
 */

#line 72 "ms_deisotope/_c/averagine.pyx"


#line 72 "ms_deisotope/_c/averagine.pyx"
static void __pyx_f_12ms_deisotope_2_c_9averagine_slide(double __pyx_v_mz, PyObject *__pyx_v_peaklist) {
  size_t __pyx_v_n
#line 72 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_i
#line 72 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_peak = 0
#line 72 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_first_peak = 0
#line 72 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_delta
#line 72 "ms_deisotope/_c/averagine.pyx"
;

#line 72 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 72 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1;

#line 72 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 72 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 72 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_4;

#line 72 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_5;

#line 72 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("slide", 0);

  /* "ms_deisotope/_c/averagine.pyx":79
 *         double delta
 * 
 *     n = PyList_GET_SIZE(peaklist) - 1             # <<<<<<<<<<<<<<
 * 
 *     first_peak = <TheoreticalPeak>PyList_GET_ITEM(peaklist, 0)
 */

#line 79 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = (PyList_GET_SIZE(__pyx_v_peaklist) - 1);

  /* "ms_deisotope/_c/averagine.pyx":81
 *     n = PyList_GET_SIZE(peaklist) - 1
 * 
 *     first_peak = <TheoreticalPeak>PyList_GET_ITEM(peaklist, 0)             # <<<<<<<<<<<<<<
 *     for i in range(n):
 *         peak = <TheoreticalPeak>PyList_GET_ITEM(peaklist, i + 1)
 */

#line 81 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyList_GET_ITEM(__pyx_v_peaklist, 0);

#line 81 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = ((PyObject *)__pyx_t_1);

#line 81 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_t_2);

#line 81 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_first_peak = ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_2);

#line 81 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":82
 * 
 *     first_peak = <TheoreticalPeak>PyList_GET_ITEM(peaklist, 0)
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         peak = <TheoreticalPeak>PyList_GET_ITEM(peaklist, i + 1)
 *         delta = peak.mz - first_peak.mz
 */

#line 82 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __pyx_v_n;

#line 82 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = __pyx_t_3;

#line 82 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {

#line 82 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_5;

    /* "ms_deisotope/_c/averagine.pyx":83
 *     first_peak = <TheoreticalPeak>PyList_GET_ITEM(peaklist, 0)
 *     for i in range(n):
 *         peak = <TheoreticalPeak>PyList_GET_ITEM(peaklist, i + 1)             # <<<<<<<<<<<<<<
 *         delta = peak.mz - first_peak.mz
 *         peak.mz = mz + delta
 */

#line 83 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = PyList_GET_ITEM(__pyx_v_peaklist, (__pyx_v_i + 1));

#line 83 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = ((PyObject *)__pyx_t_1);

#line 83 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_t_2);

#line 83 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_peak, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_2));

#line 83 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = 0;

    /* "ms_deisotope/_c/averagine.pyx":84
 *     for i in range(n):
 *         peak = <TheoreticalPeak>PyList_GET_ITEM(peaklist, i + 1)
 *         delta = peak.mz - first_peak.mz             # <<<<<<<<<<<<<<
 *         peak.mz = mz + delta
 *     first_peak.mz = mz
 */

#line 84 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_delta = (__pyx_v_peak->mz - __pyx_v_first_peak->mz);

    /* "ms_deisotope/_c/averagine.pyx":85
 *         peak = <TheoreticalPeak>PyList_GET_ITEM(peaklist, i + 1)
 *         delta = peak.mz - first_peak.mz
 *         peak.mz = mz + delta             # <<<<<<<<<<<<<<
 *     first_peak.mz = mz
 *     return
 */

#line 85 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_peak->mz = (__pyx_v_mz + __pyx_v_delta);

#line 85 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":86
 *         delta = peak.mz - first_peak.mz
 *         peak.mz = mz + delta
 *     first_peak.mz = mz             # <<<<<<<<<<<<<<
 *     return
 * 
 */

#line 86 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_first_peak->mz = __pyx_v_mz;

  /* "ms_deisotope/_c/averagine.pyx":87
 *         peak.mz = mz + delta
 *     first_peak.mz = mz
 *     return             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 87 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":72
 * 
 * 
 * cdef void slide(double mz, list peaklist):             # <<<<<<<<<<<<<<
 *     cdef:
 *         size_t n
 */

#line 72 "ms_deisotope/_c/averagine.pyx"


#line 72 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 72 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 72 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_peak);

#line 72 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_first_peak);

#line 72 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 72 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":90
 * 
 * 
 * cdef dict scale_dict(dict data, double factor):             # <<<<<<<<<<<<<<
 *     cdef:
 *         dict scaled
 */

#line 90 "ms_deisotope/_c/averagine.pyx"


#line 90 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_f_12ms_deisotope_2_c_9averagine_scale_dict(PyObject *__pyx_v_data, double __pyx_v_factor) {
  PyObject *__pyx_v_scaled = 0
#line 90 "ms_deisotope/_c/averagine.pyx"
;
  Py_ssize_t __pyx_v_i
#line 90 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_key
#line 90 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_value
#line 90 "ms_deisotope/_c/averagine.pyx"
;

#line 90 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 90 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 90 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 90 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_2;

#line 90 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_3;

#line 90 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_4;

#line 90 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 90 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 90 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 90 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("scale_dict", 0);

  /* "ms_deisotope/_c/averagine.pyx":97
 *         PyObject* value
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     scaled = {}
 *     while PyDict_Next(data, &i, &key, &value):
 */

#line 97 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_i = 0;

  /* "ms_deisotope/_c/averagine.pyx":98
 * 
 *     i = 0
 *     scaled = {}             # <<<<<<<<<<<<<<
 *     while PyDict_Next(data, &i, &key, &value):
 *         PyDict_SetItem(scaled, <object>key, _round(PyFloat_AsDouble(<object>value) * factor))
 */

#line 98 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)

#line 98 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 98 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_scaled = ((PyObject*)__pyx_t_1);

#line 98 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":99
 *     i = 0
 *     scaled = {}
 *     while PyDict_Next(data, &i, &key, &value):             # <<<<<<<<<<<<<<
 *         PyDict_SetItem(scaled, <object>key, _round(PyFloat_AsDouble(<object>value) * factor))
 *     return scaled
 */

#line 99 "ms_deisotope/_c/averagine.pyx"
  while (1) {

#line 99 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = (PyDict_Next(__pyx_v_data, (&__pyx_v_i), (&__pyx_v_key), (&__pyx_v_value)) != 0);

#line 99 "ms_deisotope/_c/averagine.pyx"
    if (!__pyx_t_2) break;

    /* "ms_deisotope/_c/averagine.pyx":100
 *     scaled = {}
 *     while PyDict_Next(data, &i, &key, &value):
 *         PyDict_SetItem(scaled, <object>key, _round(PyFloat_AsDouble(<object>value) * factor))             # <<<<<<<<<<<<<<
 *     return scaled
 * 
 */

#line 100 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = PyFloat_AsDouble(((PyObject *)__pyx_v_value)); if (unlikely(__pyx_t_3 == ((double)-1.0) && PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L1_error)

#line 100 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = PyFloat_FromDouble(__pyx_f_12ms_deisotope_2_c_9averagine__round((__pyx_t_3 * __pyx_v_factor))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)

#line 100 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 100 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = PyDict_SetItem(__pyx_v_scaled, ((PyObject *)__pyx_v_key), __pyx_t_1); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 100, __pyx_L1_error)

#line 100 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 100 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":101
 *     while PyDict_Next(data, &i, &key, &value):
 *         PyDict_SetItem(scaled, <object>key, _round(PyFloat_AsDouble(<object>value) * factor))
 *     return scaled             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 101 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 101 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_scaled);

#line 101 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_scaled;

#line 101 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":90
 * 
 * 
 * cdef dict scale_dict(dict data, double factor):             # <<<<<<<<<<<<<<
 *     cdef:
 *         dict scaled
 */

#line 90 "ms_deisotope/_c/averagine.pyx"


#line 90 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 90 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 90 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 90 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.scale_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 90 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 90 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 90 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_scaled);

#line 90 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 90 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 90 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 90 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":120
 *     """
 * 
 *     def __init__(self, object base_composition):             # <<<<<<<<<<<<<<
 *         self.base_composition = dict(**base_composition)
 *         self.base_mass = calculate_mass(self.base_composition)
 */

#line 120 "ms_deisotope/_c/averagine.pyx"


#line 120 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 120 "ms_deisotope/_c/averagine.pyx"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 120 "ms_deisotope/_c/averagine.pyx"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_base_composition = 0
#line 120 "ms_deisotope/_c/averagine.pyx"
;

#line 120 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 120 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 120 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 120 "ms_deisotope/_c/averagine.pyx"
  int __pyx_r;

#line 120 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 120 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);

#line 120 "ms_deisotope/_c/averagine.pyx"
  {

#line 120 "ms_deisotope/_c/averagine.pyx"
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_base_composition,0};

#line 120 "ms_deisotope/_c/averagine.pyx"
    PyObject* values[1] = {0};

#line 120 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_kwds)) {

#line 120 "ms_deisotope/_c/averagine.pyx"
      Py_ssize_t kw_args;

#line 120 "ms_deisotope/_c/averagine.pyx"
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);

#line 120 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {
        case  1: 
#line 120 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 120 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 120 "ms_deisotope/_c/averagine.pyx"
        case  0: break;
        default: 
#line 120 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 120 "ms_deisotope/_c/averagine.pyx"
      }

#line 120 "ms_deisotope/_c/averagine.pyx"
      kw_args = PyDict_Size(__pyx_kwds);

#line 120 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {

#line 120 "ms_deisotope/_c/averagine.pyx"
        case  0:

#line 120 "ms_deisotope/_c/averagine.pyx"
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_base_composition)) != 0)) kw_args--;
        else 
#line 120 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 120 "ms_deisotope/_c/averagine.pyx"
      }

#line 120 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(kw_args > 0)) {

#line 120 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 120, __pyx_L3_error)

#line 120 "ms_deisotope/_c/averagine.pyx"
      }

#line 120 "ms_deisotope/_c/averagine.pyx"
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {

#line 120 "ms_deisotope/_c/averagine.pyx"
      goto __pyx_L5_argtuple_error;

#line 120 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 120 "ms_deisotope/_c/averagine.pyx"
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 120 "ms_deisotope/_c/averagine.pyx"
    }

#line 120 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_base_composition = values[0];

#line 120 "ms_deisotope/_c/averagine.pyx"
  }

#line 120 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 120 "ms_deisotope/_c/averagine.pyx"
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); 
#line 120 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 120, __pyx_L3_error)

#line 120 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 120 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 120 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 120 "ms_deisotope/_c/averagine.pyx"
  return -1;

#line 120 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 120 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine___init__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self), __pyx_v_base_composition);

#line 120 "ms_deisotope/_c/averagine.pyx"


#line 120 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 120 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 120 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 120 "ms_deisotope/_c/averagine.pyx"
}

#line 120 "ms_deisotope/_c/averagine.pyx"


#line 120 "ms_deisotope/_c/averagine.pyx"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine___init__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, PyObject *__pyx_v_base_composition) {

#line 120 "ms_deisotope/_c/averagine.pyx"
  int __pyx_r;

#line 120 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 120 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 120 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 120 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 120 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 120 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 120 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "ms_deisotope/_c/averagine.pyx":121
 * 
 *     def __init__(self, object base_composition):
 *         self.base_composition = dict(**base_composition)             # <<<<<<<<<<<<<<
 *         self.base_mass = calculate_mass(self.base_composition)
 *         assert self.base_mass > 0
 */

#line 121 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_v_base_composition == Py_None)) {

#line 121 "ms_deisotope/_c/averagine.pyx"
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");

#line 121 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 121, __pyx_L1_error)

#line 121 "ms_deisotope/_c/averagine.pyx"
  }

#line 121 "ms_deisotope/_c/averagine.pyx"
  if (likely(PyDict_CheckExact(__pyx_v_base_composition))) {

#line 121 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = PyDict_Copy(__pyx_v_base_composition); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)

#line 121 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 121 "ms_deisotope/_c/averagine.pyx"
  } else {

#line 121 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_base_composition, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)

#line 121 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 121 "ms_deisotope/_c/averagine.pyx"
  }

#line 121 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyDict_Type)), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)

#line 121 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 121 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 121 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_2);

#line 121 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_v_self->base_composition);

#line 121 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_v_self->base_composition);

#line 121 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->base_composition = ((PyObject*)__pyx_t_2);

#line 121 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":122
 *     def __init__(self, object base_composition):
 *         self.base_composition = dict(**base_composition)
 *         self.base_mass = calculate_mass(self.base_composition)             # <<<<<<<<<<<<<<
 *         assert self.base_mass > 0
 * 
 */

#line 122 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_v_self->base_composition;

#line 122 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_t_2);

#line 122 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->base_mass = __pyx_f_7brainpy_8_speedup_calculate_mass(((PyObject*)__pyx_t_2), NULL);

#line 122 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":123
 *         self.base_composition = dict(**base_composition)
 *         self.base_mass = calculate_mass(self.base_composition)
 *         assert self.base_mass > 0             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */

#line 123 "ms_deisotope/_c/averagine.pyx"
  #ifndef CYTHON_WITHOUT_ASSERTIONS

#line 123 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!Py_OptimizeFlag)) {

#line 123 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(!((__pyx_v_self->base_mass > 0.0) != 0))) {

#line 123 "ms_deisotope/_c/averagine.pyx"
      PyErr_SetNone(PyExc_AssertionError);

#line 123 "ms_deisotope/_c/averagine.pyx"
      __PYX_ERR(0, 123, __pyx_L1_error)

#line 123 "ms_deisotope/_c/averagine.pyx"
    }

#line 123 "ms_deisotope/_c/averagine.pyx"
  }

#line 123 "ms_deisotope/_c/averagine.pyx"
  #endif

  /* "ms_deisotope/_c/averagine.pyx":120
 *     """
 * 
 *     def __init__(self, object base_composition):             # <<<<<<<<<<<<<<
 *         self.base_composition = dict(**base_composition)
 *         self.base_mass = calculate_mass(self.base_composition)
 */

#line 120 "ms_deisotope/_c/averagine.pyx"


#line 120 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 120 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 120 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 120 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 120 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 120 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 120 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 120 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = -1;

#line 120 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 120 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 120 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 120 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":125
 *         assert self.base_mass > 0
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return self.__class__, (self.base_composition,), self.__getstate__()
 * 
 */

#line 125 "ms_deisotope/_c/averagine.pyx"


#line 125 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 125 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 125 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_2__reduce__[] = "Averagine.__reduce__(self)";

#line 125 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 125 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 125 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 125 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = 
#line 125 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_2__reduce__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self));

#line 125 "ms_deisotope/_c/averagine.pyx"


#line 125 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 125 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 125 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 125 "ms_deisotope/_c/averagine.pyx"
}

#line 125 "ms_deisotope/_c/averagine.pyx"


#line 125 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_2__reduce__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self) {

#line 125 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 125 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 125 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 125 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 125 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 125 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 125 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_5 = NULL;

#line 125 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 125 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 125 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 125 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "ms_deisotope/_c/averagine.pyx":126
 * 
 *     def __reduce__(self):
 *         return self.__class__, (self.base_composition,), self.__getstate__()             # <<<<<<<<<<<<<<
 * 
 *     def __getstate__(self):
 */

#line 126 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 126 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)

#line 126 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 126 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error)

#line 126 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 126 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_self->base_composition);

#line 126 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_v_self->base_composition);

#line 126 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self->base_composition);

#line 126 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getstate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 126, __pyx_L1_error)

#line 126 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_4);

#line 126 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_5 = NULL;

#line 126 "ms_deisotope/_c/averagine.pyx"
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {

#line 126 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);

#line 126 "ms_deisotope/_c/averagine.pyx"
    if (likely(__pyx_t_5)) {

#line 126 "ms_deisotope/_c/averagine.pyx"
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);

#line 126 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(__pyx_t_5);

#line 126 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(function);

#line 126 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF_SET(__pyx_t_4, function);

#line 126 "ms_deisotope/_c/averagine.pyx"
    }

#line 126 "ms_deisotope/_c/averagine.pyx"
  }

#line 126 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);

#line 126 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

#line 126 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error)

#line 126 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_3);

#line 126 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 126 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 126, __pyx_L1_error)

#line 126 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_4);

#line 126 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_1);

#line 126 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);

#line 126 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_2);

#line 126 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);

#line 126 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_3);

#line 126 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);

#line 126 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 126 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

#line 126 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = 0;

#line 126 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_4;

#line 126 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = 0;

#line 126 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":125
 *         assert self.base_mass > 0
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return self.__class__, (self.base_composition,), self.__getstate__()
 * 
 */

#line 125 "ms_deisotope/_c/averagine.pyx"


#line 125 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 125 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 125 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 125 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 125 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 125 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 125 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_5);

#line 125 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 125 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 125 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 125 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 125 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 125 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 125 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":128
 *         return self.__class__, (self.base_composition,), self.__getstate__()
 * 
 *     def __getstate__(self):             # <<<<<<<<<<<<<<
 *         return self.base_composition, self.base_mass
 * 
 */

#line 128 "ms_deisotope/_c/averagine.pyx"


#line 128 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 128 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_5__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 128 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_4__getstate__[] = "Averagine.__getstate__(self)";

#line 128 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_5__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 128 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 128 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 128 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__getstate__ (wrapper)", 0);
  __pyx_r = 
#line 128 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_4__getstate__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self));

#line 128 "ms_deisotope/_c/averagine.pyx"


#line 128 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 128 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 128 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 128 "ms_deisotope/_c/averagine.pyx"
}

#line 128 "ms_deisotope/_c/averagine.pyx"


#line 128 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_4__getstate__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self) {

#line 128 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 128 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 128 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 128 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 128 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 128 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 128 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 128 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__getstate__", 0);

  /* "ms_deisotope/_c/averagine.pyx":129
 * 
 *     def __getstate__(self):
 *         return self.base_composition, self.base_mass             # <<<<<<<<<<<<<<
 * 
 *     def __setstate__(self, state):
 */

#line 129 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 129 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->base_mass); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)

#line 129 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 129 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 129, __pyx_L1_error)

#line 129 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 129 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_self->base_composition);

#line 129 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_v_self->base_composition);

#line 129 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self->base_composition);

#line 129 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_1);

#line 129 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);

#line 129 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 129 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_2;

#line 129 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

#line 129 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":128
 *         return self.__class__, (self.base_composition,), self.__getstate__()
 * 
 *     def __getstate__(self):             # <<<<<<<<<<<<<<
 *         return self.base_composition, self.base_mass
 * 
 */

#line 128 "ms_deisotope/_c/averagine.pyx"


#line 128 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 128 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 128 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 128 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 128 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.__getstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 128 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 128 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 128 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 128 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 128 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 128 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":131
 *         return self.base_composition, self.base_mass
 * 
 *     def __setstate__(self, state):             # <<<<<<<<<<<<<<
 *         composition, mass = state
 *         self.base_composition = dict(composition)
 */

#line 131 "ms_deisotope/_c/averagine.pyx"


#line 131 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 131 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/

#line 131 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_6__setstate__[] = "Averagine.__setstate__(self, state)";

#line 131 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) {

#line 131 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 131 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 131 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0);
  __pyx_r = 
#line 131 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_6__setstate__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self), ((PyObject *)__pyx_v_state));

#line 131 "ms_deisotope/_c/averagine.pyx"


#line 131 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 131 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 131 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 131 "ms_deisotope/_c/averagine.pyx"
}

#line 131 "ms_deisotope/_c/averagine.pyx"


#line 131 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_6__setstate__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, PyObject *__pyx_v_state) {
  PyObject *__pyx_v_composition = NULL
#line 131 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_mass = NULL
#line 131 "ms_deisotope/_c/averagine.pyx"
;

#line 131 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 131 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 131 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 131 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 131 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 131 "ms_deisotope/_c/averagine.pyx"
  PyObject *(*__pyx_t_4)(PyObject *);

#line 131 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_5;

#line 131 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 131 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 131 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 131 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__setstate__", 0);

  /* "ms_deisotope/_c/averagine.pyx":132
 * 
 *     def __setstate__(self, state):
 *         composition, mass = state             # <<<<<<<<<<<<<<
 *         self.base_composition = dict(composition)
 *         self.base_mass = float(mass)
 */

#line 132 "ms_deisotope/_c/averagine.pyx"
  if ((likely(PyTuple_CheckExact(__pyx_v_state))) || (PyList_CheckExact(__pyx_v_state))) {

#line 132 "ms_deisotope/_c/averagine.pyx"
    PyObject* sequence = __pyx_v_state;

#line 132 "ms_deisotope/_c/averagine.pyx"
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);

#line 132 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(size != 2)) {

#line 132 "ms_deisotope/_c/averagine.pyx"
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);

#line 132 "ms_deisotope/_c/averagine.pyx"
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);

#line 132 "ms_deisotope/_c/averagine.pyx"
      __PYX_ERR(0, 132, __pyx_L1_error)

#line 132 "ms_deisotope/_c/averagine.pyx"
    }

#line 132 "ms_deisotope/_c/averagine.pyx"
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS

#line 132 "ms_deisotope/_c/averagine.pyx"
    if (likely(PyTuple_CheckExact(sequence))) {

#line 132 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 

#line 132 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 

#line 132 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 132 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 

#line 132 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 

#line 132 "ms_deisotope/_c/averagine.pyx"
    }

#line 132 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_t_1);

#line 132 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_t_2);

#line 132 "ms_deisotope/_c/averagine.pyx"
    #else

#line 132 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)

#line 132 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 132 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)

#line 132 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);

#line 132 "ms_deisotope/_c/averagine.pyx"
    #endif

#line 132 "ms_deisotope/_c/averagine.pyx"
  } else {

#line 132 "ms_deisotope/_c/averagine.pyx"
    Py_ssize_t index = -1;

#line 132 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = PyObject_GetIter(__pyx_v_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error)

#line 132 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 132 "ms_deisotope/_c/averagine.pyx"
    __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)) 
#line 132 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L3_unpacking_failed;

#line 132 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) 
#line 132 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L3_unpacking_failed;

#line 132 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);

#line 132 "ms_deisotope/_c/averagine.pyx"
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < 0) __PYX_ERR(0, 132, __pyx_L1_error)

#line 132 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = NULL;

#line 132 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 132 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L4_unpacking_done;

#line 132 "ms_deisotope/_c/averagine.pyx"
    __pyx_L3_unpacking_failed:;

#line 132 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 132 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = NULL;

#line 132 "ms_deisotope/_c/averagine.pyx"
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);

#line 132 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 132, __pyx_L1_error)

#line 132 "ms_deisotope/_c/averagine.pyx"
    __pyx_L4_unpacking_done:;

#line 132 "ms_deisotope/_c/averagine.pyx"
  }

#line 132 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_composition = __pyx_t_1;

#line 132 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 132 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_mass = __pyx_t_2;

#line 132 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":133
 *     def __setstate__(self, state):
 *         composition, mass = state
 *         self.base_composition = dict(composition)             # <<<<<<<<<<<<<<
 *         self.base_mass = float(mass)
 * 
 */

#line 133 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_v_composition); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)

#line 133 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 133 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_2);

#line 133 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_v_self->base_composition);

#line 133 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_v_self->base_composition);

#line 133 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->base_composition = ((PyObject*)__pyx_t_2);

#line 133 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":134
 *         composition, mass = state
 *         self.base_composition = dict(composition)
 *         self.base_mass = float(mass)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95,
 */

#line 134 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_v_mass); if (unlikely(__pyx_t_5 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L1_error)

#line 134 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->base_mass = __pyx_t_5;

  /* "ms_deisotope/_c/averagine.pyx":131
 *         return self.base_composition, self.base_mass
 * 
 *     def __setstate__(self, state):             # <<<<<<<<<<<<<<
 *         composition, mass = state
 *         self.base_composition = dict(composition)
 */

#line 131 "ms_deisotope/_c/averagine.pyx"


#line 131 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 131 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);

#line 131 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 131 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 131 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 131 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 131 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 131 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 131 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 131 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 131 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_composition);

#line 131 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_mass);

#line 131 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 131 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 131 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 131 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":136
 *         self.base_mass = float(mass)
 * 
 *     def __call__(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95,             # <<<<<<<<<<<<<<
 *                  double ignore_below=0.0):
 *         out = self.isotopic_cluster(mz, charge, charge_carrier, truncate_after, ignore_below)
 */

#line 136 "ms_deisotope/_c/averagine.pyx"


#line 136 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 136 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_9__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 136 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_9__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_mz
#line 136 "ms_deisotope/_c/averagine.pyx"
;
  int __pyx_v_charge
#line 136 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_charge_carrier
#line 136 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_truncate_after
#line 136 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_ignore_below
#line 136 "ms_deisotope/_c/averagine.pyx"
;

#line 136 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 136 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 136 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 136 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 136 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 136 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);

#line 136 "ms_deisotope/_c/averagine.pyx"
  {

#line 136 "ms_deisotope/_c/averagine.pyx"
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mz,&__pyx_n_s_charge,&__pyx_n_s_charge_carrier,&__pyx_n_s_truncate_after,&__pyx_n_s_ignore_below,0};

#line 136 "ms_deisotope/_c/averagine.pyx"
    PyObject* values[5] = {0,0,0,0,0};

#line 136 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_kwds)) {

#line 136 "ms_deisotope/_c/averagine.pyx"
      Py_ssize_t kw_args;

#line 136 "ms_deisotope/_c/averagine.pyx"
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);

#line 136 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {
        case  5: 
#line 136 "ms_deisotope/_c/averagine.pyx"
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);

#line 136 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  4: 
#line 136 "ms_deisotope/_c/averagine.pyx"
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);

#line 136 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  3: 
#line 136 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 136 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 136 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 136 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 136 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 136 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 136 "ms_deisotope/_c/averagine.pyx"
        case  0: break;
        default: 
#line 136 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 136 "ms_deisotope/_c/averagine.pyx"
      }

#line 136 "ms_deisotope/_c/averagine.pyx"
      kw_args = PyDict_Size(__pyx_kwds);

#line 136 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {

#line 136 "ms_deisotope/_c/averagine.pyx"
        case  0:

#line 136 "ms_deisotope/_c/averagine.pyx"
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mz)) != 0)) kw_args--;
        else 
#line 136 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 136 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 136 "ms_deisotope/_c/averagine.pyx"
        case  1:

#line 136 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 136 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge);

#line 136 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[1] = value; kw_args--; }

#line 136 "ms_deisotope/_c/averagine.pyx"
        }

#line 136 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 136 "ms_deisotope/_c/averagine.pyx"
        case  2:

#line 136 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 136 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge_carrier);

#line 136 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[2] = value; kw_args--; }

#line 136 "ms_deisotope/_c/averagine.pyx"
        }

#line 136 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 136 "ms_deisotope/_c/averagine.pyx"
        case  3:

#line 136 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 136 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncate_after);

#line 136 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[3] = value; kw_args--; }

#line 136 "ms_deisotope/_c/averagine.pyx"
        }

#line 136 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 136 "ms_deisotope/_c/averagine.pyx"
        case  4:

#line 136 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 136 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ignore_below);

#line 136 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[4] = value; kw_args--; }

#line 136 "ms_deisotope/_c/averagine.pyx"
        }

#line 136 "ms_deisotope/_c/averagine.pyx"
      }

#line 136 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(kw_args > 0)) {

#line 136 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 136, __pyx_L3_error)

#line 136 "ms_deisotope/_c/averagine.pyx"
      }

#line 136 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 136 "ms_deisotope/_c/averagine.pyx"
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: 
#line 136 "ms_deisotope/_c/averagine.pyx"
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);

#line 136 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  4: 
#line 136 "ms_deisotope/_c/averagine.pyx"
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);

#line 136 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  3: 
#line 136 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 136 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 136 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 136 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 136 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 136 "ms_deisotope/_c/averagine.pyx"
        break;
        default: 
#line 136 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 136 "ms_deisotope/_c/averagine.pyx"
      }

#line 136 "ms_deisotope/_c/averagine.pyx"
    }

#line 136 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_mz = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mz == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error)

#line 136 "ms_deisotope/_c/averagine.pyx"
    if (values[1]) {

#line 136 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_charge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error)

#line 136 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 136 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = ((int)1);

#line 136 "ms_deisotope/_c/averagine.pyx"
    }

#line 136 "ms_deisotope/_c/averagine.pyx"
    if (values[2]) {

#line 136 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge_carrier = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_charge_carrier == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error)

#line 136 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 136 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge_carrier = __pyx_k__3;

#line 136 "ms_deisotope/_c/averagine.pyx"
    }

#line 136 "ms_deisotope/_c/averagine.pyx"
    if (values[3]) {

#line 136 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_truncate_after = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_truncate_after == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error)

#line 136 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 136 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_truncate_after = ((double)0.95);

#line 136 "ms_deisotope/_c/averagine.pyx"
    }

#line 136 "ms_deisotope/_c/averagine.pyx"
    if (values[4]) {

#line 136 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_ignore_below = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_ignore_below == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L3_error)

#line 136 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 136 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_ignore_below = ((double)0.0);

#line 136 "ms_deisotope/_c/averagine.pyx"
    }

#line 136 "ms_deisotope/_c/averagine.pyx"
  }

#line 136 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 136 "ms_deisotope/_c/averagine.pyx"
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); 
#line 136 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 136, __pyx_L3_error)

#line 136 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 136 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 136 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 136 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 136 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 136 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_8__call__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self), __pyx_v_mz, __pyx_v_charge, __pyx_v_charge_carrier, __pyx_v_truncate_after, __pyx_v_ignore_below);

#line 136 "ms_deisotope/_c/averagine.pyx"


#line 136 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 136 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 136 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 136 "ms_deisotope/_c/averagine.pyx"
}

#line 136 "ms_deisotope/_c/averagine.pyx"


#line 136 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_8__call__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, double __pyx_v_mz, int __pyx_v_charge, double __pyx_v_charge_carrier, double __pyx_v_truncate_after, double __pyx_v_ignore_below) {
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_out = NULL
#line 136 "ms_deisotope/_c/averagine.pyx"
;

#line 136 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 136 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 136 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 136 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_isotopic_cluster __pyx_t_2;

#line 136 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 136 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 136 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 136 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "ms_deisotope/_c/averagine.pyx":138
 *     def __call__(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95,
 *                  double ignore_below=0.0):
 *         out = self.isotopic_cluster(mz, charge, charge_carrier, truncate_after, ignore_below)             # <<<<<<<<<<<<<<
 *         return out
 * 
 */

#line 138 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.__pyx_n = 4;

#line 138 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge = __pyx_v_charge;

#line 138 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge_carrier = __pyx_v_charge_carrier;

#line 138 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.truncate_after = __pyx_v_truncate_after;

#line 138 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.ignore_below = __pyx_v_ignore_below;

#line 138 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self->__pyx_vtab)->isotopic_cluster(__pyx_v_self, __pyx_v_mz, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)

#line 138 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 138 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_out = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_1);

#line 138 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":139
 *                  double ignore_below=0.0):
 *         out = self.isotopic_cluster(mz, charge, charge_carrier, truncate_after, ignore_below)
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     @cython.cdivision
 */

#line 139 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 139 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_v_out));

#line 139 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = ((PyObject *)__pyx_v_out);

#line 139 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":136
 *         self.base_mass = float(mass)
 * 
 *     def __call__(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95,             # <<<<<<<<<<<<<<
 *                  double ignore_below=0.0):
 *         out = self.isotopic_cluster(mz, charge, charge_carrier, truncate_after, ignore_below)
 */

#line 136 "ms_deisotope/_c/averagine.pyx"


#line 136 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 136 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 136 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 136 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 136 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 136 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 136 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_out);

#line 136 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 136 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 136 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 136 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":142
 * 
 *     @cython.cdivision
 *     cpdef dict scale(self, double mz, int charge=1, double charge_carrier=PROTON):             # <<<<<<<<<<<<<<
 *         """Given an m/z and a charge state, interpolate the composition
 *         of the polymer with the matching neutral mass
 */

#line 142 "ms_deisotope/_c/averagine.pyx"


#line 142 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_11scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 142 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_f_12ms_deisotope_2_c_9averagine_9Averagine_scale(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, double __pyx_v_mz, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_scale *__pyx_optional_args) {

#line 142 "ms_deisotope/_c/averagine.pyx"
  int __pyx_v_charge = ((int)1);

#line 142 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_charge_carrier = __pyx_k__4;
  double __pyx_v_neutral
#line 142 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_scale
#line 142 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_scaled = 0
#line 142 "ms_deisotope/_c/averagine.pyx"
;
  int __pyx_v_delta_hydrogen
#line 142 "ms_deisotope/_c/averagine.pyx"
;
  int __pyx_v_H
#line 142 "ms_deisotope/_c/averagine.pyx"
;

#line 142 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 142 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_5 = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_6 = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_7 = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_8;

#line 142 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_9 = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_10;

#line 142 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_neutral_mass __pyx_t_11;

#line 142 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_12;

#line 142 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_13;

#line 142 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("scale", 0);

#line 142 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_optional_args) {

#line 142 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_optional_args->__pyx_n > 0) {

#line 142 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = __pyx_optional_args->charge;

#line 142 "ms_deisotope/_c/averagine.pyx"
      if (__pyx_optional_args->__pyx_n > 1) {

#line 142 "ms_deisotope/_c/averagine.pyx"
        __pyx_v_charge_carrier = __pyx_optional_args->charge_carrier;

#line 142 "ms_deisotope/_c/averagine.pyx"
      }

#line 142 "ms_deisotope/_c/averagine.pyx"
    }

#line 142 "ms_deisotope/_c/averagine.pyx"
  }

#line 142 "ms_deisotope/_c/averagine.pyx"
  /* Check if called by wrapper */

#line 142 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_skip_dispatch)) ;

#line 142 "ms_deisotope/_c/averagine.pyx"
  /* Check if overridden in Python */

#line 142 "ms_deisotope/_c/averagine.pyx"
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {

#line 142 "ms_deisotope/_c/averagine.pyx"
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS

#line 142 "ms_deisotope/_c/averagine.pyx"
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;

#line 142 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {

#line 142 "ms_deisotope/_c/averagine.pyx"
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));

#line 142 "ms_deisotope/_c/averagine.pyx"
      #endif

#line 142 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_scale); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_1);

#line 142 "ms_deisotope/_c/averagine.pyx"
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_11scale)) {

#line 142 "ms_deisotope/_c/averagine.pyx"
        __Pyx_XDECREF(__pyx_r);

#line 142 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_3 = PyFloat_FromDouble(__pyx_v_mz); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_3);

#line 142 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_charge); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_4);

#line 142 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_5 = PyFloat_FromDouble(__pyx_v_charge_carrier); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 142, __pyx_L1_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_5);

#line 142 "ms_deisotope/_c/averagine.pyx"
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_6 = __pyx_t_1; 
#line 142 "ms_deisotope/_c/averagine.pyx"
__pyx_t_7 = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_8 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {

#line 142 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);

#line 142 "ms_deisotope/_c/averagine.pyx"
          if (likely(__pyx_t_7)) {

#line 142 "ms_deisotope/_c/averagine.pyx"
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);

#line 142 "ms_deisotope/_c/averagine.pyx"
            __Pyx_INCREF(__pyx_t_7);

#line 142 "ms_deisotope/_c/averagine.pyx"
            __Pyx_INCREF(function);

#line 142 "ms_deisotope/_c/averagine.pyx"
            __Pyx_DECREF_SET(__pyx_t_6, function);

#line 142 "ms_deisotope/_c/averagine.pyx"
            __pyx_t_8 = 1;

#line 142 "ms_deisotope/_c/averagine.pyx"
          }

#line 142 "ms_deisotope/_c/averagine.pyx"
        }

#line 142 "ms_deisotope/_c/averagine.pyx"
        #if CYTHON_FAST_PYCALL

#line 142 "ms_deisotope/_c/averagine.pyx"
        if (PyFunction_Check(__pyx_t_6)) {

#line 142 "ms_deisotope/_c/averagine.pyx"
          PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5};

#line 142 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GOTREF(__pyx_t_2);

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
        } else

#line 142 "ms_deisotope/_c/averagine.pyx"
        #endif

#line 142 "ms_deisotope/_c/averagine.pyx"
        #if CYTHON_FAST_PYCCALL

#line 142 "ms_deisotope/_c/averagine.pyx"
        if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {

#line 142 "ms_deisotope/_c/averagine.pyx"
          PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_3, __pyx_t_4, __pyx_t_5};

#line 142 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GOTREF(__pyx_t_2);

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
        } else

#line 142 "ms_deisotope/_c/averagine.pyx"
        #endif

#line 142 "ms_deisotope/_c/averagine.pyx"
        {

#line 142 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 142, __pyx_L1_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GOTREF(__pyx_t_9);

#line 142 "ms_deisotope/_c/averagine.pyx"
          if (__pyx_t_7) {

#line 142 "ms_deisotope/_c/averagine.pyx"
            __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
          }

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GIVEREF(__pyx_t_3);

#line 142 "ms_deisotope/_c/averagine.pyx"
          PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_3);

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GIVEREF(__pyx_t_4);

#line 142 "ms_deisotope/_c/averagine.pyx"
          PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_4);

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GIVEREF(__pyx_t_5);

#line 142 "ms_deisotope/_c/averagine.pyx"
          PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);

#line 142 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_3 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_4 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_5 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GOTREF(__pyx_t_2);

#line 142 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
        }

#line 142 "ms_deisotope/_c/averagine.pyx"
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
        if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 142, __pyx_L1_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
        __pyx_r = ((PyObject*)__pyx_t_2);

#line 142 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_2 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
        goto __pyx_L0;

#line 142 "ms_deisotope/_c/averagine.pyx"
      }

#line 142 "ms_deisotope/_c/averagine.pyx"
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS

#line 142 "ms_deisotope/_c/averagine.pyx"
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));

#line 142 "ms_deisotope/_c/averagine.pyx"
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));

#line 142 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {

#line 142 "ms_deisotope/_c/averagine.pyx"
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;

#line 142 "ms_deisotope/_c/averagine.pyx"
      }

#line 142 "ms_deisotope/_c/averagine.pyx"
      #endif

#line 142 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS

#line 142 "ms_deisotope/_c/averagine.pyx"
    }

#line 142 "ms_deisotope/_c/averagine.pyx"
    #endif

#line 142 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":177
 *             double count
 * 
 *         neutral = neutral_mass(mz, charge, charge_carrier)             # <<<<<<<<<<<<<<
 * 
 *         scale = neutral / self.base_mass
 */

#line 177 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_11.__pyx_n = 1;

#line 177 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_11.charge_carrier = __pyx_v_charge_carrier;

#line 177 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_10 = __pyx_f_12ms_deisotope_2_c_9averagine_neutral_mass(__pyx_v_mz, __pyx_v_charge, &__pyx_t_11); 

#line 177 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_neutral = __pyx_t_10;

  /* "ms_deisotope/_c/averagine.pyx":179
 *         neutral = neutral_mass(mz, charge, charge_carrier)
 * 
 *         scale = neutral / self.base_mass             # <<<<<<<<<<<<<<
 *         scaled = scale_dict(self.base_composition, scale)
 * 
 */

#line 179 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_scale = (__pyx_v_neutral / __pyx_v_self->base_mass);

  /* "ms_deisotope/_c/averagine.pyx":180
 * 
 *         scale = neutral / self.base_mass
 *         scaled = scale_dict(self.base_composition, scale)             # <<<<<<<<<<<<<<
 * 
 *         delta_hydrogen = <int>_round(calculate_mass(scaled) - neutral)
 */

#line 180 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_v_self->base_composition;

#line 180 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_t_1);

#line 180 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_f_12ms_deisotope_2_c_9averagine_scale_dict(((PyObject*)__pyx_t_1), __pyx_v_scale); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)

#line 180 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 180 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 180 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_scaled = ((PyObject*)__pyx_t_2);

#line 180 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":182
 *         scaled = scale_dict(self.base_composition, scale)
 * 
 *         delta_hydrogen = <int>_round(calculate_mass(scaled) - neutral)             # <<<<<<<<<<<<<<
 *         H = <int>PyFloat_AsDouble(<object>PyDict_GetItem(scaled, "H"))
 *         if H > delta_hydrogen:
 */

#line 182 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_delta_hydrogen = ((int)__pyx_f_12ms_deisotope_2_c_9averagine__round((__pyx_f_7brainpy_8_speedup_calculate_mass(__pyx_v_scaled, NULL) - __pyx_v_neutral)));

  /* "ms_deisotope/_c/averagine.pyx":183
 * 
 *         delta_hydrogen = <int>_round(calculate_mass(scaled) - neutral)
 *         H = <int>PyFloat_AsDouble(<object>PyDict_GetItem(scaled, "H"))             # <<<<<<<<<<<<<<
 *         if H > delta_hydrogen:
 *             PyDict_SetItem(scaled, "H", H - delta_hydrogen)
 */

#line 183 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_12 = PyDict_GetItem(__pyx_v_scaled, __pyx_n_s_H);

#line 183 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_10 = PyFloat_AsDouble(((PyObject *)__pyx_t_12)); if (unlikely(__pyx_t_10 == ((double)-1.0) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L1_error)

#line 183 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_H = ((int)__pyx_t_10);

  /* "ms_deisotope/_c/averagine.pyx":184
 *         delta_hydrogen = <int>_round(calculate_mass(scaled) - neutral)
 *         H = <int>PyFloat_AsDouble(<object>PyDict_GetItem(scaled, "H"))
 *         if H > delta_hydrogen:             # <<<<<<<<<<<<<<
 *             PyDict_SetItem(scaled, "H", H - delta_hydrogen)
 *         else:
 */

#line 184 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_13 = ((__pyx_v_H > __pyx_v_delta_hydrogen) != 0);

#line 184 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_13) {

    /* "ms_deisotope/_c/averagine.pyx":185
 *         H = <int>PyFloat_AsDouble(<object>PyDict_GetItem(scaled, "H"))
 *         if H > delta_hydrogen:
 *             PyDict_SetItem(scaled, "H", H - delta_hydrogen)             # <<<<<<<<<<<<<<
 *         else:
 *             PyDict_SetItem(scaled, "H", 0)
 */

#line 185 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_H - __pyx_v_delta_hydrogen)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error)

#line 185 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);

#line 185 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_8 = PyDict_SetItem(__pyx_v_scaled, __pyx_n_s_H, __pyx_t_2); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 185, __pyx_L1_error)

#line 185 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "ms_deisotope/_c/averagine.pyx":184
 *         delta_hydrogen = <int>_round(calculate_mass(scaled) - neutral)
 *         H = <int>PyFloat_AsDouble(<object>PyDict_GetItem(scaled, "H"))
 *         if H > delta_hydrogen:             # <<<<<<<<<<<<<<
 *             PyDict_SetItem(scaled, "H", H - delta_hydrogen)
 *         else:
 */

#line 184 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L3;

#line 184 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":187
 *             PyDict_SetItem(scaled, "H", H - delta_hydrogen)
 *         else:
 *             PyDict_SetItem(scaled, "H", 0)             # <<<<<<<<<<<<<<
 * 
 *         return scaled
 */

#line 187 "ms_deisotope/_c/averagine.pyx"
  /*else*/ {

#line 187 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_8 = PyDict_SetItem(__pyx_v_scaled, __pyx_n_s_H, __pyx_int_0); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 187, __pyx_L1_error)

#line 187 "ms_deisotope/_c/averagine.pyx"
  }

#line 187 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3:;

  /* "ms_deisotope/_c/averagine.pyx":189
 *             PyDict_SetItem(scaled, "H", 0)
 * 
 *         return scaled             # <<<<<<<<<<<<<<
 * 
 *     cdef TheoreticalIsotopicPattern _isotopic_cluster(self, double mz, int charge=1, double charge_carrier=PROTON,
 */

#line 189 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 189 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_scaled);

#line 189 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_scaled;

#line 189 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":142
 * 
 *     @cython.cdivision
 *     cpdef dict scale(self, double mz, int charge=1, double charge_carrier=PROTON):             # <<<<<<<<<<<<<<
 *         """Given an m/z and a charge state, interpolate the composition
 *         of the polymer with the matching neutral mass
 */

#line 142 "ms_deisotope/_c/averagine.pyx"


#line 142 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_5);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_6);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_7);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_9);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.scale", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_scaled);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 142 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 142 "ms_deisotope/_c/averagine.pyx"
}

#line 142 "ms_deisotope/_c/averagine.pyx"


#line 142 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 142 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_11scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 142 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_10scale[] = "Averagine.scale(self, double mz, int charge=1, double charge_carrier=PROTON) -> dict\nGiven an m/z and a charge state, interpolate the composition\n        of the polymer with the matching neutral mass\n\n        Parameters\n        ----------\n        mz : float\n            The reference m/z to calculate the neutral mass to interpolate from\n        charge : int, optional\n            The reference charge state to calculate the neutral mass. Defaults to 1\n        charge_carrier : float, optional\n            The mass of the charge carrier. Defaults to the mass of a proton.\n\n        Returns\n        -------\n        Mapping\n            The interpolated composition for the calculated neutral mass,\n            rounded to the nearest integer and hydrogen corrected.\n\n        References\n        ----------\n        Senko, M. W., Beu, S. C., & McLafferty, F. W. (1995). Determination of monoisotopic masses and ion populations\n        for large biomolecules from resolved isotopic distributions. Journal of the American Society for Mass\n        Spectrometry, 6(4), 229\342\200\223233. http://doi.org/10.1016/1044-0305(95)00017-8\n        ";

#line 142 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_11scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_mz
#line 142 "ms_deisotope/_c/averagine.pyx"
;
  int __pyx_v_charge
#line 142 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_charge_carrier
#line 142 "ms_deisotope/_c/averagine.pyx"
;

#line 142 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("scale (wrapper)", 0);

#line 142 "ms_deisotope/_c/averagine.pyx"
  {

#line 142 "ms_deisotope/_c/averagine.pyx"
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mz,&__pyx_n_s_charge,&__pyx_n_s_charge_carrier,0};

#line 142 "ms_deisotope/_c/averagine.pyx"
    PyObject* values[3] = {0,0,0};

#line 142 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_kwds)) {

#line 142 "ms_deisotope/_c/averagine.pyx"
      Py_ssize_t kw_args;

#line 142 "ms_deisotope/_c/averagine.pyx"
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);

#line 142 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {
        case  3: 
#line 142 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 142 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 142 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 142 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 142 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 142 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 142 "ms_deisotope/_c/averagine.pyx"
        case  0: break;
        default: 
#line 142 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 142 "ms_deisotope/_c/averagine.pyx"
      }

#line 142 "ms_deisotope/_c/averagine.pyx"
      kw_args = PyDict_Size(__pyx_kwds);

#line 142 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {

#line 142 "ms_deisotope/_c/averagine.pyx"
        case  0:

#line 142 "ms_deisotope/_c/averagine.pyx"
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mz)) != 0)) kw_args--;
        else 
#line 142 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 142 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 142 "ms_deisotope/_c/averagine.pyx"
        case  1:

#line 142 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 142 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge);

#line 142 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[1] = value; kw_args--; }

#line 142 "ms_deisotope/_c/averagine.pyx"
        }

#line 142 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 142 "ms_deisotope/_c/averagine.pyx"
        case  2:

#line 142 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 142 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge_carrier);

#line 142 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[2] = value; kw_args--; }

#line 142 "ms_deisotope/_c/averagine.pyx"
        }

#line 142 "ms_deisotope/_c/averagine.pyx"
      }

#line 142 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(kw_args > 0)) {

#line 142 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) __PYX_ERR(0, 142, __pyx_L3_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
      }

#line 142 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 142 "ms_deisotope/_c/averagine.pyx"
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: 
#line 142 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 142 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 142 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 142 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 142 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 142 "ms_deisotope/_c/averagine.pyx"
        break;
        default: 
#line 142 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 142 "ms_deisotope/_c/averagine.pyx"
      }

#line 142 "ms_deisotope/_c/averagine.pyx"
    }

#line 142 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_mz = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mz == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L3_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
    if (values[1]) {

#line 142 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_charge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L3_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 142 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = ((int)1);

#line 142 "ms_deisotope/_c/averagine.pyx"
    }

#line 142 "ms_deisotope/_c/averagine.pyx"
    if (values[2]) {

#line 142 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge_carrier = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_charge_carrier == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L3_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 142 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge_carrier = __pyx_k__4;

#line 142 "ms_deisotope/_c/averagine.pyx"
    }

#line 142 "ms_deisotope/_c/averagine.pyx"
  }

#line 142 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scale", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); 
#line 142 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 142, __pyx_L3_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.scale", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 142 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 142 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_10scale(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self), __pyx_v_mz, __pyx_v_charge, __pyx_v_charge_carrier);

#line 142 "ms_deisotope/_c/averagine.pyx"


#line 142 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 142 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 142 "ms_deisotope/_c/averagine.pyx"
}

#line 142 "ms_deisotope/_c/averagine.pyx"


#line 142 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_10scale(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, double __pyx_v_mz, int __pyx_v_charge, double __pyx_v_charge_carrier) {

#line 142 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 142 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_scale __pyx_t_2;

#line 142 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("scale", 0);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.__pyx_n = 2;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge = __pyx_v_charge;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge_carrier = __pyx_v_charge_carrier;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_vtabptr_12ms_deisotope_2_c_9averagine_Averagine->scale(__pyx_v_self, __pyx_v_mz, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 142 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 142 "ms_deisotope/_c/averagine.pyx"


#line 142 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.scale", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 142 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 142 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 142 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":191
 *         return scaled
 * 
 *     cdef TheoreticalIsotopicPattern _isotopic_cluster(self, double mz, int charge=1, double charge_carrier=PROTON,             # <<<<<<<<<<<<<<
 *                                                       double truncate_after=0.95, double ignore_below=0.0):
 *         cdef:
 */

#line 191 "ms_deisotope/_c/averagine.pyx"


#line 191 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_9Averagine__isotopic_cluster(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, double __pyx_v_mz, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine__isotopic_cluster *__pyx_optional_args) {

#line 191 "ms_deisotope/_c/averagine.pyx"
  int __pyx_v_charge = ((int)1);

#line 191 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_charge_carrier = __pyx_k__5;

#line 191 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_truncate_after = ((double)0.95);

#line 191 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_ignore_below = ((double)0.0);
  PyObject *__pyx_v_composition = 0
#line 191 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_tid = 0
#line 191 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_isotopic_pattern = 0
#line 191 "ms_deisotope/_c/averagine.pyx"
;

#line 191 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 191 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 191 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 191 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_scale __pyx_t_2;

#line 191 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_7brainpy_2_c_21isotopic_distribution__isotopic_variants __pyx_t_3;

#line 191 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4;

#line 191 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_5;

#line 191 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_truncate_after __pyx_t_6;

#line 191 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_ignore_below __pyx_t_7;

#line 191 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 191 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 191 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 191 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("_isotopic_cluster", 0);

#line 191 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_optional_args) {

#line 191 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_optional_args->__pyx_n > 0) {

#line 191 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = __pyx_optional_args->charge;

#line 191 "ms_deisotope/_c/averagine.pyx"
      if (__pyx_optional_args->__pyx_n > 1) {

#line 191 "ms_deisotope/_c/averagine.pyx"
        __pyx_v_charge_carrier = __pyx_optional_args->charge_carrier;

#line 191 "ms_deisotope/_c/averagine.pyx"
        if (__pyx_optional_args->__pyx_n > 2) {

#line 191 "ms_deisotope/_c/averagine.pyx"
          __pyx_v_truncate_after = __pyx_optional_args->truncate_after;

#line 191 "ms_deisotope/_c/averagine.pyx"
          if (__pyx_optional_args->__pyx_n > 3) {

#line 191 "ms_deisotope/_c/averagine.pyx"
            __pyx_v_ignore_below = __pyx_optional_args->ignore_below;

#line 191 "ms_deisotope/_c/averagine.pyx"
          }

#line 191 "ms_deisotope/_c/averagine.pyx"
        }

#line 191 "ms_deisotope/_c/averagine.pyx"
      }

#line 191 "ms_deisotope/_c/averagine.pyx"
    }

#line 191 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":198
 *             TheoreticalIsotopicPattern isotopic_pattern
 * 
 *         composition = self.scale(mz, charge, charge_carrier)             # <<<<<<<<<<<<<<
 *         tid = _isotopic_variants(composition, npeaks=None, charge=charge, charge_carrier=PROTON)
 * 
 */

#line 198 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.__pyx_n = 2;

#line 198 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge = __pyx_v_charge;

#line 198 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge_carrier = __pyx_v_charge_carrier;

#line 198 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self->__pyx_vtab)->scale(__pyx_v_self, __pyx_v_mz, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error)

#line 198 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 198 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_composition = ((PyObject*)__pyx_t_1);

#line 198 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":199
 * 
 *         composition = self.scale(mz, charge, charge_carrier)
 *         tid = _isotopic_variants(composition, npeaks=None, charge=charge, charge_carrier=PROTON)             # <<<<<<<<<<<<<<
 * 
 *         isotopic_pattern = TheoreticalIsotopicPattern._create(
 */

#line 199 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3.__pyx_n = 3;

#line 199 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3.npeaks = Py_None;

#line 199 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3.charge = __pyx_v_charge;

#line 199 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3.charge_carrier = __pyx_v_12ms_deisotope_2_c_9averagine_PROTON;

#line 199 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_f_7brainpy_2_c_21isotopic_distribution__isotopic_variants(__pyx_v_composition, 0, &__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)

#line 199 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 199 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_tid = ((PyObject*)__pyx_t_1);

#line 199 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":202
 * 
 *         isotopic_pattern = TheoreticalIsotopicPattern._create(
 *             tid, (<TheoreticalPeak>PyList_GET_ITEM(tid, 0)).mz, 0)             # <<<<<<<<<<<<<<
 *         isotopic_pattern.shift(mz)
 * 
 */

#line 202 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = PyList_GET_ITEM(__pyx_v_tid, 0);

  /* "ms_deisotope/_c/averagine.pyx":201
 *         tid = _isotopic_variants(composition, npeaks=None, charge=charge, charge_carrier=PROTON)
 * 
 *         isotopic_pattern = TheoreticalIsotopicPattern._create(             # <<<<<<<<<<<<<<
 *             tid, (<TheoreticalPeak>PyList_GET_ITEM(tid, 0)).mz, 0)
 *         isotopic_pattern.shift(mz)
 */

#line 201 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__create(__pyx_v_tid, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_4)->mz, 0.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)

#line 201 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 201 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_isotopic_pattern = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_1);

#line 201 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":203
 *         isotopic_pattern = TheoreticalIsotopicPattern._create(
 *             tid, (<TheoreticalPeak>PyList_GET_ITEM(tid, 0)).mz, 0)
 *         isotopic_pattern.shift(mz)             # <<<<<<<<<<<<<<
 * 
 *         if truncate_after < 1.0:
 */

#line 203 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_shift(__pyx_v_isotopic_pattern, __pyx_v_mz, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error)

#line 203 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 203 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":205
 *         isotopic_pattern.shift(mz)
 * 
 *         if truncate_after < 1.0:             # <<<<<<<<<<<<<<
 *             isotopic_pattern.truncate_after(truncate_after)
 * 
 */

#line 205 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_5 = ((__pyx_v_truncate_after < 1.0) != 0);

#line 205 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_5) {

    /* "ms_deisotope/_c/averagine.pyx":206
 * 
 *         if truncate_after < 1.0:
 *             isotopic_pattern.truncate_after(truncate_after)             # <<<<<<<<<<<<<<
 * 
 *         if ignore_below > 0:
 */

#line 206 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6.__pyx_n = 1;

#line 206 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6.truncate_after = __pyx_v_truncate_after;

#line 206 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_truncate_after(__pyx_v_isotopic_pattern, 0, &__pyx_t_6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error)

#line 206 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 206 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":205
 *         isotopic_pattern.shift(mz)
 * 
 *         if truncate_after < 1.0:             # <<<<<<<<<<<<<<
 *             isotopic_pattern.truncate_after(truncate_after)
 * 
 */

#line 205 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":208
 *             isotopic_pattern.truncate_after(truncate_after)
 * 
 *         if ignore_below > 0:             # <<<<<<<<<<<<<<
 *             isotopic_pattern.ignore_below(ignore_below)
 * 
 */

#line 208 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_5 = ((__pyx_v_ignore_below > 0.0) != 0);

#line 208 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_5) {

    /* "ms_deisotope/_c/averagine.pyx":209
 * 
 *         if ignore_below > 0:
 *             isotopic_pattern.ignore_below(ignore_below)             # <<<<<<<<<<<<<<
 * 
 *         return isotopic_pattern
 */

#line 209 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_7.__pyx_n = 1;

#line 209 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_7.ignore_below = __pyx_v_ignore_below;

#line 209 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_ignore_below(__pyx_v_isotopic_pattern, 0, &__pyx_t_7)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)

#line 209 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 209 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":208
 *             isotopic_pattern.truncate_after(truncate_after)
 * 
 *         if ignore_below > 0:             # <<<<<<<<<<<<<<
 *             isotopic_pattern.ignore_below(ignore_below)
 * 
 */

#line 208 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":211
 *             isotopic_pattern.ignore_below(ignore_below)
 * 
 *         return isotopic_pattern             # <<<<<<<<<<<<<<
 * 
 *     cpdef TheoreticalIsotopicPattern isotopic_cluster(self, double mz, int charge=1, double charge_carrier=PROTON,
 */

#line 211 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 211 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_v_isotopic_pattern));

#line 211 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_isotopic_pattern;

#line 211 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":191
 *         return scaled
 * 
 *     cdef TheoreticalIsotopicPattern _isotopic_cluster(self, double mz, int charge=1, double charge_carrier=PROTON,             # <<<<<<<<<<<<<<
 *                                                       double truncate_after=0.95, double ignore_below=0.0):
 *         cdef:
 */

#line 191 "ms_deisotope/_c/averagine.pyx"


#line 191 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 191 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 191 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 191 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine._isotopic_cluster", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 191 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 191 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 191 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_composition);

#line 191 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_tid);

#line 191 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_isotopic_pattern);

#line 191 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 191 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 191 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 191 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":213
 *         return isotopic_pattern
 * 
 *     cpdef TheoreticalIsotopicPattern isotopic_cluster(self, double mz, int charge=1, double charge_carrier=PROTON,             # <<<<<<<<<<<<<<
 *                                                       double truncate_after=0.95, double ignore_below=0.0):
 *         """Generate a theoretical isotopic pattern for the given m/z and charge state, thresholded
 */

#line 213 "ms_deisotope/_c/averagine.pyx"


#line 213 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_13isotopic_cluster(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 213 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_9Averagine_isotopic_cluster(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, double __pyx_v_mz, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_isotopic_cluster *__pyx_optional_args) {

#line 213 "ms_deisotope/_c/averagine.pyx"
  int __pyx_v_charge = ((int)1);

#line 213 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_charge_carrier = __pyx_k__6;

#line 213 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_truncate_after = ((double)0.95);

#line 213 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_ignore_below = ((double)0.0);
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_out = 0
#line 213 "ms_deisotope/_c/averagine.pyx"
;

#line 213 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 213 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_5 = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_6 = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_7 = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_8 = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_9 = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_10;

#line 213 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_11 = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine__isotopic_cluster __pyx_t_12;

#line 213 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("isotopic_cluster", 0);

#line 213 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_optional_args) {

#line 213 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_optional_args->__pyx_n > 0) {

#line 213 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = __pyx_optional_args->charge;

#line 213 "ms_deisotope/_c/averagine.pyx"
      if (__pyx_optional_args->__pyx_n > 1) {

#line 213 "ms_deisotope/_c/averagine.pyx"
        __pyx_v_charge_carrier = __pyx_optional_args->charge_carrier;

#line 213 "ms_deisotope/_c/averagine.pyx"
        if (__pyx_optional_args->__pyx_n > 2) {

#line 213 "ms_deisotope/_c/averagine.pyx"
          __pyx_v_truncate_after = __pyx_optional_args->truncate_after;

#line 213 "ms_deisotope/_c/averagine.pyx"
          if (__pyx_optional_args->__pyx_n > 3) {

#line 213 "ms_deisotope/_c/averagine.pyx"
            __pyx_v_ignore_below = __pyx_optional_args->ignore_below;

#line 213 "ms_deisotope/_c/averagine.pyx"
          }

#line 213 "ms_deisotope/_c/averagine.pyx"
        }

#line 213 "ms_deisotope/_c/averagine.pyx"
      }

#line 213 "ms_deisotope/_c/averagine.pyx"
    }

#line 213 "ms_deisotope/_c/averagine.pyx"
  }

#line 213 "ms_deisotope/_c/averagine.pyx"
  /* Check if called by wrapper */

#line 213 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_skip_dispatch)) ;

#line 213 "ms_deisotope/_c/averagine.pyx"
  /* Check if overridden in Python */

#line 213 "ms_deisotope/_c/averagine.pyx"
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {

#line 213 "ms_deisotope/_c/averagine.pyx"
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS

#line 213 "ms_deisotope/_c/averagine.pyx"
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;

#line 213 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {

#line 213 "ms_deisotope/_c/averagine.pyx"
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));

#line 213 "ms_deisotope/_c/averagine.pyx"
      #endif

#line 213 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_isotopic_cluster); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_1);

#line 213 "ms_deisotope/_c/averagine.pyx"
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_13isotopic_cluster)) {

#line 213 "ms_deisotope/_c/averagine.pyx"
        __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 213 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_3 = PyFloat_FromDouble(__pyx_v_mz); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_3);

#line 213 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_charge); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 213, __pyx_L1_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_4);

#line 213 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_5 = PyFloat_FromDouble(__pyx_v_charge_carrier); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 213, __pyx_L1_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_5);

#line 213 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_6 = PyFloat_FromDouble(__pyx_v_truncate_after); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 213, __pyx_L1_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_6);

#line 213 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_7 = PyFloat_FromDouble(__pyx_v_ignore_below); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 213, __pyx_L1_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_7);

#line 213 "ms_deisotope/_c/averagine.pyx"
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_8 = __pyx_t_1; 
#line 213 "ms_deisotope/_c/averagine.pyx"
__pyx_t_9 = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_10 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {

#line 213 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);

#line 213 "ms_deisotope/_c/averagine.pyx"
          if (likely(__pyx_t_9)) {

#line 213 "ms_deisotope/_c/averagine.pyx"
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);

#line 213 "ms_deisotope/_c/averagine.pyx"
            __Pyx_INCREF(__pyx_t_9);

#line 213 "ms_deisotope/_c/averagine.pyx"
            __Pyx_INCREF(function);

#line 213 "ms_deisotope/_c/averagine.pyx"
            __Pyx_DECREF_SET(__pyx_t_8, function);

#line 213 "ms_deisotope/_c/averagine.pyx"
            __pyx_t_10 = 1;

#line 213 "ms_deisotope/_c/averagine.pyx"
          }

#line 213 "ms_deisotope/_c/averagine.pyx"
        }

#line 213 "ms_deisotope/_c/averagine.pyx"
        #if CYTHON_FAST_PYCALL

#line 213 "ms_deisotope/_c/averagine.pyx"
        if (PyFunction_Check(__pyx_t_8)) {

#line 213 "ms_deisotope/_c/averagine.pyx"
          PyObject *__pyx_temp[6] = {__pyx_t_9, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7};

#line 213 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_10, 5+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GOTREF(__pyx_t_2);

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
        } else

#line 213 "ms_deisotope/_c/averagine.pyx"
        #endif

#line 213 "ms_deisotope/_c/averagine.pyx"
        #if CYTHON_FAST_PYCCALL

#line 213 "ms_deisotope/_c/averagine.pyx"
        if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {

#line 213 "ms_deisotope/_c/averagine.pyx"
          PyObject *__pyx_temp[6] = {__pyx_t_9, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7};

#line 213 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_10, 5+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GOTREF(__pyx_t_2);

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
        } else

#line 213 "ms_deisotope/_c/averagine.pyx"
        #endif

#line 213 "ms_deisotope/_c/averagine.pyx"
        {

#line 213 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_11 = PyTuple_New(5+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 213, __pyx_L1_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GOTREF(__pyx_t_11);

#line 213 "ms_deisotope/_c/averagine.pyx"
          if (__pyx_t_9) {

#line 213 "ms_deisotope/_c/averagine.pyx"
            __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
          }

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GIVEREF(__pyx_t_3);

#line 213 "ms_deisotope/_c/averagine.pyx"
          PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_3);

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GIVEREF(__pyx_t_4);

#line 213 "ms_deisotope/_c/averagine.pyx"
          PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_4);

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GIVEREF(__pyx_t_5);

#line 213 "ms_deisotope/_c/averagine.pyx"
          PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_5);

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GIVEREF(__pyx_t_6);

#line 213 "ms_deisotope/_c/averagine.pyx"
          PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_10, __pyx_t_6);

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GIVEREF(__pyx_t_7);

#line 213 "ms_deisotope/_c/averagine.pyx"
          PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_10, __pyx_t_7);

#line 213 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_3 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_4 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_5 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_6 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_7 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GOTREF(__pyx_t_2);

#line 213 "ms_deisotope/_c/averagine.pyx"
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
        }

#line 213 "ms_deisotope/_c/averagine.pyx"
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern))))) __PYX_ERR(0, 213, __pyx_L1_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
        __pyx_r = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_2);

#line 213 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_2 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
        goto __pyx_L0;

#line 213 "ms_deisotope/_c/averagine.pyx"
      }

#line 213 "ms_deisotope/_c/averagine.pyx"
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS

#line 213 "ms_deisotope/_c/averagine.pyx"
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));

#line 213 "ms_deisotope/_c/averagine.pyx"
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));

#line 213 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {

#line 213 "ms_deisotope/_c/averagine.pyx"
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;

#line 213 "ms_deisotope/_c/averagine.pyx"
      }

#line 213 "ms_deisotope/_c/averagine.pyx"
      #endif

#line 213 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS

#line 213 "ms_deisotope/_c/averagine.pyx"
    }

#line 213 "ms_deisotope/_c/averagine.pyx"
    #endif

#line 213 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":240
 *         cdef:
 *             TheoreticalIsotopicPattern out
 *         out = self._isotopic_cluster(mz, charge, charge_carrier, truncate_after, ignore_below)             # <<<<<<<<<<<<<<
 *         return out
 * 
 */

#line 240 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_12.__pyx_n = 4;

#line 240 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_12.charge = __pyx_v_charge;

#line 240 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_12.charge_carrier = __pyx_v_charge_carrier;

#line 240 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_12.truncate_after = __pyx_v_truncate_after;

#line 240 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_12.ignore_below = __pyx_v_ignore_below;

#line 240 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self->__pyx_vtab)->_isotopic_cluster(__pyx_v_self, __pyx_v_mz, &__pyx_t_12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error)

#line 240 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 240 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_out = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_1);

#line 240 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":241
 *             TheoreticalIsotopicPattern out
 *         out = self._isotopic_cluster(mz, charge, charge_carrier, truncate_after, ignore_below)
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */

#line 241 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 241 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_v_out));

#line 241 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_out;

#line 241 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":213
 *         return isotopic_pattern
 * 
 *     cpdef TheoreticalIsotopicPattern isotopic_cluster(self, double mz, int charge=1, double charge_carrier=PROTON,             # <<<<<<<<<<<<<<
 *                                                       double truncate_after=0.95, double ignore_below=0.0):
 *         """Generate a theoretical isotopic pattern for the given m/z and charge state, thresholded
 */

#line 213 "ms_deisotope/_c/averagine.pyx"


#line 213 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_5);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_6);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_7);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_8);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_9);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_11);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.isotopic_cluster", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_out);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 213 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 213 "ms_deisotope/_c/averagine.pyx"
}

#line 213 "ms_deisotope/_c/averagine.pyx"


#line 213 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 213 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_13isotopic_cluster(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 213 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_12isotopic_cluster[] = "Averagine.isotopic_cluster(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95, double ignore_below=0.0) -> TheoreticalIsotopicPattern\nGenerate a theoretical isotopic pattern for the given m/z and charge state, thresholded\n        by theoretical peak height and density.\n\n        Parameters\n        ----------\n        mz : float\n            The reference m/z to calculate the neutral mass to interpolate from\n        charge : int, optional\n            The reference charge state to calculate the neutral mass. Defaults to 1\n        charge_carrier : float, optional\n            The mass of the charge carrier. Defaults to the mass of a proton.\n        truncate_after : float, optional\n            The percentage of the signal in the theoretical isotopic pattern to include.\n            Defaults to 0.95, including the first 95% of the signal in the generated pattern\n        ignore_below : float, optional\n            Omit theoretical peaks whose intensity is below this number.\n            Defaults to 0.0\n\n        Returns\n        -------\n        :class:`.TheoreticalIsotopicPattern`\n            The generated and thresholded pattern\n        ";

#line 213 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_13isotopic_cluster(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_mz
#line 213 "ms_deisotope/_c/averagine.pyx"
;
  int __pyx_v_charge
#line 213 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_charge_carrier
#line 213 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_truncate_after
#line 213 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_ignore_below
#line 213 "ms_deisotope/_c/averagine.pyx"
;

#line 213 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("isotopic_cluster (wrapper)", 0);

#line 213 "ms_deisotope/_c/averagine.pyx"
  {

#line 213 "ms_deisotope/_c/averagine.pyx"
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mz,&__pyx_n_s_charge,&__pyx_n_s_charge_carrier,&__pyx_n_s_truncate_after,&__pyx_n_s_ignore_below,0};

#line 213 "ms_deisotope/_c/averagine.pyx"
    PyObject* values[5] = {0,0,0,0,0};

#line 213 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_kwds)) {

#line 213 "ms_deisotope/_c/averagine.pyx"
      Py_ssize_t kw_args;

#line 213 "ms_deisotope/_c/averagine.pyx"
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);

#line 213 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {
        case  5: 
#line 213 "ms_deisotope/_c/averagine.pyx"
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);

#line 213 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  4: 
#line 213 "ms_deisotope/_c/averagine.pyx"
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);

#line 213 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  3: 
#line 213 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 213 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 213 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 213 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 213 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 213 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 213 "ms_deisotope/_c/averagine.pyx"
        case  0: break;
        default: 
#line 213 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 213 "ms_deisotope/_c/averagine.pyx"
      }

#line 213 "ms_deisotope/_c/averagine.pyx"
      kw_args = PyDict_Size(__pyx_kwds);

#line 213 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {

#line 213 "ms_deisotope/_c/averagine.pyx"
        case  0:

#line 213 "ms_deisotope/_c/averagine.pyx"
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mz)) != 0)) kw_args--;
        else 
#line 213 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 213 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 213 "ms_deisotope/_c/averagine.pyx"
        case  1:

#line 213 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 213 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge);

#line 213 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[1] = value; kw_args--; }

#line 213 "ms_deisotope/_c/averagine.pyx"
        }

#line 213 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 213 "ms_deisotope/_c/averagine.pyx"
        case  2:

#line 213 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 213 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge_carrier);

#line 213 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[2] = value; kw_args--; }

#line 213 "ms_deisotope/_c/averagine.pyx"
        }

#line 213 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 213 "ms_deisotope/_c/averagine.pyx"
        case  3:

#line 213 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 213 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncate_after);

#line 213 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[3] = value; kw_args--; }

#line 213 "ms_deisotope/_c/averagine.pyx"
        }

#line 213 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 213 "ms_deisotope/_c/averagine.pyx"
        case  4:

#line 213 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 213 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ignore_below);

#line 213 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[4] = value; kw_args--; }

#line 213 "ms_deisotope/_c/averagine.pyx"
        }

#line 213 "ms_deisotope/_c/averagine.pyx"
      }

#line 213 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(kw_args > 0)) {

#line 213 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "isotopic_cluster") < 0)) __PYX_ERR(0, 213, __pyx_L3_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
      }

#line 213 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 213 "ms_deisotope/_c/averagine.pyx"
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: 
#line 213 "ms_deisotope/_c/averagine.pyx"
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);

#line 213 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  4: 
#line 213 "ms_deisotope/_c/averagine.pyx"
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);

#line 213 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  3: 
#line 213 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 213 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 213 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 213 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 213 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 213 "ms_deisotope/_c/averagine.pyx"
        break;
        default: 
#line 213 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 213 "ms_deisotope/_c/averagine.pyx"
      }

#line 213 "ms_deisotope/_c/averagine.pyx"
    }

#line 213 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_mz = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mz == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L3_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
    if (values[1]) {

#line 213 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_charge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L3_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 213 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = ((int)1);

#line 213 "ms_deisotope/_c/averagine.pyx"
    }

#line 213 "ms_deisotope/_c/averagine.pyx"
    if (values[2]) {

#line 213 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge_carrier = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_charge_carrier == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L3_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 213 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge_carrier = __pyx_k__6;

#line 213 "ms_deisotope/_c/averagine.pyx"
    }

#line 213 "ms_deisotope/_c/averagine.pyx"
    if (values[3]) {

#line 213 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_truncate_after = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_truncate_after == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 213 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_truncate_after = ((double)0.95);

#line 213 "ms_deisotope/_c/averagine.pyx"
    }

#line 213 "ms_deisotope/_c/averagine.pyx"
    if (values[4]) {

#line 213 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_ignore_below = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_ignore_below == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 213 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_ignore_below = ((double)0.0);

#line 213 "ms_deisotope/_c/averagine.pyx"
    }

#line 213 "ms_deisotope/_c/averagine.pyx"
  }

#line 213 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("isotopic_cluster", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); 
#line 213 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 213, __pyx_L3_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.isotopic_cluster", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 213 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 213 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_12isotopic_cluster(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self), __pyx_v_mz, __pyx_v_charge, __pyx_v_charge_carrier, __pyx_v_truncate_after, __pyx_v_ignore_below);

#line 213 "ms_deisotope/_c/averagine.pyx"


#line 213 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 213 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 213 "ms_deisotope/_c/averagine.pyx"
}

#line 213 "ms_deisotope/_c/averagine.pyx"


#line 213 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_12isotopic_cluster(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, double __pyx_v_mz, int __pyx_v_charge, double __pyx_v_charge_carrier, double __pyx_v_truncate_after, double __pyx_v_ignore_below) {

#line 213 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 213 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_isotopic_cluster __pyx_t_2;

#line 213 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("isotopic_cluster", 0);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.__pyx_n = 4;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge = __pyx_v_charge;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge_carrier = __pyx_v_charge_carrier;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.truncate_after = __pyx_v_truncate_after;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.ignore_below = __pyx_v_ignore_below;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_12ms_deisotope_2_c_9averagine_Averagine->isotopic_cluster(__pyx_v_self, __pyx_v_mz, 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 213 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 213 "ms_deisotope/_c/averagine.pyx"


#line 213 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.isotopic_cluster", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 213 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 213 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 213 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":243
 *         return out
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         return self.base_composition[key]
 * 
 */

#line 243 "ms_deisotope/_c/averagine.pyx"


#line 243 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 243 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_15__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/

#line 243 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_15__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {

#line 243 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 243 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 243 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = 
#line 243 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_14__getitem__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self), ((PyObject *)__pyx_v_key));

#line 243 "ms_deisotope/_c/averagine.pyx"


#line 243 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 243 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 243 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 243 "ms_deisotope/_c/averagine.pyx"
}

#line 243 "ms_deisotope/_c/averagine.pyx"


#line 243 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_14__getitem__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, PyObject *__pyx_v_key) {

#line 243 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 243 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 243 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 243 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 243 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 243 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 243 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "ms_deisotope/_c/averagine.pyx":244
 * 
 *     def __getitem__(self, key):
 *         return self.base_composition[key]             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */

#line 244 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 244 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_v_self->base_composition == Py_None)) {

#line 244 "ms_deisotope/_c/averagine.pyx"
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");

#line 244 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 244, __pyx_L1_error)

#line 244 "ms_deisotope/_c/averagine.pyx"
  }

#line 244 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_self->base_composition, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)

#line 244 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 244 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 244 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 244 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":243
 *         return out
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         return self.base_composition[key]
 * 
 */

#line 243 "ms_deisotope/_c/averagine.pyx"


#line 243 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 243 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 243 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 243 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 243 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 243 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 243 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 243 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 243 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 243 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":246
 *         return self.base_composition[key]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.base_composition)
 * 
 */

#line 246 "ms_deisotope/_c/averagine.pyx"


#line 246 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 246 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_17__iter__(PyObject *__pyx_v_self); /*proto*/

#line 246 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_17__iter__(PyObject *__pyx_v_self) {

#line 246 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 246 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 246 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = 
#line 246 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_16__iter__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self));

#line 246 "ms_deisotope/_c/averagine.pyx"


#line 246 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 246 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 246 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 246 "ms_deisotope/_c/averagine.pyx"
}

#line 246 "ms_deisotope/_c/averagine.pyx"


#line 246 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_16__iter__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self) {

#line 246 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 246 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 246 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 246 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 246 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 246 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 246 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 246 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "ms_deisotope/_c/averagine.pyx":247
 * 
 *     def __iter__(self):
 *         return iter(self.base_composition)             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */

#line 247 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 247 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_v_self->base_composition;

#line 247 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_t_1);

#line 247 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error)

#line 247 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 247 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 247 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_2;

#line 247 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

#line 247 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":246
 *         return self.base_composition[key]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.base_composition)
 * 
 */

#line 246 "ms_deisotope/_c/averagine.pyx"


#line 246 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 246 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 246 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 246 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 246 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 246 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 246 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 246 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 246 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 246 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 246 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":249
 *         return iter(self.base_composition)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         return self.base_composition.keys()
 * 
 */

#line 249 "ms_deisotope/_c/averagine.pyx"


#line 249 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 249 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_19keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 249 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_18keys[] = "Averagine.keys(self)";

#line 249 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_19keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 249 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 249 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 249 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = 
#line 249 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_18keys(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self));

#line 249 "ms_deisotope/_c/averagine.pyx"


#line 249 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 249 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 249 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 249 "ms_deisotope/_c/averagine.pyx"
}

#line 249 "ms_deisotope/_c/averagine.pyx"


#line 249 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_18keys(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self) {

#line 249 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 249 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 249 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 249 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 249 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 249 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 249 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("keys", 0);

  /* "ms_deisotope/_c/averagine.pyx":250
 * 
 *     def keys(self):
 *         return self.base_composition.keys()             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */

#line 250 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 250 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_v_self->base_composition == Py_None)) {

#line 250 "ms_deisotope/_c/averagine.pyx"
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");

#line 250 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 250, __pyx_L1_error)

#line 250 "ms_deisotope/_c/averagine.pyx"
  }

#line 250 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_self->base_composition); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error)

#line 250 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 250 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 250 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 250 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":249
 *         return iter(self.base_composition)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         return self.base_composition.keys()
 * 
 */

#line 249 "ms_deisotope/_c/averagine.pyx"


#line 249 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 249 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 249 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 249 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 249 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 249 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 249 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 249 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 249 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 249 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":252
 *         return self.base_composition.keys()
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         return self.base_composition.values()
 * 
 */

#line 252 "ms_deisotope/_c/averagine.pyx"


#line 252 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 252 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_21values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 252 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_20values[] = "Averagine.values(self)";

#line 252 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_21values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 252 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 252 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 252 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = 
#line 252 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_20values(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self));

#line 252 "ms_deisotope/_c/averagine.pyx"


#line 252 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 252 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 252 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 252 "ms_deisotope/_c/averagine.pyx"
}

#line 252 "ms_deisotope/_c/averagine.pyx"


#line 252 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_20values(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self) {

#line 252 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 252 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 252 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 252 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 252 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 252 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 252 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("values", 0);

  /* "ms_deisotope/_c/averagine.pyx":253
 * 
 *     def values(self):
 *         return self.base_composition.values()             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */

#line 253 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 253 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_v_self->base_composition == Py_None)) {

#line 253 "ms_deisotope/_c/averagine.pyx"
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values");

#line 253 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 253, __pyx_L1_error)

#line 253 "ms_deisotope/_c/averagine.pyx"
  }

#line 253 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyDict_Values(__pyx_v_self->base_composition); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)

#line 253 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 253 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 253 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 253 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":252
 *         return self.base_composition.keys()
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         return self.base_composition.values()
 * 
 */

#line 252 "ms_deisotope/_c/averagine.pyx"


#line 252 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 252 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 252 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 252 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.values", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 252 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 252 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 252 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 252 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 252 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 252 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":255
 *         return self.base_composition.values()
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         return self.base_composition.items()
 * 
 */

#line 255 "ms_deisotope/_c/averagine.pyx"


#line 255 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 255 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_23items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 255 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_22items[] = "Averagine.items(self)";

#line 255 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_23items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 255 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 255 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 255 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = 
#line 255 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_22items(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self));

#line 255 "ms_deisotope/_c/averagine.pyx"


#line 255 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 255 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 255 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 255 "ms_deisotope/_c/averagine.pyx"
}

#line 255 "ms_deisotope/_c/averagine.pyx"


#line 255 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_22items(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self) {

#line 255 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 255 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 255 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 255 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 255 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 255 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 255 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("items", 0);

  /* "ms_deisotope/_c/averagine.pyx":256
 * 
 *     def items(self):
 *         return self.base_composition.items()             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */

#line 256 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 256 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_v_self->base_composition == Py_None)) {

#line 256 "ms_deisotope/_c/averagine.pyx"
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");

#line 256 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 256, __pyx_L1_error)

#line 256 "ms_deisotope/_c/averagine.pyx"
  }

#line 256 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_self->base_composition); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error)

#line 256 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 256 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 256 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 256 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":255
 *         return self.base_composition.values()
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         return self.base_composition.items()
 * 
 */

#line 255 "ms_deisotope/_c/averagine.pyx"


#line 255 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 255 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 255 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 255 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.items", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 255 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 255 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 255 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 255 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 255 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 255 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":258
 *         return self.base_composition.items()
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "Averagine(%r)" % self.base_composition
 * 
 */

#line 258 "ms_deisotope/_c/averagine.pyx"


#line 258 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 258 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_25__repr__(PyObject *__pyx_v_self); /*proto*/

#line 258 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_25__repr__(PyObject *__pyx_v_self) {

#line 258 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 258 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 258 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = 
#line 258 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_24__repr__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self));

#line 258 "ms_deisotope/_c/averagine.pyx"


#line 258 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 258 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 258 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 258 "ms_deisotope/_c/averagine.pyx"
}

#line 258 "ms_deisotope/_c/averagine.pyx"


#line 258 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_24__repr__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self) {

#line 258 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 258 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 258 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 258 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 258 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 258 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 258 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "ms_deisotope/_c/averagine.pyx":259
 * 
 *     def __repr__(self):
 *         return "Averagine(%r)" % self.base_composition             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, other, int code):
 */

#line 259 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 259 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Averagine_r, __pyx_v_self->base_composition); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error)

#line 259 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 259 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 259 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 259 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":258
 *         return self.base_composition.items()
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "Averagine(%r)" % self.base_composition
 * 
 */

#line 258 "ms_deisotope/_c/averagine.pyx"


#line 258 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 258 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 258 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 258 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 258 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 258 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 258 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 258 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 258 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 258 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":261
 *         return "Averagine(%r)" % self.base_composition
 * 
 *     def __richcmp__(self, other, int code):             # <<<<<<<<<<<<<<
 *         if code == 2:
 *             return self.base_composition == other.base_composition
 */

#line 261 "ms_deisotope/_c/averagine.pyx"


#line 261 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 261 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_27__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_code); /*proto*/

#line 261 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_27__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_code) {

#line 261 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 261 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 261 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_r = 
#line 261 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_26__richcmp__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_code));

#line 261 "ms_deisotope/_c/averagine.pyx"


#line 261 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 261 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 261 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 261 "ms_deisotope/_c/averagine.pyx"
}

#line 261 "ms_deisotope/_c/averagine.pyx"


#line 261 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_26__richcmp__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_code) {

#line 261 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 261 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 261 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 261 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 261 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 261 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 261 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 261 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "ms_deisotope/_c/averagine.pyx":262
 * 
 *     def __richcmp__(self, other, int code):
 *         if code == 2:             # <<<<<<<<<<<<<<
 *             return self.base_composition == other.base_composition
 *         elif code == 3:
 */

#line 262 "ms_deisotope/_c/averagine.pyx"
  switch (__pyx_v_code) {

#line 262 "ms_deisotope/_c/averagine.pyx"
    case 2:

    /* "ms_deisotope/_c/averagine.pyx":263
 *     def __richcmp__(self, other, int code):
 *         if code == 2:
 *             return self.base_composition == other.base_composition             # <<<<<<<<<<<<<<
 *         elif code == 3:
 *             return self.base_composition != other.base_composition
 */

#line 263 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF(__pyx_r);

#line 263 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_base_composition); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error)

#line 263 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 263 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_self->base_composition, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error)

#line 263 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 263 "ms_deisotope/_c/averagine.pyx"
    __pyx_r = __pyx_t_2;

#line 263 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = 0;

#line 263 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L0;

    /* "ms_deisotope/_c/averagine.pyx":262
 * 
 *     def __richcmp__(self, other, int code):
 *         if code == 2:             # <<<<<<<<<<<<<<
 *             return self.base_composition == other.base_composition
 *         elif code == 3:
 */

#line 262 "ms_deisotope/_c/averagine.pyx"
    break;

#line 262 "ms_deisotope/_c/averagine.pyx"
    case 3:

    /* "ms_deisotope/_c/averagine.pyx":265
 *             return self.base_composition == other.base_composition
 *         elif code == 3:
 *             return self.base_composition != other.base_composition             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */

#line 265 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF(__pyx_r);

#line 265 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_base_composition); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error)

#line 265 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);

#line 265 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->base_composition, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error)

#line 265 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 265 "ms_deisotope/_c/averagine.pyx"
    __pyx_r = __pyx_t_1;

#line 265 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

#line 265 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L0;

    /* "ms_deisotope/_c/averagine.pyx":264
 *         if code == 2:
 *             return self.base_composition == other.base_composition
 *         elif code == 3:             # <<<<<<<<<<<<<<
 *             return self.base_composition != other.base_composition
 * 
 */

#line 264 "ms_deisotope/_c/averagine.pyx"
    break;

#line 264 "ms_deisotope/_c/averagine.pyx"
    default: break;

#line 264 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":261
 *         return "Averagine(%r)" % self.base_composition
 * 
 *     def __richcmp__(self, other, int code):             # <<<<<<<<<<<<<<
 *         if code == 2:
 *             return self.base_composition == other.base_composition
 */

#line 261 "ms_deisotope/_c/averagine.pyx"


#line 261 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 261 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);

#line 261 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 261 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 261 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 261 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 261 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 261 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 261 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 261 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 261 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 261 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 261 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":267
 *             return self.base_composition != other.base_composition
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(frozenset(self.base_composition.items()))
 * 
 */

#line 267 "ms_deisotope/_c/averagine.pyx"


#line 267 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 267 "ms_deisotope/_c/averagine.pyx"
static Py_hash_t __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_29__hash__(PyObject *__pyx_v_self); /*proto*/

#line 267 "ms_deisotope/_c/averagine.pyx"
static Py_hash_t __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_29__hash__(PyObject *__pyx_v_self) {

#line 267 "ms_deisotope/_c/averagine.pyx"
  Py_hash_t __pyx_r;

#line 267 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 267 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = 
#line 267 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_28__hash__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self));

#line 267 "ms_deisotope/_c/averagine.pyx"


#line 267 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 267 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 267 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 267 "ms_deisotope/_c/averagine.pyx"
}

#line 267 "ms_deisotope/_c/averagine.pyx"


#line 267 "ms_deisotope/_c/averagine.pyx"
static Py_hash_t __pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_28__hash__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self) {

#line 267 "ms_deisotope/_c/averagine.pyx"
  Py_hash_t __pyx_r;

#line 267 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 267 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 267 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 267 "ms_deisotope/_c/averagine.pyx"
  Py_hash_t __pyx_t_3;

#line 267 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 267 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 267 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 267 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__hash__", 0);

  /* "ms_deisotope/_c/averagine.pyx":268
 * 
 *     def __hash__(self):
 *         return hash(frozenset(self.base_composition.items()))             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 268 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_v_self->base_composition == Py_None)) {

#line 268 "ms_deisotope/_c/averagine.pyx"
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");

#line 268 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 268, __pyx_L1_error)

#line 268 "ms_deisotope/_c/averagine.pyx"
  }

#line 268 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_self->base_composition); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)

#line 268 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 268 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_PyFrozenSet_New(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 268, __pyx_L1_error)

#line 268 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 268 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 268 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = PyObject_Hash(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_hash_t)-1))) __PYX_ERR(0, 268, __pyx_L1_error)

#line 268 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 268 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_3;

#line 268 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":267
 *             return self.base_composition != other.base_composition
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(frozenset(self.base_composition.items()))
 * 
 */

#line 267 "ms_deisotope/_c/averagine.pyx"


#line 267 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 267 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 267 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 267 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 267 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 267 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = -1;

#line 267 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 267 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;

#line 267 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 267 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 267 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pxd":14
 * cdef class Averagine(object):
 *     cdef:
 *         public double base_mass             # <<<<<<<<<<<<<<
 *         public dict base_composition
 * 
 */

#line 14 "ms_deisotope/_c/averagine.pxd"


#line 14 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 14 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_9base_mass_1__get__(PyObject *__pyx_v_self); /*proto*/

#line 14 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_9base_mass_1__get__(PyObject *__pyx_v_self) {

#line 14 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = 0;

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = 
#line 14 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_9base_mass___get__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self));

#line 14 "ms_deisotope/_c/averagine.pxd"


#line 14 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 14 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 14 "ms_deisotope/_c/averagine.pxd"
}

#line 14 "ms_deisotope/_c/averagine.pxd"


#line 14 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_9base_mass___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self) {

#line 14 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = NULL;

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 14 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_t_1 = NULL;

#line 14 "ms_deisotope/_c/averagine.pxd"
  int __pyx_lineno = 0;

#line 14 "ms_deisotope/_c/averagine.pxd"
  const char *__pyx_filename = NULL;

#line 14 "ms_deisotope/_c/averagine.pxd"
  int __pyx_clineno = 0;

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__", 0);

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_r);

#line 14 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->base_mass); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GOTREF(__pyx_t_1);

#line 14 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = __pyx_t_1;

#line 14 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = 0;

#line 14 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 14 "ms_deisotope/_c/averagine.pxd"


#line 14 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 14 "ms_deisotope/_c/averagine.pxd"
  __pyx_L1_error:;

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_t_1);

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.base_mass.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 14 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = NULL;

#line 14 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XGIVEREF(__pyx_r);

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 14 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 14 "ms_deisotope/_c/averagine.pxd"
}

#line 14 "ms_deisotope/_c/averagine.pxd"


#line 14 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 14 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_9base_mass_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/

#line 14 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_9base_mass_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {

#line 14 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = 
#line 14 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_9base_mass_2__set__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self), ((PyObject *)__pyx_v_value));

#line 14 "ms_deisotope/_c/averagine.pxd"


#line 14 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 14 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 14 "ms_deisotope/_c/averagine.pxd"
}

#line 14 "ms_deisotope/_c/averagine.pxd"


#line 14 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_9base_mass_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, PyObject *__pyx_v_value) {

#line 14 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 14 "ms_deisotope/_c/averagine.pxd"
  double __pyx_t_1;

#line 14 "ms_deisotope/_c/averagine.pxd"
  int __pyx_lineno = 0;

#line 14 "ms_deisotope/_c/averagine.pxd"
  const char *__pyx_filename = NULL;

#line 14 "ms_deisotope/_c/averagine.pxd"
  int __pyx_clineno = 0;

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__", 0);

#line 14 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 14, __pyx_L1_error)

#line 14 "ms_deisotope/_c/averagine.pxd"
  __pyx_v_self->base_mass = __pyx_t_1;

#line 14 "ms_deisotope/_c/averagine.pxd"


#line 14 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 14 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = 0;

#line 14 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 14 "ms_deisotope/_c/averagine.pxd"
  __pyx_L1_error:;

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.base_mass.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 14 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = -1;

#line 14 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 14 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 14 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 14 "ms_deisotope/_c/averagine.pxd"
}

/* "ms_deisotope/_c/averagine.pxd":15
 *     cdef:
 *         public double base_mass
 *         public dict base_composition             # <<<<<<<<<<<<<<
 * 
 *     cpdef dict scale(self, double mz, int charge=*, double charge_carrier=*)
 */

#line 15 "ms_deisotope/_c/averagine.pxd"


#line 15 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 15 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_1__get__(PyObject *__pyx_v_self); /*proto*/

#line 15 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_1__get__(PyObject *__pyx_v_self) {

#line 15 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = 0;

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = 
#line 15 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition___get__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self));

#line 15 "ms_deisotope/_c/averagine.pxd"


#line 15 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 15 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 15 "ms_deisotope/_c/averagine.pxd"
}

#line 15 "ms_deisotope/_c/averagine.pxd"


#line 15 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self) {

#line 15 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = NULL;

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__", 0);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_r);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_INCREF(__pyx_v_self->base_composition);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = __pyx_v_self->base_composition;

#line 15 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 15 "ms_deisotope/_c/averagine.pxd"


#line 15 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 15 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XGIVEREF(__pyx_r);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 15 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 15 "ms_deisotope/_c/averagine.pxd"
}

#line 15 "ms_deisotope/_c/averagine.pxd"


#line 15 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 15 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/

#line 15 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {

#line 15 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = 
#line 15 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_2__set__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self), ((PyObject *)__pyx_v_value));

#line 15 "ms_deisotope/_c/averagine.pxd"


#line 15 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 15 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 15 "ms_deisotope/_c/averagine.pxd"
}

#line 15 "ms_deisotope/_c/averagine.pxd"


#line 15 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self, PyObject *__pyx_v_value) {

#line 15 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 15 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_t_1 = NULL;

#line 15 "ms_deisotope/_c/averagine.pxd"
  int __pyx_lineno = 0;

#line 15 "ms_deisotope/_c/averagine.pxd"
  const char *__pyx_filename = NULL;

#line 15 "ms_deisotope/_c/averagine.pxd"
  int __pyx_clineno = 0;

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__", 0);

#line 15 "ms_deisotope/_c/averagine.pxd"
  if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 15, __pyx_L1_error)

#line 15 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = __pyx_v_value;

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_INCREF(__pyx_t_1);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GIVEREF(__pyx_t_1);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GOTREF(__pyx_v_self->base_composition);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_DECREF(__pyx_v_self->base_composition);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __pyx_v_self->base_composition = ((PyObject*)__pyx_t_1);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = 0;

#line 15 "ms_deisotope/_c/averagine.pxd"


#line 15 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 15 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = 0;

#line 15 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 15 "ms_deisotope/_c/averagine.pxd"
  __pyx_L1_error:;

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_t_1);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.Averagine.base_composition.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = -1;

#line 15 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 15 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 15 "ms_deisotope/_c/averagine.pxd"
}

#line 15 "ms_deisotope/_c/averagine.pxd"


#line 15 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 15 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_5__del__(PyObject *__pyx_v_self); /*proto*/

#line 15 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_5__del__(PyObject *__pyx_v_self) {

#line 15 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = 
#line 15 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_4__del__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self));

#line 15 "ms_deisotope/_c/averagine.pxd"


#line 15 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 15 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 15 "ms_deisotope/_c/averagine.pxd"
}

#line 15 "ms_deisotope/_c/averagine.pxd"


#line 15 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_4__del__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *__pyx_v_self) {

#line 15 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__del__", 0);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_INCREF(Py_None);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GIVEREF(Py_None);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GOTREF(__pyx_v_self->base_composition);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_DECREF(__pyx_v_self->base_composition);

#line 15 "ms_deisotope/_c/averagine.pxd"
  __pyx_v_self->base_composition = ((PyObject*)Py_None);

#line 15 "ms_deisotope/_c/averagine.pxd"


#line 15 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 15 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = 0;

#line 15 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 15 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 15 "ms_deisotope/_c/averagine.pxd"
}

/* "ms_deisotope/_c/averagine.pyx":271
 * 
 * 
 * cdef list clone_peak_list(list peaklist):             # <<<<<<<<<<<<<<
 *     cdef:
 *         size_t i, n
 */

#line 271 "ms_deisotope/_c/averagine.pyx"


#line 271 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_f_12ms_deisotope_2_c_9averagine_clone_peak_list(PyObject *__pyx_v_peaklist) {
  size_t __pyx_v_i
#line 271 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 271 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_result = 0
#line 271 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_peak = 0
#line 271 "ms_deisotope/_c/averagine.pyx"
;

#line 271 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 271 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 271 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 271 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 271 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 271 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_4;

#line 271 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_5;

#line 271 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 271 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 271 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 271 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("clone_peak_list", 0);

  /* "ms_deisotope/_c/averagine.pyx":277
 *         TheoreticalPeak peak
 * 
 *     n = PyList_GET_SIZE(peaklist)             # <<<<<<<<<<<<<<
 *     result = PyList_New(n)
 *     for i in range(n):
 */

#line 277 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = PyList_GET_SIZE(__pyx_v_peaklist);

  /* "ms_deisotope/_c/averagine.pyx":278
 * 
 *     n = PyList_GET_SIZE(peaklist)
 *     result = PyList_New(n)             # <<<<<<<<<<<<<<
 *     for i in range(n):
 *         peak = (<TheoreticalPeak>PyList_GET_ITEM(peaklist, i)).clone()
 */

#line 278 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyList_New(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error)

#line 278 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 278 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_result = ((PyObject*)__pyx_t_1);

#line 278 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":279
 *     n = PyList_GET_SIZE(peaklist)
 *     result = PyList_New(n)
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         peak = (<TheoreticalPeak>PyList_GET_ITEM(peaklist, i)).clone()
 *         Py_INCREF(peak)
 */

#line 279 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_v_n;

#line 279 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __pyx_t_2;

#line 279 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {

#line 279 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_4;

    /* "ms_deisotope/_c/averagine.pyx":280
 *     result = PyList_New(n)
 *     for i in range(n):
 *         peak = (<TheoreticalPeak>PyList_GET_ITEM(peaklist, i)).clone()             # <<<<<<<<<<<<<<
 *         Py_INCREF(peak)
 *         PyList_SET_ITEM(result, i, peak)
 */

#line 280 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = PyList_GET_ITEM(__pyx_v_peaklist, __pyx_v_i);

#line 280 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_5)->__pyx_vtab)->clone(((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_5), 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 280, __pyx_L1_error)

#line 280 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 280 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_peak, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1));

#line 280 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":281
 *     for i in range(n):
 *         peak = (<TheoreticalPeak>PyList_GET_ITEM(peaklist, i)).clone()
 *         Py_INCREF(peak)             # <<<<<<<<<<<<<<
 *         PyList_SET_ITEM(result, i, peak)
 *     return result
 */

#line 281 "ms_deisotope/_c/averagine.pyx"
    Py_INCREF(((PyObject *)__pyx_v_peak));

    /* "ms_deisotope/_c/averagine.pyx":282
 *         peak = (<TheoreticalPeak>PyList_GET_ITEM(peaklist, i)).clone()
 *         Py_INCREF(peak)
 *         PyList_SET_ITEM(result, i, peak)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */

#line 282 "ms_deisotope/_c/averagine.pyx"
    PyList_SET_ITEM(__pyx_v_result, __pyx_v_i, ((PyObject *)__pyx_v_peak));

#line 282 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":283
 *         Py_INCREF(peak)
 *         PyList_SET_ITEM(result, i, peak)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 283 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 283 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_result);

#line 283 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_result;

#line 283 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":271
 * 
 * 
 * cdef list clone_peak_list(list peaklist):             # <<<<<<<<<<<<<<
 *     cdef:
 *         size_t i, n
 */

#line 271 "ms_deisotope/_c/averagine.pyx"


#line 271 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 271 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 271 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 271 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.clone_peak_list", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 271 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 271 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 271 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_result);

#line 271 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_peak);

#line 271 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 271 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 271 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 271 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":286
 * 
 * 
 * cdef double sum_intensity(list peaklist, size_t n):             # <<<<<<<<<<<<<<
 *     cdef:
 *         size_t i
 */

#line 286 "ms_deisotope/_c/averagine.pyx"


#line 286 "ms_deisotope/_c/averagine.pyx"
static double __pyx_f_12ms_deisotope_2_c_9averagine_sum_intensity(PyObject *__pyx_v_peaklist, size_t __pyx_v_n) {
  size_t __pyx_v_i
#line 286 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_total
#line 286 "ms_deisotope/_c/averagine.pyx"
;

#line 286 "ms_deisotope/_c/averagine.pyx"
  double __pyx_r;

#line 286 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 286 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_1;

#line 286 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 286 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 286 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4;

#line 286 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("sum_intensity", 0);

  /* "ms_deisotope/_c/averagine.pyx":291
 *         double total
 *         FittedPeak peak
 *     total = 0             # <<<<<<<<<<<<<<
 *     for i in range(n):
 *         total += (<FittedPeak>PyList_GET_ITEM(peaklist, i)).intensity
 */

#line 291 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_total = 0.0;

  /* "ms_deisotope/_c/averagine.pyx":292
 *         FittedPeak peak
 *     total = 0
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         total += (<FittedPeak>PyList_GET_ITEM(peaklist, i)).intensity
 *     return total
 */

#line 292 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_v_n;

#line 292 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_t_1;

#line 292 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {

#line 292 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_3;

    /* "ms_deisotope/_c/averagine.pyx":293
 *     total = 0
 *     for i in range(n):
 *         total += (<FittedPeak>PyList_GET_ITEM(peaklist, i)).intensity             # <<<<<<<<<<<<<<
 *     return total
 * 
 */

#line 293 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = PyList_GET_ITEM(__pyx_v_peaklist, __pyx_v_i);

#line 293 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_total = (__pyx_v_total + ((struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *)__pyx_t_4)->__pyx_base.intensity);

#line 293 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":294
 *     for i in range(n):
 *         total += (<FittedPeak>PyList_GET_ITEM(peaklist, i)).intensity
 *     return total             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 294 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_total;

#line 294 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":286
 * 
 * 
 * cdef double sum_intensity(list peaklist, size_t n):             # <<<<<<<<<<<<<<
 *     cdef:
 *         size_t i
 */

#line 286 "ms_deisotope/_c/averagine.pyx"


#line 286 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 286 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 286 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 286 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 286 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":297
 * 
 * 
 * cdef double top3_scale_factor(TheoreticalIsotopicPattern self, list experimental_distribution):             # <<<<<<<<<<<<<<
 *     cdef:
 *         double top1, top2, top3, scale
 */

#line 297 "ms_deisotope/_c/averagine.pyx"


#line 297 "ms_deisotope/_c/averagine.pyx"
static double __pyx_f_12ms_deisotope_2_c_9averagine_top3_scale_factor(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_experimental_distribution) {
  double __pyx_v_top1
#line 297 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_top2
#line 297 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_top3
#line 297 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_scale
#line 297 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_i
#line 297 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 297 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_top1_index
#line 297 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_top2_index
#line 297 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_top3_index
#line 297 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_peak = 0
#line 297 "ms_deisotope/_c/averagine.pyx"
;

#line 297 "ms_deisotope/_c/averagine.pyx"
  double __pyx_r;

#line 297 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 297 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_1;

#line 297 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 297 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 297 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 297 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_5;

#line 297 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_6;

#line 297 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_7;

#line 297 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 297 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 297 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 297 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("top3_scale_factor", 0);

  /* "ms_deisotope/_c/averagine.pyx":302
 *         size_t i, n, top1_index, top2_index, top3_index
 *         TheoreticalPeak peak
 *     n = self.get_size()             # <<<<<<<<<<<<<<
 * 
 *     top1 = 0
 */

#line 302 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":304
 *     n = self.get_size()
 * 
 *     top1 = 0             # <<<<<<<<<<<<<<
 *     top2 = 0
 *     top3 = 0
 */

#line 304 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_top1 = 0.0;

  /* "ms_deisotope/_c/averagine.pyx":305
 * 
 *     top1 = 0
 *     top2 = 0             # <<<<<<<<<<<<<<
 *     top3 = 0
 *     top1_index = 0
 */

#line 305 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_top2 = 0.0;

  /* "ms_deisotope/_c/averagine.pyx":306
 *     top1 = 0
 *     top2 = 0
 *     top3 = 0             # <<<<<<<<<<<<<<
 *     top1_index = 0
 *     top2_index = 0
 */

#line 306 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_top3 = 0.0;

  /* "ms_deisotope/_c/averagine.pyx":307
 *     top2 = 0
 *     top3 = 0
 *     top1_index = 0             # <<<<<<<<<<<<<<
 *     top2_index = 0
 *     top3_index = 0
 */

#line 307 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_top1_index = 0;

  /* "ms_deisotope/_c/averagine.pyx":308
 *     top3 = 0
 *     top1_index = 0
 *     top2_index = 0             # <<<<<<<<<<<<<<
 *     top3_index = 0
 *     for i in range(n):
 */

#line 308 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_top2_index = 0;

  /* "ms_deisotope/_c/averagine.pyx":309
 *     top1_index = 0
 *     top2_index = 0
 *     top3_index = 0             # <<<<<<<<<<<<<<
 *     for i in range(n):
 *         peak = self.get(i)
 */

#line 309 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_top3_index = 0;

  /* "ms_deisotope/_c/averagine.pyx":310
 *     top2_index = 0
 *     top3_index = 0
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         peak = self.get(i)
 *         if peak.intensity > top1:
 */

#line 310 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_v_n;

#line 310 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_t_1;

#line 310 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {

#line 310 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_3;

    /* "ms_deisotope/_c/averagine.pyx":311
 *     top3_index = 0
 *     for i in range(n):
 *         peak = self.get(i)             # <<<<<<<<<<<<<<
 *         if peak.intensity > top1:
 *             top3 = top2
 */

#line 311 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error)

#line 311 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_4);

#line 311 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_peak, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_4));

#line 311 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = 0;

    /* "ms_deisotope/_c/averagine.pyx":312
 *     for i in range(n):
 *         peak = self.get(i)
 *         if peak.intensity > top1:             # <<<<<<<<<<<<<<
 *             top3 = top2
 *             top3_index = top2_index
 */

#line 312 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = ((__pyx_v_peak->intensity > __pyx_v_top1) != 0);

#line 312 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_5) {

      /* "ms_deisotope/_c/averagine.pyx":313
 *         peak = self.get(i)
 *         if peak.intensity > top1:
 *             top3 = top2             # <<<<<<<<<<<<<<
 *             top3_index = top2_index
 *             top2 = top1
 */

#line 313 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_top3 = __pyx_v_top2;

      /* "ms_deisotope/_c/averagine.pyx":314
 *         if peak.intensity > top1:
 *             top3 = top2
 *             top3_index = top2_index             # <<<<<<<<<<<<<<
 *             top2 = top1
 *             top2_index = top1_index
 */

#line 314 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_top3_index = __pyx_v_top2_index;

      /* "ms_deisotope/_c/averagine.pyx":315
 *             top3 = top2
 *             top3_index = top2_index
 *             top2 = top1             # <<<<<<<<<<<<<<
 *             top2_index = top1_index
 *             top1 = peak.intensity
 */

#line 315 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_top2 = __pyx_v_top1;

      /* "ms_deisotope/_c/averagine.pyx":316
 *             top3_index = top2_index
 *             top2 = top1
 *             top2_index = top1_index             # <<<<<<<<<<<<<<
 *             top1 = peak.intensity
 *             top1_index = i
 */

#line 316 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_top2_index = __pyx_v_top1_index;

      /* "ms_deisotope/_c/averagine.pyx":317
 *             top2 = top1
 *             top2_index = top1_index
 *             top1 = peak.intensity             # <<<<<<<<<<<<<<
 *             top1_index = i
 *         elif peak.intensity > top2:
 */

#line 317 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_6 = __pyx_v_peak->intensity;

#line 317 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_top1 = __pyx_t_6;

      /* "ms_deisotope/_c/averagine.pyx":318
 *             top2_index = top1_index
 *             top1 = peak.intensity
 *             top1_index = i             # <<<<<<<<<<<<<<
 *         elif peak.intensity > top2:
 *             top3 = top2
 */

#line 318 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_top1_index = __pyx_v_i;

      /* "ms_deisotope/_c/averagine.pyx":312
 *     for i in range(n):
 *         peak = self.get(i)
 *         if peak.intensity > top1:             # <<<<<<<<<<<<<<
 *             top3 = top2
 *             top3_index = top2_index
 */

#line 312 "ms_deisotope/_c/averagine.pyx"
      goto __pyx_L5;

#line 312 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":319
 *             top1 = peak.intensity
 *             top1_index = i
 *         elif peak.intensity > top2:             # <<<<<<<<<<<<<<
 *             top3 = top2
 *             top3_index = top2_index
 */

#line 319 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = ((__pyx_v_peak->intensity > __pyx_v_top2) != 0);

#line 319 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_5) {

      /* "ms_deisotope/_c/averagine.pyx":320
 *             top1_index = i
 *         elif peak.intensity > top2:
 *             top3 = top2             # <<<<<<<<<<<<<<
 *             top3_index = top2_index
 *             top2 = peak.intensity
 */

#line 320 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_top3 = __pyx_v_top2;

      /* "ms_deisotope/_c/averagine.pyx":321
 *         elif peak.intensity > top2:
 *             top3 = top2
 *             top3_index = top2_index             # <<<<<<<<<<<<<<
 *             top2 = peak.intensity
 *             top2_index = i
 */

#line 321 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_top3_index = __pyx_v_top2_index;

      /* "ms_deisotope/_c/averagine.pyx":322
 *             top3 = top2
 *             top3_index = top2_index
 *             top2 = peak.intensity             # <<<<<<<<<<<<<<
 *             top2_index = i
 *         elif peak.intensity > top3:
 */

#line 322 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_6 = __pyx_v_peak->intensity;

#line 322 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_top2 = __pyx_t_6;

      /* "ms_deisotope/_c/averagine.pyx":323
 *             top3_index = top2_index
 *             top2 = peak.intensity
 *             top2_index = i             # <<<<<<<<<<<<<<
 *         elif peak.intensity > top3:
 *             top3 = peak.intensity
 */

#line 323 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_top2_index = __pyx_v_i;

      /* "ms_deisotope/_c/averagine.pyx":319
 *             top1 = peak.intensity
 *             top1_index = i
 *         elif peak.intensity > top2:             # <<<<<<<<<<<<<<
 *             top3 = top2
 *             top3_index = top2_index
 */

#line 319 "ms_deisotope/_c/averagine.pyx"
      goto __pyx_L5;

#line 319 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":324
 *             top2 = peak.intensity
 *             top2_index = i
 *         elif peak.intensity > top3:             # <<<<<<<<<<<<<<
 *             top3 = peak.intensity
 *             top3_index = i
 */

#line 324 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = ((__pyx_v_peak->intensity > __pyx_v_top3) != 0);

#line 324 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_5) {

      /* "ms_deisotope/_c/averagine.pyx":325
 *             top2_index = i
 *         elif peak.intensity > top3:
 *             top3 = peak.intensity             # <<<<<<<<<<<<<<
 *             top3_index = i
 * 
 */

#line 325 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_6 = __pyx_v_peak->intensity;

#line 325 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_top3 = __pyx_t_6;

      /* "ms_deisotope/_c/averagine.pyx":326
 *         elif peak.intensity > top3:
 *             top3 = peak.intensity
 *             top3_index = i             # <<<<<<<<<<<<<<
 * 
 *     scale = (<FittedPeak>PyList_GET_ITEM(experimental_distribution, top1_index)).intensity / self.get(top1_index).intensity
 */

#line 326 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_top3_index = __pyx_v_i;

      /* "ms_deisotope/_c/averagine.pyx":324
 *             top2 = peak.intensity
 *             top2_index = i
 *         elif peak.intensity > top3:             # <<<<<<<<<<<<<<
 *             top3 = peak.intensity
 *             top3_index = i
 */

#line 324 "ms_deisotope/_c/averagine.pyx"
    }

#line 324 "ms_deisotope/_c/averagine.pyx"
    __pyx_L5:;

#line 324 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":328
 *             top3_index = i
 * 
 *     scale = (<FittedPeak>PyList_GET_ITEM(experimental_distribution, top1_index)).intensity / self.get(top1_index).intensity             # <<<<<<<<<<<<<<
 *     scale += (<FittedPeak>PyList_GET_ITEM(experimental_distribution, top2_index)).intensity / self.get(top2_index).intensity
 *     scale += (<FittedPeak>PyList_GET_ITEM(experimental_distribution, top3_index)).intensity / self.get(top3_index).intensity
 */

#line 328 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_7 = PyList_GET_ITEM(__pyx_v_experimental_distribution, __pyx_v_top1_index);

#line 328 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_top1_index)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 328, __pyx_L1_error)

#line 328 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_4);

#line 328 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_6 = ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_4)->intensity;

#line 328 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 328 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_t_6 == 0)) {

#line 328 "ms_deisotope/_c/averagine.pyx"
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");

#line 328 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 328, __pyx_L1_error)

#line 328 "ms_deisotope/_c/averagine.pyx"
  }

#line 328 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_scale = (((struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *)__pyx_t_7)->__pyx_base.intensity / __pyx_t_6);

  /* "ms_deisotope/_c/averagine.pyx":329
 * 
 *     scale = (<FittedPeak>PyList_GET_ITEM(experimental_distribution, top1_index)).intensity / self.get(top1_index).intensity
 *     scale += (<FittedPeak>PyList_GET_ITEM(experimental_distribution, top2_index)).intensity / self.get(top2_index).intensity             # <<<<<<<<<<<<<<
 *     scale += (<FittedPeak>PyList_GET_ITEM(experimental_distribution, top3_index)).intensity / self.get(top3_index).intensity
 *     scale /= 3
 */

#line 329 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_7 = PyList_GET_ITEM(__pyx_v_experimental_distribution, __pyx_v_top2_index);

#line 329 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_top2_index)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 329, __pyx_L1_error)

#line 329 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_4);

#line 329 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_6 = ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_4)->intensity;

#line 329 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 329 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_t_6 == 0)) {

#line 329 "ms_deisotope/_c/averagine.pyx"
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");

#line 329 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 329, __pyx_L1_error)

#line 329 "ms_deisotope/_c/averagine.pyx"
  }

#line 329 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_scale = (__pyx_v_scale + (((struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *)__pyx_t_7)->__pyx_base.intensity / __pyx_t_6));

  /* "ms_deisotope/_c/averagine.pyx":330
 *     scale = (<FittedPeak>PyList_GET_ITEM(experimental_distribution, top1_index)).intensity / self.get(top1_index).intensity
 *     scale += (<FittedPeak>PyList_GET_ITEM(experimental_distribution, top2_index)).intensity / self.get(top2_index).intensity
 *     scale += (<FittedPeak>PyList_GET_ITEM(experimental_distribution, top3_index)).intensity / self.get(top3_index).intensity             # <<<<<<<<<<<<<<
 *     scale /= 3
 *     return scale
 */

#line 330 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_7 = PyList_GET_ITEM(__pyx_v_experimental_distribution, __pyx_v_top3_index);

#line 330 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_top3_index)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 330, __pyx_L1_error)

#line 330 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_4);

#line 330 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_6 = ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_4)->intensity;

#line 330 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 330 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_t_6 == 0)) {

#line 330 "ms_deisotope/_c/averagine.pyx"
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");

#line 330 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 330, __pyx_L1_error)

#line 330 "ms_deisotope/_c/averagine.pyx"
  }

#line 330 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_scale = (__pyx_v_scale + (((struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *)__pyx_t_7)->__pyx_base.intensity / __pyx_t_6));

  /* "ms_deisotope/_c/averagine.pyx":331
 *     scale += (<FittedPeak>PyList_GET_ITEM(experimental_distribution, top2_index)).intensity / self.get(top2_index).intensity
 *     scale += (<FittedPeak>PyList_GET_ITEM(experimental_distribution, top3_index)).intensity / self.get(top3_index).intensity
 *     scale /= 3             # <<<<<<<<<<<<<<
 *     return scale
 * 
 */

#line 331 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_scale = (__pyx_v_scale / 3.0);

  /* "ms_deisotope/_c/averagine.pyx":332
 *     scale += (<FittedPeak>PyList_GET_ITEM(experimental_distribution, top3_index)).intensity / self.get(top3_index).intensity
 *     scale /= 3
 *     return scale             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 332 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_scale;

#line 332 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":297
 * 
 * 
 * cdef double top3_scale_factor(TheoreticalIsotopicPattern self, list experimental_distribution):             # <<<<<<<<<<<<<<
 *     cdef:
 *         double top1, top2, top3, scale
 */

#line 297 "ms_deisotope/_c/averagine.pyx"


#line 297 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 297 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 297 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 297 "ms_deisotope/_c/averagine.pyx"
  __Pyx_WriteUnraisable("ms_deisotope._c.averagine.top3_scale_factor", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);

#line 297 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 297 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 297 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_peak);

#line 297 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 297 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 297 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":350
 * 
 *     @staticmethod
 *     cdef TheoreticalIsotopicPattern _create(list peaklist, double origin, double offset):             # <<<<<<<<<<<<<<
 *         cdef:
 *             TheoreticalIsotopicPattern self
 */

#line 350 "ms_deisotope/_c/averagine.pyx"


#line 350 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__create(PyObject *__pyx_v_peaklist, double __pyx_v_origin, double __pyx_v_offset) {
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self = 0
#line 350 "ms_deisotope/_c/averagine.pyx"
;

#line 350 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 350 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 350 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 350 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 350 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 350 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 350 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("_create", 0);

  /* "ms_deisotope/_c/averagine.pyx":354
 *             TheoreticalIsotopicPattern self
 * 
 *         self = TheoreticalIsotopicPattern.__new__(TheoreticalIsotopicPattern)             # <<<<<<<<<<<<<<
 *         self.peaklist = peaklist
 *         self.origin = origin
 */

#line 354 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern(((PyTypeObject *)__pyx_ptype_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error)

#line 354 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));

#line 354 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_1);

#line 354 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":355
 * 
 *         self = TheoreticalIsotopicPattern.__new__(TheoreticalIsotopicPattern)
 *         self.peaklist = peaklist             # <<<<<<<<<<<<<<
 *         self.origin = origin
 *         self.offset = offset
 */

#line 355 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_peaklist);

#line 355 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_v_peaklist);

#line 355 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_v_self->peaklist);

#line 355 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_v_self->peaklist);

#line 355 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->peaklist = __pyx_v_peaklist;

  /* "ms_deisotope/_c/averagine.pyx":356
 *         self = TheoreticalIsotopicPattern.__new__(TheoreticalIsotopicPattern)
 *         self.peaklist = peaklist
 *         self.origin = origin             # <<<<<<<<<<<<<<
 *         self.offset = offset
 *         return self
 */

#line 356 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->origin = __pyx_v_origin;

  /* "ms_deisotope/_c/averagine.pyx":357
 *         self.peaklist = peaklist
 *         self.origin = origin
 *         self.offset = offset             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

#line 357 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->offset = __pyx_v_offset;

  /* "ms_deisotope/_c/averagine.pyx":358
 *         self.origin = origin
 *         self.offset = offset
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, peaklist, origin, offset=None):
 */

#line 358 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 358 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_v_self));

#line 358 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_self;

#line 358 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":350
 * 
 *     @staticmethod
 *     cdef TheoreticalIsotopicPattern _create(list peaklist, double origin, double offset):             # <<<<<<<<<<<<<<
 *         cdef:
 *             TheoreticalIsotopicPattern self
 */

#line 350 "ms_deisotope/_c/averagine.pyx"


#line 350 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 350 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 350 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 350 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern._create", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 350 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 350 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 350 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_self);

#line 350 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 350 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 350 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 350 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":360
 *         return self
 * 
 *     def __init__(self, peaklist, origin, offset=None):             # <<<<<<<<<<<<<<
 *         self.peaklist = list(peaklist)
 *         self.origin = origin
 */

#line 360 "ms_deisotope/_c/averagine.pyx"


#line 360 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 360 "ms_deisotope/_c/averagine.pyx"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 360 "ms_deisotope/_c/averagine.pyx"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_peaklist = 0
#line 360 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_origin = 0
#line 360 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_offset = 0
#line 360 "ms_deisotope/_c/averagine.pyx"
;

#line 360 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 360 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 360 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 360 "ms_deisotope/_c/averagine.pyx"
  int __pyx_r;

#line 360 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 360 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);

#line 360 "ms_deisotope/_c/averagine.pyx"
  {

#line 360 "ms_deisotope/_c/averagine.pyx"
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_peaklist,&__pyx_n_s_origin,&__pyx_n_s_offset,0};

#line 360 "ms_deisotope/_c/averagine.pyx"
    PyObject* values[3] = {0,0,0};

#line 360 "ms_deisotope/_c/averagine.pyx"
    values[2] = ((PyObject *)Py_None);

#line 360 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_kwds)) {

#line 360 "ms_deisotope/_c/averagine.pyx"
      Py_ssize_t kw_args;

#line 360 "ms_deisotope/_c/averagine.pyx"
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);

#line 360 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {
        case  3: 
#line 360 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 360 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 360 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 360 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 360 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 360 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 360 "ms_deisotope/_c/averagine.pyx"
        case  0: break;
        default: 
#line 360 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 360 "ms_deisotope/_c/averagine.pyx"
      }

#line 360 "ms_deisotope/_c/averagine.pyx"
      kw_args = PyDict_Size(__pyx_kwds);

#line 360 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {

#line 360 "ms_deisotope/_c/averagine.pyx"
        case  0:

#line 360 "ms_deisotope/_c/averagine.pyx"
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_peaklist)) != 0)) kw_args--;
        else 
#line 360 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 360 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 360 "ms_deisotope/_c/averagine.pyx"
        case  1:

#line 360 "ms_deisotope/_c/averagine.pyx"
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_origin)) != 0)) kw_args--;

#line 360 "ms_deisotope/_c/averagine.pyx"
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); 
#line 360 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 360, __pyx_L3_error)

#line 360 "ms_deisotope/_c/averagine.pyx"
        }

#line 360 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 360 "ms_deisotope/_c/averagine.pyx"
        case  2:

#line 360 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 360 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset);

#line 360 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[2] = value; kw_args--; }

#line 360 "ms_deisotope/_c/averagine.pyx"
        }

#line 360 "ms_deisotope/_c/averagine.pyx"
      }

#line 360 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(kw_args > 0)) {

#line 360 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 360, __pyx_L3_error)

#line 360 "ms_deisotope/_c/averagine.pyx"
      }

#line 360 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 360 "ms_deisotope/_c/averagine.pyx"
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: 
#line 360 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 360 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 360 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 360 "ms_deisotope/_c/averagine.pyx"
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 360 "ms_deisotope/_c/averagine.pyx"
        break;
        default: 
#line 360 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 360 "ms_deisotope/_c/averagine.pyx"
      }

#line 360 "ms_deisotope/_c/averagine.pyx"
    }

#line 360 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_peaklist = values[0];

#line 360 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_origin = values[1];

#line 360 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_offset = values[2];

#line 360 "ms_deisotope/_c/averagine.pyx"
  }

#line 360 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 360 "ms_deisotope/_c/averagine.pyx"
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); 
#line 360 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 360, __pyx_L3_error)

#line 360 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 360 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 360 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 360 "ms_deisotope/_c/averagine.pyx"
  return -1;

#line 360 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 360 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern___init__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self), __pyx_v_peaklist, __pyx_v_origin, __pyx_v_offset);

#line 360 "ms_deisotope/_c/averagine.pyx"


#line 360 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 360 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 360 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 360 "ms_deisotope/_c/averagine.pyx"
}

#line 360 "ms_deisotope/_c/averagine.pyx"


#line 360 "ms_deisotope/_c/averagine.pyx"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern___init__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_peaklist, PyObject *__pyx_v_origin, PyObject *__pyx_v_offset) {

#line 360 "ms_deisotope/_c/averagine.pyx"
  int __pyx_r;

#line 360 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 360 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 360 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_2;

#line 360 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_3;

#line 360 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_4;

#line 360 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_5 = NULL;

#line 360 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 360 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 360 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 360 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__init__", 0);

#line 360 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_offset);

  /* "ms_deisotope/_c/averagine.pyx":361
 * 
 *     def __init__(self, peaklist, origin, offset=None):
 *         self.peaklist = list(peaklist)             # <<<<<<<<<<<<<<
 *         self.origin = origin
 *         if offset is None:
 */

#line 361 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PySequence_List(__pyx_v_peaklist); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error)

#line 361 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 361 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_1);

#line 361 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_v_self->peaklist);

#line 361 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_v_self->peaklist);

#line 361 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->peaklist = ((PyObject*)__pyx_t_1);

#line 361 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":362
 *     def __init__(self, peaklist, origin, offset=None):
 *         self.peaklist = list(peaklist)
 *         self.origin = origin             # <<<<<<<<<<<<<<
 *         if offset is None:
 *             offset = self.peaklist[0].mz - origin
 */

#line 362 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_origin); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 362, __pyx_L1_error)

#line 362 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->origin = __pyx_t_2;

  /* "ms_deisotope/_c/averagine.pyx":363
 *         self.peaklist = list(peaklist)
 *         self.origin = origin
 *         if offset is None:             # <<<<<<<<<<<<<<
 *             offset = self.peaklist[0].mz - origin
 *         self.offset = offset
 */

#line 363 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = (__pyx_v_offset == Py_None);

#line 363 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = (__pyx_t_3 != 0);

#line 363 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_4) {

    /* "ms_deisotope/_c/averagine.pyx":364
 *         self.origin = origin
 *         if offset is None:
 *             offset = self.peaklist[0].mz - origin             # <<<<<<<<<<<<<<
 *         self.offset = offset
 * 
 */

#line 364 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_v_self->peaklist == Py_None)) {

#line 364 "ms_deisotope/_c/averagine.pyx"
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");

#line 364 "ms_deisotope/_c/averagine.pyx"
      __PYX_ERR(0, 364, __pyx_L1_error)

#line 364 "ms_deisotope/_c/averagine.pyx"
    }

#line 364 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_self->peaklist, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error)

#line 364 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 364 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_mz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 364, __pyx_L1_error)

#line 364 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_5);

#line 364 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 364 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_5, __pyx_v_origin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error)

#line 364 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 364 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

#line 364 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF_SET(__pyx_v_offset, __pyx_t_1);

#line 364 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":363
 *         self.peaklist = list(peaklist)
 *         self.origin = origin
 *         if offset is None:             # <<<<<<<<<<<<<<
 *             offset = self.peaklist[0].mz - origin
 *         self.offset = offset
 */

#line 363 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":365
 *         if offset is None:
 *             offset = self.peaklist[0].mz - origin
 *         self.offset = offset             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 365 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_offset); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 365, __pyx_L1_error)

#line 365 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->offset = __pyx_t_2;

  /* "ms_deisotope/_c/averagine.pyx":360
 *         return self
 * 
 *     def __init__(self, peaklist, origin, offset=None):             # <<<<<<<<<<<<<<
 *         self.peaklist = list(peaklist)
 *         self.origin = origin
 */

#line 360 "ms_deisotope/_c/averagine.pyx"


#line 360 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 360 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 360 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 360 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 360 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 360 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_5);

#line 360 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 360 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = -1;

#line 360 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 360 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_offset);

#line 360 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 360 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 360 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":368
 * 
 * 
 *     def __getitem__(self, i):             # <<<<<<<<<<<<<<
 *         return self.peaklist[i]
 * 
 */

#line 368 "ms_deisotope/_c/averagine.pyx"


#line 368 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 368 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/

#line 368 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) {

#line 368 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 368 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 368 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = 
#line 368 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_2__getitem__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self), ((PyObject *)__pyx_v_i));

#line 368 "ms_deisotope/_c/averagine.pyx"


#line 368 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 368 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 368 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 368 "ms_deisotope/_c/averagine.pyx"
}

#line 368 "ms_deisotope/_c/averagine.pyx"


#line 368 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_2__getitem__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_i) {

#line 368 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 368 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 368 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 368 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 368 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 368 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 368 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "ms_deisotope/_c/averagine.pyx":369
 * 
 *     def __getitem__(self, i):
 *         return self.peaklist[i]             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */

#line 369 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 369 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_v_self->peaklist == Py_None)) {

#line 369 "ms_deisotope/_c/averagine.pyx"
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");

#line 369 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 369, __pyx_L1_error)

#line 369 "ms_deisotope/_c/averagine.pyx"
  }

#line 369 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_self->peaklist, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error)

#line 369 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 369 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 369 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 369 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":368
 * 
 * 
 *     def __getitem__(self, i):             # <<<<<<<<<<<<<<
 *         return self.peaklist[i]
 * 
 */

#line 368 "ms_deisotope/_c/averagine.pyx"


#line 368 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 368 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 368 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 368 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 368 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 368 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 368 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 368 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 368 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 368 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":371
 *         return self.peaklist[i]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.peaklist)
 * 
 */

#line 371 "ms_deisotope/_c/averagine.pyx"


#line 371 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 371 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_5__iter__(PyObject *__pyx_v_self); /*proto*/

#line 371 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_5__iter__(PyObject *__pyx_v_self) {

#line 371 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 371 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 371 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = 
#line 371 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_4__iter__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self));

#line 371 "ms_deisotope/_c/averagine.pyx"


#line 371 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 371 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 371 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 371 "ms_deisotope/_c/averagine.pyx"
}

#line 371 "ms_deisotope/_c/averagine.pyx"


#line 371 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_4__iter__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 371 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 371 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 371 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 371 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 371 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 371 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 371 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 371 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "ms_deisotope/_c/averagine.pyx":372
 * 
 *     def __iter__(self):
 *         return iter(self.peaklist)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */

#line 372 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 372 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_v_self->peaklist;

#line 372 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_t_1);

#line 372 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error)

#line 372 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 372 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 372 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_2;

#line 372 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

#line 372 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":371
 *         return self.peaklist[i]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.peaklist)
 * 
 */

#line 371 "ms_deisotope/_c/averagine.pyx"


#line 371 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 371 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 371 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 371 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 371 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 371 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 371 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 371 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 371 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 371 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 371 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":374
 *         return iter(self.peaklist)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.get_size()
 * 
 */

#line 374 "ms_deisotope/_c/averagine.pyx"


#line 374 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 374 "ms_deisotope/_c/averagine.pyx"
static Py_ssize_t __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_7__len__(PyObject *__pyx_v_self); /*proto*/

#line 374 "ms_deisotope/_c/averagine.pyx"
static Py_ssize_t __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_7__len__(PyObject *__pyx_v_self) {

#line 374 "ms_deisotope/_c/averagine.pyx"
  Py_ssize_t __pyx_r;

#line 374 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 374 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = 
#line 374 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6__len__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self));

#line 374 "ms_deisotope/_c/averagine.pyx"


#line 374 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 374 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 374 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 374 "ms_deisotope/_c/averagine.pyx"
}

#line 374 "ms_deisotope/_c/averagine.pyx"


#line 374 "ms_deisotope/_c/averagine.pyx"
static Py_ssize_t __pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6__len__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 374 "ms_deisotope/_c/averagine.pyx"
  Py_ssize_t __pyx_r;

#line 374 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 374 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "ms_deisotope/_c/averagine.pyx":375
 * 
 *     def __len__(self):
 *         return self.get_size()             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */

#line 375 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

#line 375 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":374
 *         return iter(self.peaklist)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.get_size()
 * 
 */

#line 374 "ms_deisotope/_c/averagine.pyx"


#line 374 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 374 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 374 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 374 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 374 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":378
 * 
 *     @cython.final
 *     cdef inline TheoreticalPeak get(self, ssize_t i):             # <<<<<<<<<<<<<<
 *         return <TheoreticalPeak>PyList_GET_ITEM(self.peaklist, i)
 * 
 */

#line 378 "ms_deisotope/_c/averagine.pyx"


#line 378 "ms_deisotope/_c/averagine.pyx"
static CYTHON_INLINE struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, Py_ssize_t __pyx_v_i) {

#line 378 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_r = NULL;

#line 378 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 378 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 378 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2;

#line 378 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("get", 0);

  /* "ms_deisotope/_c/averagine.pyx":379
 *     @cython.final
 *     cdef inline TheoreticalPeak get(self, ssize_t i):
 *         return <TheoreticalPeak>PyList_GET_ITEM(self.peaklist, i)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */

#line 379 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 379 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_v_self->peaklist;

#line 379 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_t_1);

#line 379 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_v_i);

#line 379 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 379 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_2)));

#line 379 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_2);

#line 379 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":378
 * 
 *     @cython.final
 *     cdef inline TheoreticalPeak get(self, ssize_t i):             # <<<<<<<<<<<<<<
 *         return <TheoreticalPeak>PyList_GET_ITEM(self.peaklist, i)
 * 
 */

#line 378 "ms_deisotope/_c/averagine.pyx"


#line 378 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 378 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 378 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 378 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 378 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 378 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":382
 * 
 *     @cython.final
 *     cdef inline size_t get_size(self):             # <<<<<<<<<<<<<<
 *         return PyList_GET_SIZE(self.peaklist)
 * 
 */

#line 382 "ms_deisotope/_c/averagine.pyx"


#line 382 "ms_deisotope/_c/averagine.pyx"
static CYTHON_INLINE size_t __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 382 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_r;

#line 382 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 382 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 382 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("get_size", 0);

  /* "ms_deisotope/_c/averagine.pyx":383
 *     @cython.final
 *     cdef inline size_t get_size(self):
 *         return PyList_GET_SIZE(self.peaklist)             # <<<<<<<<<<<<<<
 * 
 *     cpdef TheoreticalIsotopicPattern clone(self):
 */

#line 383 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_v_self->peaklist;

#line 383 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_t_1);

#line 383 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = PyList_GET_SIZE(__pyx_t_1);

#line 383 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 383 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":382
 * 
 *     @cython.final
 *     cdef inline size_t get_size(self):             # <<<<<<<<<<<<<<
 *         return PyList_GET_SIZE(self.peaklist)
 * 
 */

#line 382 "ms_deisotope/_c/averagine.pyx"


#line 382 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 382 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 382 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 382 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 382 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":385
 *         return PyList_GET_SIZE(self.peaklist)
 * 
 *     cpdef TheoreticalIsotopicPattern clone(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             size_t i, n
 */

#line 385 "ms_deisotope/_c/averagine.pyx"


#line 385 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_9clone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 385 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_i
#line 385 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 385 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_p = 0
#line 385 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_peaklist = 0
#line 385 "ms_deisotope/_c/averagine.pyx"
;

#line 385 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 385 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 385 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 385 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 385 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_4;

#line 385 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 385 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 385 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("clone", 0);

  /* "ms_deisotope/_c/averagine.pyx":390
 *             TheoreticalPeak p
 *             list peaklist
 *         n = self.get_size()             # <<<<<<<<<<<<<<
 *         peaklist = PyList_New(n)
 *         for i in range(n):
 */

#line 390 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":391
 *             list peaklist
 *         n = self.get_size()
 *         peaklist = PyList_New(n)             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             p = self.get(i)
 */

#line 391 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyList_New(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error)

#line 391 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 391 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_peaklist = ((PyObject*)__pyx_t_1);

#line 391 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":392
 *         n = self.get_size()
 *         peaklist = PyList_New(n)
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             p = self.get(i)
 *             p = TheoreticalPeak._create(p.mz, p.intensity, p.charge)
 */

#line 392 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_v_n;

#line 392 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __pyx_t_2;

#line 392 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {

#line 392 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_4;

    /* "ms_deisotope/_c/averagine.pyx":393
 *         peaklist = PyList_New(n)
 *         for i in range(n):
 *             p = self.get(i)             # <<<<<<<<<<<<<<
 *             p = TheoreticalPeak._create(p.mz, p.intensity, p.charge)
 *             Py_INCREF(p)
 */

#line 393 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error)

#line 393 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 393 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1));

#line 393 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":394
 *         for i in range(n):
 *             p = self.get(i)
 *             p = TheoreticalPeak._create(p.mz, p.intensity, p.charge)             # <<<<<<<<<<<<<<
 *             Py_INCREF(p)
 *             PyList_SET_ITEM(peaklist, i, p)
 */

#line 394 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak->_create(__pyx_v_p->mz, __pyx_v_p->intensity, __pyx_v_p->charge)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 394, __pyx_L1_error)

#line 394 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 394 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF_SET(__pyx_v_p, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1));

#line 394 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":395
 *             p = self.get(i)
 *             p = TheoreticalPeak._create(p.mz, p.intensity, p.charge)
 *             Py_INCREF(p)             # <<<<<<<<<<<<<<
 *             PyList_SET_ITEM(peaklist, i, p)
 *         return TheoreticalIsotopicPattern._create(peaklist, self.origin, self.offset)
 */

#line 395 "ms_deisotope/_c/averagine.pyx"
    Py_INCREF(((PyObject *)__pyx_v_p));

    /* "ms_deisotope/_c/averagine.pyx":396
 *             p = TheoreticalPeak._create(p.mz, p.intensity, p.charge)
 *             Py_INCREF(p)
 *             PyList_SET_ITEM(peaklist, i, p)             # <<<<<<<<<<<<<<
 *         return TheoreticalIsotopicPattern._create(peaklist, self.origin, self.offset)
 * 
 */

#line 396 "ms_deisotope/_c/averagine.pyx"
    PyList_SET_ITEM(__pyx_v_peaklist, __pyx_v_i, ((PyObject *)__pyx_v_p));

#line 396 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":397
 *             Py_INCREF(p)
 *             PyList_SET_ITEM(peaklist, i, p)
 *         return TheoreticalIsotopicPattern._create(peaklist, self.origin, self.offset)             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */

#line 397 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 397 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__create(__pyx_v_peaklist, __pyx_v_self->origin, __pyx_v_self->offset)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error)

#line 397 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 397 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_1);

#line 397 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 397 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":385
 *         return PyList_GET_SIZE(self.peaklist)
 * 
 *     cpdef TheoreticalIsotopicPattern clone(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             size_t i, n
 */

#line 385 "ms_deisotope/_c/averagine.pyx"


#line 385 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 385 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 385 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 385 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_p);

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_peaklist);

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 385 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 385 "ms_deisotope/_c/averagine.pyx"
}

#line 385 "ms_deisotope/_c/averagine.pyx"


#line 385 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 385 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_9clone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 385 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8clone[] = "TheoreticalIsotopicPattern.clone(self) -> TheoreticalIsotopicPattern";

#line 385 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_9clone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 385 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("clone (wrapper)", 0);
  __pyx_r = 
#line 385 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8clone(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self));

#line 385 "ms_deisotope/_c/averagine.pyx"


#line 385 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 385 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 385 "ms_deisotope/_c/averagine.pyx"
}

#line 385 "ms_deisotope/_c/averagine.pyx"


#line 385 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8clone(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 385 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 385 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 385 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 385 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 385 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("clone", 0);

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 385 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 385, __pyx_L1_error)

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 385 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 385 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 385 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 385 "ms_deisotope/_c/averagine.pyx"


#line 385 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 385 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 385 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 385 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 385 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 385 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 385 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":399
 *         return TheoreticalIsotopicPattern._create(peaklist, self.origin, self.offset)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return self.__class__, (self.peaklist, self.origin, self.offset)
 * 
 */

#line 399 "ms_deisotope/_c/averagine.pyx"


#line 399 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 399 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_11__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 399 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_10__reduce__[] = "TheoreticalIsotopicPattern.__reduce__(self)";

#line 399 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_11__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 399 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 399 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 399 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = 
#line 399 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_10__reduce__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self));

#line 399 "ms_deisotope/_c/averagine.pyx"


#line 399 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 399 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 399 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 399 "ms_deisotope/_c/averagine.pyx"
}

#line 399 "ms_deisotope/_c/averagine.pyx"


#line 399 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_10__reduce__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 399 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 399 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 399 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 399 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 399 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 399 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 399 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 399 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 399 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 399 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "ms_deisotope/_c/averagine.pyx":400
 * 
 *     def __reduce__(self):
 *         return self.__class__, (self.peaklist, self.origin, self.offset)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */

#line 400 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 400 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)

#line 400 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 400 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 400, __pyx_L1_error)

#line 400 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 400 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 400, __pyx_L1_error)

#line 400 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_3);

#line 400 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error)

#line 400 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_4);

#line 400 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_self->peaklist);

#line 400 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_v_self->peaklist);

#line 400 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self->peaklist);

#line 400 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_2);

#line 400 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);

#line 400 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_3);

#line 400 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);

#line 400 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

#line 400 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = 0;

#line 400 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 400, __pyx_L1_error)

#line 400 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_3);

#line 400 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_1);

#line 400 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);

#line 400 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_4);

#line 400 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);

#line 400 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 400 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = 0;

#line 400 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_3;

#line 400 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = 0;

#line 400 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":399
 *         return TheoreticalIsotopicPattern._create(peaklist, self.origin, self.offset)
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return self.__class__, (self.peaklist, self.origin, self.offset)
 * 
 */

#line 399 "ms_deisotope/_c/averagine.pyx"


#line 399 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 399 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 399 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 399 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 399 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 399 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 399 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 399 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 399 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 399 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 399 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 399 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 399 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":403
 * 
 *     @cython.final
 *     cdef inline list get_processed_peaks(self):             # <<<<<<<<<<<<<<
 *         return self.peaklist
 * 
 */

#line 403 "ms_deisotope/_c/averagine.pyx"


#line 403 "ms_deisotope/_c/averagine.pyx"
static CYTHON_INLINE PyObject *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_processed_peaks(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 403 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 403 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 403 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("get_processed_peaks", 0);

  /* "ms_deisotope/_c/averagine.pyx":404
 *     @cython.final
 *     cdef inline list get_processed_peaks(self):
 *         return self.peaklist             # <<<<<<<<<<<<<<
 * 
 *     cdef inline double get_monoisotopic_mz(self):
 */

#line 404 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 404 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_self->peaklist);

#line 404 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_self->peaklist;

#line 404 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":403
 * 
 *     @cython.final
 *     cdef inline list get_processed_peaks(self):             # <<<<<<<<<<<<<<
 *         return self.peaklist
 * 
 */

#line 403 "ms_deisotope/_c/averagine.pyx"


#line 403 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 403 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 403 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 403 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 403 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 403 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":406
 *         return self.peaklist
 * 
 *     cdef inline double get_monoisotopic_mz(self):             # <<<<<<<<<<<<<<
 *         return self.origin
 * 
 */

#line 406 "ms_deisotope/_c/averagine.pyx"


#line 406 "ms_deisotope/_c/averagine.pyx"
static CYTHON_INLINE double __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_monoisotopic_mz(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 406 "ms_deisotope/_c/averagine.pyx"
  double __pyx_r;

#line 406 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 406 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("get_monoisotopic_mz", 0);

  /* "ms_deisotope/_c/averagine.pyx":407
 * 
 *     cdef inline double get_monoisotopic_mz(self):
 *         return self.origin             # <<<<<<<<<<<<<<
 * 
 *     @property
 */

#line 407 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_self->origin;

#line 407 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":406
 *         return self.peaklist
 * 
 *     cdef inline double get_monoisotopic_mz(self):             # <<<<<<<<<<<<<<
 *         return self.origin
 * 
 */

#line 406 "ms_deisotope/_c/averagine.pyx"


#line 406 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 406 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 406 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 406 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 406 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":410
 * 
 *     @property
 *     def monoisotopic_mz(self):             # <<<<<<<<<<<<<<
 *         return self.get_monoisotopic_mz()
 * 
 */

#line 410 "ms_deisotope/_c/averagine.pyx"


#line 410 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 410 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_15monoisotopic_mz_1__get__(PyObject *__pyx_v_self); /*proto*/

#line 410 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_15monoisotopic_mz_1__get__(PyObject *__pyx_v_self) {

#line 410 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 410 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 410 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = 
#line 410 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_15monoisotopic_mz___get__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self));

#line 410 "ms_deisotope/_c/averagine.pyx"


#line 410 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 410 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 410 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 410 "ms_deisotope/_c/averagine.pyx"
}

#line 410 "ms_deisotope/_c/averagine.pyx"


#line 410 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_15monoisotopic_mz___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 410 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 410 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 410 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 410 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 410 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 410 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 410 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "ms_deisotope/_c/averagine.pyx":411
 *     @property
 *     def monoisotopic_mz(self):
 *         return self.get_monoisotopic_mz()             # <<<<<<<<<<<<<<
 * 
 *     @cython.cdivision
 */

#line 411 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 411 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_monoisotopic_mz(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 411, __pyx_L1_error)

#line 411 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 411 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 411 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 411 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":410
 * 
 *     @property
 *     def monoisotopic_mz(self):             # <<<<<<<<<<<<<<
 *         return self.get_monoisotopic_mz()
 * 
 */

#line 410 "ms_deisotope/_c/averagine.pyx"


#line 410 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 410 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 410 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 410 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.monoisotopic_mz.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 410 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 410 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 410 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 410 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 410 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 410 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":414
 * 
 *     @cython.cdivision
 *     cpdef TheoreticalIsotopicPattern ignore_below(self, double ignore_below=0.0):             # <<<<<<<<<<<<<<
 *         """Discards peaks whose intensity is below ``ignore_below``.
 * 
 */

#line 414 "ms_deisotope/_c/averagine.pyx"


#line 414 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_13ignore_below(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 414 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_ignore_below(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_ignore_below *__pyx_optional_args) {

#line 414 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_ignore_below = ((double)0.0);
  double __pyx_v_total
#line 414 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_kept_tid = 0
#line 414 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_i
#line 414 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 414 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_p = 0
#line 414 "ms_deisotope/_c/averagine.pyx"
;

#line 414 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 414 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 414 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 414 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 414 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_4;

#line 414 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_5;

#line 414 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_6;

#line 414 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_7;

#line 414 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 414 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 414 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("ignore_below", 0);

#line 414 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_optional_args) {

#line 414 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_optional_args->__pyx_n > 0) {

#line 414 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_ignore_below = __pyx_optional_args->ignore_below;

#line 414 "ms_deisotope/_c/averagine.pyx"
    }

#line 414 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":435
 *             size_t i, n
 *             TheoreticalPeak p
 *         total = 0             # <<<<<<<<<<<<<<
 *         kept_tid = []
 *         n = self.get_size()
 */

#line 435 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_total = 0.0;

  /* "ms_deisotope/_c/averagine.pyx":436
 *             TheoreticalPeak p
 *         total = 0
 *         kept_tid = []             # <<<<<<<<<<<<<<
 *         n = self.get_size()
 *         for i in range(n):
 */

#line 436 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error)

#line 436 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 436 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_kept_tid = ((PyObject*)__pyx_t_1);

#line 436 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":437
 *         total = 0
 *         kept_tid = []
 *         n = self.get_size()             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             p = self.get(i)
 */

#line 437 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":438
 *         kept_tid = []
 *         n = self.get_size()
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             p = self.get(i)
 *             if (p.intensity < ignore_below) and (i > 1):
 */

#line 438 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_v_n;

#line 438 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __pyx_t_2;

#line 438 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {

#line 438 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_4;

    /* "ms_deisotope/_c/averagine.pyx":439
 *         n = self.get_size()
 *         for i in range(n):
 *             p = self.get(i)             # <<<<<<<<<<<<<<
 *             if (p.intensity < ignore_below) and (i > 1):
 *                 continue
 */

#line 439 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error)

#line 439 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 439 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1));

#line 439 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":440
 *         for i in range(n):
 *             p = self.get(i)
 *             if (p.intensity < ignore_below) and (i > 1):             # <<<<<<<<<<<<<<
 *                 continue
 *             else:
 */

#line 440 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = ((__pyx_v_p->intensity < __pyx_v_ignore_below) != 0);

#line 440 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_6) {

#line 440 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 440 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_5 = __pyx_t_6;

#line 440 "ms_deisotope/_c/averagine.pyx"
      goto __pyx_L6_bool_binop_done;

#line 440 "ms_deisotope/_c/averagine.pyx"
    }

#line 440 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = ((__pyx_v_i > 1) != 0);

#line 440 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = __pyx_t_6;

#line 440 "ms_deisotope/_c/averagine.pyx"
    __pyx_L6_bool_binop_done:;

#line 440 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_5) {

      /* "ms_deisotope/_c/averagine.pyx":441
 *             p = self.get(i)
 *             if (p.intensity < ignore_below) and (i > 1):
 *                 continue             # <<<<<<<<<<<<<<
 *             else:
 *                 total += p.intensity
 */

#line 441 "ms_deisotope/_c/averagine.pyx"
      goto __pyx_L3_continue;

      /* "ms_deisotope/_c/averagine.pyx":440
 *         for i in range(n):
 *             p = self.get(i)
 *             if (p.intensity < ignore_below) and (i > 1):             # <<<<<<<<<<<<<<
 *                 continue
 *             else:
 */

#line 440 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":443
 *                 continue
 *             else:
 *                 total += p.intensity             # <<<<<<<<<<<<<<
 *                 kept_tid.append(p)
 *         self.peaklist = kept_tid
 */

#line 443 "ms_deisotope/_c/averagine.pyx"
    /*else*/ {

#line 443 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_total = (__pyx_v_total + __pyx_v_p->intensity);

      /* "ms_deisotope/_c/averagine.pyx":444
 *             else:
 *                 total += p.intensity
 *                 kept_tid.append(p)             # <<<<<<<<<<<<<<
 *         self.peaklist = kept_tid
 *         self.offset = self.origin - self.get(0).mz
 */

#line 444 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_kept_tid, ((PyObject *)__pyx_v_p)); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 444, __pyx_L1_error)

#line 444 "ms_deisotope/_c/averagine.pyx"
    }

#line 444 "ms_deisotope/_c/averagine.pyx"
    __pyx_L3_continue:;

#line 444 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":445
 *                 total += p.intensity
 *                 kept_tid.append(p)
 *         self.peaklist = kept_tid             # <<<<<<<<<<<<<<
 *         self.offset = self.origin - self.get(0).mz
 *         n = self.get_size()
 */

#line 445 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_kept_tid);

#line 445 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_v_kept_tid);

#line 445 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_v_self->peaklist);

#line 445 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_v_self->peaklist);

#line 445 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->peaklist = __pyx_v_kept_tid;

  /* "ms_deisotope/_c/averagine.pyx":446
 *                 kept_tid.append(p)
 *         self.peaklist = kept_tid
 *         self.offset = self.origin - self.get(0).mz             # <<<<<<<<<<<<<<
 *         n = self.get_size()
 *         for i in range(n):
 */

#line 446 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error)

#line 446 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 446 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->offset = (__pyx_v_self->origin - ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1)->mz);

#line 446 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":447
 *         self.peaklist = kept_tid
 *         self.offset = self.origin - self.get(0).mz
 *         n = self.get_size()             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             p = self.get(i)
 */

#line 447 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":448
 *         self.offset = self.origin - self.get(0).mz
 *         n = self.get_size()
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             p = self.get(i)
 *             p.intensity /= total
 */

#line 448 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_v_n;

#line 448 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __pyx_t_2;

#line 448 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {

#line 448 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_4;

    /* "ms_deisotope/_c/averagine.pyx":449
 *         n = self.get_size()
 *         for i in range(n):
 *             p = self.get(i)             # <<<<<<<<<<<<<<
 *             p.intensity /= total
 *         return self
 */

#line 449 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)

#line 449 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 449 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1));

#line 449 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":450
 *         for i in range(n):
 *             p = self.get(i)
 *             p.intensity /= total             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

#line 450 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_p->intensity = (__pyx_v_p->intensity / __pyx_v_total);

#line 450 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":451
 *             p = self.get(i)
 *             p.intensity /= total
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     cpdef TheoreticalIsotopicPattern shift(self, double mz):
 */

#line 451 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 451 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_v_self));

#line 451 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_self;

#line 451 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":414
 * 
 *     @cython.cdivision
 *     cpdef TheoreticalIsotopicPattern ignore_below(self, double ignore_below=0.0):             # <<<<<<<<<<<<<<
 *         """Discards peaks whose intensity is below ``ignore_below``.
 * 
 */

#line 414 "ms_deisotope/_c/averagine.pyx"


#line 414 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 414 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.ignore_below", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 414 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_kept_tid);

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_p);

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 414 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 414 "ms_deisotope/_c/averagine.pyx"
}

#line 414 "ms_deisotope/_c/averagine.pyx"


#line 414 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 414 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_13ignore_below(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 414 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_12ignore_below[] = "TheoreticalIsotopicPattern.ignore_below(self, double ignore_below=0.0) -> TheoreticalIsotopicPattern\nDiscards peaks whose intensity is below ``ignore_below``.\n\n        After discarding peaks, the pattern will be renormalized to\n        sum to ``1.0``\n\n        Parameters\n        ----------\n        ignore_below : float, optional\n            The threshold below which peaks will be discarded\n\n        Returns\n        -------\n        TheoreticalIsotopicPattern\n            self\n        ";

#line 414 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_13ignore_below(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_ignore_below
#line 414 "ms_deisotope/_c/averagine.pyx"
;

#line 414 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 414 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 414 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 414 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("ignore_below (wrapper)", 0);

#line 414 "ms_deisotope/_c/averagine.pyx"
  {

#line 414 "ms_deisotope/_c/averagine.pyx"
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ignore_below,0};

#line 414 "ms_deisotope/_c/averagine.pyx"
    PyObject* values[1] = {0};

#line 414 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_kwds)) {

#line 414 "ms_deisotope/_c/averagine.pyx"
      Py_ssize_t kw_args;

#line 414 "ms_deisotope/_c/averagine.pyx"
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);

#line 414 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {
        case  1: 
#line 414 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 414 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 414 "ms_deisotope/_c/averagine.pyx"
        case  0: break;
        default: 
#line 414 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 414 "ms_deisotope/_c/averagine.pyx"
      }

#line 414 "ms_deisotope/_c/averagine.pyx"
      kw_args = PyDict_Size(__pyx_kwds);

#line 414 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {

#line 414 "ms_deisotope/_c/averagine.pyx"
        case  0:

#line 414 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 414 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ignore_below);

#line 414 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[0] = value; kw_args--; }

#line 414 "ms_deisotope/_c/averagine.pyx"
        }

#line 414 "ms_deisotope/_c/averagine.pyx"
      }

#line 414 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(kw_args > 0)) {

#line 414 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ignore_below") < 0)) __PYX_ERR(0, 414, __pyx_L3_error)

#line 414 "ms_deisotope/_c/averagine.pyx"
      }

#line 414 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 414 "ms_deisotope/_c/averagine.pyx"
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: 
#line 414 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 414 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  0: 
#line 414 "ms_deisotope/_c/averagine.pyx"
break;
        default: 
#line 414 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 414 "ms_deisotope/_c/averagine.pyx"
      }

#line 414 "ms_deisotope/_c/averagine.pyx"
    }

#line 414 "ms_deisotope/_c/averagine.pyx"
    if (values[0]) {

#line 414 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_ignore_below = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_ignore_below == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L3_error)

#line 414 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 414 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_ignore_below = ((double)0.0);

#line 414 "ms_deisotope/_c/averagine.pyx"
    }

#line 414 "ms_deisotope/_c/averagine.pyx"
  }

#line 414 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ignore_below", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); 
#line 414 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 414, __pyx_L3_error)

#line 414 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.ignore_below", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 414 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 414 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_12ignore_below(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self), __pyx_v_ignore_below);

#line 414 "ms_deisotope/_c/averagine.pyx"


#line 414 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 414 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 414 "ms_deisotope/_c/averagine.pyx"
}

#line 414 "ms_deisotope/_c/averagine.pyx"


#line 414 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_12ignore_below(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_ignore_below) {

#line 414 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 414 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 414 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_ignore_below __pyx_t_2;

#line 414 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 414 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 414 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("ignore_below", 0);

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 414 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.__pyx_n = 1;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.ignore_below = __pyx_v_ignore_below;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern->ignore_below(__pyx_v_self, 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error)

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 414 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 414 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 414 "ms_deisotope/_c/averagine.pyx"


#line 414 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 414 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.ignore_below", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 414 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 414 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 414 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 414 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":453
 *         return self
 * 
 *     cpdef TheoreticalIsotopicPattern shift(self, double mz):             # <<<<<<<<<<<<<<
 *         """Shift all the m/z of peaks in the isotopic pattern by ``offset``
 *         m/z.
 */

#line 453 "ms_deisotope/_c/averagine.pyx"


#line 453 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_15shift(PyObject *__pyx_v_self, PyObject *__pyx_arg_mz); /*proto*/

#line 453 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_shift(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_mz, CYTHON_UNUSED int __pyx_skip_dispatch) {
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_peak = 0
#line 453 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_i
#line 453 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 453 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_delta
#line 453 "ms_deisotope/_c/averagine.pyx"
;

#line 453 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 453 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_1;

#line 453 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 453 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 453 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 453 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 453 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 453 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("shift", 0);

  /* "ms_deisotope/_c/averagine.pyx":475
 *             double delta
 * 
 *         delta = mz - self.origin             # <<<<<<<<<<<<<<
 *         self.origin = mz
 * 
 */

#line 475 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_delta = (__pyx_v_mz - __pyx_v_self->origin);

  /* "ms_deisotope/_c/averagine.pyx":476
 * 
 *         delta = mz - self.origin
 *         self.origin = mz             # <<<<<<<<<<<<<<
 * 
 *         n = self.get_size()
 */

#line 476 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->origin = __pyx_v_mz;

  /* "ms_deisotope/_c/averagine.pyx":478
 *         self.origin = mz
 * 
 *         n = self.get_size()             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             peak = self.get(i)
 */

#line 478 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":479
 * 
 *         n = self.get_size()
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             peak = self.get(i)
 *             peak.mz += delta
 */

#line 479 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_v_n;

#line 479 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_t_1;

#line 479 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {

#line 479 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_3;

    /* "ms_deisotope/_c/averagine.pyx":480
 *         n = self.get_size()
 *         for i in range(n):
 *             peak = self.get(i)             # <<<<<<<<<<<<<<
 *             peak.mz += delta
 *         return self
 */

#line 480 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 480, __pyx_L1_error)

#line 480 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_4);

#line 480 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_peak, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_4));

#line 480 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = 0;

    /* "ms_deisotope/_c/averagine.pyx":481
 *         for i in range(n):
 *             peak = self.get(i)
 *             peak.mz += delta             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

#line 481 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_peak->mz = (__pyx_v_peak->mz + __pyx_v_delta);

#line 481 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":482
 *             peak = self.get(i)
 *             peak.mz += delta
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     cdef TheoreticalIsotopicPattern clone_shift(self, double mz):
 */

#line 482 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 482 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_v_self));

#line 482 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_self;

#line 482 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":453
 *         return self
 * 
 *     cpdef TheoreticalIsotopicPattern shift(self, double mz):             # <<<<<<<<<<<<<<
 *         """Shift all the m/z of peaks in the isotopic pattern by ``offset``
 *         m/z.
 */

#line 453 "ms_deisotope/_c/averagine.pyx"


#line 453 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 453 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.shift", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 453 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_peak);

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 453 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 453 "ms_deisotope/_c/averagine.pyx"
}

#line 453 "ms_deisotope/_c/averagine.pyx"


#line 453 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 453 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_15shift(PyObject *__pyx_v_self, PyObject *__pyx_arg_mz); /*proto*/

#line 453 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_14shift[] = "TheoreticalIsotopicPattern.shift(self, double mz) -> TheoreticalIsotopicPattern\nShift all the m/z of peaks in the isotopic pattern by ``offset``\n        m/z.\n\n        This will update :attr:`origin` to reflect the new starting\n        monoisotopic m/z.\n\n        Parameters\n        ----------\n        offset : float\n            The amount to shift each peak in the pattern by in m/z\n\n        Returns\n        -------\n        TheoreticalIsotopicPattern\n            self\n        ";

#line 453 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_15shift(PyObject *__pyx_v_self, PyObject *__pyx_arg_mz) {
  double __pyx_v_mz
#line 453 "ms_deisotope/_c/averagine.pyx"
;

#line 453 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 453 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 453 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 453 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("shift (wrapper)", 0);

#line 453 "ms_deisotope/_c/averagine.pyx"
  assert(__pyx_arg_mz); {

#line 453 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_mz = __pyx_PyFloat_AsDouble(__pyx_arg_mz); if (unlikely((__pyx_v_mz == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 453, __pyx_L3_error)

#line 453 "ms_deisotope/_c/averagine.pyx"
  }

#line 453 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.shift", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 453 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 453 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_14shift(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self), ((double)__pyx_v_mz));

#line 453 "ms_deisotope/_c/averagine.pyx"


#line 453 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 453 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 453 "ms_deisotope/_c/averagine.pyx"
}

#line 453 "ms_deisotope/_c/averagine.pyx"


#line 453 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_14shift(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_mz) {

#line 453 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 453 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 453 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 453 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 453 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("shift", 0);

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 453 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_shift(__pyx_v_self, __pyx_v_mz, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 453 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 453 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 453 "ms_deisotope/_c/averagine.pyx"


#line 453 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 453 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.shift", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 453 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 453 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 453 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 453 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":484
 *         return self
 * 
 *     cdef TheoreticalIsotopicPattern clone_shift(self, double mz):             # <<<<<<<<<<<<<<
 *         cdef:
 *             size_t i, n
 */

#line 484 "ms_deisotope/_c/averagine.pyx"


#line 484 "ms_deisotope/_c/averagine.pyx"
static CYTHON_INLINE struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone_shift(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_mz) {
  size_t __pyx_v_i
#line 484 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 484 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_p = 0
#line 484 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_peaklist = 0
#line 484 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_delta
#line 484 "ms_deisotope/_c/averagine.pyx"
;

#line 484 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 484 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 484 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 484 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 484 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 484 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_4;

#line 484 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 484 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 484 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 484 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("clone_shift", 0);

  /* "ms_deisotope/_c/averagine.pyx":491
 *             double delta
 * 
 *         delta = mz - self.origin             # <<<<<<<<<<<<<<
 *         n = self.get_size()
 *         peaklist = PyList_New(n)
 */

#line 491 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_delta = (__pyx_v_mz - __pyx_v_self->origin);

  /* "ms_deisotope/_c/averagine.pyx":492
 * 
 *         delta = mz - self.origin
 *         n = self.get_size()             # <<<<<<<<<<<<<<
 *         peaklist = PyList_New(n)
 *         for i in range(n):
 */

#line 492 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":493
 *         delta = mz - self.origin
 *         n = self.get_size()
 *         peaklist = PyList_New(n)             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             p = self.get(i)
 */

#line 493 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyList_New(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error)

#line 493 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 493 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_peaklist = ((PyObject*)__pyx_t_1);

#line 493 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":494
 *         n = self.get_size()
 *         peaklist = PyList_New(n)
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             p = self.get(i)
 *             p = TheoreticalPeak._create(p.mz + delta, p.intensity, p.charge)
 */

#line 494 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_v_n;

#line 494 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __pyx_t_2;

#line 494 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {

#line 494 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_4;

    /* "ms_deisotope/_c/averagine.pyx":495
 *         peaklist = PyList_New(n)
 *         for i in range(n):
 *             p = self.get(i)             # <<<<<<<<<<<<<<
 *             p = TheoreticalPeak._create(p.mz + delta, p.intensity, p.charge)
 *             Py_INCREF(p)
 */

#line 495 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error)

#line 495 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 495 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1));

#line 495 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":496
 *         for i in range(n):
 *             p = self.get(i)
 *             p = TheoreticalPeak._create(p.mz + delta, p.intensity, p.charge)             # <<<<<<<<<<<<<<
 *             Py_INCREF(p)
 *             PyList_SET_ITEM(peaklist, i, p)
 */

#line 496 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak->_create((__pyx_v_p->mz + __pyx_v_delta), __pyx_v_p->intensity, __pyx_v_p->charge)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error)

#line 496 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 496 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF_SET(__pyx_v_p, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1));

#line 496 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":497
 *             p = self.get(i)
 *             p = TheoreticalPeak._create(p.mz + delta, p.intensity, p.charge)
 *             Py_INCREF(p)             # <<<<<<<<<<<<<<
 *             PyList_SET_ITEM(peaklist, i, p)
 *         return TheoreticalIsotopicPattern._create(peaklist, mz, self.offset)
 */

#line 497 "ms_deisotope/_c/averagine.pyx"
    Py_INCREF(((PyObject *)__pyx_v_p));

    /* "ms_deisotope/_c/averagine.pyx":498
 *             p = TheoreticalPeak._create(p.mz + delta, p.intensity, p.charge)
 *             Py_INCREF(p)
 *             PyList_SET_ITEM(peaklist, i, p)             # <<<<<<<<<<<<<<
 *         return TheoreticalIsotopicPattern._create(peaklist, mz, self.offset)
 * 
 */

#line 498 "ms_deisotope/_c/averagine.pyx"
    PyList_SET_ITEM(__pyx_v_peaklist, __pyx_v_i, ((PyObject *)__pyx_v_p));

#line 498 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":499
 *             Py_INCREF(p)
 *             PyList_SET_ITEM(peaklist, i, p)
 *         return TheoreticalIsotopicPattern._create(peaklist, mz, self.offset)             # <<<<<<<<<<<<<<
 * 
 *     @cython.cdivision
 */

#line 499 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 499 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__create(__pyx_v_peaklist, __pyx_v_mz, __pyx_v_self->offset)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error)

#line 499 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 499 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_1);

#line 499 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 499 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":484
 *         return self
 * 
 *     cdef TheoreticalIsotopicPattern clone_shift(self, double mz):             # <<<<<<<<<<<<<<
 *         cdef:
 *             size_t i, n
 */

#line 484 "ms_deisotope/_c/averagine.pyx"


#line 484 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 484 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 484 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 484 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.clone_shift", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 484 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 484 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 484 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_p);

#line 484 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_peaklist);

#line 484 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 484 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 484 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 484 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":502
 * 
 *     @cython.cdivision
 *     cpdef TheoreticalIsotopicPattern truncate_after(self, double truncate_after=0.95):             # <<<<<<<<<<<<<<
 *         """Drops peaks from the end of the isotopic pattern
 *         which make up the last ``1 - truncate_after`` percent
 */

#line 502 "ms_deisotope/_c/averagine.pyx"


#line 502 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_17truncate_after(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 502 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_truncate_after(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_truncate_after *__pyx_optional_args) {

#line 502 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_truncate_after = ((double)0.95);
  double __pyx_v_cumsum
#line 502 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_normalizer
#line 502 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_peak = 0
#line 502 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_result = 0
#line 502 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_i
#line 502 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 502 "ms_deisotope/_c/averagine.pyx"
;

#line 502 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 502 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 502 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 502 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 502 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_4;

#line 502 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_5;

#line 502 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_6;

#line 502 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 502 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 502 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("truncate_after", 0);

#line 502 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_optional_args) {

#line 502 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_optional_args->__pyx_n > 0) {

#line 502 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_truncate_after = __pyx_optional_args->truncate_after;

#line 502 "ms_deisotope/_c/averagine.pyx"
    }

#line 502 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":525
 *             list result
 *             size_t i, n
 *         cumsum = 0             # <<<<<<<<<<<<<<
 *         result = []
 *         n = self.get_size()
 */

#line 525 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_cumsum = 0.0;

  /* "ms_deisotope/_c/averagine.pyx":526
 *             size_t i, n
 *         cumsum = 0
 *         result = []             # <<<<<<<<<<<<<<
 *         n = self.get_size()
 *         for i in range(n):
 */

#line 526 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error)

#line 526 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 526 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_result = ((PyObject*)__pyx_t_1);

#line 526 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":527
 *         cumsum = 0
 *         result = []
 *         n = self.get_size()             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             peak = self.get(i)
 */

#line 527 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":528
 *         result = []
 *         n = self.get_size()
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             peak = self.get(i)
 *             cumsum += peak.intensity
 */

#line 528 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_v_n;

#line 528 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __pyx_t_2;

#line 528 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {

#line 528 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_4;

    /* "ms_deisotope/_c/averagine.pyx":529
 *         n = self.get_size()
 *         for i in range(n):
 *             peak = self.get(i)             # <<<<<<<<<<<<<<
 *             cumsum += peak.intensity
 *             PyList_Append(result, peak)
 */

#line 529 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)

#line 529 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 529 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_peak, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1));

#line 529 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":530
 *         for i in range(n):
 *             peak = self.get(i)
 *             cumsum += peak.intensity             # <<<<<<<<<<<<<<
 *             PyList_Append(result, peak)
 *             if cumsum >= truncate_after:
 */

#line 530 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_cumsum = (__pyx_v_cumsum + __pyx_v_peak->intensity);

    /* "ms_deisotope/_c/averagine.pyx":531
 *             peak = self.get(i)
 *             cumsum += peak.intensity
 *             PyList_Append(result, peak)             # <<<<<<<<<<<<<<
 *             if cumsum >= truncate_after:
 *                 break
 */

#line 531 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_v_peak)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 531, __pyx_L1_error)

    /* "ms_deisotope/_c/averagine.pyx":532
 *             cumsum += peak.intensity
 *             PyList_Append(result, peak)
 *             if cumsum >= truncate_after:             # <<<<<<<<<<<<<<
 *                 break
 *         self.peaklist = result
 */

#line 532 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = ((__pyx_v_cumsum >= __pyx_v_truncate_after) != 0);

#line 532 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_6) {

      /* "ms_deisotope/_c/averagine.pyx":533
 *             PyList_Append(result, peak)
 *             if cumsum >= truncate_after:
 *                 break             # <<<<<<<<<<<<<<
 *         self.peaklist = result
 *         n = self.get_size()
 */

#line 533 "ms_deisotope/_c/averagine.pyx"
      goto __pyx_L4_break;

      /* "ms_deisotope/_c/averagine.pyx":532
 *             cumsum += peak.intensity
 *             PyList_Append(result, peak)
 *             if cumsum >= truncate_after:             # <<<<<<<<<<<<<<
 *                 break
 *         self.peaklist = result
 */

#line 532 "ms_deisotope/_c/averagine.pyx"
    }

#line 532 "ms_deisotope/_c/averagine.pyx"
  }

#line 532 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_break:;

  /* "ms_deisotope/_c/averagine.pyx":534
 *             if cumsum >= truncate_after:
 *                 break
 *         self.peaklist = result             # <<<<<<<<<<<<<<
 *         n = self.get_size()
 *         normalizer = 1. / cumsum
 */

#line 534 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_result);

#line 534 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_v_result);

#line 534 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_v_self->peaklist);

#line 534 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_v_self->peaklist);

#line 534 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->peaklist = __pyx_v_result;

  /* "ms_deisotope/_c/averagine.pyx":535
 *                 break
 *         self.peaklist = result
 *         n = self.get_size()             # <<<<<<<<<<<<<<
 *         normalizer = 1. / cumsum
 *         for i in range(n):
 */

#line 535 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":536
 *         self.peaklist = result
 *         n = self.get_size()
 *         normalizer = 1. / cumsum             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             peak = self.get(i)
 */

#line 536 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_normalizer = (1. / __pyx_v_cumsum);

  /* "ms_deisotope/_c/averagine.pyx":537
 *         n = self.get_size()
 *         normalizer = 1. / cumsum
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             peak = self.get(i)
 *             peak.intensity *= normalizer
 */

#line 537 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_v_n;

#line 537 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __pyx_t_2;

#line 537 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {

#line 537 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_4;

    /* "ms_deisotope/_c/averagine.pyx":538
 *         normalizer = 1. / cumsum
 *         for i in range(n):
 *             peak = self.get(i)             # <<<<<<<<<<<<<<
 *             peak.intensity *= normalizer
 *         return self
 */

#line 538 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error)

#line 538 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 538 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_peak, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1));

#line 538 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":539
 *         for i in range(n):
 *             peak = self.get(i)
 *             peak.intensity *= normalizer             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

#line 539 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_peak->intensity = (__pyx_v_peak->intensity * __pyx_v_normalizer);

#line 539 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":540
 *             peak = self.get(i)
 *             peak.intensity *= normalizer
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     cpdef TheoreticalIsotopicPattern scale(self, list experimental_distribution, str method="sum"):
 */

#line 540 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 540 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_v_self));

#line 540 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_self;

#line 540 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":502
 * 
 *     @cython.cdivision
 *     cpdef TheoreticalIsotopicPattern truncate_after(self, double truncate_after=0.95):             # <<<<<<<<<<<<<<
 *         """Drops peaks from the end of the isotopic pattern
 *         which make up the last ``1 - truncate_after`` percent
 */

#line 502 "ms_deisotope/_c/averagine.pyx"


#line 502 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 502 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.truncate_after", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 502 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_peak);

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_result);

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 502 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 502 "ms_deisotope/_c/averagine.pyx"
}

#line 502 "ms_deisotope/_c/averagine.pyx"


#line 502 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 502 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_17truncate_after(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 502 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_16truncate_after[] = "TheoreticalIsotopicPattern.truncate_after(self, double truncate_after=0.95) -> TheoreticalIsotopicPattern\nDrops peaks from the end of the isotopic pattern\n        which make up the last ``1 - truncate_after`` percent\n        of the isotopic pattern.\n\n        After truncation, the pattern is renormalized to sum to ``1``\n\n        Parameters\n        ----------\n        truncate_after : float, optional\n            The percentage of the isotopic pattern signal to retain. Defaults\n            to 0.95.\n\n        Returns\n        -------\n        TheoreticalIsotopicPattern\n            self\n        ";

#line 502 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_17truncate_after(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_truncate_after
#line 502 "ms_deisotope/_c/averagine.pyx"
;

#line 502 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 502 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 502 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 502 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("truncate_after (wrapper)", 0);

#line 502 "ms_deisotope/_c/averagine.pyx"
  {

#line 502 "ms_deisotope/_c/averagine.pyx"
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_truncate_after,0};

#line 502 "ms_deisotope/_c/averagine.pyx"
    PyObject* values[1] = {0};

#line 502 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_kwds)) {

#line 502 "ms_deisotope/_c/averagine.pyx"
      Py_ssize_t kw_args;

#line 502 "ms_deisotope/_c/averagine.pyx"
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);

#line 502 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {
        case  1: 
#line 502 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 502 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 502 "ms_deisotope/_c/averagine.pyx"
        case  0: break;
        default: 
#line 502 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 502 "ms_deisotope/_c/averagine.pyx"
      }

#line 502 "ms_deisotope/_c/averagine.pyx"
      kw_args = PyDict_Size(__pyx_kwds);

#line 502 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {

#line 502 "ms_deisotope/_c/averagine.pyx"
        case  0:

#line 502 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 502 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncate_after);

#line 502 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[0] = value; kw_args--; }

#line 502 "ms_deisotope/_c/averagine.pyx"
        }

#line 502 "ms_deisotope/_c/averagine.pyx"
      }

#line 502 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(kw_args > 0)) {

#line 502 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "truncate_after") < 0)) __PYX_ERR(0, 502, __pyx_L3_error)

#line 502 "ms_deisotope/_c/averagine.pyx"
      }

#line 502 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 502 "ms_deisotope/_c/averagine.pyx"
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: 
#line 502 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 502 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  0: 
#line 502 "ms_deisotope/_c/averagine.pyx"
break;
        default: 
#line 502 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 502 "ms_deisotope/_c/averagine.pyx"
      }

#line 502 "ms_deisotope/_c/averagine.pyx"
    }

#line 502 "ms_deisotope/_c/averagine.pyx"
    if (values[0]) {

#line 502 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_truncate_after = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_truncate_after == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 502, __pyx_L3_error)

#line 502 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 502 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_truncate_after = ((double)0.95);

#line 502 "ms_deisotope/_c/averagine.pyx"
    }

#line 502 "ms_deisotope/_c/averagine.pyx"
  }

#line 502 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("truncate_after", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); 
#line 502 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 502, __pyx_L3_error)

#line 502 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.truncate_after", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 502 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 502 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_16truncate_after(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self), __pyx_v_truncate_after);

#line 502 "ms_deisotope/_c/averagine.pyx"


#line 502 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 502 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 502 "ms_deisotope/_c/averagine.pyx"
}

#line 502 "ms_deisotope/_c/averagine.pyx"


#line 502 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_16truncate_after(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_truncate_after) {

#line 502 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 502 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 502 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_truncate_after __pyx_t_2;

#line 502 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 502 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 502 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("truncate_after", 0);

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 502 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.__pyx_n = 1;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.truncate_after = __pyx_v_truncate_after;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern->truncate_after(__pyx_v_self, 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L1_error)

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 502 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 502 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 502 "ms_deisotope/_c/averagine.pyx"


#line 502 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 502 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.truncate_after", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 502 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 502 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 502 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 502 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":542
 *         return self
 * 
 *     cpdef TheoreticalIsotopicPattern scale(self, list experimental_distribution, str method="sum"):             # <<<<<<<<<<<<<<
 *         r"""Scales ``self``'s intensity to match the intensity distribution of the
 *         experimental isotopic pattern in ``experimental_distribution``.
 */

#line 542 "ms_deisotope/_c/averagine.pyx"


#line 542 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_19scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 542 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_experimental_distribution, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale *__pyx_optional_args) {

#line 542 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_v_method = ((PyObject*)__pyx_n_s_sum);

#line 542 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 542 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 542 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__scale __pyx_t_2;

#line 542 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 542 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 542 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("scale", 0);

#line 542 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_optional_args) {

#line 542 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_optional_args->__pyx_n > 0) {

#line 542 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_method = __pyx_optional_args->method;

#line 542 "ms_deisotope/_c/averagine.pyx"
    }

#line 542 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":580
 *             self
 *         """
 *         return self._scale(experimental_distribution, method)             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */

#line 580 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 580 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.__pyx_n = 1;

#line 580 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.method = __pyx_v_method;

#line 580 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__scale(__pyx_v_self, __pyx_v_experimental_distribution, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error)

#line 580 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 580 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_1);

#line 580 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 580 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":542
 *         return self
 * 
 *     cpdef TheoreticalIsotopicPattern scale(self, list experimental_distribution, str method="sum"):             # <<<<<<<<<<<<<<
 *         r"""Scales ``self``'s intensity to match the intensity distribution of the
 *         experimental isotopic pattern in ``experimental_distribution``.
 */

#line 542 "ms_deisotope/_c/averagine.pyx"


#line 542 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.scale", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 542 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 542 "ms_deisotope/_c/averagine.pyx"
}

#line 542 "ms_deisotope/_c/averagine.pyx"


#line 542 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 542 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_19scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 542 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_18scale[] = "TheoreticalIsotopicPattern.scale(self, list experimental_distribution, str method='sum') -> TheoreticalIsotopicPattern\nScales ``self``'s intensity to match the intensity distribution of the\n        experimental isotopic pattern in ``experimental_distribution``.\n\n        The ``method`` argument must be one of:\n\n        `\"sum\"`:\n            Scale each peak of the theoretical distribution by the sum of the\n            intensity in the experimental distribution such that the sums of their\n            intensities are equal.\n\n        `\"max\"`:\n            Select the most abundant peak in the theoretical distribution :math:`t_i`, find it's\n            match in the experimental distribution :math:`e_i`, find the scaling factor\n            :math:`\\alpha = \\frac{e_i}{t_i}` which will make :math:`e_i == t_i` and scale all\n            peaks in self by :math:`\\alpha`\n\n        `\"basepeak\"`:\n            As in `\"max\"`, except the most abundant peak index is taken from the *experimental*\n            distribution\n\n        `\"top3\"`:\n            The as in `\"max\"`, but the scaling factor is the mean of the scale factors for the\n            top three most abundant theoretical peaks.\n\n\n        Parameters\n        ----------\n        experimental_distribution : list\n            The experimental peaks matched\n        method : str, optional\n            The scaling method to use. Defaults to ``\"sum\"``\n\n        Returns\n        -------\n        TheoreticalIsotopicPattern\n            self\n        ";

#line 542 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_19scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_experimental_distribution = 0
#line 542 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_method = 0
#line 542 "ms_deisotope/_c/averagine.pyx"
;

#line 542 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 542 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 542 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 542 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("scale (wrapper)", 0);

#line 542 "ms_deisotope/_c/averagine.pyx"
  {

#line 542 "ms_deisotope/_c/averagine.pyx"
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_experimental_distribution,&__pyx_n_s_method,0};

#line 542 "ms_deisotope/_c/averagine.pyx"
    PyObject* values[2] = {0,0};

#line 542 "ms_deisotope/_c/averagine.pyx"
    values[1] = ((PyObject*)__pyx_n_s_sum);

#line 542 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_kwds)) {

#line 542 "ms_deisotope/_c/averagine.pyx"
      Py_ssize_t kw_args;

#line 542 "ms_deisotope/_c/averagine.pyx"
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);

#line 542 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {
        case  2: 
#line 542 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 542 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 542 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 542 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 542 "ms_deisotope/_c/averagine.pyx"
        case  0: break;
        default: 
#line 542 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 542 "ms_deisotope/_c/averagine.pyx"
      }

#line 542 "ms_deisotope/_c/averagine.pyx"
      kw_args = PyDict_Size(__pyx_kwds);

#line 542 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {

#line 542 "ms_deisotope/_c/averagine.pyx"
        case  0:

#line 542 "ms_deisotope/_c/averagine.pyx"
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_experimental_distribution)) != 0)) kw_args--;
        else 
#line 542 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 542 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 542 "ms_deisotope/_c/averagine.pyx"
        case  1:

#line 542 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 542 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_method);

#line 542 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[1] = value; kw_args--; }

#line 542 "ms_deisotope/_c/averagine.pyx"
        }

#line 542 "ms_deisotope/_c/averagine.pyx"
      }

#line 542 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(kw_args > 0)) {

#line 542 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) __PYX_ERR(0, 542, __pyx_L3_error)

#line 542 "ms_deisotope/_c/averagine.pyx"
      }

#line 542 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 542 "ms_deisotope/_c/averagine.pyx"
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: 
#line 542 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 542 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 542 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 542 "ms_deisotope/_c/averagine.pyx"
        break;
        default: 
#line 542 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 542 "ms_deisotope/_c/averagine.pyx"
      }

#line 542 "ms_deisotope/_c/averagine.pyx"
    }

#line 542 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_experimental_distribution = ((PyObject*)values[0]);

#line 542 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_method = ((PyObject*)values[1]);

#line 542 "ms_deisotope/_c/averagine.pyx"
  }

#line 542 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("scale", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); 
#line 542 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 542, __pyx_L3_error)

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.scale", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 542 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;

#line 542 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_experimental_distribution), (&PyList_Type), 1, "experimental_distribution", 1))) __PYX_ERR(0, 542, __pyx_L1_error)

#line 542 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_method), (&PyString_Type), 1, "method", 1))) __PYX_ERR(0, 542, __pyx_L1_error)
  __pyx_r = 
#line 542 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_18scale(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self), __pyx_v_experimental_distribution, __pyx_v_method);

#line 542 "ms_deisotope/_c/averagine.pyx"


#line 542 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 542 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 542 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 542 "ms_deisotope/_c/averagine.pyx"
}

#line 542 "ms_deisotope/_c/averagine.pyx"


#line 542 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_18scale(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_experimental_distribution, PyObject *__pyx_v_method) {

#line 542 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 542 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 542 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale __pyx_t_2;

#line 542 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 542 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 542 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("scale", 0);

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.__pyx_n = 1;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.method = __pyx_v_method;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern->scale(__pyx_v_self, __pyx_v_experimental_distribution, 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error)

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 542 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 542 "ms_deisotope/_c/averagine.pyx"


#line 542 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.scale", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 542 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 542 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 542 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":584
 *     @cython.final
 *     @cython.cdivision
 *     cdef inline TheoreticalIsotopicPattern _scale(self, list experimental_distribution, str method="sum"):             # <<<<<<<<<<<<<<
 *         cdef:
 *             size_t i, j, n
 */

#line 584 "ms_deisotope/_c/averagine.pyx"


#line 584 "ms_deisotope/_c/averagine.pyx"
static CYTHON_INLINE struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__scale(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_experimental_distribution, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__scale *__pyx_optional_args) {

#line 584 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_v_method = ((PyObject*)__pyx_n_s_sum);
  size_t __pyx_v_i
#line 584 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_j
#line 584 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 584 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_peak = 0
#line 584 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *__pyx_v_expeak = 0
#line 584 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_total_abundance
#line 584 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_maximum
#line 584 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_scale_factor
#line 584 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_weights
#line 584 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_scales
#line 584 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_w
#line 584 "ms_deisotope/_c/averagine.pyx"
;

#line 584 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 584 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 584 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_1;

#line 584 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 584 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 584 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_4;

#line 584 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_5;

#line 584 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_6;

#line 584 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_7;

#line 584 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_t_8 = NULL;

#line 584 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_9;

#line 584 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_10;

#line 584 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 584 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 584 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 584 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("_scale", 0);

#line 584 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_optional_args) {

#line 584 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_optional_args->__pyx_n > 0) {

#line 584 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_method = __pyx_optional_args->method;

#line 584 "ms_deisotope/_c/averagine.pyx"
    }

#line 584 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":592
 *             double weights, scales, w
 * 
 *         n = self.get_size()             # <<<<<<<<<<<<<<
 *         if n == 0:
 *             raise ValueError("Isotopic Pattern has length 0 (%f, %r)" % (self.origin, self.peaklist))
 */

#line 592 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":593
 * 
 *         n = self.get_size()
 *         if n == 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Isotopic Pattern has length 0 (%f, %r)" % (self.origin, self.peaklist))
 *         if method == "sum":
 */

#line 593 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((__pyx_v_n == 0) != 0);

#line 593 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_t_1)) {

    /* "ms_deisotope/_c/averagine.pyx":594
 *         n = self.get_size()
 *         if n == 0:
 *             raise ValueError("Isotopic Pattern has length 0 (%f, %r)" % (self.origin, self.peaklist))             # <<<<<<<<<<<<<<
 *         if method == "sum":
 *             total_abundance = sum_intensity(experimental_distribution, n)
 */

#line 594 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 594, __pyx_L1_error)

#line 594 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);

#line 594 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error)

#line 594 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 594 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GIVEREF(__pyx_t_2);

#line 594 "ms_deisotope/_c/averagine.pyx"
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);

#line 594 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_v_self->peaklist);

#line 594 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GIVEREF(__pyx_v_self->peaklist);

#line 594 "ms_deisotope/_c/averagine.pyx"
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self->peaklist);

#line 594 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = 0;

#line 594 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Isotopic_Pattern_has_length_0_f, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 594, __pyx_L1_error)

#line 594 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);

#line 594 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 594 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error)

#line 594 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 594 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 594 "ms_deisotope/_c/averagine.pyx"
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);

#line 594 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 594 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 594, __pyx_L1_error)

    /* "ms_deisotope/_c/averagine.pyx":593
 * 
 *         n = self.get_size()
 *         if n == 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Isotopic Pattern has length 0 (%f, %r)" % (self.origin, self.peaklist))
 *         if method == "sum":
 */

#line 593 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":595
 *         if n == 0:
 *             raise ValueError("Isotopic Pattern has length 0 (%f, %r)" % (self.origin, self.peaklist))
 *         if method == "sum":             # <<<<<<<<<<<<<<
 *             total_abundance = sum_intensity(experimental_distribution, n)
 *             for i in range(n):
 */

#line 595 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_sum, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 595, __pyx_L1_error)

#line 595 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = (__pyx_t_1 != 0);

#line 595 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_4) {

    /* "ms_deisotope/_c/averagine.pyx":596
 *             raise ValueError("Isotopic Pattern has length 0 (%f, %r)" % (self.origin, self.peaklist))
 *         if method == "sum":
 *             total_abundance = sum_intensity(experimental_distribution, n)             # <<<<<<<<<<<<<<
 *             for i in range(n):
 *                 (<TheoreticalPeak>self.get(i)).intensity *= total_abundance
 */

#line 596 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_total_abundance = __pyx_f_12ms_deisotope_2_c_9averagine_sum_intensity(__pyx_v_experimental_distribution, __pyx_v_n);

    /* "ms_deisotope/_c/averagine.pyx":597
 *         if method == "sum":
 *             total_abundance = sum_intensity(experimental_distribution, n)
 *             for i in range(n):             # <<<<<<<<<<<<<<
 *                 (<TheoreticalPeak>self.get(i)).intensity *= total_abundance
 *         elif method == "max":
 */

#line 597 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = __pyx_v_n;

#line 597 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = __pyx_t_5;

#line 597 "ms_deisotope/_c/averagine.pyx"
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {

#line 597 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_i = __pyx_t_7;

      /* "ms_deisotope/_c/averagine.pyx":598
 *             total_abundance = sum_intensity(experimental_distribution, n)
 *             for i in range(n):
 *                 (<TheoreticalPeak>self.get(i)).intensity *= total_abundance             # <<<<<<<<<<<<<<
 *         elif method == "max":
 *             i = 0
 */

#line 598 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 598, __pyx_L1_error)

#line 598 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_3);

#line 598 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_3)));

#line 598 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_8 = ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_3);

#line 598 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 598 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_8->intensity = (__pyx_t_8->intensity * __pyx_v_total_abundance);

#line 598 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;

#line 598 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":595
 *         if n == 0:
 *             raise ValueError("Isotopic Pattern has length 0 (%f, %r)" % (self.origin, self.peaklist))
 *         if method == "sum":             # <<<<<<<<<<<<<<
 *             total_abundance = sum_intensity(experimental_distribution, n)
 *             for i in range(n):
 */

#line 595 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L4;

#line 595 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":599
 *             for i in range(n):
 *                 (<TheoreticalPeak>self.get(i)).intensity *= total_abundance
 *         elif method == "max":             # <<<<<<<<<<<<<<
 *             i = 0
 *             maximum = 0
 */

#line 599 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_max, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 599, __pyx_L1_error)

#line 599 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = (__pyx_t_4 != 0);

#line 599 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_1) {

    /* "ms_deisotope/_c/averagine.pyx":600
 *                 (<TheoreticalPeak>self.get(i)).intensity *= total_abundance
 *         elif method == "max":
 *             i = 0             # <<<<<<<<<<<<<<
 *             maximum = 0
 *             for j in range(n):
 */

#line 600 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = 0;

    /* "ms_deisotope/_c/averagine.pyx":601
 *         elif method == "max":
 *             i = 0
 *             maximum = 0             # <<<<<<<<<<<<<<
 *             for j in range(n):
 *                 peak = self.get(j)
 */

#line 601 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_maximum = 0.0;

    /* "ms_deisotope/_c/averagine.pyx":602
 *             i = 0
 *             maximum = 0
 *             for j in range(n):             # <<<<<<<<<<<<<<
 *                 peak = self.get(j)
 *                 if peak.intensity > maximum:
 */

#line 602 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = __pyx_v_n;

#line 602 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = __pyx_t_5;

#line 602 "ms_deisotope/_c/averagine.pyx"
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {

#line 602 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_j = __pyx_t_7;

      /* "ms_deisotope/_c/averagine.pyx":603
 *             maximum = 0
 *             for j in range(n):
 *                 peak = self.get(j)             # <<<<<<<<<<<<<<
 *                 if peak.intensity > maximum:
 *                     maximum = peak.intensity
 */

#line 603 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_j)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L1_error)

#line 603 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_3);

#line 603 "ms_deisotope/_c/averagine.pyx"
      __Pyx_XDECREF_SET(__pyx_v_peak, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_3));

#line 603 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = 0;

      /* "ms_deisotope/_c/averagine.pyx":604
 *             for j in range(n):
 *                 peak = self.get(j)
 *                 if peak.intensity > maximum:             # <<<<<<<<<<<<<<
 *                     maximum = peak.intensity
 *                     j = i
 */

#line 604 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_1 = ((__pyx_v_peak->intensity > __pyx_v_maximum) != 0);

#line 604 "ms_deisotope/_c/averagine.pyx"
      if (__pyx_t_1) {

        /* "ms_deisotope/_c/averagine.pyx":605
 *                 peak = self.get(j)
 *                 if peak.intensity > maximum:
 *                     maximum = peak.intensity             # <<<<<<<<<<<<<<
 *                     j = i
 *             scale_factor = (<FittedPeak>PyList_GET_ITEM(
 */

#line 605 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_9 = __pyx_v_peak->intensity;

#line 605 "ms_deisotope/_c/averagine.pyx"
        __pyx_v_maximum = __pyx_t_9;

        /* "ms_deisotope/_c/averagine.pyx":606
 *                 if peak.intensity > maximum:
 *                     maximum = peak.intensity
 *                     j = i             # <<<<<<<<<<<<<<
 *             scale_factor = (<FittedPeak>PyList_GET_ITEM(
 *                 experimental_distribution, i)).intensity / maximum
 */

#line 606 "ms_deisotope/_c/averagine.pyx"
        __pyx_v_j = __pyx_v_i;

        /* "ms_deisotope/_c/averagine.pyx":604
 *             for j in range(n):
 *                 peak = self.get(j)
 *                 if peak.intensity > maximum:             # <<<<<<<<<<<<<<
 *                     maximum = peak.intensity
 *                     j = i
 */

#line 604 "ms_deisotope/_c/averagine.pyx"
      }

#line 604 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":607
 *                     maximum = peak.intensity
 *                     j = i
 *             scale_factor = (<FittedPeak>PyList_GET_ITEM(             # <<<<<<<<<<<<<<
 *                 experimental_distribution, i)).intensity / maximum
 *             for j in range(n):
 */

#line 607 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_10 = PyList_GET_ITEM(__pyx_v_experimental_distribution, __pyx_v_i);

    /* "ms_deisotope/_c/averagine.pyx":608
 *                     j = i
 *             scale_factor = (<FittedPeak>PyList_GET_ITEM(
 *                 experimental_distribution, i)).intensity / maximum             # <<<<<<<<<<<<<<
 *             for j in range(n):
 *                 peak = self.get(j)
 */

#line 608 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_scale_factor = (((struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *)__pyx_t_10)->__pyx_base.intensity / __pyx_v_maximum);

    /* "ms_deisotope/_c/averagine.pyx":609
 *             scale_factor = (<FittedPeak>PyList_GET_ITEM(
 *                 experimental_distribution, i)).intensity / maximum
 *             for j in range(n):             # <<<<<<<<<<<<<<
 *                 peak = self.get(j)
 *                 peak.intensity *= scale_factor
 */

#line 609 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = __pyx_v_n;

#line 609 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = __pyx_t_5;

#line 609 "ms_deisotope/_c/averagine.pyx"
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {

#line 609 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_j = __pyx_t_7;

      /* "ms_deisotope/_c/averagine.pyx":610
 *                 experimental_distribution, i)).intensity / maximum
 *             for j in range(n):
 *                 peak = self.get(j)             # <<<<<<<<<<<<<<
 *                 peak.intensity *= scale_factor
 *         elif method == "meanscale":
 */

#line 610 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_j)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L1_error)

#line 610 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_3);

#line 610 "ms_deisotope/_c/averagine.pyx"
      __Pyx_XDECREF_SET(__pyx_v_peak, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_3));

#line 610 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = 0;

      /* "ms_deisotope/_c/averagine.pyx":611
 *             for j in range(n):
 *                 peak = self.get(j)
 *                 peak.intensity *= scale_factor             # <<<<<<<<<<<<<<
 *         elif method == "meanscale":
 *             scales = 0
 */

#line 611 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_peak->intensity = (__pyx_v_peak->intensity * __pyx_v_scale_factor);

#line 611 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":599
 *             for i in range(n):
 *                 (<TheoreticalPeak>self.get(i)).intensity *= total_abundance
 *         elif method == "max":             # <<<<<<<<<<<<<<
 *             i = 0
 *             maximum = 0
 */

#line 599 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L4;

#line 599 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":612
 *                 peak = self.get(j)
 *                 peak.intensity *= scale_factor
 *         elif method == "meanscale":             # <<<<<<<<<<<<<<
 *             scales = 0
 *             weights = 0
 */

#line 612 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_meanscale, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 612, __pyx_L1_error)

#line 612 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = (__pyx_t_1 != 0);

#line 612 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_4) {

    /* "ms_deisotope/_c/averagine.pyx":613
 *                 peak.intensity *= scale_factor
 *         elif method == "meanscale":
 *             scales = 0             # <<<<<<<<<<<<<<
 *             weights = 0
 *             total_abundance = 0
 */

#line 613 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_scales = 0.0;

    /* "ms_deisotope/_c/averagine.pyx":614
 *         elif method == "meanscale":
 *             scales = 0
 *             weights = 0             # <<<<<<<<<<<<<<
 *             total_abundance = 0
 *             for i in range(n):
 */

#line 614 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_weights = 0.0;

    /* "ms_deisotope/_c/averagine.pyx":615
 *             scales = 0
 *             weights = 0
 *             total_abundance = 0             # <<<<<<<<<<<<<<
 *             for i in range(n):
 *                 expeak = <FittedPeak>PyList_GET_ITEM(experimental_distribution, i)
 */

#line 615 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_total_abundance = 0.0;

    /* "ms_deisotope/_c/averagine.pyx":616
 *             weights = 0
 *             total_abundance = 0
 *             for i in range(n):             # <<<<<<<<<<<<<<
 *                 expeak = <FittedPeak>PyList_GET_ITEM(experimental_distribution, i)
 *                 peak = self.get(i)
 */

#line 616 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = __pyx_v_n;

#line 616 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = __pyx_t_5;

#line 616 "ms_deisotope/_c/averagine.pyx"
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {

#line 616 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_i = __pyx_t_7;

      /* "ms_deisotope/_c/averagine.pyx":617
 *             total_abundance = 0
 *             for i in range(n):
 *                 expeak = <FittedPeak>PyList_GET_ITEM(experimental_distribution, i)             # <<<<<<<<<<<<<<
 *                 peak = self.get(i)
 *                 total_abundance += expeak.intensity
 */

#line 617 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_10 = PyList_GET_ITEM(__pyx_v_experimental_distribution, __pyx_v_i);

#line 617 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = ((PyObject *)__pyx_t_10);

#line 617 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(__pyx_t_3);

#line 617 "ms_deisotope/_c/averagine.pyx"
      __Pyx_XDECREF_SET(__pyx_v_expeak, ((struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *)__pyx_t_3));

#line 617 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = 0;

      /* "ms_deisotope/_c/averagine.pyx":618
 *             for i in range(n):
 *                 expeak = <FittedPeak>PyList_GET_ITEM(experimental_distribution, i)
 *                 peak = self.get(i)             # <<<<<<<<<<<<<<
 *                 total_abundance += expeak.intensity
 *                 w = (peak.intensity * expeak.intensity ** 2)
 */

#line 618 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 618, __pyx_L1_error)

#line 618 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_3);

#line 618 "ms_deisotope/_c/averagine.pyx"
      __Pyx_XDECREF_SET(__pyx_v_peak, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_3));

#line 618 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = 0;

      /* "ms_deisotope/_c/averagine.pyx":619
 *                 expeak = <FittedPeak>PyList_GET_ITEM(experimental_distribution, i)
 *                 peak = self.get(i)
 *                 total_abundance += expeak.intensity             # <<<<<<<<<<<<<<
 *                 w = (peak.intensity * expeak.intensity ** 2)
 *                 scales += expeak.intensity / peak.intensity * w
 */

#line 619 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_total_abundance = (__pyx_v_total_abundance + __pyx_v_expeak->__pyx_base.intensity);

      /* "ms_deisotope/_c/averagine.pyx":620
 *                 peak = self.get(i)
 *                 total_abundance += expeak.intensity
 *                 w = (peak.intensity * expeak.intensity ** 2)             # <<<<<<<<<<<<<<
 *                 scales += expeak.intensity / peak.intensity * w
 *                 weights += w
 */

#line 620 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_w = (__pyx_v_peak->intensity * pow(__pyx_v_expeak->__pyx_base.intensity, 2.0));

      /* "ms_deisotope/_c/averagine.pyx":621
 *                 total_abundance += expeak.intensity
 *                 w = (peak.intensity * expeak.intensity ** 2)
 *                 scales += expeak.intensity / peak.intensity * w             # <<<<<<<<<<<<<<
 *                 weights += w
 *             scale_factor = scales / weights
 */

#line 621 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_scales = (__pyx_v_scales + ((__pyx_v_expeak->__pyx_base.intensity / __pyx_v_peak->intensity) * __pyx_v_w));

      /* "ms_deisotope/_c/averagine.pyx":622
 *                 w = (peak.intensity * expeak.intensity ** 2)
 *                 scales += expeak.intensity / peak.intensity * w
 *                 weights += w             # <<<<<<<<<<<<<<
 *             scale_factor = scales / weights
 *             for i in range(n):
 */

#line 622 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_weights = (__pyx_v_weights + __pyx_v_w);

#line 622 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":623
 *                 scales += expeak.intensity / peak.intensity * w
 *                 weights += w
 *             scale_factor = scales / weights             # <<<<<<<<<<<<<<
 *             for i in range(n):
 *                 peak = self.get(i)
 */

#line 623 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_scale_factor = (__pyx_v_scales / __pyx_v_weights);

    /* "ms_deisotope/_c/averagine.pyx":624
 *                 weights += w
 *             scale_factor = scales / weights
 *             for i in range(n):             # <<<<<<<<<<<<<<
 *                 peak = self.get(i)
 *                 peak.intensity *= scale_factor
 */

#line 624 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = __pyx_v_n;

#line 624 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = __pyx_t_5;

#line 624 "ms_deisotope/_c/averagine.pyx"
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {

#line 624 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_i = __pyx_t_7;

      /* "ms_deisotope/_c/averagine.pyx":625
 *             scale_factor = scales / weights
 *             for i in range(n):
 *                 peak = self.get(i)             # <<<<<<<<<<<<<<
 *                 peak.intensity *= scale_factor
 *         elif method == 'basepeak':
 */

#line 625 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error)

#line 625 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_3);

#line 625 "ms_deisotope/_c/averagine.pyx"
      __Pyx_XDECREF_SET(__pyx_v_peak, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_3));

#line 625 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = 0;

      /* "ms_deisotope/_c/averagine.pyx":626
 *             for i in range(n):
 *                 peak = self.get(i)
 *                 peak.intensity *= scale_factor             # <<<<<<<<<<<<<<
 *         elif method == 'basepeak':
 *             i = 1
 */

#line 626 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_peak->intensity = (__pyx_v_peak->intensity * __pyx_v_scale_factor);

#line 626 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":612
 *                 peak = self.get(j)
 *                 peak.intensity *= scale_factor
 *         elif method == "meanscale":             # <<<<<<<<<<<<<<
 *             scales = 0
 *             weights = 0
 */

#line 612 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L4;

#line 612 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":627
 *                 peak = self.get(i)
 *                 peak.intensity *= scale_factor
 *         elif method == 'basepeak':             # <<<<<<<<<<<<<<
 *             i = 1
 *             j = self.basepeak_index()
 */

#line 627 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_basepeak, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 627, __pyx_L1_error)

#line 627 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = (__pyx_t_4 != 0);

#line 627 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_1) {

    /* "ms_deisotope/_c/averagine.pyx":628
 *                 peak.intensity *= scale_factor
 *         elif method == 'basepeak':
 *             i = 1             # <<<<<<<<<<<<<<
 *             j = self.basepeak_index()
 *             scale_factor =  (<FittedPeak>PyList_GET_ITEM(
 */

#line 628 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = 1;

    /* "ms_deisotope/_c/averagine.pyx":629
 *         elif method == 'basepeak':
 *             i = 1
 *             j = self.basepeak_index()             # <<<<<<<<<<<<<<
 *             scale_factor =  (<FittedPeak>PyList_GET_ITEM(
 *                 experimental_distribution, j)).intensity / self.get(j).intensity
 */

#line 629 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_j = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_basepeak_index(__pyx_v_self, 0);

    /* "ms_deisotope/_c/averagine.pyx":630
 *             i = 1
 *             j = self.basepeak_index()
 *             scale_factor =  (<FittedPeak>PyList_GET_ITEM(             # <<<<<<<<<<<<<<
 *                 experimental_distribution, j)).intensity / self.get(j).intensity
 *             if j < n:
 */

#line 630 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_10 = PyList_GET_ITEM(__pyx_v_experimental_distribution, __pyx_v_j);

    /* "ms_deisotope/_c/averagine.pyx":631
 *             j = self.basepeak_index()
 *             scale_factor =  (<FittedPeak>PyList_GET_ITEM(
 *                 experimental_distribution, j)).intensity / self.get(j).intensity             # <<<<<<<<<<<<<<
 *             if j < n:
 *                 scale_factor += (<FittedPeak>PyList_GET_ITEM(
 */

#line 631 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_j)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 631, __pyx_L1_error)

#line 631 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 631 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_scale_factor = (((struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *)__pyx_t_10)->__pyx_base.intensity / ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_3)->intensity);

#line 631 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "ms_deisotope/_c/averagine.pyx":632
 *             scale_factor =  (<FittedPeak>PyList_GET_ITEM(
 *                 experimental_distribution, j)).intensity / self.get(j).intensity
 *             if j < n:             # <<<<<<<<<<<<<<
 *                 scale_factor += (<FittedPeak>PyList_GET_ITEM(
 *                                 experimental_distribution, j + 1)).intensity / self.get(j + 1).intensity
 */

#line 632 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((__pyx_v_j < __pyx_v_n) != 0);

#line 632 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_1) {

      /* "ms_deisotope/_c/averagine.pyx":633
 *                 experimental_distribution, j)).intensity / self.get(j).intensity
 *             if j < n:
 *                 scale_factor += (<FittedPeak>PyList_GET_ITEM(             # <<<<<<<<<<<<<<
 *                                 experimental_distribution, j + 1)).intensity / self.get(j + 1).intensity
 *                 i += 1
 */

#line 633 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_10 = PyList_GET_ITEM(__pyx_v_experimental_distribution, (__pyx_v_j + 1));

      /* "ms_deisotope/_c/averagine.pyx":634
 *             if j < n:
 *                 scale_factor += (<FittedPeak>PyList_GET_ITEM(
 *                                 experimental_distribution, j + 1)).intensity / self.get(j + 1).intensity             # <<<<<<<<<<<<<<
 *                 i += 1
 *             if j > 0:
 */

#line 634 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, (__pyx_v_j + 1))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 634, __pyx_L1_error)

#line 634 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_3);

      /* "ms_deisotope/_c/averagine.pyx":633
 *                 experimental_distribution, j)).intensity / self.get(j).intensity
 *             if j < n:
 *                 scale_factor += (<FittedPeak>PyList_GET_ITEM(             # <<<<<<<<<<<<<<
 *                                 experimental_distribution, j + 1)).intensity / self.get(j + 1).intensity
 *                 i += 1
 */

#line 633 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_scale_factor = (__pyx_v_scale_factor + (((struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *)__pyx_t_10)->__pyx_base.intensity / ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_3)->intensity));

#line 633 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "ms_deisotope/_c/averagine.pyx":635
 *                 scale_factor += (<FittedPeak>PyList_GET_ITEM(
 *                                 experimental_distribution, j + 1)).intensity / self.get(j + 1).intensity
 *                 i += 1             # <<<<<<<<<<<<<<
 *             if j > 0:
 *                 scale_factor += (<FittedPeak>PyList_GET_ITEM(
 */

#line 635 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_i = (__pyx_v_i + 1);

      /* "ms_deisotope/_c/averagine.pyx":632
 *             scale_factor =  (<FittedPeak>PyList_GET_ITEM(
 *                 experimental_distribution, j)).intensity / self.get(j).intensity
 *             if j < n:             # <<<<<<<<<<<<<<
 *                 scale_factor += (<FittedPeak>PyList_GET_ITEM(
 *                                 experimental_distribution, j + 1)).intensity / self.get(j + 1).intensity
 */

#line 632 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":636
 *                                 experimental_distribution, j + 1)).intensity / self.get(j + 1).intensity
 *                 i += 1
 *             if j > 0:             # <<<<<<<<<<<<<<
 *                 scale_factor += (<FittedPeak>PyList_GET_ITEM(
 *                                 experimental_distribution, j - 1)).intensity / self.get(j - 1).intensity
 */

#line 636 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((__pyx_v_j > 0) != 0);

#line 636 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_1) {

      /* "ms_deisotope/_c/averagine.pyx":637
 *                 i += 1
 *             if j > 0:
 *                 scale_factor += (<FittedPeak>PyList_GET_ITEM(             # <<<<<<<<<<<<<<
 *                                 experimental_distribution, j - 1)).intensity / self.get(j - 1).intensity
 *                 i += 1
 */

#line 637 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_10 = PyList_GET_ITEM(__pyx_v_experimental_distribution, (__pyx_v_j - 1));

      /* "ms_deisotope/_c/averagine.pyx":638
 *             if j > 0:
 *                 scale_factor += (<FittedPeak>PyList_GET_ITEM(
 *                                 experimental_distribution, j - 1)).intensity / self.get(j - 1).intensity             # <<<<<<<<<<<<<<
 *                 i += 1
 *             scale_factor /= i
 */

#line 638 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, (__pyx_v_j - 1))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 638, __pyx_L1_error)

#line 638 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_3);

      /* "ms_deisotope/_c/averagine.pyx":637
 *                 i += 1
 *             if j > 0:
 *                 scale_factor += (<FittedPeak>PyList_GET_ITEM(             # <<<<<<<<<<<<<<
 *                                 experimental_distribution, j - 1)).intensity / self.get(j - 1).intensity
 *                 i += 1
 */

#line 637 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_scale_factor = (__pyx_v_scale_factor + (((struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak *)__pyx_t_10)->__pyx_base.intensity / ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_3)->intensity));

#line 637 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "ms_deisotope/_c/averagine.pyx":639
 *                 scale_factor += (<FittedPeak>PyList_GET_ITEM(
 *                                 experimental_distribution, j - 1)).intensity / self.get(j - 1).intensity
 *                 i += 1             # <<<<<<<<<<<<<<
 *             scale_factor /= i
 *             for i in range(n):
 */

#line 639 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_i = (__pyx_v_i + 1);

      /* "ms_deisotope/_c/averagine.pyx":636
 *                                 experimental_distribution, j + 1)).intensity / self.get(j + 1).intensity
 *                 i += 1
 *             if j > 0:             # <<<<<<<<<<<<<<
 *                 scale_factor += (<FittedPeak>PyList_GET_ITEM(
 *                                 experimental_distribution, j - 1)).intensity / self.get(j - 1).intensity
 */

#line 636 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":640
 *                                 experimental_distribution, j - 1)).intensity / self.get(j - 1).intensity
 *                 i += 1
 *             scale_factor /= i             # <<<<<<<<<<<<<<
 *             for i in range(n):
 *                 peak = self.get(i)
 */

#line 640 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_scale_factor = (__pyx_v_scale_factor / __pyx_v_i);

    /* "ms_deisotope/_c/averagine.pyx":641
 *                 i += 1
 *             scale_factor /= i
 *             for i in range(n):             # <<<<<<<<<<<<<<
 *                 peak = self.get(i)
 *                 peak.intensity *= scale_factor
 */

#line 641 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = __pyx_v_n;

#line 641 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = __pyx_t_5;

#line 641 "ms_deisotope/_c/averagine.pyx"
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {

#line 641 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_i = __pyx_t_7;

      /* "ms_deisotope/_c/averagine.pyx":642
 *             scale_factor /= i
 *             for i in range(n):
 *                 peak = self.get(i)             # <<<<<<<<<<<<<<
 *                 peak.intensity *= scale_factor
 *         elif method == 'top3':
 */

#line 642 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 642, __pyx_L1_error)

#line 642 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_3);

#line 642 "ms_deisotope/_c/averagine.pyx"
      __Pyx_XDECREF_SET(__pyx_v_peak, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_3));

#line 642 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = 0;

      /* "ms_deisotope/_c/averagine.pyx":643
 *             for i in range(n):
 *                 peak = self.get(i)
 *                 peak.intensity *= scale_factor             # <<<<<<<<<<<<<<
 *         elif method == 'top3':
 *             scale_factor = top3_scale_factor(self, experimental_distribution)
 */

#line 643 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_peak->intensity = (__pyx_v_peak->intensity * __pyx_v_scale_factor);

#line 643 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":627
 *                 peak = self.get(i)
 *                 peak.intensity *= scale_factor
 *         elif method == 'basepeak':             # <<<<<<<<<<<<<<
 *             i = 1
 *             j = self.basepeak_index()
 */

#line 627 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L4;

#line 627 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":644
 *                 peak = self.get(i)
 *                 peak.intensity *= scale_factor
 *         elif method == 'top3':             # <<<<<<<<<<<<<<
 *             scale_factor = top3_scale_factor(self, experimental_distribution)
 *             for i in range(n):
 */

#line 644 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_top3, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 644, __pyx_L1_error)

#line 644 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = (__pyx_t_1 != 0);

#line 644 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_4) {

    /* "ms_deisotope/_c/averagine.pyx":645
 *                 peak.intensity *= scale_factor
 *         elif method == 'top3':
 *             scale_factor = top3_scale_factor(self, experimental_distribution)             # <<<<<<<<<<<<<<
 *             for i in range(n):
 *                 peak = self.get(i)
 */

#line 645 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_scale_factor = __pyx_f_12ms_deisotope_2_c_9averagine_top3_scale_factor(__pyx_v_self, __pyx_v_experimental_distribution);

    /* "ms_deisotope/_c/averagine.pyx":646
 *         elif method == 'top3':
 *             scale_factor = top3_scale_factor(self, experimental_distribution)
 *             for i in range(n):             # <<<<<<<<<<<<<<
 *                 peak = self.get(i)
 *                 peak.intensity *= scale_factor
 */

#line 646 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = __pyx_v_n;

#line 646 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = __pyx_t_5;

#line 646 "ms_deisotope/_c/averagine.pyx"
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {

#line 646 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_i = __pyx_t_7;

      /* "ms_deisotope/_c/averagine.pyx":647
 *             scale_factor = top3_scale_factor(self, experimental_distribution)
 *             for i in range(n):
 *                 peak = self.get(i)             # <<<<<<<<<<<<<<
 *                 peak.intensity *= scale_factor
 *         return self
 */

#line 647 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 647, __pyx_L1_error)

#line 647 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_3);

#line 647 "ms_deisotope/_c/averagine.pyx"
      __Pyx_XDECREF_SET(__pyx_v_peak, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_3));

#line 647 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = 0;

      /* "ms_deisotope/_c/averagine.pyx":648
 *             for i in range(n):
 *                 peak = self.get(i)
 *                 peak.intensity *= scale_factor             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

#line 648 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_peak->intensity = (__pyx_v_peak->intensity * __pyx_v_scale_factor);

#line 648 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":644
 *                 peak = self.get(i)
 *                 peak.intensity *= scale_factor
 *         elif method == 'top3':             # <<<<<<<<<<<<<<
 *             scale_factor = top3_scale_factor(self, experimental_distribution)
 *             for i in range(n):
 */

#line 644 "ms_deisotope/_c/averagine.pyx"
  }

#line 644 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4:;

  /* "ms_deisotope/_c/averagine.pyx":649
 *                 peak = self.get(i)
 *                 peak.intensity *= scale_factor
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     cpdef size_t basepeak_index(self):
 */

#line 649 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 649 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_v_self));

#line 649 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_self;

#line 649 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":584
 *     @cython.final
 *     @cython.cdivision
 *     cdef inline TheoreticalIsotopicPattern _scale(self, list experimental_distribution, str method="sum"):             # <<<<<<<<<<<<<<
 *         cdef:
 *             size_t i, j, n
 */

#line 584 "ms_deisotope/_c/averagine.pyx"


#line 584 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 584 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 584 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 584 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 584 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_t_8));

#line 584 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern._scale", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 584 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 584 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 584 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_peak);

#line 584 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_expeak);

#line 584 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 584 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 584 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 584 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":651
 *         return self
 * 
 *     cpdef size_t basepeak_index(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             size_t i, n, bp_index
 */

#line 651 "ms_deisotope/_c/averagine.pyx"


#line 651 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_21basepeak_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 651 "ms_deisotope/_c/averagine.pyx"
static size_t __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_basepeak_index(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_i
#line 651 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_bp_index
#line 651 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_bp_intensity
#line 651 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_p = 0
#line 651 "ms_deisotope/_c/averagine.pyx"
;

#line 651 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_r;

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 651 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_1;

#line 651 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 651 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 651 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 651 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_5;

#line 651 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_6;

#line 651 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 651 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 651 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("basepeak_index", 0);

  /* "ms_deisotope/_c/averagine.pyx":656
 *             double bp_intensity
 *             TheoreticalPeak p
 *         bp_intensity = 0             # <<<<<<<<<<<<<<
 *         bp_index = 0
 *         for i in range(self.get_size()):
 */

#line 656 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_bp_intensity = 0.0;

  /* "ms_deisotope/_c/averagine.pyx":657
 *             TheoreticalPeak p
 *         bp_intensity = 0
 *         bp_index = 0             # <<<<<<<<<<<<<<
 *         for i in range(self.get_size()):
 *             p = self.get(i)
 */

#line 657 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_bp_index = 0;

  /* "ms_deisotope/_c/averagine.pyx":658
 *         bp_intensity = 0
 *         bp_index = 0
 *         for i in range(self.get_size()):             # <<<<<<<<<<<<<<
 *             p = self.get(i)
 *             if p.intensity > bp_intensity:
 */

#line 658 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

#line 658 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_t_1;

#line 658 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {

#line 658 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_3;

    /* "ms_deisotope/_c/averagine.pyx":659
 *         bp_index = 0
 *         for i in range(self.get_size()):
 *             p = self.get(i)             # <<<<<<<<<<<<<<
 *             if p.intensity > bp_intensity:
 *                 bp_intensity = p.intensity
 */

#line 659 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 659, __pyx_L1_error)

#line 659 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_4);

#line 659 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_4));

#line 659 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = 0;

    /* "ms_deisotope/_c/averagine.pyx":660
 *         for i in range(self.get_size()):
 *             p = self.get(i)
 *             if p.intensity > bp_intensity:             # <<<<<<<<<<<<<<
 *                 bp_intensity = p.intensity
 *                 bp_index = i
 */

#line 660 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = ((__pyx_v_p->intensity > __pyx_v_bp_intensity) != 0);

#line 660 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_5) {

      /* "ms_deisotope/_c/averagine.pyx":661
 *             p = self.get(i)
 *             if p.intensity > bp_intensity:
 *                 bp_intensity = p.intensity             # <<<<<<<<<<<<<<
 *                 bp_index = i
 *         return bp_index
 */

#line 661 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_6 = __pyx_v_p->intensity;

#line 661 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_bp_intensity = __pyx_t_6;

      /* "ms_deisotope/_c/averagine.pyx":662
 *             if p.intensity > bp_intensity:
 *                 bp_intensity = p.intensity
 *                 bp_index = i             # <<<<<<<<<<<<<<
 *         return bp_index
 * 
 */

#line 662 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_bp_index = __pyx_v_i;

      /* "ms_deisotope/_c/averagine.pyx":660
 *         for i in range(self.get_size()):
 *             p = self.get(i)
 *             if p.intensity > bp_intensity:             # <<<<<<<<<<<<<<
 *                 bp_intensity = p.intensity
 *                 bp_index = i
 */

#line 660 "ms_deisotope/_c/averagine.pyx"
    }

#line 660 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":663
 *                 bp_intensity = p.intensity
 *                 bp_index = i
 *         return bp_index             # <<<<<<<<<<<<<<
 * 
 *     @cython.cdivision
 */

#line 663 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_bp_index;

#line 663 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":651
 *         return self
 * 
 *     cpdef size_t basepeak_index(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             size_t i, n, bp_index
 */

#line 651 "ms_deisotope/_c/averagine.pyx"


#line 651 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 651 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_WriteUnraisable("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.basepeak_index", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);

#line 651 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 651 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_p);

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 651 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 651 "ms_deisotope/_c/averagine.pyx"
}

#line 651 "ms_deisotope/_c/averagine.pyx"


#line 651 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 651 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_21basepeak_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 651 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_20basepeak_index[] = "TheoreticalIsotopicPattern.basepeak_index(self) -> size_t";

#line 651 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_21basepeak_index(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 651 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("basepeak_index (wrapper)", 0);
  __pyx_r = 
#line 651 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_20basepeak_index(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self));

#line 651 "ms_deisotope/_c/averagine.pyx"


#line 651 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 651 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 651 "ms_deisotope/_c/averagine.pyx"
}

#line 651 "ms_deisotope/_c/averagine.pyx"


#line 651 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_20basepeak_index(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 651 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 651 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 651 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 651 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 651 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("basepeak_index", 0);

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 651 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_basepeak_index(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __pyx_L1_error)

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 651 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 651 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 651 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 651 "ms_deisotope/_c/averagine.pyx"


#line 651 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 651 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.basepeak_index", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 651 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 651 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 651 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 651 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 651 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":666
 * 
 *     @cython.cdivision
 *     cpdef TheoreticalIsotopicPattern normalize(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             size_t i, j, n
 */

#line 666 "ms_deisotope/_c/averagine.pyx"


#line 666 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_23normalize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 666 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_normalize(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_i
#line 666 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 666 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_peak = 0
#line 666 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_total_abundance
#line 666 "ms_deisotope/_c/averagine.pyx"
;

#line 666 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 666 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_1;

#line 666 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 666 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 666 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 666 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 666 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 666 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("normalize", 0);

  /* "ms_deisotope/_c/averagine.pyx":671
 *             TheoreticalPeak peak
 *             double total_abundance
 *         n = self.get_size()             # <<<<<<<<<<<<<<
 *         total_abundance = 0
 *         for i in range(n):
 */

#line 671 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":672
 *             double total_abundance
 *         n = self.get_size()
 *         total_abundance = 0             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             total_abundance += self.get(i).intensity
 */

#line 672 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_total_abundance = 0.0;

  /* "ms_deisotope/_c/averagine.pyx":673
 *         n = self.get_size()
 *         total_abundance = 0
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             total_abundance += self.get(i).intensity
 *         for i in range(n):
 */

#line 673 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_v_n;

#line 673 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_t_1;

#line 673 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {

#line 673 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_3;

    /* "ms_deisotope/_c/averagine.pyx":674
 *         total_abundance = 0
 *         for i in range(n):
 *             total_abundance += self.get(i).intensity             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             peak = self.get(i)
 */

#line 674 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 674, __pyx_L1_error)

#line 674 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_4);

#line 674 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_total_abundance = (__pyx_v_total_abundance + ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_4)->intensity);

#line 674 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 674 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":675
 *         for i in range(n):
 *             total_abundance += self.get(i).intensity
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             peak = self.get(i)
 *             peak.intensity /= total_abundance
 */

#line 675 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_v_n;

#line 675 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_t_1;

#line 675 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {

#line 675 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_3;

    /* "ms_deisotope/_c/averagine.pyx":676
 *             total_abundance += self.get(i).intensity
 *         for i in range(n):
 *             peak = self.get(i)             # <<<<<<<<<<<<<<
 *             peak.intensity /= total_abundance
 *         return self
 */

#line 676 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 676, __pyx_L1_error)

#line 676 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_4);

#line 676 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_peak, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_4));

#line 676 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = 0;

    /* "ms_deisotope/_c/averagine.pyx":677
 *         for i in range(n):
 *             peak = self.get(i)
 *             peak.intensity /= total_abundance             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

#line 677 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_peak->intensity = (__pyx_v_peak->intensity / __pyx_v_total_abundance);

#line 677 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":678
 *             peak = self.get(i)
 *             peak.intensity /= total_abundance
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     cpdef TheoreticalIsotopicPattern scale_raw(self, double scale_factor):
 */

#line 678 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 678 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_v_self));

#line 678 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_self;

#line 678 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":666
 * 
 *     @cython.cdivision
 *     cpdef TheoreticalIsotopicPattern normalize(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             size_t i, j, n
 */

#line 666 "ms_deisotope/_c/averagine.pyx"


#line 666 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 666 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.normalize", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 666 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 666 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_peak);

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 666 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 666 "ms_deisotope/_c/averagine.pyx"
}

#line 666 "ms_deisotope/_c/averagine.pyx"


#line 666 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 666 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_23normalize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 666 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_22normalize[] = "TheoreticalIsotopicPattern.normalize(self) -> TheoreticalIsotopicPattern";

#line 666 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_23normalize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 666 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("normalize (wrapper)", 0);
  __pyx_r = 
#line 666 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_22normalize(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self));

#line 666 "ms_deisotope/_c/averagine.pyx"


#line 666 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 666 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 666 "ms_deisotope/_c/averagine.pyx"
}

#line 666 "ms_deisotope/_c/averagine.pyx"


#line 666 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_22normalize(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 666 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 666 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 666 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 666 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 666 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("normalize", 0);

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 666 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_normalize(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error)

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 666 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 666 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 666 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 666 "ms_deisotope/_c/averagine.pyx"


#line 666 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 666 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.normalize", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 666 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 666 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 666 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 666 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 666 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":680
 *         return self
 * 
 *     cpdef TheoreticalIsotopicPattern scale_raw(self, double scale_factor):             # <<<<<<<<<<<<<<
 *         for peak in self:
 *             peak.intensity *= scale_factor
 */

#line 680 "ms_deisotope/_c/averagine.pyx"


#line 680 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_25scale_raw(PyObject *__pyx_v_self, PyObject *__pyx_arg_scale_factor); /*proto*/

#line 680 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale_raw(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_scale_factor, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_peak = NULL
#line 680 "ms_deisotope/_c/averagine.pyx"
;

#line 680 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 680 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 680 "ms_deisotope/_c/averagine.pyx"
  Py_ssize_t __pyx_t_2;

#line 680 "ms_deisotope/_c/averagine.pyx"
  PyObject *(*__pyx_t_3)(PyObject *);

#line 680 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 680 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_5 = NULL;

#line 680 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_6 = NULL;

#line 680 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 680 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 680 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("scale_raw", 0);

  /* "ms_deisotope/_c/averagine.pyx":681
 * 
 *     cpdef TheoreticalIsotopicPattern scale_raw(self, double scale_factor):
 *         for peak in self:             # <<<<<<<<<<<<<<
 *             peak.intensity *= scale_factor
 *         return self
 */

#line 681 "ms_deisotope/_c/averagine.pyx"
  if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {

#line 681 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;

#line 681 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = NULL;

#line 681 "ms_deisotope/_c/averagine.pyx"
  } else {
    __pyx_t_2 = -1; 
#line 681 "ms_deisotope/_c/averagine.pyx"
__pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 681, __pyx_L1_error)

#line 681 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 681 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 681, __pyx_L1_error)

#line 681 "ms_deisotope/_c/averagine.pyx"
  }

#line 681 "ms_deisotope/_c/averagine.pyx"
  for (;;) {

#line 681 "ms_deisotope/_c/averagine.pyx"
    if (likely(!__pyx_t_3)) {

#line 681 "ms_deisotope/_c/averagine.pyx"
      if (likely(PyList_CheckExact(__pyx_t_1))) {

#line 681 "ms_deisotope/_c/averagine.pyx"
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;

#line 681 "ms_deisotope/_c/averagine.pyx"
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS

#line 681 "ms_deisotope/_c/averagine.pyx"
        __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(0, 681, __pyx_L1_error)

#line 681 "ms_deisotope/_c/averagine.pyx"
        #else

#line 681 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 681, __pyx_L1_error)

#line 681 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_4);

#line 681 "ms_deisotope/_c/averagine.pyx"
        #endif

#line 681 "ms_deisotope/_c/averagine.pyx"
      } else {

#line 681 "ms_deisotope/_c/averagine.pyx"
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;

#line 681 "ms_deisotope/_c/averagine.pyx"
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS

#line 681 "ms_deisotope/_c/averagine.pyx"
        __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(0, 681, __pyx_L1_error)

#line 681 "ms_deisotope/_c/averagine.pyx"
        #else

#line 681 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 681, __pyx_L1_error)

#line 681 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_4);

#line 681 "ms_deisotope/_c/averagine.pyx"
        #endif

#line 681 "ms_deisotope/_c/averagine.pyx"
      }
    } else 
#line 681 "ms_deisotope/_c/averagine.pyx"
{

#line 681 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);

#line 681 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(!__pyx_t_4)) {

#line 681 "ms_deisotope/_c/averagine.pyx"
        PyObject* exc_type = PyErr_Occurred();

#line 681 "ms_deisotope/_c/averagine.pyx"
        if (exc_type) {

#line 681 "ms_deisotope/_c/averagine.pyx"
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();

#line 681 "ms_deisotope/_c/averagine.pyx"
          else __PYX_ERR(0, 681, __pyx_L1_error)

#line 681 "ms_deisotope/_c/averagine.pyx"
        }

#line 681 "ms_deisotope/_c/averagine.pyx"
        break;

#line 681 "ms_deisotope/_c/averagine.pyx"
      }

#line 681 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_4);

#line 681 "ms_deisotope/_c/averagine.pyx"
    }

#line 681 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_peak, __pyx_t_4);

#line 681 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = 0;

    /* "ms_deisotope/_c/averagine.pyx":682
 *     cpdef TheoreticalIsotopicPattern scale_raw(self, double scale_factor):
 *         for peak in self:
 *             peak.intensity *= scale_factor             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

#line 682 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_peak, __pyx_n_s_intensity); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 682, __pyx_L1_error)

#line 682 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_4);

#line 682 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_scale_factor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 682, __pyx_L1_error)

#line 682 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_5);

#line 682 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 682, __pyx_L1_error)

#line 682 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_6);

#line 682 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 682 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

#line 682 "ms_deisotope/_c/averagine.pyx"
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_peak, __pyx_n_s_intensity, __pyx_t_6) < 0) __PYX_ERR(0, 682, __pyx_L1_error)

#line 682 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "ms_deisotope/_c/averagine.pyx":681
 * 
 *     cpdef TheoreticalIsotopicPattern scale_raw(self, double scale_factor):
 *         for peak in self:             # <<<<<<<<<<<<<<
 *             peak.intensity *= scale_factor
 *         return self
 */

#line 681 "ms_deisotope/_c/averagine.pyx"
  }

#line 681 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":683
 *         for peak in self:
 *             peak.intensity *= scale_factor
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     cpdef double drop_last_peak(self):
 */

#line 683 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 683 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_v_self));

#line 683 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_self;

#line 683 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":680
 *         return self
 * 
 *     cpdef TheoreticalIsotopicPattern scale_raw(self, double scale_factor):             # <<<<<<<<<<<<<<
 *         for peak in self:
 *             peak.intensity *= scale_factor
 */

#line 680 "ms_deisotope/_c/averagine.pyx"


#line 680 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 680 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_5);

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_6);

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.scale_raw", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 680 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_peak);

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 680 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 680 "ms_deisotope/_c/averagine.pyx"
}

#line 680 "ms_deisotope/_c/averagine.pyx"


#line 680 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 680 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_25scale_raw(PyObject *__pyx_v_self, PyObject *__pyx_arg_scale_factor); /*proto*/

#line 680 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_24scale_raw[] = "TheoreticalIsotopicPattern.scale_raw(self, double scale_factor) -> TheoreticalIsotopicPattern";

#line 680 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_25scale_raw(PyObject *__pyx_v_self, PyObject *__pyx_arg_scale_factor) {
  double __pyx_v_scale_factor
#line 680 "ms_deisotope/_c/averagine.pyx"
;

#line 680 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 680 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 680 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 680 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("scale_raw (wrapper)", 0);

#line 680 "ms_deisotope/_c/averagine.pyx"
  assert(__pyx_arg_scale_factor); {

#line 680 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_scale_factor = __pyx_PyFloat_AsDouble(__pyx_arg_scale_factor); if (unlikely((__pyx_v_scale_factor == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 680, __pyx_L3_error)

#line 680 "ms_deisotope/_c/averagine.pyx"
  }

#line 680 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.scale_raw", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 680 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 680 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_24scale_raw(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self), ((double)__pyx_v_scale_factor));

#line 680 "ms_deisotope/_c/averagine.pyx"


#line 680 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 680 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 680 "ms_deisotope/_c/averagine.pyx"
}

#line 680 "ms_deisotope/_c/averagine.pyx"


#line 680 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_24scale_raw(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_scale_factor) {

#line 680 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 680 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 680 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 680 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 680 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("scale_raw", 0);

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 680 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale_raw(__pyx_v_self, __pyx_v_scale_factor, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error)

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 680 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 680 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 680 "ms_deisotope/_c/averagine.pyx"


#line 680 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 680 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.scale_raw", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 680 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 680 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 680 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 680 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":685
 *         return self
 * 
 *     cpdef double drop_last_peak(self):             # <<<<<<<<<<<<<<
 *         """Drop the last peak in the isotopic pattern and re-normalize.
 * 
 */

#line 685 "ms_deisotope/_c/averagine.pyx"


#line 685 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_27drop_last_peak(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 685 "ms_deisotope/_c/averagine.pyx"
static double __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_drop_last_peak(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) {
  size_t __pyx_v_i
#line 685 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 685 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_p = 0
#line 685 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_tail = 0
#line 685 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_scaler
#line 685 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_peaks = 0
#line 685 "ms_deisotope/_c/averagine.pyx"
;

#line 685 "ms_deisotope/_c/averagine.pyx"
  double __pyx_r;

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 685 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 685 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 685 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 685 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_4;

#line 685 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_5;

#line 685 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 685 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 685 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("drop_last_peak", 0);

  /* "ms_deisotope/_c/averagine.pyx":700
 *             list peaks
 * 
 *         n = self.get_size()             # <<<<<<<<<<<<<<
 *         peaks = PyList_New(n - 1)
 *         i = 0
 */

#line 700 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":701
 * 
 *         n = self.get_size()
 *         peaks = PyList_New(n - 1)             # <<<<<<<<<<<<<<
 *         i = 0
 *         tail = self.get(n - 1)
 */

#line 701 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyList_New((__pyx_v_n - 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 701, __pyx_L1_error)

#line 701 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 701 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_peaks = ((PyObject*)__pyx_t_1);

#line 701 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":702
 *         n = self.get_size()
 *         peaks = PyList_New(n - 1)
 *         i = 0             # <<<<<<<<<<<<<<
 *         tail = self.get(n - 1)
 *         scaler = 1 - tail.intensity
 */

#line 702 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_i = 0;

  /* "ms_deisotope/_c/averagine.pyx":703
 *         peaks = PyList_New(n - 1)
 *         i = 0
 *         tail = self.get(n - 1)             # <<<<<<<<<<<<<<
 *         scaler = 1 - tail.intensity
 *         for i in range(n - 1):
 */

#line 703 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, (__pyx_v_n - 1))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 703, __pyx_L1_error)

#line 703 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 703 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_tail = ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1);

#line 703 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":704
 *         i = 0
 *         tail = self.get(n - 1)
 *         scaler = 1 - tail.intensity             # <<<<<<<<<<<<<<
 *         for i in range(n - 1):
 *             p = self.get(i)
 */

#line 704 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_scaler = (1.0 - __pyx_v_tail->intensity);

  /* "ms_deisotope/_c/averagine.pyx":705
 *         tail = self.get(n - 1)
 *         scaler = 1 - tail.intensity
 *         for i in range(n - 1):             # <<<<<<<<<<<<<<
 *             p = self.get(i)
 *             p.intensity /= scaler
 */

#line 705 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = (__pyx_v_n - 1);

#line 705 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __pyx_t_2;

#line 705 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {

#line 705 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_4;

    /* "ms_deisotope/_c/averagine.pyx":706
 *         scaler = 1 - tail.intensity
 *         for i in range(n - 1):
 *             p = self.get(i)             # <<<<<<<<<<<<<<
 *             p.intensity /= scaler
 *             Py_INCREF(p)
 */

#line 706 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L1_error)

#line 706 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 706 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1));

#line 706 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":707
 *         for i in range(n - 1):
 *             p = self.get(i)
 *             p.intensity /= scaler             # <<<<<<<<<<<<<<
 *             Py_INCREF(p)
 *             PyList_SetItem(peaks, i, p)
 */

#line 707 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_v_scaler == 0)) {

#line 707 "ms_deisotope/_c/averagine.pyx"
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");

#line 707 "ms_deisotope/_c/averagine.pyx"
      __PYX_ERR(0, 707, __pyx_L1_error)

#line 707 "ms_deisotope/_c/averagine.pyx"
    }

#line 707 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_p->intensity = (__pyx_v_p->intensity / __pyx_v_scaler);

    /* "ms_deisotope/_c/averagine.pyx":708
 *             p = self.get(i)
 *             p.intensity /= scaler
 *             Py_INCREF(p)             # <<<<<<<<<<<<<<
 *             PyList_SetItem(peaks, i, p)
 *         self.peaklist = peaks
 */

#line 708 "ms_deisotope/_c/averagine.pyx"
    Py_INCREF(((PyObject *)__pyx_v_p));

    /* "ms_deisotope/_c/averagine.pyx":709
 *             p.intensity /= scaler
 *             Py_INCREF(p)
 *             PyList_SetItem(peaks, i, p)             # <<<<<<<<<<<<<<
 *         self.peaklist = peaks
 *         return scaler
 */

#line 709 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = PyList_SetItem(__pyx_v_peaks, __pyx_v_i, ((PyObject *)__pyx_v_p)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 709, __pyx_L1_error)

#line 709 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":710
 *             Py_INCREF(p)
 *             PyList_SetItem(peaks, i, p)
 *         self.peaklist = peaks             # <<<<<<<<<<<<<<
 *         return scaler
 * 
 */

#line 710 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_peaks);

#line 710 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_v_peaks);

#line 710 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_v_self->peaklist);

#line 710 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_v_self->peaklist);

#line 710 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->peaklist = __pyx_v_peaks;

  /* "ms_deisotope/_c/averagine.pyx":711
 *             PyList_SetItem(peaks, i, p)
 *         self.peaklist = peaks
 *         return scaler             # <<<<<<<<<<<<<<
 * 
 *     cdef TheoreticalIsotopicPattern clone_drop_last(self):
 */

#line 711 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_scaler;

#line 711 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":685
 *         return self
 * 
 *     cpdef double drop_last_peak(self):             # <<<<<<<<<<<<<<
 *         """Drop the last peak in the isotopic pattern and re-normalize.
 * 
 */

#line 685 "ms_deisotope/_c/averagine.pyx"


#line 685 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 685 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_WriteUnraisable("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.drop_last_peak", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);

#line 685 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 685 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_p);

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_tail);

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_peaks);

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 685 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 685 "ms_deisotope/_c/averagine.pyx"
}

#line 685 "ms_deisotope/_c/averagine.pyx"


#line 685 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 685 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_27drop_last_peak(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 685 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_26drop_last_peak[] = "TheoreticalIsotopicPattern.drop_last_peak(self) -> double\nDrop the last peak in the isotopic pattern and re-normalize.\n\n        Returns\n        -------\n        float:\n            The percentage of the total signal in the isotopic pattern remaining\n            following the removal of the last peak.\n        ";

#line 685 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_27drop_last_peak(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 685 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("drop_last_peak (wrapper)", 0);
  __pyx_r = 
#line 685 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_26drop_last_peak(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self));

#line 685 "ms_deisotope/_c/averagine.pyx"


#line 685 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 685 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 685 "ms_deisotope/_c/averagine.pyx"
}

#line 685 "ms_deisotope/_c/averagine.pyx"


#line 685 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_26drop_last_peak(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 685 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 685 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 685 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 685 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 685 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("drop_last_peak", 0);

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 685 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_drop_last_peak(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 685, __pyx_L1_error)

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 685 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 685 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 685 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 685 "ms_deisotope/_c/averagine.pyx"


#line 685 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 685 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.drop_last_peak", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 685 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 685 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 685 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 685 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 685 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":713
 *         return scaler
 * 
 *     cdef TheoreticalIsotopicPattern clone_drop_last(self):             # <<<<<<<<<<<<<<
 *         """Combines the copying traversal with the re-normalization
 *         of :meth:`drop_last_peak` for efffiency.
 */

#line 713 "ms_deisotope/_c/averagine.pyx"


#line 713 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone_drop_last(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {
  size_t __pyx_v_i
#line 713 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 713 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_p = 0
#line 713 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_tail = 0
#line 713 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_scaler
#line 713 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_peaks = 0
#line 713 "ms_deisotope/_c/averagine.pyx"
;

#line 713 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 713 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 713 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 713 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 713 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 713 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_4;

#line 713 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_5 = NULL;

#line 713 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_6;

#line 713 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 713 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 713 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 713 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("clone_drop_last", 0);

  /* "ms_deisotope/_c/averagine.pyx":728
 *             list peaks
 * 
 *         n = self.get_size()             # <<<<<<<<<<<<<<
 *         peaks = PyList_New(n - 1)
 *         i = 0
 */

#line 728 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":729
 * 
 *         n = self.get_size()
 *         peaks = PyList_New(n - 1)             # <<<<<<<<<<<<<<
 *         i = 0
 *         tail = self.get(n - 1)
 */

#line 729 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyList_New((__pyx_v_n - 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 729, __pyx_L1_error)

#line 729 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 729 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_peaks = ((PyObject*)__pyx_t_1);

#line 729 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":730
 *         n = self.get_size()
 *         peaks = PyList_New(n - 1)
 *         i = 0             # <<<<<<<<<<<<<<
 *         tail = self.get(n - 1)
 *         scaler = 1 - tail.intensity
 */

#line 730 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_i = 0;

  /* "ms_deisotope/_c/averagine.pyx":731
 *         peaks = PyList_New(n - 1)
 *         i = 0
 *         tail = self.get(n - 1)             # <<<<<<<<<<<<<<
 *         scaler = 1 - tail.intensity
 *         for i in range(n - 1):
 */

#line 731 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, (__pyx_v_n - 1))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error)

#line 731 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 731 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_tail = ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1);

#line 731 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":732
 *         i = 0
 *         tail = self.get(n - 1)
 *         scaler = 1 - tail.intensity             # <<<<<<<<<<<<<<
 *         for i in range(n - 1):
 *             p = self.get(i).clone()
 */

#line 732 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_scaler = (1.0 - __pyx_v_tail->intensity);

  /* "ms_deisotope/_c/averagine.pyx":733
 *         tail = self.get(n - 1)
 *         scaler = 1 - tail.intensity
 *         for i in range(n - 1):             # <<<<<<<<<<<<<<
 *             p = self.get(i).clone()
 *             p.intensity /= scaler
 */

#line 733 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = (__pyx_v_n - 1);

#line 733 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __pyx_t_2;

#line 733 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {

#line 733 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_4;

    /* "ms_deisotope/_c/averagine.pyx":734
 *         scaler = 1 - tail.intensity
 *         for i in range(n - 1):
 *             p = self.get(i).clone()             # <<<<<<<<<<<<<<
 *             p.intensity /= scaler
 *             Py_INCREF(p)
 */

#line 734 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error)

#line 734 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 734 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1)->__pyx_vtab)->clone(((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_1), 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 734, __pyx_L1_error)

#line 734 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_5);

#line 734 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 734 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_5));

#line 734 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = 0;

    /* "ms_deisotope/_c/averagine.pyx":735
 *         for i in range(n - 1):
 *             p = self.get(i).clone()
 *             p.intensity /= scaler             # <<<<<<<<<<<<<<
 *             Py_INCREF(p)
 *             PyList_SetItem(peaks, i, p)
 */

#line 735 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_v_scaler == 0)) {

#line 735 "ms_deisotope/_c/averagine.pyx"
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");

#line 735 "ms_deisotope/_c/averagine.pyx"
      __PYX_ERR(0, 735, __pyx_L1_error)

#line 735 "ms_deisotope/_c/averagine.pyx"
    }

#line 735 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_p->intensity = (__pyx_v_p->intensity / __pyx_v_scaler);

    /* "ms_deisotope/_c/averagine.pyx":736
 *             p = self.get(i).clone()
 *             p.intensity /= scaler
 *             Py_INCREF(p)             # <<<<<<<<<<<<<<
 *             PyList_SetItem(peaks, i, p)
 *         return TheoreticalIsotopicPattern._create(peaks, self.origin, self.offset)
 */

#line 736 "ms_deisotope/_c/averagine.pyx"
    Py_INCREF(((PyObject *)__pyx_v_p));

    /* "ms_deisotope/_c/averagine.pyx":737
 *             p.intensity /= scaler
 *             Py_INCREF(p)
 *             PyList_SetItem(peaks, i, p)             # <<<<<<<<<<<<<<
 *         return TheoreticalIsotopicPattern._create(peaks, self.origin, self.offset)
 * 
 */

#line 737 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = PyList_SetItem(__pyx_v_peaks, __pyx_v_i, ((PyObject *)__pyx_v_p)); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 737, __pyx_L1_error)

#line 737 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":738
 *             Py_INCREF(p)
 *             PyList_SetItem(peaks, i, p)
 *         return TheoreticalIsotopicPattern._create(peaks, self.origin, self.offset)             # <<<<<<<<<<<<<<
 * 
 *     cpdef double total(self):
 */

#line 738 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 738 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_5 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__create(__pyx_v_peaks, __pyx_v_self->origin, __pyx_v_self->offset)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 738, __pyx_L1_error)

#line 738 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_5);

#line 738 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_5);

#line 738 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_5 = 0;

#line 738 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":713
 *         return scaler
 * 
 *     cdef TheoreticalIsotopicPattern clone_drop_last(self):             # <<<<<<<<<<<<<<
 *         """Combines the copying traversal with the re-normalization
 *         of :meth:`drop_last_peak` for efffiency.
 */

#line 713 "ms_deisotope/_c/averagine.pyx"


#line 713 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 713 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 713 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 713 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_5);

#line 713 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.clone_drop_last", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 713 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 713 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 713 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_p);

#line 713 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_tail);

#line 713 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_peaks);

#line 713 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 713 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 713 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 713 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":740
 *         return TheoreticalIsotopicPattern._create(peaks, self.origin, self.offset)
 * 
 *     cpdef double total(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double total
 */

#line 740 "ms_deisotope/_c/averagine.pyx"


#line 740 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_29total(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 740 "ms_deisotope/_c/averagine.pyx"
static double __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_total(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) {
  double __pyx_v_total
#line 740 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_i
#line 740 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 740 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_p = 0
#line 740 "ms_deisotope/_c/averagine.pyx"
;

#line 740 "ms_deisotope/_c/averagine.pyx"
  double __pyx_r;

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 740 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_1;

#line 740 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 740 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 740 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 740 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 740 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 740 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("total", 0);

  /* "ms_deisotope/_c/averagine.pyx":745
 *             size_t i, n
 *             TheoreticalPeak p
 *         total = 0.0             # <<<<<<<<<<<<<<
 *         n = self.get_size()
 *         for i in range(n):
 */

#line 745 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_total = 0.0;

  /* "ms_deisotope/_c/averagine.pyx":746
 *             TheoreticalPeak p
 *         total = 0.0
 *         n = self.get_size()             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             p = self.get(i)
 */

#line 746 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":747
 *         total = 0.0
 *         n = self.get_size()
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             p = self.get(i)
 *             total += p.intensity
 */

#line 747 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_v_n;

#line 747 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_t_1;

#line 747 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {

#line 747 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_3;

    /* "ms_deisotope/_c/averagine.pyx":748
 *         n = self.get_size()
 *         for i in range(n):
 *             p = self.get(i)             # <<<<<<<<<<<<<<
 *             total += p.intensity
 *         return total
 */

#line 748 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 748, __pyx_L1_error)

#line 748 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_4);

#line 748 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_4));

#line 748 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = 0;

    /* "ms_deisotope/_c/averagine.pyx":749
 *         for i in range(n):
 *             p = self.get(i)
 *             total += p.intensity             # <<<<<<<<<<<<<<
 *         return total
 * 
 */

#line 749 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_total = (__pyx_v_total + __pyx_v_p->intensity);

#line 749 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":750
 *             p = self.get(i)
 *             total += p.intensity
 *         return total             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */

#line 750 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_total;

#line 750 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":740
 *         return TheoreticalIsotopicPattern._create(peaks, self.origin, self.offset)
 * 
 *     cpdef double total(self):             # <<<<<<<<<<<<<<
 *         cdef:
 *             double total
 */

#line 740 "ms_deisotope/_c/averagine.pyx"


#line 740 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 740 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_WriteUnraisable("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.total", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);

#line 740 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 740 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_p);

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 740 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 740 "ms_deisotope/_c/averagine.pyx"
}

#line 740 "ms_deisotope/_c/averagine.pyx"


#line 740 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 740 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_29total(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 740 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_28total[] = "TheoreticalIsotopicPattern.total(self) -> double";

#line 740 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_29total(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 740 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("total (wrapper)", 0);
  __pyx_r = 
#line 740 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_28total(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self));

#line 740 "ms_deisotope/_c/averagine.pyx"


#line 740 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 740 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 740 "ms_deisotope/_c/averagine.pyx"
}

#line 740 "ms_deisotope/_c/averagine.pyx"


#line 740 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_28total(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 740 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 740 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 740 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 740 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 740 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("total", 0);

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 740 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_total(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 740 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 740 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 740 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 740 "ms_deisotope/_c/averagine.pyx"


#line 740 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 740 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.total", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 740 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 740 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 740 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 740 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 740 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":752
 *         return total
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "TheoreticalIsotopicPattern(%0.4f, charge=%d, (%s))" % (
 *             self.monoisotopic_mz,
 */

#line 752 "ms_deisotope/_c/averagine.pyx"


#line 752 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 752 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_31__repr__(PyObject *__pyx_v_self); /*proto*/

#line 752 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_31__repr__(PyObject *__pyx_v_self) {

#line 752 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = 
#line 752 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_30__repr__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self));

#line 752 "ms_deisotope/_c/averagine.pyx"


#line 752 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 752 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 752 "ms_deisotope/_c/averagine.pyx"
}

#line 752 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_gb_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8__repr___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "ms_deisotope/_c/averagine.pyx":756
 *             self.monoisotopic_mz,
 *             self.peaklist[0].charge,
 *             ', '.join("%0.3f" % p.intensity for p in self.peaklist))             # <<<<<<<<<<<<<<
 * 
 *     cpdef bint _eq(self, object other):
 */

#line 756 "ms_deisotope/_c/averagine.pyx"


#line 756 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8__repr___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr *__pyx_cur_scope
#line 756 "ms_deisotope/_c/averagine.pyx"
;

#line 756 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 756 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 756 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 756 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("genexpr", 0);

#line 756 "ms_deisotope/_c/averagine.pyx"
  __pyx_cur_scope = (struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr *)__pyx_tp_new_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr(__pyx_ptype_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);

#line 756 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!__pyx_cur_scope)) {

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_cur_scope = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr *)Py_None);

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(Py_None);

#line 756 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 756, __pyx_L1_error)

#line 756 "ms_deisotope/_c/averagine.pyx"
  } else {

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_cur_scope);

#line 756 "ms_deisotope/_c/averagine.pyx"
  }

#line 756 "ms_deisotope/_c/averagine.pyx"
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ *) __pyx_self;

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);

#line 756 "ms_deisotope/_c/averagine.pyx"
  {

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8__repr___2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_repr___locals_genexpr, __pyx_n_s_ms_deisotope__c_averagine); if (unlikely(!gen)) __PYX_ERR(0, 756, __pyx_L1_error)

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_cur_scope);

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_RefNannyFinishContext();

#line 756 "ms_deisotope/_c/averagine.pyx"
    return (PyObject *) gen;

#line 756 "ms_deisotope/_c/averagine.pyx"
  }

#line 756 "ms_deisotope/_c/averagine.pyx"


#line 756 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 756 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.__repr__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 756 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 756 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 756 "ms_deisotope/_c/averagine.pyx"
}

#line 756 "ms_deisotope/_c/averagine.pyx"


#line 756 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_gb_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8__repr___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{

#line 756 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);

#line 756 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 756 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 756 "ms_deisotope/_c/averagine.pyx"
  Py_ssize_t __pyx_t_2;

#line 756 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 756 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 756 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 756 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 756 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("genexpr", 0);

#line 756 "ms_deisotope/_c/averagine.pyx"
  switch (__pyx_generator->resume_label) {

#line 756 "ms_deisotope/_c/averagine.pyx"
    case 0: goto __pyx_L3_first_run;

#line 756 "ms_deisotope/_c/averagine.pyx"
    case 1: goto __pyx_L6_resume_from_yield;

#line 756 "ms_deisotope/_c/averagine.pyx"
    default: /* CPython raises the right error here */

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_RefNannyFinishContext();

#line 756 "ms_deisotope/_c/averagine.pyx"
    return NULL;

#line 756 "ms_deisotope/_c/averagine.pyx"
  }

#line 756 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_first_run:;

#line 756 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 756, __pyx_L1_error)

#line 756 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 756, __pyx_L1_error) }

#line 756 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->peaklist == Py_None)) {

#line 756 "ms_deisotope/_c/averagine.pyx"
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");

#line 756 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 756, __pyx_L1_error)

#line 756 "ms_deisotope/_c/averagine.pyx"
  }

#line 756 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->peaklist; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;

#line 756 "ms_deisotope/_c/averagine.pyx"
  for (;;) {

#line 756 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;

#line 756 "ms_deisotope/_c/averagine.pyx"
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS

#line 756 "ms_deisotope/_c/averagine.pyx"
    __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(0, 756, __pyx_L1_error)

#line 756 "ms_deisotope/_c/averagine.pyx"
    #else

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error)

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 756 "ms_deisotope/_c/averagine.pyx"
    #endif

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_p);

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_p, __pyx_t_3);

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GIVEREF(__pyx_t_3);

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = 0;

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_p, __pyx_n_s_intensity); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error)

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = __Pyx_PyString_FormatSafe(__pyx_kp_s_0_3f, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error)

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_4);

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_r = __pyx_t_4;

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = 0;

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XGIVEREF(__pyx_t_1);

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XGIVEREF(__pyx_r);

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_RefNannyFinishContext();

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);

#line 756 "ms_deisotope/_c/averagine.pyx"
    /* return from generator, yielding value */

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_generator->resume_label = 1;

#line 756 "ms_deisotope/_c/averagine.pyx"
    return __pyx_r;

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_L6_resume_from_yield:;

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_cur_scope->__pyx_t_0 = 0;

#line 756 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XGOTREF(__pyx_t_1);

#line 756 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;

#line 756 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 756, __pyx_L1_error)

#line 756 "ms_deisotope/_c/averagine.pyx"
  }

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 756 "ms_deisotope/_c/averagine.pyx"
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

#line 756 "ms_deisotope/_c/averagine.pyx"


#line 756 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 756 "ms_deisotope/_c/averagine.pyx"
  PyErr_SetNone(PyExc_StopIteration);

#line 756 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 756 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 756 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;

#line 756 "ms_deisotope/_c/averagine.pyx"
  #if !CYTHON_USE_EXC_INFO_STACK

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);

#line 756 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 756 "ms_deisotope/_c/averagine.pyx"
  __pyx_generator->resume_label = -1;

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 756 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 756 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":752
 *         return total
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "TheoreticalIsotopicPattern(%0.4f, charge=%d, (%s))" % (
 *             self.monoisotopic_mz,
 */

#line 752 "ms_deisotope/_c/averagine.pyx"


#line 752 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_30__repr__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {
  struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ *__pyx_cur_scope
#line 752 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_gb_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8__repr___2generator = 0
#line 752 "ms_deisotope/_c/averagine.pyx"
;

#line 752 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 752 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 752 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 752 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 752 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 752 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 752 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 752 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__repr__", 0);

#line 752 "ms_deisotope/_c/averagine.pyx"
  __pyx_cur_scope = (struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ *)__pyx_tp_new_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__(__pyx_ptype_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__, __pyx_empty_tuple, NULL);

#line 752 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!__pyx_cur_scope)) {

#line 752 "ms_deisotope/_c/averagine.pyx"
    __pyx_cur_scope = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ *)Py_None);

#line 752 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(Py_None);

#line 752 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 752, __pyx_L1_error)

#line 752 "ms_deisotope/_c/averagine.pyx"
  } else {

#line 752 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_cur_scope);

#line 752 "ms_deisotope/_c/averagine.pyx"
  }

#line 752 "ms_deisotope/_c/averagine.pyx"
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":753
 * 
 *     def __repr__(self):
 *         return "TheoreticalIsotopicPattern(%0.4f, charge=%d, (%s))" % (             # <<<<<<<<<<<<<<
 *             self.monoisotopic_mz,
 *             self.peaklist[0].charge,
 */

#line 753 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

  /* "ms_deisotope/_c/averagine.pyx":754
 *     def __repr__(self):
 *         return "TheoreticalIsotopicPattern(%0.4f, charge=%d, (%s))" % (
 *             self.monoisotopic_mz,             # <<<<<<<<<<<<<<
 *             self.peaklist[0].charge,
 *             ', '.join("%0.3f" % p.intensity for p in self.peaklist))
 */

#line 754 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_monoisotopic_mz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 754, __pyx_L1_error)

#line 754 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

  /* "ms_deisotope/_c/averagine.pyx":755
 *         return "TheoreticalIsotopicPattern(%0.4f, charge=%d, (%s))" % (
 *             self.monoisotopic_mz,
 *             self.peaklist[0].charge,             # <<<<<<<<<<<<<<
 *             ', '.join("%0.3f" % p.intensity for p in self.peaklist))
 * 
 */

#line 755 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_cur_scope->__pyx_v_self->peaklist == Py_None)) {

#line 755 "ms_deisotope/_c/averagine.pyx"
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");

#line 755 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 755, __pyx_L1_error)

#line 755 "ms_deisotope/_c/averagine.pyx"
  }

#line 755 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_cur_scope->__pyx_v_self->peaklist, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 755, __pyx_L1_error)

#line 755 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 755 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_charge); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 755, __pyx_L1_error)

#line 755 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_3);

#line 755 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":756
 *             self.monoisotopic_mz,
 *             self.peaklist[0].charge,
 *             ', '.join("%0.3f" % p.intensity for p in self.peaklist))             # <<<<<<<<<<<<<<
 * 
 *     cpdef bint _eq(self, object other):
 */

#line 756 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8__repr___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error)

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 756 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = __Pyx_PyString_Join(__pyx_kp_s__7, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error)

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_4);

#line 756 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":754
 *     def __repr__(self):
 *         return "TheoreticalIsotopicPattern(%0.4f, charge=%d, (%s))" % (
 *             self.monoisotopic_mz,             # <<<<<<<<<<<<<<
 *             self.peaklist[0].charge,
 *             ', '.join("%0.3f" % p.intensity for p in self.peaklist))
 */

#line 754 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error)

#line 754 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 754 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_1);

#line 754 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);

#line 754 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_3);

#line 754 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);

#line 754 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_4);

#line 754 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_4);

#line 754 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 754 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = 0;

#line 754 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = 0;

  /* "ms_deisotope/_c/averagine.pyx":753
 * 
 *     def __repr__(self):
 *         return "TheoreticalIsotopicPattern(%0.4f, charge=%d, (%s))" % (             # <<<<<<<<<<<<<<
 *             self.monoisotopic_mz,
 *             self.peaklist[0].charge,
 */

#line 753 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_TheoreticalIsotopicPattern_0_4f, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 753, __pyx_L1_error)

#line 753 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_4);

#line 753 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 753 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_4;

#line 753 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = 0;

#line 753 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":752
 *         return total
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "TheoreticalIsotopicPattern(%0.4f, charge=%d, (%s))" % (
 *             self.monoisotopic_mz,
 */

#line 752 "ms_deisotope/_c/averagine.pyx"


#line 752 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 752 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 752 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 752 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_gb_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8__repr___2generator);

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 752 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 752 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 752 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":758
 *             ', '.join("%0.3f" % p.intensity for p in self.peaklist))
 * 
 *     cpdef bint _eq(self, object other):             # <<<<<<<<<<<<<<
 *         cdef:
 *             list peaklist
 */

#line 758 "ms_deisotope/_c/averagine.pyx"


#line 758 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_33_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/

#line 758 "ms_deisotope/_c/averagine.pyx"
static int __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__eq(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_other, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_peaklist = 0
#line 758 "ms_deisotope/_c/averagine.pyx"
;

#line 758 "ms_deisotope/_c/averagine.pyx"
  int __pyx_r;

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 758 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_1;

#line 758 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_2;

#line 758 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 758 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 758 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 758 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 758 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("_eq", 0);

  /* "ms_deisotope/_c/averagine.pyx":762
 *             list peaklist
 *             TheoreticalIsotopicPattern other_typed
 *         if isinstance(other, list):             # <<<<<<<<<<<<<<
 *             peaklist = other
 *         elif isinstance(other, TheoreticalIsotopicPattern):
 */

#line 762 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyList_Check(__pyx_v_other); 

#line 762 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = (__pyx_t_1 != 0);

#line 762 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_2) {

    /* "ms_deisotope/_c/averagine.pyx":763
 *             TheoreticalIsotopicPattern other_typed
 *         if isinstance(other, list):
 *             peaklist = other             # <<<<<<<<<<<<<<
 *         elif isinstance(other, TheoreticalIsotopicPattern):
 *             peaklist = other.peaklist
 */

#line 763 "ms_deisotope/_c/averagine.pyx"
    if (!(likely(PyList_CheckExact(__pyx_v_other))||((__pyx_v_other) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_other)->tp_name), 0))) __PYX_ERR(0, 763, __pyx_L1_error)

#line 763 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __pyx_v_other;

#line 763 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_t_3);

#line 763 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_peaklist = ((PyObject*)__pyx_t_3);

#line 763 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = 0;

    /* "ms_deisotope/_c/averagine.pyx":762
 *             list peaklist
 *             TheoreticalIsotopicPattern other_typed
 *         if isinstance(other, list):             # <<<<<<<<<<<<<<
 *             peaklist = other
 *         elif isinstance(other, TheoreticalIsotopicPattern):
 */

#line 762 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L3;

#line 762 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":764
 *         if isinstance(other, list):
 *             peaklist = other
 *         elif isinstance(other, TheoreticalIsotopicPattern):             # <<<<<<<<<<<<<<
 *             peaklist = other.peaklist
 *         else:
 */

#line 764 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, __pyx_ptype_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern); 

#line 764 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = (__pyx_t_2 != 0);

#line 764 "ms_deisotope/_c/averagine.pyx"
  if (likely(__pyx_t_1)) {

    /* "ms_deisotope/_c/averagine.pyx":765
 *             peaklist = other
 *         elif isinstance(other, TheoreticalIsotopicPattern):
 *             peaklist = other.peaklist             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError(type(other))
 */

#line 765 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_peaklist); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 765, __pyx_L1_error)

#line 765 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 765 "ms_deisotope/_c/averagine.pyx"
    if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 765, __pyx_L1_error)

#line 765 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_peaklist = ((PyObject*)__pyx_t_3);

#line 765 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = 0;

    /* "ms_deisotope/_c/averagine.pyx":764
 *         if isinstance(other, list):
 *             peaklist = other
 *         elif isinstance(other, TheoreticalIsotopicPattern):             # <<<<<<<<<<<<<<
 *             peaklist = other.peaklist
 *         else:
 */

#line 764 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L3;

#line 764 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":767
 *             peaklist = other.peaklist
 *         else:
 *             raise TypeError(type(other))             # <<<<<<<<<<<<<<
 *         return self.get_processed_peaks() == peaklist
 * 
 */

#line 767 "ms_deisotope/_c/averagine.pyx"
  /*else*/ {

#line 767 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, ((PyObject *)Py_TYPE(__pyx_v_other))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 767, __pyx_L1_error)

#line 767 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 767 "ms_deisotope/_c/averagine.pyx"
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);

#line 767 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 767 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 767, __pyx_L1_error)

#line 767 "ms_deisotope/_c/averagine.pyx"
  }

#line 767 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3:;

  /* "ms_deisotope/_c/averagine.pyx":768
 *         else:
 *             raise TypeError(type(other))
 *         return self.get_processed_peaks() == peaklist             # <<<<<<<<<<<<<<
 * 
 *     @cython.final
 */

#line 768 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_processed_peaks(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 768, __pyx_L1_error)

#line 768 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_3);

#line 768 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_peaklist, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 768, __pyx_L1_error)

#line 768 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 768 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 768, __pyx_L1_error)

#line 768 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 768 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 768 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":758
 *             ', '.join("%0.3f" % p.intensity for p in self.peaklist))
 * 
 *     cpdef bint _eq(self, object other):             # <<<<<<<<<<<<<<
 *         cdef:
 *             list peaklist
 */

#line 758 "ms_deisotope/_c/averagine.pyx"


#line 758 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 758 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_WriteUnraisable("ms_deisotope._c.averagine.TheoreticalIsotopicPattern._eq", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);

#line 758 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 758 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_peaklist);

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 758 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 758 "ms_deisotope/_c/averagine.pyx"
}

#line 758 "ms_deisotope/_c/averagine.pyx"


#line 758 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 758 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_33_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/

#line 758 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_32_eq[] = "TheoreticalIsotopicPattern._eq(self, other) -> bool";

#line 758 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_33_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {

#line 758 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("_eq (wrapper)", 0);
  __pyx_r = 
#line 758 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_32_eq(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self), ((PyObject *)__pyx_v_other));

#line 758 "ms_deisotope/_c/averagine.pyx"


#line 758 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 758 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 758 "ms_deisotope/_c/averagine.pyx"
}

#line 758 "ms_deisotope/_c/averagine.pyx"


#line 758 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_32_eq(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_other) {

#line 758 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 758 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 758 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 758 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 758 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("_eq", 0);

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 758 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__eq(__pyx_v_self, __pyx_v_other, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error)

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 758 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 758 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 758 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 758 "ms_deisotope/_c/averagine.pyx"


#line 758 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 758 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern._eq", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 758 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 758 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 758 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 758 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 758 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":771
 * 
 *     @cython.final
 *     cdef bint _eq_inst(self, TheoreticalIsotopicPattern other):             # <<<<<<<<<<<<<<
 *         cdef:
 *             bint val
 */

#line 771 "ms_deisotope/_c/averagine.pyx"


#line 771 "ms_deisotope/_c/averagine.pyx"
static int __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__eq_inst(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_other) {
  int __pyx_v_val
#line 771 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_tp1 = 0
#line 771 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *__pyx_v_tp2 = 0
#line 771 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_i
#line 771 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 771 "ms_deisotope/_c/averagine.pyx"
;

#line 771 "ms_deisotope/_c/averagine.pyx"
  int __pyx_r;

#line 771 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 771 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_1;

#line 771 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_2;

#line 771 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_3;

#line 771 "ms_deisotope/_c/averagine.pyx"
  size_t __pyx_t_4;

#line 771 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_5 = NULL;

#line 771 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 771 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 771 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 771 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("_eq_inst", 0);

  /* "ms_deisotope/_c/averagine.pyx":777
 *             size_t i, n
 * 
 *         n = self.get_size()             # <<<<<<<<<<<<<<
 *         val = n == other.get_size()
 *         if not val:
 */

#line 777 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":778
 * 
 *         n = self.get_size()
 *         val = n == other.get_size()             # <<<<<<<<<<<<<<
 *         if not val:
 *             return val
 */

#line 778 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_val = (__pyx_v_n == __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_other));

  /* "ms_deisotope/_c/averagine.pyx":779
 *         n = self.get_size()
 *         val = n == other.get_size()
 *         if not val:             # <<<<<<<<<<<<<<
 *             return val
 *         for i in range(n):
 */

#line 779 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((!(__pyx_v_val != 0)) != 0);

#line 779 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_1) {

    /* "ms_deisotope/_c/averagine.pyx":780
 *         val = n == other.get_size()
 *         if not val:
 *             return val             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             tp1 = self.get(i)
 */

#line 780 "ms_deisotope/_c/averagine.pyx"
    __pyx_r = __pyx_v_val;

#line 780 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L0;

    /* "ms_deisotope/_c/averagine.pyx":779
 *         n = self.get_size()
 *         val = n == other.get_size()
 *         if not val:             # <<<<<<<<<<<<<<
 *             return val
 *         for i in range(n):
 */

#line 779 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":781
 *         if not val:
 *             return val
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             tp1 = self.get(i)
 *             tp2 = other.get(i)
 */

#line 781 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __pyx_v_n;

#line 781 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __pyx_t_2;

#line 781 "ms_deisotope/_c/averagine.pyx"
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {

#line 781 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = __pyx_t_4;

    /* "ms_deisotope/_c/averagine.pyx":782
 *             return val
 *         for i in range(n):
 *             tp1 = self.get(i)             # <<<<<<<<<<<<<<
 *             tp2 = other.get(i)
 *             val = tp1._eq(tp2)
 */

#line 782 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_self, __pyx_v_i)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 782, __pyx_L1_error)

#line 782 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_5);

#line 782 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_tp1, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_5));

#line 782 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = 0;

    /* "ms_deisotope/_c/averagine.pyx":783
 *         for i in range(n):
 *             tp1 = self.get(i)
 *             tp2 = other.get(i)             # <<<<<<<<<<<<<<
 *             val = tp1._eq(tp2)
 *             if not val:
 */

#line 783 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get(__pyx_v_other, __pyx_v_i)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 783, __pyx_L1_error)

#line 783 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_5);

#line 783 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_tp2, ((struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_t_5));

#line 783 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = 0;

    /* "ms_deisotope/_c/averagine.pyx":784
 *             tp1 = self.get(i)
 *             tp2 = other.get(i)
 *             val = tp1._eq(tp2)             # <<<<<<<<<<<<<<
 *             if not val:
 *                 return val
 */

#line 784 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_val = ((struct __pyx_vtabstruct_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *)__pyx_v_tp1->__pyx_vtab)->_eq(__pyx_v_tp1, __pyx_v_tp2, 0);

    /* "ms_deisotope/_c/averagine.pyx":785
 *             tp2 = other.get(i)
 *             val = tp1._eq(tp2)
 *             if not val:             # <<<<<<<<<<<<<<
 *                 return val
 *         return val
 */

#line 785 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((!(__pyx_v_val != 0)) != 0);

#line 785 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_1) {

      /* "ms_deisotope/_c/averagine.pyx":786
 *             val = tp1._eq(tp2)
 *             if not val:
 *                 return val             # <<<<<<<<<<<<<<
 *         return val
 * 
 */

#line 786 "ms_deisotope/_c/averagine.pyx"
      __pyx_r = __pyx_v_val;

#line 786 "ms_deisotope/_c/averagine.pyx"
      goto __pyx_L0;

      /* "ms_deisotope/_c/averagine.pyx":785
 *             tp2 = other.get(i)
 *             val = tp1._eq(tp2)
 *             if not val:             # <<<<<<<<<<<<<<
 *                 return val
 *         return val
 */

#line 785 "ms_deisotope/_c/averagine.pyx"
    }

#line 785 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":787
 *             if not val:
 *                 return val
 *         return val             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, object other, int code):
 */

#line 787 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_val;

#line 787 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":771
 * 
 *     @cython.final
 *     cdef bint _eq_inst(self, TheoreticalIsotopicPattern other):             # <<<<<<<<<<<<<<
 *         cdef:
 *             bint val
 */

#line 771 "ms_deisotope/_c/averagine.pyx"


#line 771 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 771 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 771 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_5);

#line 771 "ms_deisotope/_c/averagine.pyx"
  __Pyx_WriteUnraisable("ms_deisotope._c.averagine.TheoreticalIsotopicPattern._eq_inst", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);

#line 771 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 771 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 771 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_tp1);

#line 771 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_tp2);

#line 771 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 771 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 771 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":789
 *         return val
 * 
 *     def __richcmp__(self, object other, int code):             # <<<<<<<<<<<<<<
 *         if other is None:
 *             if code == 3:
 */

#line 789 "ms_deisotope/_c/averagine.pyx"


#line 789 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 789 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_35__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_code); /*proto*/

#line 789 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_35__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_code) {

#line 789 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 789 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 789 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_r = 
#line 789 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_34__richcmp__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_code));

#line 789 "ms_deisotope/_c/averagine.pyx"


#line 789 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 789 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 789 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 789 "ms_deisotope/_c/averagine.pyx"
}

#line 789 "ms_deisotope/_c/averagine.pyx"


#line 789 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_34__richcmp__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_code) {

#line 789 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 789 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 789 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_1;

#line 789 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_2;

#line 789 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 789 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 789 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 789 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 789 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "ms_deisotope/_c/averagine.pyx":790
 * 
 *     def __richcmp__(self, object other, int code):
 *         if other is None:             # <<<<<<<<<<<<<<
 *             if code == 3:
 *                 return True
 */

#line 790 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = (__pyx_v_other == Py_None);

#line 790 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = (__pyx_t_1 != 0);

#line 790 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_2) {

    /* "ms_deisotope/_c/averagine.pyx":791
 *     def __richcmp__(self, object other, int code):
 *         if other is None:
 *             if code == 3:             # <<<<<<<<<<<<<<
 *                 return True
 *             else:
 */

#line 791 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = ((__pyx_v_code == 3) != 0);

#line 791 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_2) {

      /* "ms_deisotope/_c/averagine.pyx":792
 *         if other is None:
 *             if code == 3:
 *                 return True             # <<<<<<<<<<<<<<
 *             else:
 *                 return False
 */

#line 792 "ms_deisotope/_c/averagine.pyx"
      __Pyx_XDECREF(__pyx_r);

#line 792 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(Py_True);

#line 792 "ms_deisotope/_c/averagine.pyx"
      __pyx_r = Py_True;

#line 792 "ms_deisotope/_c/averagine.pyx"
      goto __pyx_L0;

      /* "ms_deisotope/_c/averagine.pyx":791
 *     def __richcmp__(self, object other, int code):
 *         if other is None:
 *             if code == 3:             # <<<<<<<<<<<<<<
 *                 return True
 *             else:
 */

#line 791 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":794
 *                 return True
 *             else:
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *         if code == 2:
 */

#line 794 "ms_deisotope/_c/averagine.pyx"
    /*else*/ {

#line 794 "ms_deisotope/_c/averagine.pyx"
      __Pyx_XDECREF(__pyx_r);

#line 794 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(Py_False);

#line 794 "ms_deisotope/_c/averagine.pyx"
      __pyx_r = Py_False;

#line 794 "ms_deisotope/_c/averagine.pyx"
      goto __pyx_L0;

#line 794 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":790
 * 
 *     def __richcmp__(self, object other, int code):
 *         if other is None:             # <<<<<<<<<<<<<<
 *             if code == 3:
 *                 return True
 */

#line 790 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":796
 *                 return False
 * 
 *         if code == 2:             # <<<<<<<<<<<<<<
 *             return self._eq(other)
 *         elif code == 3:
 */

#line 796 "ms_deisotope/_c/averagine.pyx"
  switch (__pyx_v_code) {

#line 796 "ms_deisotope/_c/averagine.pyx"
    case 2:

    /* "ms_deisotope/_c/averagine.pyx":797
 * 
 *         if code == 2:
 *             return self._eq(other)             # <<<<<<<<<<<<<<
 *         elif code == 3:
 *             return not (self._eq(other))
 */

#line 797 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF(__pyx_r);

#line 797 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__eq(__pyx_v_self, __pyx_v_other, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 797, __pyx_L1_error)

#line 797 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 797 "ms_deisotope/_c/averagine.pyx"
    __pyx_r = __pyx_t_3;

#line 797 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = 0;

#line 797 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L0;

    /* "ms_deisotope/_c/averagine.pyx":796
 *                 return False
 * 
 *         if code == 2:             # <<<<<<<<<<<<<<
 *             return self._eq(other)
 *         elif code == 3:
 */

#line 796 "ms_deisotope/_c/averagine.pyx"
    break;

#line 796 "ms_deisotope/_c/averagine.pyx"
    case 3:

    /* "ms_deisotope/_c/averagine.pyx":799
 *             return self._eq(other)
 *         elif code == 3:
 *             return not (self._eq(other))             # <<<<<<<<<<<<<<
 *         else:
 *             return NotImplemented
 */

#line 799 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF(__pyx_r);

#line 799 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyBool_FromLong((!(__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__eq(__pyx_v_self, __pyx_v_other, 0) != 0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 799, __pyx_L1_error)

#line 799 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 799 "ms_deisotope/_c/averagine.pyx"
    __pyx_r = __pyx_t_3;

#line 799 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = 0;

#line 799 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L0;

    /* "ms_deisotope/_c/averagine.pyx":798
 *         if code == 2:
 *             return self._eq(other)
 *         elif code == 3:             # <<<<<<<<<<<<<<
 *             return not (self._eq(other))
 *         else:
 */

#line 798 "ms_deisotope/_c/averagine.pyx"
    break;

#line 798 "ms_deisotope/_c/averagine.pyx"
    default:

    /* "ms_deisotope/_c/averagine.pyx":801
 *             return not (self._eq(other))
 *         else:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *     cpdef list incremental_truncation(TheoreticalIsotopicPattern self, double threshold):
 */

#line 801 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF(__pyx_r);

#line 801 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_builtin_NotImplemented);

#line 801 "ms_deisotope/_c/averagine.pyx"
    __pyx_r = __pyx_builtin_NotImplemented;

#line 801 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L0;

#line 801 "ms_deisotope/_c/averagine.pyx"
    break;

#line 801 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":789
 *         return val
 * 
 *     def __richcmp__(self, object other, int code):             # <<<<<<<<<<<<<<
 *         if other is None:
 *             if code == 3:
 */

#line 789 "ms_deisotope/_c/averagine.pyx"


#line 789 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 789 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 789 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 789 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 789 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 789 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 789 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 789 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 789 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 789 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":803
 *             return NotImplemented
 * 
 *     cpdef list incremental_truncation(TheoreticalIsotopicPattern self, double threshold):             # <<<<<<<<<<<<<<
 *         """Create incremental truncations of `self`, dropping the last peak until
 *         the the total signal in reaches `threshold`
 */

#line 803 "ms_deisotope/_c/averagine.pyx"


#line 803 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_37incremental_truncation(PyObject *__pyx_v_self, PyObject *__pyx_arg_threshold); /*proto*/

#line 803 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_incremental_truncation(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_threshold, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_accumulator = 0
#line 803 "ms_deisotope/_c/averagine.pyx"
;
  double *__pyx_v_cumulative_intensities
#line 803 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_i
#line 803 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n
#line 803 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_template = 0
#line 803 "ms_deisotope/_c/averagine.pyx"
;

#line 803 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 803 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 803 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 803 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_3;

#line 803 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_4;

#line 803 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 803 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 803 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("incremental_truncation", 0);

  /* "ms_deisotope/_c/averagine.pyx":822
 *             TheoreticalIsotopicPattern template, current
 * 
 *         template = self.clone().normalize()             # <<<<<<<<<<<<<<
 *         n = self.get_size()
 *         cumulative_intensities = _cumulative(template)
 */

#line 822 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __pyx_L1_error)

#line 822 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 822 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_normalize(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_1), 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error)

#line 822 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 822 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 822 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_template = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_2);

#line 822 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":823
 * 
 *         template = self.clone().normalize()
 *         n = self.get_size()             # <<<<<<<<<<<<<<
 *         cumulative_intensities = _cumulative(template)
 *         accumulator = [template]
 */

#line 823 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_n = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size(__pyx_v_self);

  /* "ms_deisotope/_c/averagine.pyx":824
 *         template = self.clone().normalize()
 *         n = self.get_size()
 *         cumulative_intensities = _cumulative(template)             # <<<<<<<<<<<<<<
 *         accumulator = [template]
 * 
 */

#line 824 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_cumulative_intensities = __pyx_f_12ms_deisotope_2_c_9averagine__cumulative(__pyx_v_template);

  /* "ms_deisotope/_c/averagine.pyx":825
 *         n = self.get_size()
 *         cumulative_intensities = _cumulative(template)
 *         accumulator = [template]             # <<<<<<<<<<<<<<
 * 
 *         i = n - 1
 */

#line 825 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L1_error)

#line 825 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 825 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_v_template));

#line 825 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(((PyObject *)__pyx_v_template));

#line 825 "ms_deisotope/_c/averagine.pyx"
  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_template));

#line 825 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_accumulator = ((PyObject*)__pyx_t_2);

#line 825 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":827
 *         accumulator = [template]
 * 
 *         i = n - 1             # <<<<<<<<<<<<<<
 *         while i > 0:
 *             if cumulative_intensities[i - 1] < threshold:
 */

#line 827 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_i = (__pyx_v_n - 1);

  /* "ms_deisotope/_c/averagine.pyx":828
 * 
 *         i = n - 1
 *         while i > 0:             # <<<<<<<<<<<<<<
 *             if cumulative_intensities[i - 1] < threshold:
 *                 break
 */

#line 828 "ms_deisotope/_c/averagine.pyx"
  while (1) {

#line 828 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = ((__pyx_v_i > 0) != 0);

#line 828 "ms_deisotope/_c/averagine.pyx"
    if (!__pyx_t_3) break;

    /* "ms_deisotope/_c/averagine.pyx":829
 *         i = n - 1
 *         while i > 0:
 *             if cumulative_intensities[i - 1] < threshold:             # <<<<<<<<<<<<<<
 *                 break
 *             template = template.clone_drop_last()
 */

#line 829 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = (((__pyx_v_cumulative_intensities[(__pyx_v_i - 1)]) < __pyx_v_threshold) != 0);

#line 829 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_3) {

      /* "ms_deisotope/_c/averagine.pyx":830
 *         while i > 0:
 *             if cumulative_intensities[i - 1] < threshold:
 *                 break             # <<<<<<<<<<<<<<
 *             template = template.clone_drop_last()
 *             accumulator.append(template)
 */

#line 830 "ms_deisotope/_c/averagine.pyx"
      goto __pyx_L4_break;

      /* "ms_deisotope/_c/averagine.pyx":829
 *         i = n - 1
 *         while i > 0:
 *             if cumulative_intensities[i - 1] < threshold:             # <<<<<<<<<<<<<<
 *                 break
 *             template = template.clone_drop_last()
 */

#line 829 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":831
 *             if cumulative_intensities[i - 1] < threshold:
 *                 break
 *             template = template.clone_drop_last()             # <<<<<<<<<<<<<<
 *             accumulator.append(template)
 *             i -= 1
 */

#line 831 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone_drop_last(__pyx_v_template)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error)

#line 831 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);

#line 831 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF_SET(__pyx_v_template, ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_2));

#line 831 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = 0;

    /* "ms_deisotope/_c/averagine.pyx":832
 *                 break
 *             template = template.clone_drop_last()
 *             accumulator.append(template)             # <<<<<<<<<<<<<<
 *             i -= 1
 *         free(cumulative_intensities)
 */

#line 832 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_accumulator, ((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 832, __pyx_L1_error)

    /* "ms_deisotope/_c/averagine.pyx":833
 *             template = template.clone_drop_last()
 *             accumulator.append(template)
 *             i -= 1             # <<<<<<<<<<<<<<
 *         free(cumulative_intensities)
 *         return accumulator
 */

#line 833 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_i = (__pyx_v_i - 1);

#line 833 "ms_deisotope/_c/averagine.pyx"
  }

#line 833 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_break:;

  /* "ms_deisotope/_c/averagine.pyx":834
 *             accumulator.append(template)
 *             i -= 1
 *         free(cumulative_intensities)             # <<<<<<<<<<<<<<
 *         return accumulator
 * 
 */

#line 834 "ms_deisotope/_c/averagine.pyx"
  free(__pyx_v_cumulative_intensities);

  /* "ms_deisotope/_c/averagine.pyx":835
 *             i -= 1
 *         free(cumulative_intensities)
 *         return accumulator             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 835 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 835 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_accumulator);

#line 835 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_accumulator;

#line 835 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":803
 *             return NotImplemented
 * 
 *     cpdef list incremental_truncation(TheoreticalIsotopicPattern self, double threshold):             # <<<<<<<<<<<<<<
 *         """Create incremental truncations of `self`, dropping the last peak until
 *         the the total signal in reaches `threshold`
 */

#line 803 "ms_deisotope/_c/averagine.pyx"


#line 803 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 803 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.incremental_truncation", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 803 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_accumulator);

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_template);

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 803 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 803 "ms_deisotope/_c/averagine.pyx"
}

#line 803 "ms_deisotope/_c/averagine.pyx"


#line 803 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 803 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_37incremental_truncation(PyObject *__pyx_v_self, PyObject *__pyx_arg_threshold); /*proto*/

#line 803 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_36incremental_truncation[] = "TheoreticalIsotopicPattern.incremental_truncation(self, double threshold) -> list\nCreate incremental truncations of `self`, dropping the last peak until\n        the the total signal in reaches `threshold`\n\n        Parameters\n        ----------\n        threshold: float\n            The minimum percentage of the isotopic pattern to retain.\n\n        Returns\n        -------\n        :class:`list` of :class:`TheoreticalIsotopicPattern`\n        ";

#line 803 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_37incremental_truncation(PyObject *__pyx_v_self, PyObject *__pyx_arg_threshold) {
  double __pyx_v_threshold
#line 803 "ms_deisotope/_c/averagine.pyx"
;

#line 803 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 803 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 803 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 803 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("incremental_truncation (wrapper)", 0);

#line 803 "ms_deisotope/_c/averagine.pyx"
  assert(__pyx_arg_threshold); {

#line 803 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_threshold = __pyx_PyFloat_AsDouble(__pyx_arg_threshold); if (unlikely((__pyx_v_threshold == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 803, __pyx_L3_error)

#line 803 "ms_deisotope/_c/averagine.pyx"
  }

#line 803 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.incremental_truncation", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 803 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 803 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_36incremental_truncation(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self), ((double)__pyx_v_threshold));

#line 803 "ms_deisotope/_c/averagine.pyx"


#line 803 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 803 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 803 "ms_deisotope/_c/averagine.pyx"
}

#line 803 "ms_deisotope/_c/averagine.pyx"


#line 803 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_36incremental_truncation(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, double __pyx_v_threshold) {

#line 803 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 803 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 803 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 803 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 803 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("incremental_truncation", 0);

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 803 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_incremental_truncation(__pyx_v_self, __pyx_v_threshold, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error)

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 803 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 803 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 803 "ms_deisotope/_c/averagine.pyx"


#line 803 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 803 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.incremental_truncation", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 803 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 803 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 803 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 803 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pxd":25
 * cdef class TheoreticalIsotopicPattern(object):
 *     cdef:
 *         public list peaklist             # <<<<<<<<<<<<<<
 *         public double origin
 *         public double offset
 */

#line 25 "ms_deisotope/_c/averagine.pxd"


#line 25 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 25 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_1__get__(PyObject *__pyx_v_self); /*proto*/

#line 25 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_1__get__(PyObject *__pyx_v_self) {

#line 25 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = 0;

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = 
#line 25 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist___get__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self));

#line 25 "ms_deisotope/_c/averagine.pxd"


#line 25 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 25 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 25 "ms_deisotope/_c/averagine.pxd"
}

#line 25 "ms_deisotope/_c/averagine.pxd"


#line 25 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 25 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = NULL;

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__", 0);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_r);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_INCREF(__pyx_v_self->peaklist);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = __pyx_v_self->peaklist;

#line 25 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 25 "ms_deisotope/_c/averagine.pxd"


#line 25 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 25 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XGIVEREF(__pyx_r);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 25 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 25 "ms_deisotope/_c/averagine.pxd"
}

#line 25 "ms_deisotope/_c/averagine.pxd"


#line 25 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 25 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/

#line 25 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {

#line 25 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = 
#line 25 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_2__set__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self), ((PyObject *)__pyx_v_value));

#line 25 "ms_deisotope/_c/averagine.pxd"


#line 25 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 25 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 25 "ms_deisotope/_c/averagine.pxd"
}

#line 25 "ms_deisotope/_c/averagine.pxd"


#line 25 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_value) {

#line 25 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 25 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_t_1 = NULL;

#line 25 "ms_deisotope/_c/averagine.pxd"
  int __pyx_lineno = 0;

#line 25 "ms_deisotope/_c/averagine.pxd"
  const char *__pyx_filename = NULL;

#line 25 "ms_deisotope/_c/averagine.pxd"
  int __pyx_clineno = 0;

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__", 0);

#line 25 "ms_deisotope/_c/averagine.pxd"
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 25, __pyx_L1_error)

#line 25 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = __pyx_v_value;

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_INCREF(__pyx_t_1);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GIVEREF(__pyx_t_1);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GOTREF(__pyx_v_self->peaklist);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_DECREF(__pyx_v_self->peaklist);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __pyx_v_self->peaklist = ((PyObject*)__pyx_t_1);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = 0;

#line 25 "ms_deisotope/_c/averagine.pxd"


#line 25 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 25 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = 0;

#line 25 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 25 "ms_deisotope/_c/averagine.pxd"
  __pyx_L1_error:;

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_t_1);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.peaklist.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = -1;

#line 25 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 25 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 25 "ms_deisotope/_c/averagine.pxd"
}

#line 25 "ms_deisotope/_c/averagine.pxd"


#line 25 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 25 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_5__del__(PyObject *__pyx_v_self); /*proto*/

#line 25 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_5__del__(PyObject *__pyx_v_self) {

#line 25 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = 
#line 25 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_4__del__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self));

#line 25 "ms_deisotope/_c/averagine.pxd"


#line 25 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 25 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 25 "ms_deisotope/_c/averagine.pxd"
}

#line 25 "ms_deisotope/_c/averagine.pxd"


#line 25 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_4__del__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 25 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__del__", 0);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_INCREF(Py_None);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GIVEREF(Py_None);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GOTREF(__pyx_v_self->peaklist);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_DECREF(__pyx_v_self->peaklist);

#line 25 "ms_deisotope/_c/averagine.pxd"
  __pyx_v_self->peaklist = ((PyObject*)Py_None);

#line 25 "ms_deisotope/_c/averagine.pxd"


#line 25 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 25 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = 0;

#line 25 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 25 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 25 "ms_deisotope/_c/averagine.pxd"
}

/* "ms_deisotope/_c/averagine.pxd":26
 *     cdef:
 *         public list peaklist
 *         public double origin             # <<<<<<<<<<<<<<
 *         public double offset
 * 
 */

#line 26 "ms_deisotope/_c/averagine.pxd"


#line 26 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 26 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6origin_1__get__(PyObject *__pyx_v_self); /*proto*/

#line 26 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6origin_1__get__(PyObject *__pyx_v_self) {

#line 26 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = 0;

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = 
#line 26 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6origin___get__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self));

#line 26 "ms_deisotope/_c/averagine.pxd"


#line 26 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 26 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 26 "ms_deisotope/_c/averagine.pxd"
}

#line 26 "ms_deisotope/_c/averagine.pxd"


#line 26 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6origin___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 26 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = NULL;

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 26 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_t_1 = NULL;

#line 26 "ms_deisotope/_c/averagine.pxd"
  int __pyx_lineno = 0;

#line 26 "ms_deisotope/_c/averagine.pxd"
  const char *__pyx_filename = NULL;

#line 26 "ms_deisotope/_c/averagine.pxd"
  int __pyx_clineno = 0;

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__", 0);

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_r);

#line 26 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->origin); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 26, __pyx_L1_error)

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GOTREF(__pyx_t_1);

#line 26 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = __pyx_t_1;

#line 26 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = 0;

#line 26 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 26 "ms_deisotope/_c/averagine.pxd"


#line 26 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 26 "ms_deisotope/_c/averagine.pxd"
  __pyx_L1_error:;

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_t_1);

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.origin.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 26 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = NULL;

#line 26 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XGIVEREF(__pyx_r);

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 26 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 26 "ms_deisotope/_c/averagine.pxd"
}

#line 26 "ms_deisotope/_c/averagine.pxd"


#line 26 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 26 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6origin_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/

#line 26 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6origin_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {

#line 26 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = 
#line 26 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6origin_2__set__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self), ((PyObject *)__pyx_v_value));

#line 26 "ms_deisotope/_c/averagine.pxd"


#line 26 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 26 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 26 "ms_deisotope/_c/averagine.pxd"
}

#line 26 "ms_deisotope/_c/averagine.pxd"


#line 26 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6origin_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_value) {

#line 26 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 26 "ms_deisotope/_c/averagine.pxd"
  double __pyx_t_1;

#line 26 "ms_deisotope/_c/averagine.pxd"
  int __pyx_lineno = 0;

#line 26 "ms_deisotope/_c/averagine.pxd"
  const char *__pyx_filename = NULL;

#line 26 "ms_deisotope/_c/averagine.pxd"
  int __pyx_clineno = 0;

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__", 0);

#line 26 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 26, __pyx_L1_error)

#line 26 "ms_deisotope/_c/averagine.pxd"
  __pyx_v_self->origin = __pyx_t_1;

#line 26 "ms_deisotope/_c/averagine.pxd"


#line 26 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 26 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = 0;

#line 26 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 26 "ms_deisotope/_c/averagine.pxd"
  __pyx_L1_error:;

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.origin.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 26 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = -1;

#line 26 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 26 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 26 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 26 "ms_deisotope/_c/averagine.pxd"
}

/* "ms_deisotope/_c/averagine.pxd":27
 *         public list peaklist
 *         public double origin
 *         public double offset             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */

#line 27 "ms_deisotope/_c/averagine.pxd"


#line 27 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 27 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6offset_1__get__(PyObject *__pyx_v_self); /*proto*/

#line 27 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6offset_1__get__(PyObject *__pyx_v_self) {

#line 27 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = 0;

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = 
#line 27 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6offset___get__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self));

#line 27 "ms_deisotope/_c/averagine.pxd"


#line 27 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 27 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 27 "ms_deisotope/_c/averagine.pxd"
}

#line 27 "ms_deisotope/_c/averagine.pxd"


#line 27 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6offset___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self) {

#line 27 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = NULL;

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 27 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_t_1 = NULL;

#line 27 "ms_deisotope/_c/averagine.pxd"
  int __pyx_lineno = 0;

#line 27 "ms_deisotope/_c/averagine.pxd"
  const char *__pyx_filename = NULL;

#line 27 "ms_deisotope/_c/averagine.pxd"
  int __pyx_clineno = 0;

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__", 0);

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_r);

#line 27 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->offset); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 27, __pyx_L1_error)

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GOTREF(__pyx_t_1);

#line 27 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = __pyx_t_1;

#line 27 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = 0;

#line 27 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 27 "ms_deisotope/_c/averagine.pxd"


#line 27 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 27 "ms_deisotope/_c/averagine.pxd"
  __pyx_L1_error:;

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_t_1);

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.offset.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 27 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = NULL;

#line 27 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XGIVEREF(__pyx_r);

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 27 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 27 "ms_deisotope/_c/averagine.pxd"
}

#line 27 "ms_deisotope/_c/averagine.pxd"


#line 27 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 27 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6offset_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/

#line 27 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6offset_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {

#line 27 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = 
#line 27 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6offset_2__set__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_v_self), ((PyObject *)__pyx_v_value));

#line 27 "ms_deisotope/_c/averagine.pxd"


#line 27 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 27 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 27 "ms_deisotope/_c/averagine.pxd"
}

#line 27 "ms_deisotope/_c/averagine.pxd"


#line 27 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6offset_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_self, PyObject *__pyx_v_value) {

#line 27 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 27 "ms_deisotope/_c/averagine.pxd"
  double __pyx_t_1;

#line 27 "ms_deisotope/_c/averagine.pxd"
  int __pyx_lineno = 0;

#line 27 "ms_deisotope/_c/averagine.pxd"
  const char *__pyx_filename = NULL;

#line 27 "ms_deisotope/_c/averagine.pxd"
  int __pyx_clineno = 0;

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__", 0);

#line 27 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 27, __pyx_L1_error)

#line 27 "ms_deisotope/_c/averagine.pxd"
  __pyx_v_self->offset = __pyx_t_1;

#line 27 "ms_deisotope/_c/averagine.pxd"


#line 27 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 27 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = 0;

#line 27 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 27 "ms_deisotope/_c/averagine.pxd"
  __pyx_L1_error:;

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.TheoreticalIsotopicPattern.offset.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 27 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = -1;

#line 27 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 27 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 27 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 27 "ms_deisotope/_c/averagine.pxd"
}

/* "ms_deisotope/_c/averagine.pyx":850
 *     """
 * 
 *     def __init__(self, object averagine, object backend=None, double cache_truncation=1.):             # <<<<<<<<<<<<<<
 *         if backend is None:
 *             backend = {}
 */

#line 850 "ms_deisotope/_c/averagine.pyx"


#line 850 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 850 "ms_deisotope/_c/averagine.pyx"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 850 "ms_deisotope/_c/averagine.pyx"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_averagine = 0
#line 850 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_backend = 0
#line 850 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_cache_truncation
#line 850 "ms_deisotope/_c/averagine.pyx"
;

#line 850 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 850 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 850 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 850 "ms_deisotope/_c/averagine.pyx"
  int __pyx_r;

#line 850 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 850 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);

#line 850 "ms_deisotope/_c/averagine.pyx"
  {

#line 850 "ms_deisotope/_c/averagine.pyx"
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_averagine,&__pyx_n_s_backend,&__pyx_n_s_cache_truncation,0};

#line 850 "ms_deisotope/_c/averagine.pyx"
    PyObject* values[3] = {0,0,0};

#line 850 "ms_deisotope/_c/averagine.pyx"
    values[1] = ((PyObject *)Py_None);

#line 850 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_kwds)) {

#line 850 "ms_deisotope/_c/averagine.pyx"
      Py_ssize_t kw_args;

#line 850 "ms_deisotope/_c/averagine.pyx"
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);

#line 850 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {
        case  3: 
#line 850 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 850 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 850 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 850 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 850 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 850 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 850 "ms_deisotope/_c/averagine.pyx"
        case  0: break;
        default: 
#line 850 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 850 "ms_deisotope/_c/averagine.pyx"
      }

#line 850 "ms_deisotope/_c/averagine.pyx"
      kw_args = PyDict_Size(__pyx_kwds);

#line 850 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {

#line 850 "ms_deisotope/_c/averagine.pyx"
        case  0:

#line 850 "ms_deisotope/_c/averagine.pyx"
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_averagine)) != 0)) kw_args--;
        else 
#line 850 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 850 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 850 "ms_deisotope/_c/averagine.pyx"
        case  1:

#line 850 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 850 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_backend);

#line 850 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[1] = value; kw_args--; }

#line 850 "ms_deisotope/_c/averagine.pyx"
        }

#line 850 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 850 "ms_deisotope/_c/averagine.pyx"
        case  2:

#line 850 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 850 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cache_truncation);

#line 850 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[2] = value; kw_args--; }

#line 850 "ms_deisotope/_c/averagine.pyx"
        }

#line 850 "ms_deisotope/_c/averagine.pyx"
      }

#line 850 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(kw_args > 0)) {

#line 850 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 850, __pyx_L3_error)

#line 850 "ms_deisotope/_c/averagine.pyx"
      }

#line 850 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 850 "ms_deisotope/_c/averagine.pyx"
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: 
#line 850 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 850 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 850 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 850 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 850 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 850 "ms_deisotope/_c/averagine.pyx"
        break;
        default: 
#line 850 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 850 "ms_deisotope/_c/averagine.pyx"
      }

#line 850 "ms_deisotope/_c/averagine.pyx"
    }

#line 850 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_averagine = values[0];

#line 850 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_backend = values[1];

#line 850 "ms_deisotope/_c/averagine.pyx"
    if (values[2]) {

#line 850 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_cache_truncation = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_cache_truncation == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 850, __pyx_L3_error)

#line 850 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 850 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_cache_truncation = ((double)1.);

#line 850 "ms_deisotope/_c/averagine.pyx"
    }

#line 850 "ms_deisotope/_c/averagine.pyx"
  }

#line 850 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 850 "ms_deisotope/_c/averagine.pyx"
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); 
#line 850 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 850, __pyx_L3_error)

#line 850 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 850 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 850 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 850 "ms_deisotope/_c/averagine.pyx"
  return -1;

#line 850 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 850 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache___init__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self), __pyx_v_averagine, __pyx_v_backend, __pyx_v_cache_truncation);

#line 850 "ms_deisotope/_c/averagine.pyx"


#line 850 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 850 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 850 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 850 "ms_deisotope/_c/averagine.pyx"
}

#line 850 "ms_deisotope/_c/averagine.pyx"


#line 850 "ms_deisotope/_c/averagine.pyx"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache___init__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_averagine, PyObject *__pyx_v_backend, double __pyx_v_cache_truncation) {

#line 850 "ms_deisotope/_c/averagine.pyx"
  int __pyx_r;

#line 850 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 850 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_1;

#line 850 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_2;

#line 850 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 850 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_4;

#line 850 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_5 = NULL;

#line 850 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_6 = NULL;

#line 850 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 850 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 850 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 850 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__init__", 0);

#line 850 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_backend);

  /* "ms_deisotope/_c/averagine.pyx":851
 * 
 *     def __init__(self, object averagine, object backend=None, double cache_truncation=1.):
 *         if backend is None:             # <<<<<<<<<<<<<<
 *             backend = {}
 *         self.backend = dict(backend)
 */

#line 851 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = (__pyx_v_backend == Py_None);

#line 851 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = (__pyx_t_1 != 0);

#line 851 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_2) {

    /* "ms_deisotope/_c/averagine.pyx":852
 *     def __init__(self, object averagine, object backend=None, double cache_truncation=1.):
 *         if backend is None:
 *             backend = {}             # <<<<<<<<<<<<<<
 *         self.backend = dict(backend)
 *         if isinstance(averagine, AveragineCache):
 */

#line 852 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 852, __pyx_L1_error)

#line 852 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 852 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF_SET(__pyx_v_backend, __pyx_t_3);

#line 852 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = 0;

    /* "ms_deisotope/_c/averagine.pyx":851
 * 
 *     def __init__(self, object averagine, object backend=None, double cache_truncation=1.):
 *         if backend is None:             # <<<<<<<<<<<<<<
 *             backend = {}
 *         self.backend = dict(backend)
 */

#line 851 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":853
 *         if backend is None:
 *             backend = {}
 *         self.backend = dict(backend)             # <<<<<<<<<<<<<<
 *         if isinstance(averagine, AveragineCache):
 *             self.averagine = averagine.averagine
 */

#line 853 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_v_backend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 853, __pyx_L1_error)

#line 853 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_3);

#line 853 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_3);

#line 853 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_v_self->backend);

#line 853 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_v_self->backend);

#line 853 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->backend = ((PyObject*)__pyx_t_3);

#line 853 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = 0;

  /* "ms_deisotope/_c/averagine.pyx":854
 *             backend = {}
 *         self.backend = dict(backend)
 *         if isinstance(averagine, AveragineCache):             # <<<<<<<<<<<<<<
 *             self.averagine = averagine.averagine
 *             self.cache_truncation = averagine.cache_truncation
 */

#line 854 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_averagine, __pyx_ptype_12ms_deisotope_2_c_9averagine_AveragineCache); 

#line 854 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = (__pyx_t_2 != 0);

#line 854 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_1) {

    /* "ms_deisotope/_c/averagine.pyx":855
 *         self.backend = dict(backend)
 *         if isinstance(averagine, AveragineCache):
 *             self.averagine = averagine.averagine             # <<<<<<<<<<<<<<
 *             self.cache_truncation = averagine.cache_truncation
 *             self.backend = averagine.backend.copy()
 */

#line 855 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_averagine, __pyx_n_s_averagine); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 855, __pyx_L1_error)

#line 855 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 855 "ms_deisotope/_c/averagine.pyx"
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_12ms_deisotope_2_c_9averagine_Averagine))))) __PYX_ERR(0, 855, __pyx_L1_error)

#line 855 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GIVEREF(__pyx_t_3);

#line 855 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_v_self->averagine);

#line 855 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(((PyObject *)__pyx_v_self->averagine));

#line 855 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_self->averagine = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_t_3);

#line 855 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = 0;

    /* "ms_deisotope/_c/averagine.pyx":856
 *         if isinstance(averagine, AveragineCache):
 *             self.averagine = averagine.averagine
 *             self.cache_truncation = averagine.cache_truncation             # <<<<<<<<<<<<<<
 *             self.backend = averagine.backend.copy()
 *         else:
 */

#line 856 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_averagine, __pyx_n_s_cache_truncation); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 856, __pyx_L1_error)

#line 856 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 856 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 856, __pyx_L1_error)

#line 856 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 856 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_self->cache_truncation = __pyx_t_4;

    /* "ms_deisotope/_c/averagine.pyx":857
 *             self.averagine = averagine.averagine
 *             self.cache_truncation = averagine.cache_truncation
 *             self.backend = averagine.backend.copy()             # <<<<<<<<<<<<<<
 *         else:
 *             self.averagine = Averagine(averagine)
 */

#line 857 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_averagine, __pyx_n_s_backend); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 857, __pyx_L1_error)

#line 857 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_5);

#line 857 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 857, __pyx_L1_error)

#line 857 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_6);

#line 857 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

#line 857 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = NULL;

#line 857 "ms_deisotope/_c/averagine.pyx"
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {

#line 857 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);

#line 857 "ms_deisotope/_c/averagine.pyx"
      if (likely(__pyx_t_5)) {

#line 857 "ms_deisotope/_c/averagine.pyx"
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);

#line 857 "ms_deisotope/_c/averagine.pyx"
        __Pyx_INCREF(__pyx_t_5);

#line 857 "ms_deisotope/_c/averagine.pyx"
        __Pyx_INCREF(function);

#line 857 "ms_deisotope/_c/averagine.pyx"
        __Pyx_DECREF_SET(__pyx_t_6, function);

#line 857 "ms_deisotope/_c/averagine.pyx"
      }

#line 857 "ms_deisotope/_c/averagine.pyx"
    }

#line 857 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);

#line 857 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

#line 857 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 857, __pyx_L1_error)

#line 857 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 857 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

#line 857 "ms_deisotope/_c/averagine.pyx"
    if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 857, __pyx_L1_error)

#line 857 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GIVEREF(__pyx_t_3);

#line 857 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_v_self->backend);

#line 857 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_v_self->backend);

#line 857 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_self->backend = ((PyObject*)__pyx_t_3);

#line 857 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = 0;

    /* "ms_deisotope/_c/averagine.pyx":854
 *             backend = {}
 *         self.backend = dict(backend)
 *         if isinstance(averagine, AveragineCache):             # <<<<<<<<<<<<<<
 *             self.averagine = averagine.averagine
 *             self.cache_truncation = averagine.cache_truncation
 */

#line 854 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L4;

#line 854 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":859
 *             self.backend = averagine.backend.copy()
 *         else:
 *             self.averagine = Averagine(averagine)             # <<<<<<<<<<<<<<
 *             self.cache_truncation = cache_truncation
 *         self.enabled = True
 */

#line 859 "ms_deisotope/_c/averagine.pyx"
  /*else*/ {

#line 859 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_12ms_deisotope_2_c_9averagine_Averagine), __pyx_v_averagine); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 859, __pyx_L1_error)

#line 859 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 859 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GIVEREF(__pyx_t_3);

#line 859 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_v_self->averagine);

#line 859 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(((PyObject *)__pyx_v_self->averagine));

#line 859 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_self->averagine = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_t_3);

#line 859 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = 0;

    /* "ms_deisotope/_c/averagine.pyx":860
 *         else:
 *             self.averagine = Averagine(averagine)
 *             self.cache_truncation = cache_truncation             # <<<<<<<<<<<<<<
 *         self.enabled = True
 * 
 */

#line 860 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_self->cache_truncation = __pyx_v_cache_truncation;

#line 860 "ms_deisotope/_c/averagine.pyx"
  }

#line 860 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4:;

  /* "ms_deisotope/_c/averagine.pyx":861
 *             self.averagine = Averagine(averagine)
 *             self.cache_truncation = cache_truncation
 *         self.enabled = True             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */

#line 861 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->enabled = 1;

  /* "ms_deisotope/_c/averagine.pyx":850
 *     """
 * 
 *     def __init__(self, object averagine, object backend=None, double cache_truncation=1.):             # <<<<<<<<<<<<<<
 *         if backend is None:
 *             backend = {}
 */

#line 850 "ms_deisotope/_c/averagine.pyx"


#line 850 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 850 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 850 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 850 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 850 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 850 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_5);

#line 850 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_6);

#line 850 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 850 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = -1;

#line 850 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 850 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_backend);

#line 850 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 850 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 850 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":863
 *         self.enabled = True
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return self.__class__, self.__getstate__()
 * 
 */

#line 863 "ms_deisotope/_c/averagine.pyx"


#line 863 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 863 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 863 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_2__reduce__[] = "AveragineCache.__reduce__(self)";

#line 863 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 863 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 863 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 863 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = 
#line 863 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_2__reduce__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self));

#line 863 "ms_deisotope/_c/averagine.pyx"


#line 863 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 863 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 863 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 863 "ms_deisotope/_c/averagine.pyx"
}

#line 863 "ms_deisotope/_c/averagine.pyx"


#line 863 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_2__reduce__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self) {

#line 863 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 863 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 863 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 863 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 863 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 863 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 863 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 863 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 863 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 863 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "ms_deisotope/_c/averagine.pyx":864
 * 
 *     def __reduce__(self):
 *         return self.__class__, self.__getstate__()             # <<<<<<<<<<<<<<
 * 
 *     def __getstate__(self):
 */

#line 864 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 864 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 864, __pyx_L1_error)

#line 864 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 864 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getstate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 864, __pyx_L1_error)

#line 864 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_3);

#line 864 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = NULL;

#line 864 "ms_deisotope/_c/averagine.pyx"
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {

#line 864 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);

#line 864 "ms_deisotope/_c/averagine.pyx"
    if (likely(__pyx_t_4)) {

#line 864 "ms_deisotope/_c/averagine.pyx"
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);

#line 864 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(__pyx_t_4);

#line 864 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(function);

#line 864 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF_SET(__pyx_t_3, function);

#line 864 "ms_deisotope/_c/averagine.pyx"
    }

#line 864 "ms_deisotope/_c/averagine.pyx"
  }

#line 864 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);

#line 864 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 864 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 864, __pyx_L1_error)

#line 864 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 864 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 864 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 864, __pyx_L1_error)

#line 864 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_3);

#line 864 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_1);

#line 864 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);

#line 864 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_2);

#line 864 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);

#line 864 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 864 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

#line 864 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_3;

#line 864 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = 0;

#line 864 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":863
 *         self.enabled = True
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return self.__class__, self.__getstate__()
 * 
 */

#line 863 "ms_deisotope/_c/averagine.pyx"


#line 863 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 863 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 863 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 863 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 863 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 863 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 863 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 863 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 863 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 863 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 863 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 863 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 863 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":866
 *         return self.__class__, self.__getstate__()
 * 
 *     def __getstate__(self):             # <<<<<<<<<<<<<<
 *         return self.averagine, self.backend, self.cache_truncation
 * 
 */

#line 866 "ms_deisotope/_c/averagine.pyx"


#line 866 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 866 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_5__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 866 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_4__getstate__[] = "AveragineCache.__getstate__(self)";

#line 866 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_5__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 866 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 866 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 866 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__getstate__ (wrapper)", 0);
  __pyx_r = 
#line 866 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_4__getstate__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self));

#line 866 "ms_deisotope/_c/averagine.pyx"


#line 866 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 866 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 866 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 866 "ms_deisotope/_c/averagine.pyx"
}

#line 866 "ms_deisotope/_c/averagine.pyx"


#line 866 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_4__getstate__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self) {

#line 866 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 866 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 866 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 866 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 866 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 866 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 866 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 866 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__getstate__", 0);

  /* "ms_deisotope/_c/averagine.pyx":867
 * 
 *     def __getstate__(self):
 *         return self.averagine, self.backend, self.cache_truncation             # <<<<<<<<<<<<<<
 * 
 *     def __setstate__(self, state):
 */

#line 867 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 867 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->cache_truncation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 867, __pyx_L1_error)

#line 867 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 867 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 867, __pyx_L1_error)

#line 867 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 867 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_v_self->averagine));

#line 867 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->averagine));

#line 867 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->averagine));

#line 867 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_self->backend);

#line 867 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_v_self->backend);

#line 867 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->backend);

#line 867 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_1);

#line 867 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1);

#line 867 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 867 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_2;

#line 867 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

#line 867 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":866
 *         return self.__class__, self.__getstate__()
 * 
 *     def __getstate__(self):             # <<<<<<<<<<<<<<
 *         return self.averagine, self.backend, self.cache_truncation
 * 
 */

#line 866 "ms_deisotope/_c/averagine.pyx"


#line 866 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 866 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 866 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 866 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 866 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.__getstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 866 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 866 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 866 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 866 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 866 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 866 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":869
 *         return self.averagine, self.backend, self.cache_truncation
 * 
 *     def __setstate__(self, state):             # <<<<<<<<<<<<<<
 *         avg, store, trunc = state
 *         self.averagine = Averagine(avg)
 */

#line 869 "ms_deisotope/_c/averagine.pyx"


#line 869 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 869 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/

#line 869 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_6__setstate__[] = "AveragineCache.__setstate__(self, state)";

#line 869 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) {

#line 869 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0);
  __pyx_r = 
#line 869 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_6__setstate__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self), ((PyObject *)__pyx_v_state));

#line 869 "ms_deisotope/_c/averagine.pyx"


#line 869 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 869 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 869 "ms_deisotope/_c/averagine.pyx"
}

#line 869 "ms_deisotope/_c/averagine.pyx"


#line 869 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_6__setstate__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_state) {
  PyObject *__pyx_v_avg = NULL
#line 869 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_store = NULL
#line 869 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_trunc = NULL
#line 869 "ms_deisotope/_c/averagine.pyx"
;

#line 869 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 869 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 869 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 869 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 869 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 869 "ms_deisotope/_c/averagine.pyx"
  PyObject *(*__pyx_t_5)(PyObject *);

#line 869 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_6;

#line 869 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 869 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 869 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__setstate__", 0);

  /* "ms_deisotope/_c/averagine.pyx":870
 * 
 *     def __setstate__(self, state):
 *         avg, store, trunc = state             # <<<<<<<<<<<<<<
 *         self.averagine = Averagine(avg)
 *         self.store = dict(store)
 */

#line 870 "ms_deisotope/_c/averagine.pyx"
  if ((likely(PyTuple_CheckExact(__pyx_v_state))) || (PyList_CheckExact(__pyx_v_state))) {

#line 870 "ms_deisotope/_c/averagine.pyx"
    PyObject* sequence = __pyx_v_state;

#line 870 "ms_deisotope/_c/averagine.pyx"
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);

#line 870 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(size != 3)) {

#line 870 "ms_deisotope/_c/averagine.pyx"
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);

#line 870 "ms_deisotope/_c/averagine.pyx"
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);

#line 870 "ms_deisotope/_c/averagine.pyx"
      __PYX_ERR(0, 870, __pyx_L1_error)

#line 870 "ms_deisotope/_c/averagine.pyx"
    }

#line 870 "ms_deisotope/_c/averagine.pyx"
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS

#line 870 "ms_deisotope/_c/averagine.pyx"
    if (likely(PyTuple_CheckExact(sequence))) {

#line 870 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 

#line 870 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 

#line 870 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 

#line 870 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 870 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 

#line 870 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 

#line 870 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_3 = PyList_GET_ITEM(sequence, 2); 

#line 870 "ms_deisotope/_c/averagine.pyx"
    }

#line 870 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_t_1);

#line 870 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_t_2);

#line 870 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_t_3);

#line 870 "ms_deisotope/_c/averagine.pyx"
    #else

#line 870 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 870, __pyx_L1_error)

#line 870 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 870 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 870, __pyx_L1_error)

#line 870 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);

#line 870 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 870, __pyx_L1_error)

#line 870 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 870 "ms_deisotope/_c/averagine.pyx"
    #endif

#line 870 "ms_deisotope/_c/averagine.pyx"
  } else {

#line 870 "ms_deisotope/_c/averagine.pyx"
    Py_ssize_t index = -1;

#line 870 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = PyObject_GetIter(__pyx_v_state); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 870, __pyx_L1_error)

#line 870 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_4);

#line 870 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) 
#line 870 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L3_unpacking_failed;

#line 870 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) 
#line 870 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L3_unpacking_failed;

#line 870 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);
    index = 2; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) 
#line 870 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L3_unpacking_failed;

#line 870 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 870 "ms_deisotope/_c/averagine.pyx"
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 3) < 0) __PYX_ERR(0, 870, __pyx_L1_error)

#line 870 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = NULL;

#line 870 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 870 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L4_unpacking_done;

#line 870 "ms_deisotope/_c/averagine.pyx"
    __pyx_L3_unpacking_failed:;

#line 870 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 870 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = NULL;

#line 870 "ms_deisotope/_c/averagine.pyx"
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);

#line 870 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 870, __pyx_L1_error)

#line 870 "ms_deisotope/_c/averagine.pyx"
    __pyx_L4_unpacking_done:;

#line 870 "ms_deisotope/_c/averagine.pyx"
  }

#line 870 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_avg = __pyx_t_1;

#line 870 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 870 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_store = __pyx_t_2;

#line 870 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

#line 870 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_trunc = __pyx_t_3;

#line 870 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = 0;

  /* "ms_deisotope/_c/averagine.pyx":871
 *     def __setstate__(self, state):
 *         avg, store, trunc = state
 *         self.averagine = Averagine(avg)             # <<<<<<<<<<<<<<
 *         self.store = dict(store)
 *         self.cache_truncation = trunc
 */

#line 871 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_12ms_deisotope_2_c_9averagine_Averagine), __pyx_v_avg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 871, __pyx_L1_error)

#line 871 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_3);

#line 871 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_3);

#line 871 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_v_self->averagine);

#line 871 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(((PyObject *)__pyx_v_self->averagine));

#line 871 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->averagine = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_t_3);

#line 871 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = 0;

  /* "ms_deisotope/_c/averagine.pyx":872
 *         avg, store, trunc = state
 *         self.averagine = Averagine(avg)
 *         self.store = dict(store)             # <<<<<<<<<<<<<<
 *         self.cache_truncation = trunc
 * 
 */

#line 872 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_v_store); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 872, __pyx_L1_error)

#line 872 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_3);

#line 872 "ms_deisotope/_c/averagine.pyx"
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_store, __pyx_t_3) < 0) __PYX_ERR(0, 872, __pyx_L1_error)

#line 872 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "ms_deisotope/_c/averagine.pyx":873
 *         self.averagine = Averagine(avg)
 *         self.store = dict(store)
 *         self.cache_truncation = trunc             # <<<<<<<<<<<<<<
 * 
 *     @cython.cdivision
 */

#line 873 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_trunc); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 873, __pyx_L1_error)

#line 873 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_self->cache_truncation = __pyx_t_6;

  /* "ms_deisotope/_c/averagine.pyx":869
 *         return self.averagine, self.backend, self.cache_truncation
 * 
 *     def __setstate__(self, state):             # <<<<<<<<<<<<<<
 *         avg, store, trunc = state
 *         self.averagine = Averagine(avg)
 */

#line 869 "ms_deisotope/_c/averagine.pyx"


#line 869 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 869 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);

#line 869 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 869 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 869 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 869 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_avg);

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_store);

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_trunc);

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 869 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 869 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 869 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":876
 * 
 *     @cython.cdivision
 *     cdef double _make_cache_key(self, double mz):             # <<<<<<<<<<<<<<
 *         cdef double key_mz
 *         if self.cache_truncation == 0.0:
 */

#line 876 "ms_deisotope/_c/averagine.pyx"


#line 876 "ms_deisotope/_c/averagine.pyx"
static double __pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache__make_cache_key(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, double __pyx_v_mz) {
  double __pyx_v_key_mz
#line 876 "ms_deisotope/_c/averagine.pyx"
;

#line 876 "ms_deisotope/_c/averagine.pyx"
  double __pyx_r;

#line 876 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 876 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_1;

#line 876 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("_make_cache_key", 0);

  /* "ms_deisotope/_c/averagine.pyx":878
 *     cdef double _make_cache_key(self, double mz):
 *         cdef double key_mz
 *         if self.cache_truncation == 0.0:             # <<<<<<<<<<<<<<
 *             key_mz = mz
 *         else:
 */

#line 878 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((__pyx_v_self->cache_truncation == 0.0) != 0);

#line 878 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_1) {

    /* "ms_deisotope/_c/averagine.pyx":879
 *         cdef double key_mz
 *         if self.cache_truncation == 0.0:
 *             key_mz = mz             # <<<<<<<<<<<<<<
 *         else:
 *             key_mz = _round(mz / self.cache_truncation) * self.cache_truncation
 */

#line 879 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_key_mz = __pyx_v_mz;

    /* "ms_deisotope/_c/averagine.pyx":878
 *     cdef double _make_cache_key(self, double mz):
 *         cdef double key_mz
 *         if self.cache_truncation == 0.0:             # <<<<<<<<<<<<<<
 *             key_mz = mz
 *         else:
 */

#line 878 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L3;

#line 878 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":881
 *             key_mz = mz
 *         else:
 *             key_mz = _round(mz / self.cache_truncation) * self.cache_truncation             # <<<<<<<<<<<<<<
 *         return key_mz
 * 
 */

#line 881 "ms_deisotope/_c/averagine.pyx"
  /*else*/ {

#line 881 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_key_mz = (__pyx_f_12ms_deisotope_2_c_9averagine__round((__pyx_v_mz / __pyx_v_self->cache_truncation)) * __pyx_v_self->cache_truncation);

#line 881 "ms_deisotope/_c/averagine.pyx"
  }

#line 881 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3:;

  /* "ms_deisotope/_c/averagine.pyx":882
 *         else:
 *             key_mz = _round(mz / self.cache_truncation) * self.cache_truncation
 *         return key_mz             # <<<<<<<<<<<<<<
 * 
 *     def make_cache_key(self, double mz):
 */

#line 882 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_v_key_mz;

#line 882 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":876
 * 
 *     @cython.cdivision
 *     cdef double _make_cache_key(self, double mz):             # <<<<<<<<<<<<<<
 *         cdef double key_mz
 *         if self.cache_truncation == 0.0:
 */

#line 876 "ms_deisotope/_c/averagine.pyx"


#line 876 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 876 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 876 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 876 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 876 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":884
 *         return key_mz
 * 
 *     def make_cache_key(self, double mz):             # <<<<<<<<<<<<<<
 *         return self._make_cache_key(mz)
 * 
 */

#line 884 "ms_deisotope/_c/averagine.pyx"


#line 884 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 884 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_9make_cache_key(PyObject *__pyx_v_self, PyObject *__pyx_arg_mz); /*proto*/

#line 884 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_8make_cache_key[] = "AveragineCache.make_cache_key(self, double mz)";

#line 884 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_9make_cache_key(PyObject *__pyx_v_self, PyObject *__pyx_arg_mz) {
  double __pyx_v_mz
#line 884 "ms_deisotope/_c/averagine.pyx"
;

#line 884 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 884 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 884 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 884 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 884 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 884 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("make_cache_key (wrapper)", 0);

#line 884 "ms_deisotope/_c/averagine.pyx"
  assert(__pyx_arg_mz); {

#line 884 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_mz = __pyx_PyFloat_AsDouble(__pyx_arg_mz); if (unlikely((__pyx_v_mz == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 884, __pyx_L3_error)

#line 884 "ms_deisotope/_c/averagine.pyx"
  }

#line 884 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 884 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 884 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.make_cache_key", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 884 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 884 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 884 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 884 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_8make_cache_key(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self), ((double)__pyx_v_mz));

#line 884 "ms_deisotope/_c/averagine.pyx"


#line 884 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 884 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 884 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 884 "ms_deisotope/_c/averagine.pyx"
}

#line 884 "ms_deisotope/_c/averagine.pyx"


#line 884 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_8make_cache_key(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, double __pyx_v_mz) {

#line 884 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 884 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 884 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 884 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 884 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 884 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 884 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("make_cache_key", 0);

  /* "ms_deisotope/_c/averagine.pyx":885
 * 
 *     def make_cache_key(self, double mz):
 *         return self._make_cache_key(mz)             # <<<<<<<<<<<<<<
 * 
 *     @cython.cdivision
 */

#line 885 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 885 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache__make_cache_key(__pyx_v_self, __pyx_v_mz)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error)

#line 885 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 885 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 885 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 885 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":884
 *         return key_mz
 * 
 *     def make_cache_key(self, double mz):             # <<<<<<<<<<<<<<
 *         return self._make_cache_key(mz)
 * 
 */

#line 884 "ms_deisotope/_c/averagine.pyx"


#line 884 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 884 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 884 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 884 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.make_cache_key", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 884 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 884 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 884 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 884 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 884 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 884 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":888
 * 
 *     @cython.cdivision
 *     cdef TheoreticalIsotopicPattern has_mz_charge_pair(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95,             # <<<<<<<<<<<<<<
 *                                  double ignore_below=0.0):
 *         cdef:
 */

#line 888 "ms_deisotope/_c/averagine.pyx"


#line 888 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache_has_mz_charge_pair(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, double __pyx_v_mz, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_has_mz_charge_pair *__pyx_optional_args) {

#line 888 "ms_deisotope/_c/averagine.pyx"
  int __pyx_v_charge = ((int)1);

#line 888 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_charge_carrier = __pyx_k__8;

#line 888 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_truncate_after = ((double)0.95);

#line 888 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_ignore_below = ((double)0.0);
  double __pyx_v_key_mz
#line 888 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_cache_key = 0
#line 888 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_pvalue
#line 888 "ms_deisotope/_c/averagine.pyx"
;
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_tid = 0
#line 888 "ms_deisotope/_c/averagine.pyx"
;

#line 888 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 888 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 888 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_1;

#line 888 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 888 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 888 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 888 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_5 = NULL;

#line 888 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_6 = NULL;

#line 888 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine__isotopic_cluster __pyx_t_7;

#line 888 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_8;

#line 888 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 888 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 888 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 888 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("has_mz_charge_pair", 0);

#line 888 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_optional_args) {

#line 888 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_optional_args->__pyx_n > 0) {

#line 888 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = __pyx_optional_args->charge;

#line 888 "ms_deisotope/_c/averagine.pyx"
      if (__pyx_optional_args->__pyx_n > 1) {

#line 888 "ms_deisotope/_c/averagine.pyx"
        __pyx_v_charge_carrier = __pyx_optional_args->charge_carrier;

#line 888 "ms_deisotope/_c/averagine.pyx"
        if (__pyx_optional_args->__pyx_n > 2) {

#line 888 "ms_deisotope/_c/averagine.pyx"
          __pyx_v_truncate_after = __pyx_optional_args->truncate_after;

#line 888 "ms_deisotope/_c/averagine.pyx"
          if (__pyx_optional_args->__pyx_n > 3) {

#line 888 "ms_deisotope/_c/averagine.pyx"
            __pyx_v_ignore_below = __pyx_optional_args->ignore_below;

#line 888 "ms_deisotope/_c/averagine.pyx"
          }

#line 888 "ms_deisotope/_c/averagine.pyx"
        }

#line 888 "ms_deisotope/_c/averagine.pyx"
      }

#line 888 "ms_deisotope/_c/averagine.pyx"
    }

#line 888 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":895
 *             PyObject* pvalue
 *             TheoreticalIsotopicPattern tid
 *         if self.enabled:             # <<<<<<<<<<<<<<
 *             key_mz = self._make_cache_key(mz)
 * 
 */

#line 895 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = (__pyx_v_self->enabled != 0);

#line 895 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_t_1) {

    /* "ms_deisotope/_c/averagine.pyx":896
 *             TheoreticalIsotopicPattern tid
 *         if self.enabled:
 *             key_mz = self._make_cache_key(mz)             # <<<<<<<<<<<<<<
 * 
 *             # Attempting to replace this tuple construction (which in turn necessitates packing each
 */

#line 896 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_key_mz = __pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache__make_cache_key(__pyx_v_self, __pyx_v_mz);

    /* "ms_deisotope/_c/averagine.pyx":902
 *             # its own hash value without invoking any Python operations turns out to be just a bit slower
 *             # than the bare tuple itself.
 *             cache_key = (key_mz, charge, charge_carrier, truncate_after)             # <<<<<<<<<<<<<<
 *             pvalue = PyDict_GetItem(self.backend, cache_key)
 *             if pvalue == NULL:
 */

#line 902 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_key_mz); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 902, __pyx_L1_error)

#line 902 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);

#line 902 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_charge); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 902, __pyx_L1_error)

#line 902 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 902 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_charge_carrier); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 902, __pyx_L1_error)

#line 902 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_4);

#line 902 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_truncate_after); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 902, __pyx_L1_error)

#line 902 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_5);

#line 902 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 902, __pyx_L1_error)

#line 902 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_6);

#line 902 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GIVEREF(__pyx_t_2);

#line 902 "ms_deisotope/_c/averagine.pyx"
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);

#line 902 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GIVEREF(__pyx_t_3);

#line 902 "ms_deisotope/_c/averagine.pyx"
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);

#line 902 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GIVEREF(__pyx_t_4);

#line 902 "ms_deisotope/_c/averagine.pyx"
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);

#line 902 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GIVEREF(__pyx_t_5);

#line 902 "ms_deisotope/_c/averagine.pyx"
    PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5);

#line 902 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = 0;

#line 902 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = 0;

#line 902 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = 0;

#line 902 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = 0;

#line 902 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_cache_key = ((PyObject*)__pyx_t_6);

#line 902 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = 0;

    /* "ms_deisotope/_c/averagine.pyx":903
 *             # than the bare tuple itself.
 *             cache_key = (key_mz, charge, charge_carrier, truncate_after)
 *             pvalue = PyDict_GetItem(self.backend, cache_key)             # <<<<<<<<<<<<<<
 *             if pvalue == NULL:
 *                 tid = self.averagine._isotopic_cluster(key_mz, charge, charge_carrier, truncate_after, ignore_below)
 */

#line 903 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = __pyx_v_self->backend;

#line 903 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_t_6);

#line 903 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_pvalue = PyDict_GetItem(__pyx_t_6, __pyx_v_cache_key);

#line 903 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "ms_deisotope/_c/averagine.pyx":904
 *             cache_key = (key_mz, charge, charge_carrier, truncate_after)
 *             pvalue = PyDict_GetItem(self.backend, cache_key)
 *             if pvalue == NULL:             # <<<<<<<<<<<<<<
 *                 tid = self.averagine._isotopic_cluster(key_mz, charge, charge_carrier, truncate_after, ignore_below)
 *                 PyDict_SetItem(self.backend, cache_key, tid.clone())
 */

#line 904 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((__pyx_v_pvalue == NULL) != 0);

#line 904 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_1) {

      /* "ms_deisotope/_c/averagine.pyx":905
 *             pvalue = PyDict_GetItem(self.backend, cache_key)
 *             if pvalue == NULL:
 *                 tid = self.averagine._isotopic_cluster(key_mz, charge, charge_carrier, truncate_after, ignore_below)             # <<<<<<<<<<<<<<
 *                 PyDict_SetItem(self.backend, cache_key, tid.clone())
 *                 tid.shift(mz)
 */

#line 905 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_7.__pyx_n = 4;

#line 905 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_7.charge = __pyx_v_charge;

#line 905 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_7.charge_carrier = __pyx_v_charge_carrier;

#line 905 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_7.truncate_after = __pyx_v_truncate_after;

#line 905 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_7.ignore_below = __pyx_v_ignore_below;

#line 905 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self->averagine->__pyx_vtab)->_isotopic_cluster(__pyx_v_self->averagine, __pyx_v_key_mz, &__pyx_t_7)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 905, __pyx_L1_error)

#line 905 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_6);

#line 905 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_tid = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_6);

#line 905 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_6 = 0;

      /* "ms_deisotope/_c/averagine.pyx":906
 *             if pvalue == NULL:
 *                 tid = self.averagine._isotopic_cluster(key_mz, charge, charge_carrier, truncate_after, ignore_below)
 *                 PyDict_SetItem(self.backend, cache_key, tid.clone())             # <<<<<<<<<<<<<<
 *                 tid.shift(mz)
 *                 return tid
 */

#line 906 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_6 = __pyx_v_self->backend;

#line 906 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(__pyx_t_6);

#line 906 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_5 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone(__pyx_v_tid, 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 906, __pyx_L1_error)

#line 906 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_5);

#line 906 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_8 = PyDict_SetItem(__pyx_t_6, __pyx_v_cache_key, __pyx_t_5); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 906, __pyx_L1_error)

#line 906 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

#line 906 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "ms_deisotope/_c/averagine.pyx":907
 *                 tid = self.averagine._isotopic_cluster(key_mz, charge, charge_carrier, truncate_after, ignore_below)
 *                 PyDict_SetItem(self.backend, cache_key, tid.clone())
 *                 tid.shift(mz)             # <<<<<<<<<<<<<<
 *                 return tid
 *             else:
 */

#line 907 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_5 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_shift(__pyx_v_tid, __pyx_v_mz, 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 907, __pyx_L1_error)

#line 907 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_5);

#line 907 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "ms_deisotope/_c/averagine.pyx":908
 *                 PyDict_SetItem(self.backend, cache_key, tid.clone())
 *                 tid.shift(mz)
 *                 return tid             # <<<<<<<<<<<<<<
 *             else:
 *                 tid = <TheoreticalIsotopicPattern>pvalue
 */

#line 908 "ms_deisotope/_c/averagine.pyx"
      __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 908 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(((PyObject *)__pyx_v_tid));

#line 908 "ms_deisotope/_c/averagine.pyx"
      __pyx_r = __pyx_v_tid;

#line 908 "ms_deisotope/_c/averagine.pyx"
      goto __pyx_L0;

      /* "ms_deisotope/_c/averagine.pyx":904
 *             cache_key = (key_mz, charge, charge_carrier, truncate_after)
 *             pvalue = PyDict_GetItem(self.backend, cache_key)
 *             if pvalue == NULL:             # <<<<<<<<<<<<<<
 *                 tid = self.averagine._isotopic_cluster(key_mz, charge, charge_carrier, truncate_after, ignore_below)
 *                 PyDict_SetItem(self.backend, cache_key, tid.clone())
 */

#line 904 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":910
 *                 return tid
 *             else:
 *                 tid = <TheoreticalIsotopicPattern>pvalue             # <<<<<<<<<<<<<<
 *                 tid = tid.clone_shift(mz)
 *                 return tid
 */

#line 910 "ms_deisotope/_c/averagine.pyx"
    /*else*/ {

#line 910 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_5 = ((PyObject *)__pyx_v_pvalue);

#line 910 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(__pyx_t_5);

#line 910 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_tid = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_5);

#line 910 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_5 = 0;

      /* "ms_deisotope/_c/averagine.pyx":911
 *             else:
 *                 tid = <TheoreticalIsotopicPattern>pvalue
 *                 tid = tid.clone_shift(mz)             # <<<<<<<<<<<<<<
 *                 return tid
 *         else:
 */

#line 911 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_5 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone_shift(__pyx_v_tid, __pyx_v_mz)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 911, __pyx_L1_error)

#line 911 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_5);

#line 911 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF_SET(__pyx_v_tid, ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_5));

#line 911 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_5 = 0;

      /* "ms_deisotope/_c/averagine.pyx":912
 *                 tid = <TheoreticalIsotopicPattern>pvalue
 *                 tid = tid.clone_shift(mz)
 *                 return tid             # <<<<<<<<<<<<<<
 *         else:
 *             tid = self.averagine._isotopic_cluster(mz, charge, charge_carrier, truncate_after)
 */

#line 912 "ms_deisotope/_c/averagine.pyx"
      __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 912 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(((PyObject *)__pyx_v_tid));

#line 912 "ms_deisotope/_c/averagine.pyx"
      __pyx_r = __pyx_v_tid;

#line 912 "ms_deisotope/_c/averagine.pyx"
      goto __pyx_L0;

#line 912 "ms_deisotope/_c/averagine.pyx"
    }

    /* "ms_deisotope/_c/averagine.pyx":895
 *             PyObject* pvalue
 *             TheoreticalIsotopicPattern tid
 *         if self.enabled:             # <<<<<<<<<<<<<<
 *             key_mz = self._make_cache_key(mz)
 * 
 */

#line 895 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":914
 *                 return tid
 *         else:
 *             tid = self.averagine._isotopic_cluster(mz, charge, charge_carrier, truncate_after)             # <<<<<<<<<<<<<<
 *             return tid
 * 
 */

#line 914 "ms_deisotope/_c/averagine.pyx"
  /*else*/ {

#line 914 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_7.__pyx_n = 3;

#line 914 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_7.charge = __pyx_v_charge;

#line 914 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_7.charge_carrier = __pyx_v_charge_carrier;

#line 914 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_7.truncate_after = __pyx_v_truncate_after;

#line 914 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_v_self->averagine->__pyx_vtab)->_isotopic_cluster(__pyx_v_self->averagine, __pyx_v_mz, &__pyx_t_7)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 914, __pyx_L1_error)

#line 914 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_5);

#line 914 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_tid = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_5);

#line 914 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = 0;

    /* "ms_deisotope/_c/averagine.pyx":915
 *         else:
 *             tid = self.averagine._isotopic_cluster(mz, charge, charge_carrier, truncate_after)
 *             return tid             # <<<<<<<<<<<<<<
 * 
 *     cpdef TheoreticalIsotopicPattern isotopic_cluster(
 */

#line 915 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 915 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(((PyObject *)__pyx_v_tid));

#line 915 "ms_deisotope/_c/averagine.pyx"
    __pyx_r = __pyx_v_tid;

#line 915 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L0;

#line 915 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":888
 * 
 *     @cython.cdivision
 *     cdef TheoreticalIsotopicPattern has_mz_charge_pair(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95,             # <<<<<<<<<<<<<<
 *                                  double ignore_below=0.0):
 *         cdef:
 */

#line 888 "ms_deisotope/_c/averagine.pyx"


#line 888 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 888 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 888 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 888 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 888 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 888 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_5);

#line 888 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_6);

#line 888 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.has_mz_charge_pair", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 888 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 888 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 888 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_cache_key);

#line 888 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_tid);

#line 888 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 888 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 888 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 888 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":917
 *             return tid
 * 
 *     cpdef TheoreticalIsotopicPattern isotopic_cluster(             # <<<<<<<<<<<<<<
 *                                 self, double mz, int charge=1, double charge_carrier=PROTON,
 *                                 double truncate_after=0.95, double ignore_below=0.0):
 */

#line 917 "ms_deisotope/_c/averagine.pyx"


#line 917 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_11isotopic_cluster(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 917 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, double __pyx_v_mz, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster *__pyx_optional_args) {

#line 917 "ms_deisotope/_c/averagine.pyx"
  int __pyx_v_charge = ((int)1);

#line 917 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_charge_carrier = __pyx_k__9;

#line 917 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_truncate_after = ((double)0.95);

#line 917 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_ignore_below = ((double)0.0);

#line 917 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 917 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 917 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_has_mz_charge_pair __pyx_t_2;

#line 917 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 917 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 917 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("isotopic_cluster", 0);

#line 917 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_optional_args) {

#line 917 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_optional_args->__pyx_n > 0) {

#line 917 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = __pyx_optional_args->charge;

#line 917 "ms_deisotope/_c/averagine.pyx"
      if (__pyx_optional_args->__pyx_n > 1) {

#line 917 "ms_deisotope/_c/averagine.pyx"
        __pyx_v_charge_carrier = __pyx_optional_args->charge_carrier;

#line 917 "ms_deisotope/_c/averagine.pyx"
        if (__pyx_optional_args->__pyx_n > 2) {

#line 917 "ms_deisotope/_c/averagine.pyx"
          __pyx_v_truncate_after = __pyx_optional_args->truncate_after;

#line 917 "ms_deisotope/_c/averagine.pyx"
          if (__pyx_optional_args->__pyx_n > 3) {

#line 917 "ms_deisotope/_c/averagine.pyx"
            __pyx_v_ignore_below = __pyx_optional_args->ignore_below;

#line 917 "ms_deisotope/_c/averagine.pyx"
          }

#line 917 "ms_deisotope/_c/averagine.pyx"
        }

#line 917 "ms_deisotope/_c/averagine.pyx"
      }

#line 917 "ms_deisotope/_c/averagine.pyx"
    }

#line 917 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":946
 *             The generated and thresholded pattern
 *         """
 *         return self.has_mz_charge_pair(mz, charge, charge_carrier, truncate_after, ignore_below)             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95,
 */

#line 946 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 946 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.__pyx_n = 4;

#line 946 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge = __pyx_v_charge;

#line 946 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge_carrier = __pyx_v_charge_carrier;

#line 946 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.truncate_after = __pyx_v_truncate_after;

#line 946 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.ignore_below = __pyx_v_ignore_below;

#line 946 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache_has_mz_charge_pair(__pyx_v_self, __pyx_v_mz, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 946, __pyx_L1_error)

#line 946 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 946 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_1);

#line 946 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 946 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":917
 *             return tid
 * 
 *     cpdef TheoreticalIsotopicPattern isotopic_cluster(             # <<<<<<<<<<<<<<
 *                                 self, double mz, int charge=1, double charge_carrier=PROTON,
 *                                 double truncate_after=0.95, double ignore_below=0.0):
 */

#line 917 "ms_deisotope/_c/averagine.pyx"


#line 917 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.isotopic_cluster", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 917 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 917 "ms_deisotope/_c/averagine.pyx"
}

#line 917 "ms_deisotope/_c/averagine.pyx"


#line 917 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 917 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_11isotopic_cluster(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 917 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_10isotopic_cluster[] = "AveragineCache.isotopic_cluster(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95, double ignore_below=0.0) -> TheoreticalIsotopicPattern\nGenerate a theoretical isotopic pattern for the given m/z and charge state, thresholded\n        by theoretical peak height and density.\n\n        Mimics :meth:`.Averagine.isotopic_cluster` but uses the object's cache through\n        :meth:`has_mz_charge_pair`.\n\n        Parameters\n        ----------\n        mz : float\n            The reference m/z to calculate the neutral mass to interpolate from\n        charge : int, optional\n            The reference charge state to calculate the neutral mass. Defaults to 1\n        charge_carrier : float, optional\n            The mass of the charge carrier. Defaults to the mass of a proton.\n        truncate_after : float, optional\n            The percentage of the signal in the theoretical isotopic pattern to include.\n            Defaults to 0.95, including the first 95% of the signal in the generated pattern\n        ignore_below : float, optional\n            Omit theoretical peaks whose intensity is below this number.\n            Defaults to 0.0\n\n        Returns\n        -------\n        :class:`.TheoreticalIsotopicPattern`\n            The generated and thresholded pattern\n        ";

#line 917 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_11isotopic_cluster(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_mz
#line 917 "ms_deisotope/_c/averagine.pyx"
;
  int __pyx_v_charge
#line 917 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_charge_carrier
#line 917 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_truncate_after
#line 917 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_ignore_below
#line 917 "ms_deisotope/_c/averagine.pyx"
;

#line 917 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 917 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 917 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 917 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("isotopic_cluster (wrapper)", 0);

#line 917 "ms_deisotope/_c/averagine.pyx"
  {

#line 917 "ms_deisotope/_c/averagine.pyx"
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mz,&__pyx_n_s_charge,&__pyx_n_s_charge_carrier,&__pyx_n_s_truncate_after,&__pyx_n_s_ignore_below,0};

#line 917 "ms_deisotope/_c/averagine.pyx"
    PyObject* values[5] = {0,0,0,0,0};

#line 917 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_kwds)) {

#line 917 "ms_deisotope/_c/averagine.pyx"
      Py_ssize_t kw_args;

#line 917 "ms_deisotope/_c/averagine.pyx"
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);

#line 917 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {
        case  5: 
#line 917 "ms_deisotope/_c/averagine.pyx"
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);

#line 917 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  4: 
#line 917 "ms_deisotope/_c/averagine.pyx"
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);

#line 917 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  3: 
#line 917 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 917 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 917 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 917 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 917 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 917 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 917 "ms_deisotope/_c/averagine.pyx"
        case  0: break;
        default: 
#line 917 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 917 "ms_deisotope/_c/averagine.pyx"
      }

#line 917 "ms_deisotope/_c/averagine.pyx"
      kw_args = PyDict_Size(__pyx_kwds);

#line 917 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {

#line 917 "ms_deisotope/_c/averagine.pyx"
        case  0:

#line 917 "ms_deisotope/_c/averagine.pyx"
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mz)) != 0)) kw_args--;
        else 
#line 917 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 917 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 917 "ms_deisotope/_c/averagine.pyx"
        case  1:

#line 917 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 917 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge);

#line 917 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[1] = value; kw_args--; }

#line 917 "ms_deisotope/_c/averagine.pyx"
        }

#line 917 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 917 "ms_deisotope/_c/averagine.pyx"
        case  2:

#line 917 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 917 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge_carrier);

#line 917 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[2] = value; kw_args--; }

#line 917 "ms_deisotope/_c/averagine.pyx"
        }

#line 917 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 917 "ms_deisotope/_c/averagine.pyx"
        case  3:

#line 917 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 917 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncate_after);

#line 917 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[3] = value; kw_args--; }

#line 917 "ms_deisotope/_c/averagine.pyx"
        }

#line 917 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 917 "ms_deisotope/_c/averagine.pyx"
        case  4:

#line 917 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 917 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ignore_below);

#line 917 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[4] = value; kw_args--; }

#line 917 "ms_deisotope/_c/averagine.pyx"
        }

#line 917 "ms_deisotope/_c/averagine.pyx"
      }

#line 917 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(kw_args > 0)) {

#line 917 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "isotopic_cluster") < 0)) __PYX_ERR(0, 917, __pyx_L3_error)

#line 917 "ms_deisotope/_c/averagine.pyx"
      }

#line 917 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 917 "ms_deisotope/_c/averagine.pyx"
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: 
#line 917 "ms_deisotope/_c/averagine.pyx"
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);

#line 917 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  4: 
#line 917 "ms_deisotope/_c/averagine.pyx"
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);

#line 917 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  3: 
#line 917 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 917 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 917 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 917 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 917 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 917 "ms_deisotope/_c/averagine.pyx"
        break;
        default: 
#line 917 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 917 "ms_deisotope/_c/averagine.pyx"
      }

#line 917 "ms_deisotope/_c/averagine.pyx"
    }

#line 917 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_mz = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mz == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 918, __pyx_L3_error)

#line 917 "ms_deisotope/_c/averagine.pyx"
    if (values[1]) {

#line 917 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_charge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 918, __pyx_L3_error)

#line 917 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 917 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = ((int)1);

#line 917 "ms_deisotope/_c/averagine.pyx"
    }

#line 917 "ms_deisotope/_c/averagine.pyx"
    if (values[2]) {

#line 917 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge_carrier = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_charge_carrier == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 918, __pyx_L3_error)

#line 917 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 917 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge_carrier = __pyx_k__9;

#line 917 "ms_deisotope/_c/averagine.pyx"
    }

#line 917 "ms_deisotope/_c/averagine.pyx"
    if (values[3]) {

#line 917 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_truncate_after = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_truncate_after == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 919, __pyx_L3_error)

#line 917 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 917 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_truncate_after = ((double)0.95);

#line 917 "ms_deisotope/_c/averagine.pyx"
    }

#line 917 "ms_deisotope/_c/averagine.pyx"
    if (values[4]) {

#line 917 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_ignore_below = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_ignore_below == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 919, __pyx_L3_error)

#line 917 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 917 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_ignore_below = ((double)0.0);

#line 917 "ms_deisotope/_c/averagine.pyx"
    }

#line 917 "ms_deisotope/_c/averagine.pyx"
  }

#line 917 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("isotopic_cluster", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); 
#line 917 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 917, __pyx_L3_error)

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.isotopic_cluster", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 917 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 917 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_10isotopic_cluster(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self), __pyx_v_mz, __pyx_v_charge, __pyx_v_charge_carrier, __pyx_v_truncate_after, __pyx_v_ignore_below);

#line 917 "ms_deisotope/_c/averagine.pyx"


#line 917 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 917 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 917 "ms_deisotope/_c/averagine.pyx"
}

#line 917 "ms_deisotope/_c/averagine.pyx"


#line 917 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_10isotopic_cluster(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, double __pyx_v_mz, int __pyx_v_charge, double __pyx_v_charge_carrier, double __pyx_v_truncate_after, double __pyx_v_ignore_below) {

#line 917 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 917 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 917 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster __pyx_t_2;

#line 917 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 917 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 917 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("isotopic_cluster", 0);

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.__pyx_n = 4;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge = __pyx_v_charge;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge_carrier = __pyx_v_charge_carrier;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.truncate_after = __pyx_v_truncate_after;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.ignore_below = __pyx_v_ignore_below;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_vtabptr_12ms_deisotope_2_c_9averagine_AveragineCache->isotopic_cluster(__pyx_v_self, __pyx_v_mz, 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __pyx_L1_error)

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 917 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 917 "ms_deisotope/_c/averagine.pyx"


#line 917 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.isotopic_cluster", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 917 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 917 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 917 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":948
 *         return self.has_mz_charge_pair(mz, charge, charge_carrier, truncate_after, ignore_below)
 * 
 *     def __call__(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95,             # <<<<<<<<<<<<<<
 *                  double ignore_below=0.0):
 *         out = self.isotopic_cluster(mz, charge, charge_carrier, truncate_after, ignore_below)
 */

#line 948 "ms_deisotope/_c/averagine.pyx"


#line 948 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 948 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_13__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 948 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_13__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_mz
#line 948 "ms_deisotope/_c/averagine.pyx"
;
  int __pyx_v_charge
#line 948 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_charge_carrier
#line 948 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_truncate_after
#line 948 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_ignore_below
#line 948 "ms_deisotope/_c/averagine.pyx"
;

#line 948 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 948 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 948 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 948 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 948 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 948 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);

#line 948 "ms_deisotope/_c/averagine.pyx"
  {

#line 948 "ms_deisotope/_c/averagine.pyx"
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mz,&__pyx_n_s_charge,&__pyx_n_s_charge_carrier,&__pyx_n_s_truncate_after,&__pyx_n_s_ignore_below,0};

#line 948 "ms_deisotope/_c/averagine.pyx"
    PyObject* values[5] = {0,0,0,0,0};

#line 948 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_kwds)) {

#line 948 "ms_deisotope/_c/averagine.pyx"
      Py_ssize_t kw_args;

#line 948 "ms_deisotope/_c/averagine.pyx"
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);

#line 948 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {
        case  5: 
#line 948 "ms_deisotope/_c/averagine.pyx"
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);

#line 948 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  4: 
#line 948 "ms_deisotope/_c/averagine.pyx"
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);

#line 948 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  3: 
#line 948 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 948 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 948 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 948 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 948 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 948 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 948 "ms_deisotope/_c/averagine.pyx"
        case  0: break;
        default: 
#line 948 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 948 "ms_deisotope/_c/averagine.pyx"
      }

#line 948 "ms_deisotope/_c/averagine.pyx"
      kw_args = PyDict_Size(__pyx_kwds);

#line 948 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {

#line 948 "ms_deisotope/_c/averagine.pyx"
        case  0:

#line 948 "ms_deisotope/_c/averagine.pyx"
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mz)) != 0)) kw_args--;
        else 
#line 948 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 948 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 948 "ms_deisotope/_c/averagine.pyx"
        case  1:

#line 948 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 948 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge);

#line 948 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[1] = value; kw_args--; }

#line 948 "ms_deisotope/_c/averagine.pyx"
        }

#line 948 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 948 "ms_deisotope/_c/averagine.pyx"
        case  2:

#line 948 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 948 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge_carrier);

#line 948 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[2] = value; kw_args--; }

#line 948 "ms_deisotope/_c/averagine.pyx"
        }

#line 948 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 948 "ms_deisotope/_c/averagine.pyx"
        case  3:

#line 948 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 948 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncate_after);

#line 948 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[3] = value; kw_args--; }

#line 948 "ms_deisotope/_c/averagine.pyx"
        }

#line 948 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 948 "ms_deisotope/_c/averagine.pyx"
        case  4:

#line 948 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 948 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ignore_below);

#line 948 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[4] = value; kw_args--; }

#line 948 "ms_deisotope/_c/averagine.pyx"
        }

#line 948 "ms_deisotope/_c/averagine.pyx"
      }

#line 948 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(kw_args > 0)) {

#line 948 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 948, __pyx_L3_error)

#line 948 "ms_deisotope/_c/averagine.pyx"
      }

#line 948 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 948 "ms_deisotope/_c/averagine.pyx"
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: 
#line 948 "ms_deisotope/_c/averagine.pyx"
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);

#line 948 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  4: 
#line 948 "ms_deisotope/_c/averagine.pyx"
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);

#line 948 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  3: 
#line 948 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 948 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 948 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 948 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 948 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 948 "ms_deisotope/_c/averagine.pyx"
        break;
        default: 
#line 948 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 948 "ms_deisotope/_c/averagine.pyx"
      }

#line 948 "ms_deisotope/_c/averagine.pyx"
    }

#line 948 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_mz = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mz == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 948, __pyx_L3_error)

#line 948 "ms_deisotope/_c/averagine.pyx"
    if (values[1]) {

#line 948 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_charge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 948, __pyx_L3_error)

#line 948 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 948 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = ((int)1);

#line 948 "ms_deisotope/_c/averagine.pyx"
    }

#line 948 "ms_deisotope/_c/averagine.pyx"
    if (values[2]) {

#line 948 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge_carrier = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_charge_carrier == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 948, __pyx_L3_error)

#line 948 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 948 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge_carrier = __pyx_k__10;

#line 948 "ms_deisotope/_c/averagine.pyx"
    }

#line 948 "ms_deisotope/_c/averagine.pyx"
    if (values[3]) {

#line 948 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_truncate_after = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_truncate_after == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 948, __pyx_L3_error)

#line 948 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 948 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_truncate_after = ((double)0.95);

#line 948 "ms_deisotope/_c/averagine.pyx"
    }

#line 948 "ms_deisotope/_c/averagine.pyx"
    if (values[4]) {

#line 948 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_ignore_below = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_ignore_below == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 949, __pyx_L3_error)

#line 948 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 948 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_ignore_below = ((double)0.0);

#line 948 "ms_deisotope/_c/averagine.pyx"
    }

#line 948 "ms_deisotope/_c/averagine.pyx"
  }

#line 948 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 948 "ms_deisotope/_c/averagine.pyx"
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); 
#line 948 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 948, __pyx_L3_error)

#line 948 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 948 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 948 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 948 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 948 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 948 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_12__call__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self), __pyx_v_mz, __pyx_v_charge, __pyx_v_charge_carrier, __pyx_v_truncate_after, __pyx_v_ignore_below);

#line 948 "ms_deisotope/_c/averagine.pyx"


#line 948 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 948 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 948 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 948 "ms_deisotope/_c/averagine.pyx"
}

#line 948 "ms_deisotope/_c/averagine.pyx"


#line 948 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_12__call__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, double __pyx_v_mz, int __pyx_v_charge, double __pyx_v_charge_carrier, double __pyx_v_truncate_after, double __pyx_v_ignore_below) {
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_v_out = NULL
#line 948 "ms_deisotope/_c/averagine.pyx"
;

#line 948 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 948 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 948 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 948 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster __pyx_t_2;

#line 948 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 948 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 948 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 948 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "ms_deisotope/_c/averagine.pyx":950
 *     def __call__(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95,
 *                  double ignore_below=0.0):
 *         out = self.isotopic_cluster(mz, charge, charge_carrier, truncate_after, ignore_below)             # <<<<<<<<<<<<<<
 *         return out
 * 
 */

#line 950 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.__pyx_n = 4;

#line 950 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge = __pyx_v_charge;

#line 950 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge_carrier = __pyx_v_charge_carrier;

#line 950 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.truncate_after = __pyx_v_truncate_after;

#line 950 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.ignore_below = __pyx_v_ignore_below;

#line 950 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster(__pyx_v_self, __pyx_v_mz, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 950, __pyx_L1_error)

#line 950 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 950 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_out = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_1);

#line 950 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":951
 *                  double ignore_below=0.0):
 *         out = self.isotopic_cluster(mz, charge, charge_carrier, truncate_after, ignore_below)
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */

#line 951 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 951 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_v_out));

#line 951 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = ((PyObject *)__pyx_v_out);

#line 951 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":948
 *         return self.has_mz_charge_pair(mz, charge, charge_carrier, truncate_after, ignore_below)
 * 
 *     def __call__(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95,             # <<<<<<<<<<<<<<
 *                  double ignore_below=0.0):
 *         out = self.isotopic_cluster(mz, charge, charge_carrier, truncate_after, ignore_below)
 */

#line 948 "ms_deisotope/_c/averagine.pyx"


#line 948 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 948 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 948 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 948 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 948 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 948 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 948 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF((PyObject *)__pyx_v_out);

#line 948 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 948 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 948 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 948 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":953
 *         return out
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         return self.averagine[key]
 * 
 */

#line 953 "ms_deisotope/_c/averagine.pyx"


#line 953 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 953 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_15__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/

#line 953 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_15__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {

#line 953 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 953 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 953 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = 
#line 953 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_14__getitem__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self), ((PyObject *)__pyx_v_key));

#line 953 "ms_deisotope/_c/averagine.pyx"


#line 953 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 953 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 953 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 953 "ms_deisotope/_c/averagine.pyx"
}

#line 953 "ms_deisotope/_c/averagine.pyx"


#line 953 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_14__getitem__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_key) {

#line 953 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 953 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 953 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 953 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 953 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 953 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 953 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "ms_deisotope/_c/averagine.pyx":954
 * 
 *     def __getitem__(self, key):
 *         return self.averagine[key]             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */

#line 954 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 954 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->averagine), __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 954, __pyx_L1_error)

#line 954 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 954 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 954 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 954 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":953
 *         return out
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         return self.averagine[key]
 * 
 */

#line 953 "ms_deisotope/_c/averagine.pyx"


#line 953 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 953 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 953 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 953 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 953 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 953 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 953 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 953 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 953 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 953 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":956
 *         return self.averagine[key]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.averagine)
 * 
 */

#line 956 "ms_deisotope/_c/averagine.pyx"


#line 956 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 956 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_17__iter__(PyObject *__pyx_v_self); /*proto*/

#line 956 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_17__iter__(PyObject *__pyx_v_self) {

#line 956 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 956 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 956 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = 
#line 956 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_16__iter__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self));

#line 956 "ms_deisotope/_c/averagine.pyx"


#line 956 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 956 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 956 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 956 "ms_deisotope/_c/averagine.pyx"
}

#line 956 "ms_deisotope/_c/averagine.pyx"


#line 956 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_16__iter__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self) {

#line 956 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 956 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 956 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 956 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 956 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 956 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 956 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 956 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "ms_deisotope/_c/averagine.pyx":957
 * 
 *     def __iter__(self):
 *         return iter(self.averagine)             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
 */

#line 957 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 957 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_v_self->averagine);

#line 957 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_t_1);

#line 957 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 957, __pyx_L1_error)

#line 957 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 957 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 957 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_2;

#line 957 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

#line 957 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":956
 *         return self.averagine[key]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.averagine)
 * 
 */

#line 956 "ms_deisotope/_c/averagine.pyx"


#line 956 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 956 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 956 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 956 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 956 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 956 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 956 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 956 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 956 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 956 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 956 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":959
 *         return iter(self.averagine)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         return self.averagine.keys()
 * 
 */

#line 959 "ms_deisotope/_c/averagine.pyx"


#line 959 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 959 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_19keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 959 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_18keys[] = "AveragineCache.keys(self)";

#line 959 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_19keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 959 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 959 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 959 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  __pyx_r = 
#line 959 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_18keys(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self));

#line 959 "ms_deisotope/_c/averagine.pyx"


#line 959 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 959 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 959 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 959 "ms_deisotope/_c/averagine.pyx"
}

#line 959 "ms_deisotope/_c/averagine.pyx"


#line 959 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_18keys(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self) {

#line 959 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 959 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 959 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 959 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 959 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 959 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 959 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 959 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 959 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("keys", 0);

  /* "ms_deisotope/_c/averagine.pyx":960
 * 
 *     def keys(self):
 *         return self.averagine.keys()             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
 */

#line 960 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 960 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->averagine), __pyx_n_s_keys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 960, __pyx_L1_error)

#line 960 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 960 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = NULL;

#line 960 "ms_deisotope/_c/averagine.pyx"
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {

#line 960 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);

#line 960 "ms_deisotope/_c/averagine.pyx"
    if (likely(__pyx_t_3)) {

#line 960 "ms_deisotope/_c/averagine.pyx"
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);

#line 960 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(__pyx_t_3);

#line 960 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(function);

#line 960 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF_SET(__pyx_t_2, function);

#line 960 "ms_deisotope/_c/averagine.pyx"
    }

#line 960 "ms_deisotope/_c/averagine.pyx"
  }

#line 960 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);

#line 960 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 960 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 960, __pyx_L1_error)

#line 960 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 960 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 960 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 960 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 960 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":959
 *         return iter(self.averagine)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         return self.averagine.keys()
 * 
 */

#line 959 "ms_deisotope/_c/averagine.pyx"


#line 959 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 959 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 959 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 959 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 959 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 959 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 959 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 959 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 959 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 959 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 959 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 959 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":962
 *         return self.averagine.keys()
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         return self.averagine.values()
 * 
 */

#line 962 "ms_deisotope/_c/averagine.pyx"


#line 962 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 962 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_21values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 962 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_20values[] = "AveragineCache.values(self)";

#line 962 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_21values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 962 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 962 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 962 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  __pyx_r = 
#line 962 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_20values(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self));

#line 962 "ms_deisotope/_c/averagine.pyx"


#line 962 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 962 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 962 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 962 "ms_deisotope/_c/averagine.pyx"
}

#line 962 "ms_deisotope/_c/averagine.pyx"


#line 962 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_20values(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self) {

#line 962 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 962 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 962 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 962 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 962 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 962 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 962 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 962 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 962 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("values", 0);

  /* "ms_deisotope/_c/averagine.pyx":963
 * 
 *     def values(self):
 *         return self.averagine.values()             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
 */

#line 963 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 963 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->averagine), __pyx_n_s_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 963, __pyx_L1_error)

#line 963 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 963 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = NULL;

#line 963 "ms_deisotope/_c/averagine.pyx"
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {

#line 963 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);

#line 963 "ms_deisotope/_c/averagine.pyx"
    if (likely(__pyx_t_3)) {

#line 963 "ms_deisotope/_c/averagine.pyx"
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);

#line 963 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(__pyx_t_3);

#line 963 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(function);

#line 963 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF_SET(__pyx_t_2, function);

#line 963 "ms_deisotope/_c/averagine.pyx"
    }

#line 963 "ms_deisotope/_c/averagine.pyx"
  }

#line 963 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);

#line 963 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 963 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error)

#line 963 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 963 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 963 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 963 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 963 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":962
 *         return self.averagine.keys()
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         return self.averagine.values()
 * 
 */

#line 962 "ms_deisotope/_c/averagine.pyx"


#line 962 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 962 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 962 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 962 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 962 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 962 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.values", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 962 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 962 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 962 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 962 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 962 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 962 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":965
 *         return self.averagine.values()
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         return self.averagine.items()
 * 
 */

#line 965 "ms_deisotope/_c/averagine.pyx"


#line 965 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 965 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_23items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 965 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_22items[] = "AveragineCache.items(self)";

#line 965 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_23items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 965 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 965 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 965 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  __pyx_r = 
#line 965 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_22items(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self));

#line 965 "ms_deisotope/_c/averagine.pyx"


#line 965 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 965 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 965 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 965 "ms_deisotope/_c/averagine.pyx"
}

#line 965 "ms_deisotope/_c/averagine.pyx"


#line 965 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_22items(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self) {

#line 965 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 965 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 965 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 965 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 965 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 965 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 965 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 965 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 965 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("items", 0);

  /* "ms_deisotope/_c/averagine.pyx":966
 * 
 *     def items(self):
 *         return self.averagine.items()             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */

#line 966 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 966 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->averagine), __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 966, __pyx_L1_error)

#line 966 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 966 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = NULL;

#line 966 "ms_deisotope/_c/averagine.pyx"
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {

#line 966 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);

#line 966 "ms_deisotope/_c/averagine.pyx"
    if (likely(__pyx_t_3)) {

#line 966 "ms_deisotope/_c/averagine.pyx"
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);

#line 966 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(__pyx_t_3);

#line 966 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(function);

#line 966 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF_SET(__pyx_t_2, function);

#line 966 "ms_deisotope/_c/averagine.pyx"
    }

#line 966 "ms_deisotope/_c/averagine.pyx"
  }

#line 966 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);

#line 966 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 966 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __pyx_L1_error)

#line 966 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 966 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 966 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 966 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 966 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":965
 *         return self.averagine.values()
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         return self.averagine.items()
 * 
 */

#line 965 "ms_deisotope/_c/averagine.pyx"


#line 965 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 965 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 965 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 965 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 965 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 965 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.items", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 965 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 965 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 965 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 965 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 965 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 965 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":968
 *         return self.averagine.items()
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "AveragineCache(%r)" % self.averagine
 * 
 */

#line 968 "ms_deisotope/_c/averagine.pyx"


#line 968 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 968 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_25__repr__(PyObject *__pyx_v_self); /*proto*/

#line 968 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_25__repr__(PyObject *__pyx_v_self) {

#line 968 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 968 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 968 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = 
#line 968 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_24__repr__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self));

#line 968 "ms_deisotope/_c/averagine.pyx"


#line 968 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 968 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 968 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 968 "ms_deisotope/_c/averagine.pyx"
}

#line 968 "ms_deisotope/_c/averagine.pyx"


#line 968 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_24__repr__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self) {

#line 968 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 968 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 968 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 968 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 968 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 968 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 968 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "ms_deisotope/_c/averagine.pyx":969
 * 
 *     def __repr__(self):
 *         return "AveragineCache(%r)" % self.averagine             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
 */

#line 969 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 969 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_AveragineCache_r, ((PyObject *)__pyx_v_self->averagine)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 969, __pyx_L1_error)

#line 969 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 969 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 969 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 969 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":968
 *         return self.averagine.items()
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "AveragineCache(%r)" % self.averagine
 * 
 */

#line 968 "ms_deisotope/_c/averagine.pyx"


#line 968 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 968 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 968 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 968 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 968 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 968 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 968 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 968 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 968 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 968 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":971
 *         return "AveragineCache(%r)" % self.averagine
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         self.backend.clear()
 * 
 */

#line 971 "ms_deisotope/_c/averagine.pyx"


#line 971 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 971 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_27clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/

#line 971 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_26clear[] = "AveragineCache.clear(self)";

#line 971 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_27clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {

#line 971 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 971 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 971 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  __pyx_r = 
#line 971 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_26clear(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self));

#line 971 "ms_deisotope/_c/averagine.pyx"


#line 971 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 971 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 971 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 971 "ms_deisotope/_c/averagine.pyx"
}

#line 971 "ms_deisotope/_c/averagine.pyx"


#line 971 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_26clear(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self) {

#line 971 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 971 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 971 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_1;

#line 971 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 971 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 971 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 971 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("clear", 0);

  /* "ms_deisotope/_c/averagine.pyx":972
 * 
 *     def clear(self):
 *         self.backend.clear()             # <<<<<<<<<<<<<<
 * 
 *     def populate(self, min_mz=10, max_mz=3005, min_charge=1, max_charge=8, charge_carrier=PROTON,
 */

#line 972 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(__pyx_v_self->backend == Py_None)) {

#line 972 "ms_deisotope/_c/averagine.pyx"
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "clear");

#line 972 "ms_deisotope/_c/averagine.pyx"
    __PYX_ERR(0, 972, __pyx_L1_error)

#line 972 "ms_deisotope/_c/averagine.pyx"
  }

#line 972 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyDict_Clear(__pyx_v_self->backend); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 972, __pyx_L1_error)

  /* "ms_deisotope/_c/averagine.pyx":971
 *         return "AveragineCache(%r)" % self.averagine
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         self.backend.clear()
 * 
 */

#line 971 "ms_deisotope/_c/averagine.pyx"


#line 971 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 971 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);

#line 971 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 971 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 971 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 971 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 971 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 971 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 971 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 971 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 971 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":974
 *         self.backend.clear()
 * 
 *     def populate(self, min_mz=10, max_mz=3005, min_charge=1, max_charge=8, charge_carrier=PROTON,             # <<<<<<<<<<<<<<
 *                  truncate_after=TRUNCATE_AFTER, ignore_below=IGNORE_BELOW):
 *         sign = min_charge / abs(min_charge)
 */

#line 974 "ms_deisotope/_c/averagine.pyx"


#line 974 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 974 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_29populate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 974 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_28populate[] = "AveragineCache.populate(self, min_mz=10, max_mz=3005, min_charge=1, max_charge=8, charge_carrier=PROTON, truncate_after=TRUNCATE_AFTER, ignore_below=IGNORE_BELOW)";

#line 974 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_29populate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_min_mz = 0
#line 974 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_max_mz = 0
#line 974 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_min_charge = 0
#line 974 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_max_charge = 0
#line 974 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_charge_carrier = 0
#line 974 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_truncate_after = 0
#line 974 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_ignore_below = 0
#line 974 "ms_deisotope/_c/averagine.pyx"
;

#line 974 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 974 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 974 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 974 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("populate (wrapper)", 0);

#line 974 "ms_deisotope/_c/averagine.pyx"
  {

#line 974 "ms_deisotope/_c/averagine.pyx"
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_min_mz,&__pyx_n_s_max_mz,&__pyx_n_s_min_charge,&__pyx_n_s_max_charge,&__pyx_n_s_charge_carrier,&__pyx_n_s_truncate_after,&__pyx_n_s_ignore_below,0};

#line 974 "ms_deisotope/_c/averagine.pyx"
    PyObject* values[7] = {0,0,0,0,0,0,0};

#line 974 "ms_deisotope/_c/averagine.pyx"
    values[0] = ((PyObject *)__pyx_int_10);

#line 974 "ms_deisotope/_c/averagine.pyx"
    values[1] = ((PyObject *)__pyx_int_3005);

#line 974 "ms_deisotope/_c/averagine.pyx"
    values[2] = ((PyObject *)__pyx_int_1);

#line 974 "ms_deisotope/_c/averagine.pyx"
    values[3] = ((PyObject *)__pyx_int_8);

#line 974 "ms_deisotope/_c/averagine.pyx"
    values[4] = __pyx_k__11;

#line 974 "ms_deisotope/_c/averagine.pyx"
    values[5] = __pyx_k__12;

#line 974 "ms_deisotope/_c/averagine.pyx"
    values[6] = __pyx_k__13;

#line 974 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_kwds)) {

#line 974 "ms_deisotope/_c/averagine.pyx"
      Py_ssize_t kw_args;

#line 974 "ms_deisotope/_c/averagine.pyx"
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);

#line 974 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {
        case  7: 
#line 974 "ms_deisotope/_c/averagine.pyx"
values[6] = PyTuple_GET_ITEM(__pyx_args, 6);

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  6: 
#line 974 "ms_deisotope/_c/averagine.pyx"
values[5] = PyTuple_GET_ITEM(__pyx_args, 5);

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  5: 
#line 974 "ms_deisotope/_c/averagine.pyx"
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  4: 
#line 974 "ms_deisotope/_c/averagine.pyx"
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  3: 
#line 974 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 974 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 974 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 974 "ms_deisotope/_c/averagine.pyx"
        case  0: break;
        default: 
#line 974 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 974 "ms_deisotope/_c/averagine.pyx"
      }

#line 974 "ms_deisotope/_c/averagine.pyx"
      kw_args = PyDict_Size(__pyx_kwds);

#line 974 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {

#line 974 "ms_deisotope/_c/averagine.pyx"
        case  0:

#line 974 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 974 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_mz);

#line 974 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[0] = value; kw_args--; }

#line 974 "ms_deisotope/_c/averagine.pyx"
        }

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 974 "ms_deisotope/_c/averagine.pyx"
        case  1:

#line 974 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 974 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_mz);

#line 974 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[1] = value; kw_args--; }

#line 974 "ms_deisotope/_c/averagine.pyx"
        }

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 974 "ms_deisotope/_c/averagine.pyx"
        case  2:

#line 974 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 974 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_charge);

#line 974 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[2] = value; kw_args--; }

#line 974 "ms_deisotope/_c/averagine.pyx"
        }

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 974 "ms_deisotope/_c/averagine.pyx"
        case  3:

#line 974 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 974 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_charge);

#line 974 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[3] = value; kw_args--; }

#line 974 "ms_deisotope/_c/averagine.pyx"
        }

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 974 "ms_deisotope/_c/averagine.pyx"
        case  4:

#line 974 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 974 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge_carrier);

#line 974 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[4] = value; kw_args--; }

#line 974 "ms_deisotope/_c/averagine.pyx"
        }

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 974 "ms_deisotope/_c/averagine.pyx"
        case  5:

#line 974 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 974 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncate_after);

#line 974 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[5] = value; kw_args--; }

#line 974 "ms_deisotope/_c/averagine.pyx"
        }

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 974 "ms_deisotope/_c/averagine.pyx"
        case  6:

#line 974 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 974 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ignore_below);

#line 974 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[6] = value; kw_args--; }

#line 974 "ms_deisotope/_c/averagine.pyx"
        }

#line 974 "ms_deisotope/_c/averagine.pyx"
      }

#line 974 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(kw_args > 0)) {

#line 974 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "populate") < 0)) __PYX_ERR(0, 974, __pyx_L3_error)

#line 974 "ms_deisotope/_c/averagine.pyx"
      }

#line 974 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 974 "ms_deisotope/_c/averagine.pyx"
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: 
#line 974 "ms_deisotope/_c/averagine.pyx"
values[6] = PyTuple_GET_ITEM(__pyx_args, 6);

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  6: 
#line 974 "ms_deisotope/_c/averagine.pyx"
values[5] = PyTuple_GET_ITEM(__pyx_args, 5);

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  5: 
#line 974 "ms_deisotope/_c/averagine.pyx"
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  4: 
#line 974 "ms_deisotope/_c/averagine.pyx"
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  3: 
#line 974 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 974 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 974 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 974 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  0: 
#line 974 "ms_deisotope/_c/averagine.pyx"
break;
        default: 
#line 974 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 974 "ms_deisotope/_c/averagine.pyx"
      }

#line 974 "ms_deisotope/_c/averagine.pyx"
    }

#line 974 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_min_mz = values[0];

#line 974 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_max_mz = values[1];

#line 974 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_min_charge = values[2];

#line 974 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_max_charge = values[3];

#line 974 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_charge_carrier = values[4];

#line 974 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_truncate_after = values[5];

#line 974 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_ignore_below = values[6];

#line 974 "ms_deisotope/_c/averagine.pyx"
  }

#line 974 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 974 "ms_deisotope/_c/averagine.pyx"
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("populate", 0, 0, 7, PyTuple_GET_SIZE(__pyx_args)); 
#line 974 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 974, __pyx_L3_error)

#line 974 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.populate", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 974 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 974 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 974 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_28populate(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self), __pyx_v_min_mz, __pyx_v_max_mz, __pyx_v_min_charge, __pyx_v_max_charge, __pyx_v_charge_carrier, __pyx_v_truncate_after, __pyx_v_ignore_below);

#line 974 "ms_deisotope/_c/averagine.pyx"


#line 974 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 974 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 974 "ms_deisotope/_c/averagine.pyx"
}

#line 974 "ms_deisotope/_c/averagine.pyx"


#line 974 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_28populate(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_min_mz, PyObject *__pyx_v_max_mz, PyObject *__pyx_v_min_charge, PyObject *__pyx_v_max_charge, PyObject *__pyx_v_charge_carrier, PyObject *__pyx_v_truncate_after, PyObject *__pyx_v_ignore_below) {
  PyObject *__pyx_v_sign = NULL
#line 974 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_i = NULL
#line 974 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_j = NULL
#line 974 "ms_deisotope/_c/averagine.pyx"
;

#line 974 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 974 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 974 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 974 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_3;

#line 974 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_4 = NULL;

#line 974 "ms_deisotope/_c/averagine.pyx"
  Py_ssize_t __pyx_t_5;

#line 974 "ms_deisotope/_c/averagine.pyx"
  PyObject *(*__pyx_t_6)(PyObject *);

#line 974 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_7 = NULL;

#line 974 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_8 = NULL;

#line 974 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_9 = NULL;

#line 974 "ms_deisotope/_c/averagine.pyx"
  Py_ssize_t __pyx_t_10;

#line 974 "ms_deisotope/_c/averagine.pyx"
  PyObject *(*__pyx_t_11)(PyObject *);

#line 974 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_12;

#line 974 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_13;

#line 974 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_14;

#line 974 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_15;

#line 974 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_16;

#line 974 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster __pyx_t_17;

#line 974 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 974 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 974 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("populate", 0);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_min_charge);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_max_charge);

  /* "ms_deisotope/_c/averagine.pyx":976
 *     def populate(self, min_mz=10, max_mz=3005, min_charge=1, max_charge=8, charge_carrier=PROTON,
 *                  truncate_after=TRUNCATE_AFTER, ignore_below=IGNORE_BELOW):
 *         sign = min_charge / abs(min_charge)             # <<<<<<<<<<<<<<
 *         assert sign == (max_charge / abs(max_charge)), "The polarity of min_charge must match the polarity of max_charge"
 *         min_charge = abs(min_charge)
 */

#line 976 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyNumber_Absolute(__pyx_v_min_charge); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 976, __pyx_L1_error)

#line 976 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 976 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_min_charge, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 976, __pyx_L1_error)

#line 976 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 976 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 976 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_sign = __pyx_t_2;

#line 976 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":977
 *                  truncate_after=TRUNCATE_AFTER, ignore_below=IGNORE_BELOW):
 *         sign = min_charge / abs(min_charge)
 *         assert sign == (max_charge / abs(max_charge)), "The polarity of min_charge must match the polarity of max_charge"             # <<<<<<<<<<<<<<
 *         min_charge = abs(min_charge)
 *         max_charge = abs(max_charge)
 */

#line 977 "ms_deisotope/_c/averagine.pyx"
  #ifndef CYTHON_WITHOUT_ASSERTIONS

#line 977 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!Py_OptimizeFlag)) {

#line 977 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_v_max_charge); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 977, __pyx_L1_error)

#line 977 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);

#line 977 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_max_charge, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 977, __pyx_L1_error)

#line 977 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 977 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 977 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_sign, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 977, __pyx_L1_error)

#line 977 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 977 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 977, __pyx_L1_error)

#line 977 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 977 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(!__pyx_t_3)) {

#line 977 "ms_deisotope/_c/averagine.pyx"
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_The_polarity_of_min_charge_must);

#line 977 "ms_deisotope/_c/averagine.pyx"
      __PYX_ERR(0, 977, __pyx_L1_error)

#line 977 "ms_deisotope/_c/averagine.pyx"
    }

#line 977 "ms_deisotope/_c/averagine.pyx"
  }

#line 977 "ms_deisotope/_c/averagine.pyx"
  #endif

  /* "ms_deisotope/_c/averagine.pyx":978
 *         sign = min_charge / abs(min_charge)
 *         assert sign == (max_charge / abs(max_charge)), "The polarity of min_charge must match the polarity of max_charge"
 *         min_charge = abs(min_charge)             # <<<<<<<<<<<<<<
 *         max_charge = abs(max_charge)
 *         for i in range(int(min_mz), int(max_mz)):
 */

#line 978 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_v_min_charge); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 978, __pyx_L1_error)

#line 978 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 978 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF_SET(__pyx_v_min_charge, __pyx_t_2);

#line 978 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":979
 *         assert sign == (max_charge / abs(max_charge)), "The polarity of min_charge must match the polarity of max_charge"
 *         min_charge = abs(min_charge)
 *         max_charge = abs(max_charge)             # <<<<<<<<<<<<<<
 *         for i in range(int(min_mz), int(max_mz)):
 *             for j in range(min(max_charge, min_charge), max(min_charge, max_charge) + 1):
 */

#line 979 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_v_max_charge); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 979, __pyx_L1_error)

#line 979 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 979 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF_SET(__pyx_v_max_charge, __pyx_t_2);

#line 979 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":980
 *         min_charge = abs(min_charge)
 *         max_charge = abs(max_charge)
 *         for i in range(int(min_mz), int(max_mz)):             # <<<<<<<<<<<<<<
 *             for j in range(min(max_charge, min_charge), max(min_charge, max_charge) + 1):
 *                 self.isotopic_cluster(
 */

#line 980 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_v_min_mz); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 980, __pyx_L1_error)

#line 980 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 980 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_max_mz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error)

#line 980 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 980 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 980, __pyx_L1_error)

#line 980 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_4);

#line 980 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_2);

#line 980 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);

#line 980 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_1);

#line 980 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);

#line 980 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

#line 980 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 980 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error)

#line 980 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 980 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 980 "ms_deisotope/_c/averagine.pyx"
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {

#line 980 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;

#line 980 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = NULL;

#line 980 "ms_deisotope/_c/averagine.pyx"
  } else {
    __pyx_t_5 = -1; 
#line 980 "ms_deisotope/_c/averagine.pyx"
__pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 980, __pyx_L1_error)

#line 980 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_4);

#line 980 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 980, __pyx_L1_error)

#line 980 "ms_deisotope/_c/averagine.pyx"
  }

#line 980 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 980 "ms_deisotope/_c/averagine.pyx"
  for (;;) {

#line 980 "ms_deisotope/_c/averagine.pyx"
    if (likely(!__pyx_t_6)) {

#line 980 "ms_deisotope/_c/averagine.pyx"
      if (likely(PyList_CheckExact(__pyx_t_4))) {

#line 980 "ms_deisotope/_c/averagine.pyx"
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;

#line 980 "ms_deisotope/_c/averagine.pyx"
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS

#line 980 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 980, __pyx_L1_error)

#line 980 "ms_deisotope/_c/averagine.pyx"
        #else

#line 980 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error)

#line 980 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_1);

#line 980 "ms_deisotope/_c/averagine.pyx"
        #endif

#line 980 "ms_deisotope/_c/averagine.pyx"
      } else {

#line 980 "ms_deisotope/_c/averagine.pyx"
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;

#line 980 "ms_deisotope/_c/averagine.pyx"
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS

#line 980 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 980, __pyx_L1_error)

#line 980 "ms_deisotope/_c/averagine.pyx"
        #else

#line 980 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error)

#line 980 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_1);

#line 980 "ms_deisotope/_c/averagine.pyx"
        #endif

#line 980 "ms_deisotope/_c/averagine.pyx"
      }
    } else 
#line 980 "ms_deisotope/_c/averagine.pyx"
{

#line 980 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_1 = __pyx_t_6(__pyx_t_4);

#line 980 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(!__pyx_t_1)) {

#line 980 "ms_deisotope/_c/averagine.pyx"
        PyObject* exc_type = PyErr_Occurred();

#line 980 "ms_deisotope/_c/averagine.pyx"
        if (exc_type) {

#line 980 "ms_deisotope/_c/averagine.pyx"
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();

#line 980 "ms_deisotope/_c/averagine.pyx"
          else __PYX_ERR(0, 980, __pyx_L1_error)

#line 980 "ms_deisotope/_c/averagine.pyx"
        }

#line 980 "ms_deisotope/_c/averagine.pyx"
        break;

#line 980 "ms_deisotope/_c/averagine.pyx"
      }

#line 980 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_1);

#line 980 "ms_deisotope/_c/averagine.pyx"
    }

#line 980 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);

#line 980 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":981
 *         max_charge = abs(max_charge)
 *         for i in range(int(min_mz), int(max_mz)):
 *             for j in range(min(max_charge, min_charge), max(min_charge, max_charge) + 1):             # <<<<<<<<<<<<<<
 *                 self.isotopic_cluster(
 *                     i, sign * j, charge_carrier, truncate_after=truncate_after, ignore_below=ignore_below)
 */

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_v_min_charge);

#line 981 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = __pyx_v_min_charge;

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_v_max_charge);

#line 981 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = __pyx_v_max_charge;

#line 981 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 981, __pyx_L1_error)

#line 981 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 981, __pyx_L1_error)

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

#line 981 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_3) {

#line 981 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(__pyx_t_1);

#line 981 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_7 = __pyx_t_1;

#line 981 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 981 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(__pyx_t_2);

#line 981 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_7 = __pyx_t_2;

#line 981 "ms_deisotope/_c/averagine.pyx"
    }

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_v_max_charge);

#line 981 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = __pyx_v_max_charge;

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_v_min_charge);

#line 981 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = __pyx_v_min_charge;

#line 981 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_9 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 981, __pyx_L1_error)

#line 981 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 981, __pyx_L1_error)

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

#line 981 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_3) {

#line 981 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(__pyx_t_1);

#line 981 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_8 = __pyx_t_1;

#line 981 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 981 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(__pyx_t_2);

#line 981 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_8 = __pyx_t_2;

#line 981 "ms_deisotope/_c/averagine.pyx"
    }

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 981 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_8, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 981, __pyx_L1_error)

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

#line 981 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 981, __pyx_L1_error)

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_8);

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_t_7);

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GIVEREF(__pyx_t_7);

#line 981 "ms_deisotope/_c/averagine.pyx"
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GIVEREF(__pyx_t_1);

#line 981 "ms_deisotope/_c/averagine.pyx"
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

#line 981 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

#line 981 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 981, __pyx_L1_error)

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

#line 981 "ms_deisotope/_c/averagine.pyx"
    if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {

#line 981 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_8 = __pyx_t_1; __Pyx_INCREF(__pyx_t_8); __pyx_t_10 = 0;

#line 981 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_11 = NULL;

#line 981 "ms_deisotope/_c/averagine.pyx"
    } else {
      __pyx_t_10 = -1; 
#line 981 "ms_deisotope/_c/averagine.pyx"
__pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 981, __pyx_L1_error)

#line 981 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_8);

#line 981 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_11 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 981, __pyx_L1_error)

#line 981 "ms_deisotope/_c/averagine.pyx"
    }

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 981 "ms_deisotope/_c/averagine.pyx"
    for (;;) {

#line 981 "ms_deisotope/_c/averagine.pyx"
      if (likely(!__pyx_t_11)) {

#line 981 "ms_deisotope/_c/averagine.pyx"
        if (likely(PyList_CheckExact(__pyx_t_8))) {

#line 981 "ms_deisotope/_c/averagine.pyx"
          if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_8)) break;

#line 981 "ms_deisotope/_c/averagine.pyx"
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS

#line 981 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 981, __pyx_L1_error)

#line 981 "ms_deisotope/_c/averagine.pyx"
          #else

#line 981 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 981, __pyx_L1_error)

#line 981 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GOTREF(__pyx_t_1);

#line 981 "ms_deisotope/_c/averagine.pyx"
          #endif

#line 981 "ms_deisotope/_c/averagine.pyx"
        } else {

#line 981 "ms_deisotope/_c/averagine.pyx"
          if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_8)) break;

#line 981 "ms_deisotope/_c/averagine.pyx"
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS

#line 981 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 981, __pyx_L1_error)

#line 981 "ms_deisotope/_c/averagine.pyx"
          #else

#line 981 "ms_deisotope/_c/averagine.pyx"
          __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 981, __pyx_L1_error)

#line 981 "ms_deisotope/_c/averagine.pyx"
          __Pyx_GOTREF(__pyx_t_1);

#line 981 "ms_deisotope/_c/averagine.pyx"
          #endif

#line 981 "ms_deisotope/_c/averagine.pyx"
        }
      } else 
#line 981 "ms_deisotope/_c/averagine.pyx"
{

#line 981 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_1 = __pyx_t_11(__pyx_t_8);

#line 981 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(!__pyx_t_1)) {

#line 981 "ms_deisotope/_c/averagine.pyx"
          PyObject* exc_type = PyErr_Occurred();

#line 981 "ms_deisotope/_c/averagine.pyx"
          if (exc_type) {

#line 981 "ms_deisotope/_c/averagine.pyx"
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();

#line 981 "ms_deisotope/_c/averagine.pyx"
            else __PYX_ERR(0, 981, __pyx_L1_error)

#line 981 "ms_deisotope/_c/averagine.pyx"
          }

#line 981 "ms_deisotope/_c/averagine.pyx"
          break;

#line 981 "ms_deisotope/_c/averagine.pyx"
        }

#line 981 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_1);

#line 981 "ms_deisotope/_c/averagine.pyx"
      }

#line 981 "ms_deisotope/_c/averagine.pyx"
      __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_1);

#line 981 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_1 = 0;

      /* "ms_deisotope/_c/averagine.pyx":983
 *             for j in range(min(max_charge, min_charge), max(min_charge, max_charge) + 1):
 *                 self.isotopic_cluster(
 *                     i, sign * j, charge_carrier, truncate_after=truncate_after, ignore_below=ignore_below)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

#line 983 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_i); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 983, __pyx_L1_error)

#line 983 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_1 = PyNumber_Multiply(__pyx_v_sign, __pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 983, __pyx_L1_error)

#line 983 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_1);

#line 983 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 983, __pyx_L1_error)

#line 983 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 983 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_v_charge_carrier); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 983, __pyx_L1_error)

#line 983 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_v_truncate_after); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 983, __pyx_L1_error)

#line 983 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_v_ignore_below); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 983, __pyx_L1_error)

      /* "ms_deisotope/_c/averagine.pyx":982
 *         for i in range(int(min_mz), int(max_mz)):
 *             for j in range(min(max_charge, min_charge), max(min_charge, max_charge) + 1):
 *                 self.isotopic_cluster(             # <<<<<<<<<<<<<<
 *                     i, sign * j, charge_carrier, truncate_after=truncate_after, ignore_below=ignore_below)
 *         return self
 */

#line 982 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_17.__pyx_n = 4;

#line 982 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_17.charge = __pyx_t_13;

#line 982 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_17.charge_carrier = __pyx_t_14;

#line 982 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_17.truncate_after = __pyx_t_15;

#line 982 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_17.ignore_below = __pyx_t_16;

#line 982 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster(__pyx_v_self, __pyx_t_12, 0, &__pyx_t_17)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 982, __pyx_L1_error)

#line 982 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_1);

#line 982 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "ms_deisotope/_c/averagine.pyx":981
 *         max_charge = abs(max_charge)
 *         for i in range(int(min_mz), int(max_mz)):
 *             for j in range(min(max_charge, min_charge), max(min_charge, max_charge) + 1):             # <<<<<<<<<<<<<<
 *                 self.isotopic_cluster(
 *                     i, sign * j, charge_carrier, truncate_after=truncate_after, ignore_below=ignore_below)
 */

#line 981 "ms_deisotope/_c/averagine.pyx"
    }

#line 981 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "ms_deisotope/_c/averagine.pyx":980
 *         min_charge = abs(min_charge)
 *         max_charge = abs(max_charge)
 *         for i in range(int(min_mz), int(max_mz)):             # <<<<<<<<<<<<<<
 *             for j in range(min(max_charge, min_charge), max(min_charge, max_charge) + 1):
 *                 self.isotopic_cluster(
 */

#line 980 "ms_deisotope/_c/averagine.pyx"
  }

#line 980 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "ms_deisotope/_c/averagine.pyx":984
 *                 self.isotopic_cluster(
 *                     i, sign * j, charge_carrier, truncate_after=truncate_after, ignore_below=ignore_below)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, other, int code):
 */

#line 984 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 984 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(((PyObject *)__pyx_v_self));

#line 984 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = ((PyObject *)__pyx_v_self);

#line 984 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":974
 *         self.backend.clear()
 * 
 *     def populate(self, min_mz=10, max_mz=3005, min_charge=1, max_charge=8, charge_carrier=PROTON,             # <<<<<<<<<<<<<<
 *                  truncate_after=TRUNCATE_AFTER, ignore_below=IGNORE_BELOW):
 *         sign = min_charge / abs(min_charge)
 */

#line 974 "ms_deisotope/_c/averagine.pyx"


#line 974 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 974 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_7);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_8);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_9);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.populate", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 974 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_sign);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_i);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_j);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_min_charge);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_max_charge);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 974 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 974 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":986
 *         return self
 * 
 *     def __richcmp__(self, other, int code):             # <<<<<<<<<<<<<<
 *         if code == 2:
 *             return self.averagine == other.averagine and self.backend == other.backend
 */

#line 986 "ms_deisotope/_c/averagine.pyx"


#line 986 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 986 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_31__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_code); /*proto*/

#line 986 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_31__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_code) {

#line 986 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 986 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 986 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_r = 
#line 986 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_30__richcmp__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_code));

#line 986 "ms_deisotope/_c/averagine.pyx"


#line 986 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 986 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 986 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 986 "ms_deisotope/_c/averagine.pyx"
}

#line 986 "ms_deisotope/_c/averagine.pyx"


#line 986 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_30__richcmp__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_code) {

#line 986 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 986 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 986 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 986 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 986 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 986 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_4;

#line 986 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 986 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 986 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 986 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "ms_deisotope/_c/averagine.pyx":987
 * 
 *     def __richcmp__(self, other, int code):
 *         if code == 2:             # <<<<<<<<<<<<<<
 *             return self.averagine == other.averagine and self.backend == other.backend
 *         elif code == 3:
 */

#line 987 "ms_deisotope/_c/averagine.pyx"
  switch (__pyx_v_code) {

#line 987 "ms_deisotope/_c/averagine.pyx"
    case 2:

    /* "ms_deisotope/_c/averagine.pyx":988
 *     def __richcmp__(self, other, int code):
 *         if code == 2:
 *             return self.averagine == other.averagine and self.backend == other.backend             # <<<<<<<<<<<<<<
 *         elif code == 3:
 *             return self.averagine != other.averagine and self.backend != other.backend
 */

#line 988 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF(__pyx_r);

#line 988 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_averagine); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 988, __pyx_L1_error)

#line 988 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);

#line 988 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_self->averagine), __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 988, __pyx_L1_error)

#line 988 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 988 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 988, __pyx_L1_error)

#line 988 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_4) {

#line 988 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 988 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 988 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(__pyx_t_3);

#line 988 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_1 = __pyx_t_3;

#line 988 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 988 "ms_deisotope/_c/averagine.pyx"
      goto __pyx_L3_bool_binop_done;

#line 988 "ms_deisotope/_c/averagine.pyx"
    }

#line 988 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_backend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 988, __pyx_L1_error)

#line 988 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 988 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_self->backend, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 988, __pyx_L1_error)

#line 988 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 988 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_t_2);

#line 988 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = __pyx_t_2;

#line 988 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 988 "ms_deisotope/_c/averagine.pyx"
    __pyx_L3_bool_binop_done:;

#line 988 "ms_deisotope/_c/averagine.pyx"
    __pyx_r = __pyx_t_1;

#line 988 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

#line 988 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L0;

    /* "ms_deisotope/_c/averagine.pyx":987
 * 
 *     def __richcmp__(self, other, int code):
 *         if code == 2:             # <<<<<<<<<<<<<<
 *             return self.averagine == other.averagine and self.backend == other.backend
 *         elif code == 3:
 */

#line 987 "ms_deisotope/_c/averagine.pyx"
    break;

#line 987 "ms_deisotope/_c/averagine.pyx"
    case 3:

    /* "ms_deisotope/_c/averagine.pyx":990
 *             return self.averagine == other.averagine and self.backend == other.backend
 *         elif code == 3:
 *             return self.averagine != other.averagine and self.backend != other.backend             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 990 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF(__pyx_r);

#line 990 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_averagine); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 990, __pyx_L1_error)

#line 990 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);

#line 990 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_self->averagine), __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 990, __pyx_L1_error)

#line 990 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 990 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 990, __pyx_L1_error)

#line 990 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_t_4) {

#line 990 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 990 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 990 "ms_deisotope/_c/averagine.pyx"
      __Pyx_INCREF(__pyx_t_3);

#line 990 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_1 = __pyx_t_3;

#line 990 "ms_deisotope/_c/averagine.pyx"
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 990 "ms_deisotope/_c/averagine.pyx"
      goto __pyx_L5_bool_binop_done;

#line 990 "ms_deisotope/_c/averagine.pyx"
    }

#line 990 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_backend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 990, __pyx_L1_error)

#line 990 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_3);

#line 990 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_self->backend, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 990, __pyx_L1_error)

#line 990 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

#line 990 "ms_deisotope/_c/averagine.pyx"
    __Pyx_INCREF(__pyx_t_2);

#line 990 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = __pyx_t_2;

#line 990 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 990 "ms_deisotope/_c/averagine.pyx"
    __pyx_L5_bool_binop_done:;

#line 990 "ms_deisotope/_c/averagine.pyx"
    __pyx_r = __pyx_t_1;

#line 990 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

#line 990 "ms_deisotope/_c/averagine.pyx"
    goto __pyx_L0;

    /* "ms_deisotope/_c/averagine.pyx":989
 *         if code == 2:
 *             return self.averagine == other.averagine and self.backend == other.backend
 *         elif code == 3:             # <<<<<<<<<<<<<<
 *             return self.averagine != other.averagine and self.backend != other.backend
 * 
 */

#line 989 "ms_deisotope/_c/averagine.pyx"
    break;

#line 989 "ms_deisotope/_c/averagine.pyx"
    default: break;

#line 989 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":986
 *         return self
 * 
 *     def __richcmp__(self, other, int code):             # <<<<<<<<<<<<<<
 *         if code == 2:
 *             return self.averagine == other.averagine and self.backend == other.backend
 */

#line 986 "ms_deisotope/_c/averagine.pyx"


#line 986 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 986 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);

#line 986 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 986 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 986 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 986 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 986 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 986 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 986 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 986 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 986 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 986 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 986 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 986 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pxd":81
 * cdef class AveragineCache(object):
 *     cdef:
 *         public dict backend             # <<<<<<<<<<<<<<
 *         public Averagine averagine
 *         public double cache_truncation
 */

#line 81 "ms_deisotope/_c/averagine.pxd"


#line 81 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 81 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_1__get__(PyObject *__pyx_v_self); /*proto*/

#line 81 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_1__get__(PyObject *__pyx_v_self) {

#line 81 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = 0;

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = 
#line 81 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend___get__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self));

#line 81 "ms_deisotope/_c/averagine.pxd"


#line 81 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 81 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 81 "ms_deisotope/_c/averagine.pxd"
}

#line 81 "ms_deisotope/_c/averagine.pxd"


#line 81 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self) {

#line 81 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = NULL;

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__", 0);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_r);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_INCREF(__pyx_v_self->backend);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = __pyx_v_self->backend;

#line 81 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 81 "ms_deisotope/_c/averagine.pxd"


#line 81 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 81 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XGIVEREF(__pyx_r);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 81 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 81 "ms_deisotope/_c/averagine.pxd"
}

#line 81 "ms_deisotope/_c/averagine.pxd"


#line 81 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 81 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/

#line 81 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {

#line 81 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = 
#line 81 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_2__set__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self), ((PyObject *)__pyx_v_value));

#line 81 "ms_deisotope/_c/averagine.pxd"


#line 81 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 81 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 81 "ms_deisotope/_c/averagine.pxd"
}

#line 81 "ms_deisotope/_c/averagine.pxd"


#line 81 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_value) {

#line 81 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 81 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_t_1 = NULL;

#line 81 "ms_deisotope/_c/averagine.pxd"
  int __pyx_lineno = 0;

#line 81 "ms_deisotope/_c/averagine.pxd"
  const char *__pyx_filename = NULL;

#line 81 "ms_deisotope/_c/averagine.pxd"
  int __pyx_clineno = 0;

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__", 0);

#line 81 "ms_deisotope/_c/averagine.pxd"
  if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 81, __pyx_L1_error)

#line 81 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = __pyx_v_value;

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_INCREF(__pyx_t_1);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GIVEREF(__pyx_t_1);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GOTREF(__pyx_v_self->backend);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_DECREF(__pyx_v_self->backend);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __pyx_v_self->backend = ((PyObject*)__pyx_t_1);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = 0;

#line 81 "ms_deisotope/_c/averagine.pxd"


#line 81 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 81 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = 0;

#line 81 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 81 "ms_deisotope/_c/averagine.pxd"
  __pyx_L1_error:;

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_t_1);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.backend.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = -1;

#line 81 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 81 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 81 "ms_deisotope/_c/averagine.pxd"
}

#line 81 "ms_deisotope/_c/averagine.pxd"


#line 81 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 81 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_5__del__(PyObject *__pyx_v_self); /*proto*/

#line 81 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_5__del__(PyObject *__pyx_v_self) {

#line 81 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = 
#line 81 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_4__del__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self));

#line 81 "ms_deisotope/_c/averagine.pxd"


#line 81 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 81 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 81 "ms_deisotope/_c/averagine.pxd"
}

#line 81 "ms_deisotope/_c/averagine.pxd"


#line 81 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_4__del__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self) {

#line 81 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__del__", 0);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_INCREF(Py_None);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GIVEREF(Py_None);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GOTREF(__pyx_v_self->backend);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_DECREF(__pyx_v_self->backend);

#line 81 "ms_deisotope/_c/averagine.pxd"
  __pyx_v_self->backend = ((PyObject*)Py_None);

#line 81 "ms_deisotope/_c/averagine.pxd"


#line 81 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 81 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = 0;

#line 81 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 81 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 81 "ms_deisotope/_c/averagine.pxd"
}

/* "ms_deisotope/_c/averagine.pxd":82
 *     cdef:
 *         public dict backend
 *         public Averagine averagine             # <<<<<<<<<<<<<<
 *         public double cache_truncation
 *         public bint enabled
 */

#line 82 "ms_deisotope/_c/averagine.pxd"


#line 82 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 82 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_1__get__(PyObject *__pyx_v_self); /*proto*/

#line 82 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_1__get__(PyObject *__pyx_v_self) {

#line 82 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = 0;

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = 
#line 82 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine___get__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self));

#line 82 "ms_deisotope/_c/averagine.pxd"


#line 82 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 82 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 82 "ms_deisotope/_c/averagine.pxd"
}

#line 82 "ms_deisotope/_c/averagine.pxd"


#line 82 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self) {

#line 82 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = NULL;

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__", 0);

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_r);

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_INCREF(((PyObject *)__pyx_v_self->averagine));

#line 82 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = ((PyObject *)__pyx_v_self->averagine);

#line 82 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 82 "ms_deisotope/_c/averagine.pxd"


#line 82 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 82 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XGIVEREF(__pyx_r);

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 82 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 82 "ms_deisotope/_c/averagine.pxd"
}

#line 82 "ms_deisotope/_c/averagine.pxd"


#line 82 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 82 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/

#line 82 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {

#line 82 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = 
#line 82 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_2__set__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self), ((PyObject *)__pyx_v_value));

#line 82 "ms_deisotope/_c/averagine.pxd"


#line 82 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 82 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 82 "ms_deisotope/_c/averagine.pxd"
}

#line 82 "ms_deisotope/_c/averagine.pxd"


#line 82 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_value) {

#line 82 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 82 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_t_1 = NULL;

#line 82 "ms_deisotope/_c/averagine.pxd"
  int __pyx_lineno = 0;

#line 82 "ms_deisotope/_c/averagine.pxd"
  const char *__pyx_filename = NULL;

#line 82 "ms_deisotope/_c/averagine.pxd"
  int __pyx_clineno = 0;

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__", 0);

#line 82 "ms_deisotope/_c/averagine.pxd"
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_12ms_deisotope_2_c_9averagine_Averagine))))) __PYX_ERR(1, 82, __pyx_L1_error)

#line 82 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = __pyx_v_value;

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_INCREF(__pyx_t_1);

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GIVEREF(__pyx_t_1);

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GOTREF(__pyx_v_self->averagine);

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_DECREF(((PyObject *)__pyx_v_self->averagine));

#line 82 "ms_deisotope/_c/averagine.pxd"
  __pyx_v_self->averagine = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)__pyx_t_1);

#line 82 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = 0;

#line 82 "ms_deisotope/_c/averagine.pxd"


#line 82 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 82 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = 0;

#line 82 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 82 "ms_deisotope/_c/averagine.pxd"
  __pyx_L1_error:;

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_t_1);

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.averagine.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 82 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = -1;

#line 82 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 82 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 82 "ms_deisotope/_c/averagine.pxd"
}

#line 82 "ms_deisotope/_c/averagine.pxd"


#line 82 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 82 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_5__del__(PyObject *__pyx_v_self); /*proto*/

#line 82 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_5__del__(PyObject *__pyx_v_self) {

#line 82 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = 
#line 82 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_4__del__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self));

#line 82 "ms_deisotope/_c/averagine.pxd"


#line 82 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 82 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 82 "ms_deisotope/_c/averagine.pxd"
}

#line 82 "ms_deisotope/_c/averagine.pxd"


#line 82 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_4__del__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self) {

#line 82 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__del__", 0);

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_INCREF(Py_None);

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GIVEREF(Py_None);

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GOTREF(__pyx_v_self->averagine);

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_DECREF(((PyObject *)__pyx_v_self->averagine));

#line 82 "ms_deisotope/_c/averagine.pxd"
  __pyx_v_self->averagine = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)Py_None);

#line 82 "ms_deisotope/_c/averagine.pxd"


#line 82 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 82 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = 0;

#line 82 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 82 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 82 "ms_deisotope/_c/averagine.pxd"
}

/* "ms_deisotope/_c/averagine.pxd":83
 *         public dict backend
 *         public Averagine averagine
 *         public double cache_truncation             # <<<<<<<<<<<<<<
 *         public bint enabled
 * 
 */

#line 83 "ms_deisotope/_c/averagine.pxd"


#line 83 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 83 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_16cache_truncation_1__get__(PyObject *__pyx_v_self); /*proto*/

#line 83 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_16cache_truncation_1__get__(PyObject *__pyx_v_self) {

#line 83 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = 0;

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = 
#line 83 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_16cache_truncation___get__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self));

#line 83 "ms_deisotope/_c/averagine.pxd"


#line 83 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 83 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 83 "ms_deisotope/_c/averagine.pxd"
}

#line 83 "ms_deisotope/_c/averagine.pxd"


#line 83 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_16cache_truncation___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self) {

#line 83 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = NULL;

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 83 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_t_1 = NULL;

#line 83 "ms_deisotope/_c/averagine.pxd"
  int __pyx_lineno = 0;

#line 83 "ms_deisotope/_c/averagine.pxd"
  const char *__pyx_filename = NULL;

#line 83 "ms_deisotope/_c/averagine.pxd"
  int __pyx_clineno = 0;

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__", 0);

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_r);

#line 83 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->cache_truncation); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 83, __pyx_L1_error)

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GOTREF(__pyx_t_1);

#line 83 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = __pyx_t_1;

#line 83 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = 0;

#line 83 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 83 "ms_deisotope/_c/averagine.pxd"


#line 83 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 83 "ms_deisotope/_c/averagine.pxd"
  __pyx_L1_error:;

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_t_1);

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.cache_truncation.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 83 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = NULL;

#line 83 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XGIVEREF(__pyx_r);

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 83 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 83 "ms_deisotope/_c/averagine.pxd"
}

#line 83 "ms_deisotope/_c/averagine.pxd"


#line 83 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 83 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_16cache_truncation_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/

#line 83 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_16cache_truncation_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {

#line 83 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = 
#line 83 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_16cache_truncation_2__set__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self), ((PyObject *)__pyx_v_value));

#line 83 "ms_deisotope/_c/averagine.pxd"


#line 83 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 83 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 83 "ms_deisotope/_c/averagine.pxd"
}

#line 83 "ms_deisotope/_c/averagine.pxd"


#line 83 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_16cache_truncation_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_value) {

#line 83 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 83 "ms_deisotope/_c/averagine.pxd"
  double __pyx_t_1;

#line 83 "ms_deisotope/_c/averagine.pxd"
  int __pyx_lineno = 0;

#line 83 "ms_deisotope/_c/averagine.pxd"
  const char *__pyx_filename = NULL;

#line 83 "ms_deisotope/_c/averagine.pxd"
  int __pyx_clineno = 0;

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__", 0);

#line 83 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 83, __pyx_L1_error)

#line 83 "ms_deisotope/_c/averagine.pxd"
  __pyx_v_self->cache_truncation = __pyx_t_1;

#line 83 "ms_deisotope/_c/averagine.pxd"


#line 83 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 83 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = 0;

#line 83 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 83 "ms_deisotope/_c/averagine.pxd"
  __pyx_L1_error:;

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.cache_truncation.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 83 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = -1;

#line 83 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 83 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 83 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 83 "ms_deisotope/_c/averagine.pxd"
}

/* "ms_deisotope/_c/averagine.pxd":84
 *         public Averagine averagine
 *         public double cache_truncation
 *         public bint enabled             # <<<<<<<<<<<<<<
 * 
 *     cdef double _make_cache_key(self, double mz)
 */

#line 84 "ms_deisotope/_c/averagine.pxd"


#line 84 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 84 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7enabled_1__get__(PyObject *__pyx_v_self); /*proto*/

#line 84 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7enabled_1__get__(PyObject *__pyx_v_self) {

#line 84 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = 0;

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = 
#line 84 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7enabled___get__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self));

#line 84 "ms_deisotope/_c/averagine.pxd"


#line 84 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 84 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 84 "ms_deisotope/_c/averagine.pxd"
}

#line 84 "ms_deisotope/_c/averagine.pxd"


#line 84 "ms_deisotope/_c/averagine.pxd"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7enabled___get__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self) {

#line 84 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_r = NULL;

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 84 "ms_deisotope/_c/averagine.pxd"
  PyObject *__pyx_t_1 = NULL;

#line 84 "ms_deisotope/_c/averagine.pxd"
  int __pyx_lineno = 0;

#line 84 "ms_deisotope/_c/averagine.pxd"
  const char *__pyx_filename = NULL;

#line 84 "ms_deisotope/_c/averagine.pxd"
  int __pyx_clineno = 0;

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__get__", 0);

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_r);

#line 84 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->enabled); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 84, __pyx_L1_error)

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_GOTREF(__pyx_t_1);

#line 84 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = __pyx_t_1;

#line 84 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = 0;

#line 84 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 84 "ms_deisotope/_c/averagine.pxd"


#line 84 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 84 "ms_deisotope/_c/averagine.pxd"
  __pyx_L1_error:;

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XDECREF(__pyx_t_1);

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.enabled.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 84 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = NULL;

#line 84 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_XGIVEREF(__pyx_r);

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 84 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 84 "ms_deisotope/_c/averagine.pxd"
}

#line 84 "ms_deisotope/_c/averagine.pxd"


#line 84 "ms_deisotope/_c/averagine.pxd"
/* Python wrapper */

#line 84 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7enabled_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/

#line 84 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7enabled_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {

#line 84 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = 
#line 84 "ms_deisotope/_c/averagine.pxd"
__pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7enabled_2__set__(((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)__pyx_v_self), ((PyObject *)__pyx_v_value));

#line 84 "ms_deisotope/_c/averagine.pxd"


#line 84 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 84 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 84 "ms_deisotope/_c/averagine.pxd"
}

#line 84 "ms_deisotope/_c/averagine.pxd"


#line 84 "ms_deisotope/_c/averagine.pxd"
static int __pyx_pf_12ms_deisotope_2_c_9averagine_14AveragineCache_7enabled_2__set__(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *__pyx_v_self, PyObject *__pyx_v_value) {

#line 84 "ms_deisotope/_c/averagine.pxd"
  int __pyx_r;

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyDeclarations

#line 84 "ms_deisotope/_c/averagine.pxd"
  int __pyx_t_1;

#line 84 "ms_deisotope/_c/averagine.pxd"
  int __pyx_lineno = 0;

#line 84 "ms_deisotope/_c/averagine.pxd"
  const char *__pyx_filename = NULL;

#line 84 "ms_deisotope/_c/averagine.pxd"
  int __pyx_clineno = 0;

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannySetupContext("__set__", 0);

#line 84 "ms_deisotope/_c/averagine.pxd"
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 84, __pyx_L1_error)

#line 84 "ms_deisotope/_c/averagine.pxd"
  __pyx_v_self->enabled = __pyx_t_1;

#line 84 "ms_deisotope/_c/averagine.pxd"


#line 84 "ms_deisotope/_c/averagine.pxd"
  /* function exit code */

#line 84 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = 0;

#line 84 "ms_deisotope/_c/averagine.pxd"
  goto __pyx_L0;

#line 84 "ms_deisotope/_c/averagine.pxd"
  __pyx_L1_error:;

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.AveragineCache.enabled.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 84 "ms_deisotope/_c/averagine.pxd"
  __pyx_r = -1;

#line 84 "ms_deisotope/_c/averagine.pxd"
  __pyx_L0:;

#line 84 "ms_deisotope/_c/averagine.pxd"
  __Pyx_RefNannyFinishContext();

#line 84 "ms_deisotope/_c/averagine.pxd"
  return __pyx_r;

#line 84 "ms_deisotope/_c/averagine.pxd"
}

/* "ms_deisotope/_c/averagine.pyx":998
 * 
 * @cython.cdivision
 * cpdef double isotopic_shift(int charge=1):             # <<<<<<<<<<<<<<
 *     return _neutron_shift / <double>(charge)
 * 
 */

#line 998 "ms_deisotope/_c/averagine.pyx"


#line 998 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_1isotopic_shift(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 998 "ms_deisotope/_c/averagine.pyx"
static double __pyx_f_12ms_deisotope_2_c_9averagine_isotopic_shift(CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_isotopic_shift *__pyx_optional_args) {

#line 998 "ms_deisotope/_c/averagine.pyx"
  int __pyx_v_charge = ((int)1);

#line 998 "ms_deisotope/_c/averagine.pyx"
  double __pyx_r;

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("isotopic_shift", 0);

#line 998 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_optional_args) {

#line 998 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_optional_args->__pyx_n > 0) {

#line 998 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = __pyx_optional_args->charge;

#line 998 "ms_deisotope/_c/averagine.pyx"
    }

#line 998 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":999
 * @cython.cdivision
 * cpdef double isotopic_shift(int charge=1):
 *     return _neutron_shift / <double>(charge)             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 999 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = (__pyx_v_12ms_deisotope_2_c_9averagine__neutron_shift / ((double)__pyx_v_charge));

#line 999 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":998
 * 
 * @cython.cdivision
 * cpdef double isotopic_shift(int charge=1):             # <<<<<<<<<<<<<<
 *     return _neutron_shift / <double>(charge)
 * 
 */

#line 998 "ms_deisotope/_c/averagine.pyx"


#line 998 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 998 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 998 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 998 "ms_deisotope/_c/averagine.pyx"
}

#line 998 "ms_deisotope/_c/averagine.pyx"


#line 998 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 998 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_1isotopic_shift(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 998 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_isotopic_shift[] = "isotopic_shift(int charge=1) -> double";

#line 998 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_1isotopic_shift(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_charge
#line 998 "ms_deisotope/_c/averagine.pyx"
;

#line 998 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 998 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 998 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 998 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("isotopic_shift (wrapper)", 0);

#line 998 "ms_deisotope/_c/averagine.pyx"
  {

#line 998 "ms_deisotope/_c/averagine.pyx"
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_charge,0};

#line 998 "ms_deisotope/_c/averagine.pyx"
    PyObject* values[1] = {0};

#line 998 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_kwds)) {

#line 998 "ms_deisotope/_c/averagine.pyx"
      Py_ssize_t kw_args;

#line 998 "ms_deisotope/_c/averagine.pyx"
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);

#line 998 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {
        case  1: 
#line 998 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 998 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 998 "ms_deisotope/_c/averagine.pyx"
        case  0: break;
        default: 
#line 998 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 998 "ms_deisotope/_c/averagine.pyx"
      }

#line 998 "ms_deisotope/_c/averagine.pyx"
      kw_args = PyDict_Size(__pyx_kwds);

#line 998 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {

#line 998 "ms_deisotope/_c/averagine.pyx"
        case  0:

#line 998 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 998 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge);

#line 998 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[0] = value; kw_args--; }

#line 998 "ms_deisotope/_c/averagine.pyx"
        }

#line 998 "ms_deisotope/_c/averagine.pyx"
      }

#line 998 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(kw_args > 0)) {

#line 998 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "isotopic_shift") < 0)) __PYX_ERR(0, 998, __pyx_L3_error)

#line 998 "ms_deisotope/_c/averagine.pyx"
      }

#line 998 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 998 "ms_deisotope/_c/averagine.pyx"
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: 
#line 998 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 998 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  0: 
#line 998 "ms_deisotope/_c/averagine.pyx"
break;
        default: 
#line 998 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 998 "ms_deisotope/_c/averagine.pyx"
      }

#line 998 "ms_deisotope/_c/averagine.pyx"
    }

#line 998 "ms_deisotope/_c/averagine.pyx"
    if (values[0]) {

#line 998 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_charge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 998, __pyx_L3_error)

#line 998 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 998 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = ((int)1);

#line 998 "ms_deisotope/_c/averagine.pyx"
    }

#line 998 "ms_deisotope/_c/averagine.pyx"
  }

#line 998 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 998 "ms_deisotope/_c/averagine.pyx"
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("isotopic_shift", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); 
#line 998 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 998, __pyx_L3_error)

#line 998 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.isotopic_shift", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 998 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 998 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 998 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_isotopic_shift(__pyx_self, __pyx_v_charge);

#line 998 "ms_deisotope/_c/averagine.pyx"


#line 998 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 998 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 998 "ms_deisotope/_c/averagine.pyx"
}

#line 998 "ms_deisotope/_c/averagine.pyx"


#line 998 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_isotopic_shift(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_charge) {

#line 998 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 998 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_1;

#line 998 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_isotopic_shift __pyx_t_2;

#line 998 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_3 = NULL;

#line 998 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 998 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 998 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("isotopic_shift", 0);

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 998 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.__pyx_n = 1;

#line 998 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge = __pyx_v_charge;

#line 998 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __pyx_f_12ms_deisotope_2_c_9averagine_isotopic_shift(0, &__pyx_t_2); 

#line 998 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 998, __pyx_L1_error)

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_3);

#line 998 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_3;

#line 998 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = 0;

#line 998 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 998 "ms_deisotope/_c/averagine.pyx"


#line 998 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 998 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_3);

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.isotopic_shift", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 998 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 998 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 998 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 998 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 998 "ms_deisotope/_c/averagine.pyx"
}

/* "ms_deisotope/_c/averagine.pyx":1003
 * 
 * @cython.cdivision
 * cpdef TheoreticalIsotopicPattern poisson_approximate(double mass, size_t n_peaks, double lambda_factor=1800.0, int charge=1):             # <<<<<<<<<<<<<<
 *     cdef:
 *         double lmbda = mass / lambda_factor
 */

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_3poisson_approximate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_f_12ms_deisotope_2_c_9averagine_poisson_approximate(double __pyx_v_mass, size_t __pyx_v_n_peaks, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_poisson_approximate *__pyx_optional_args) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  double __pyx_v_lambda_factor = ((double)1800.0);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  int __pyx_v_charge = ((int)1);
  double __pyx_v_lmbda
#line 1003 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_p_i
#line 1003 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_factorial_acc
#line 1003 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_total
#line 1003 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_cur_intensity
#line 1003 "ms_deisotope/_c/averagine.pyx"
;
  double *__pyx_v_intensities
#line 1003 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_result = 0
#line 1003 "ms_deisotope/_c/averagine.pyx"
;
  PyObject *__pyx_v_i = NULL
#line 1003 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_iso_shift
#line 1003 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_mz
#line 1003 "ms_deisotope/_c/averagine.pyx"
;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_r = NULL;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_2 = NULL;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_ssize_t __pyx_t_3;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *(*__pyx_t_4)(PyObject *);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_5 = NULL;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  double __pyx_t_6;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_ssize_t __pyx_t_7;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_isotopic_shift __pyx_t_8;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_9 = NULL;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  int __pyx_t_10;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("poisson_approximate", 0);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_optional_args) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_optional_args->__pyx_n > 0) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_lambda_factor = __pyx_optional_args->lambda_factor;

#line 1003 "ms_deisotope/_c/averagine.pyx"
      if (__pyx_optional_args->__pyx_n > 1) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
        __pyx_v_charge = __pyx_optional_args->charge;

#line 1003 "ms_deisotope/_c/averagine.pyx"
      }

#line 1003 "ms_deisotope/_c/averagine.pyx"
    }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

  /* "ms_deisotope/_c/averagine.pyx":1005
 * cpdef TheoreticalIsotopicPattern poisson_approximate(double mass, size_t n_peaks, double lambda_factor=1800.0, int charge=1):
 *     cdef:
 *         double lmbda = mass / lambda_factor             # <<<<<<<<<<<<<<
 *         double p_i = 1.0
 *         double factorial_acc = 1
 */

#line 1005 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_lmbda = (__pyx_v_mass / __pyx_v_lambda_factor);

  /* "ms_deisotope/_c/averagine.pyx":1006
 *     cdef:
 *         double lmbda = mass / lambda_factor
 *         double p_i = 1.0             # <<<<<<<<<<<<<<
 *         double factorial_acc = 1
 *         double total = 1.0
 */

#line 1006 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_p_i = 1.0;

  /* "ms_deisotope/_c/averagine.pyx":1007
 *         double lmbda = mass / lambda_factor
 *         double p_i = 1.0
 *         double factorial_acc = 1             # <<<<<<<<<<<<<<
 *         double total = 1.0
 *         double cur_intensity
 */

#line 1007 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_factorial_acc = 1.0;

  /* "ms_deisotope/_c/averagine.pyx":1008
 *         double p_i = 1.0
 *         double factorial_acc = 1
 *         double total = 1.0             # <<<<<<<<<<<<<<
 *         double cur_intensity
 *         double* intensities
 */

#line 1008 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_total = 1.0;

  /* "ms_deisotope/_c/averagine.pyx":1013
 *         list result
 * 
 *     intensities = <double*>malloc(sizeof(double) * n_peaks)             # <<<<<<<<<<<<<<
 *     intensities[0] = 1.0
 *     for i in range(1, n_peaks):
 */

#line 1013 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_intensities = ((double *)malloc(((sizeof(double)) * __pyx_v_n_peaks)));

  /* "ms_deisotope/_c/averagine.pyx":1014
 * 
 *     intensities = <double*>malloc(sizeof(double) * n_peaks)
 *     intensities[0] = 1.0             # <<<<<<<<<<<<<<
 *     for i in range(1, n_peaks):
 *         p_i *= lmbda
 */

#line 1014 "ms_deisotope/_c/averagine.pyx"
  (__pyx_v_intensities[0]) = 1.0;

  /* "ms_deisotope/_c/averagine.pyx":1015
 *     intensities = <double*>malloc(sizeof(double) * n_peaks)
 *     intensities[0] = 1.0
 *     for i in range(1, n_peaks):             # <<<<<<<<<<<<<<
 *         p_i *= lmbda
 *         factorial_acc *= i
 */

#line 1015 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_n_peaks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)

#line 1015 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 1015 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1015, __pyx_L1_error)

#line 1015 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 1015 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_int_1);

#line 1015 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_int_1);

#line 1015 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1);

#line 1015 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_1);

#line 1015 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);

#line 1015 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 1015 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)

#line 1015 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 1015 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 1015 "ms_deisotope/_c/averagine.pyx"
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {

#line 1015 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;

#line 1015 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = NULL;

#line 1015 "ms_deisotope/_c/averagine.pyx"
  } else {
    __pyx_t_3 = -1; 
#line 1015 "ms_deisotope/_c/averagine.pyx"
__pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1015, __pyx_L1_error)

#line 1015 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);

#line 1015 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1015, __pyx_L1_error)

#line 1015 "ms_deisotope/_c/averagine.pyx"
  }

#line 1015 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 1015 "ms_deisotope/_c/averagine.pyx"
  for (;;) {

#line 1015 "ms_deisotope/_c/averagine.pyx"
    if (likely(!__pyx_t_4)) {

#line 1015 "ms_deisotope/_c/averagine.pyx"
      if (likely(PyList_CheckExact(__pyx_t_2))) {

#line 1015 "ms_deisotope/_c/averagine.pyx"
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;

#line 1015 "ms_deisotope/_c/averagine.pyx"
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS

#line 1015 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1015, __pyx_L1_error)

#line 1015 "ms_deisotope/_c/averagine.pyx"
        #else

#line 1015 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)

#line 1015 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_1);

#line 1015 "ms_deisotope/_c/averagine.pyx"
        #endif

#line 1015 "ms_deisotope/_c/averagine.pyx"
      } else {

#line 1015 "ms_deisotope/_c/averagine.pyx"
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;

#line 1015 "ms_deisotope/_c/averagine.pyx"
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS

#line 1015 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1015, __pyx_L1_error)

#line 1015 "ms_deisotope/_c/averagine.pyx"
        #else

#line 1015 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)

#line 1015 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_1);

#line 1015 "ms_deisotope/_c/averagine.pyx"
        #endif

#line 1015 "ms_deisotope/_c/averagine.pyx"
      }
    } else 
#line 1015 "ms_deisotope/_c/averagine.pyx"
{

#line 1015 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);

#line 1015 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(!__pyx_t_1)) {

#line 1015 "ms_deisotope/_c/averagine.pyx"
        PyObject* exc_type = PyErr_Occurred();

#line 1015 "ms_deisotope/_c/averagine.pyx"
        if (exc_type) {

#line 1015 "ms_deisotope/_c/averagine.pyx"
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();

#line 1015 "ms_deisotope/_c/averagine.pyx"
          else __PYX_ERR(0, 1015, __pyx_L1_error)

#line 1015 "ms_deisotope/_c/averagine.pyx"
        }

#line 1015 "ms_deisotope/_c/averagine.pyx"
        break;

#line 1015 "ms_deisotope/_c/averagine.pyx"
      }

#line 1015 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_1);

#line 1015 "ms_deisotope/_c/averagine.pyx"
    }

#line 1015 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);

#line 1015 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":1016
 *     intensities[0] = 1.0
 *     for i in range(1, n_peaks):
 *         p_i *= lmbda             # <<<<<<<<<<<<<<
 *         factorial_acc *= i
 *         cur_intensity = p_i / factorial_acc
 */

#line 1016 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_p_i = (__pyx_v_p_i * __pyx_v_lmbda);

    /* "ms_deisotope/_c/averagine.pyx":1017
 *     for i in range(1, n_peaks):
 *         p_i *= lmbda
 *         factorial_acc *= i             # <<<<<<<<<<<<<<
 *         cur_intensity = p_i / factorial_acc
 *         intensities[i] = (cur_intensity if not isinf(cur_intensity) else 0.0)
 */

#line 1017 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_factorial_acc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1017, __pyx_L1_error)

#line 1017 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 1017 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1017, __pyx_L1_error)

#line 1017 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_5);

#line 1017 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 1017 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1017, __pyx_L1_error)

#line 1017 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

#line 1017 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_factorial_acc = __pyx_t_6;

    /* "ms_deisotope/_c/averagine.pyx":1018
 *         p_i *= lmbda
 *         factorial_acc *= i
 *         cur_intensity = p_i / factorial_acc             # <<<<<<<<<<<<<<
 *         intensities[i] = (cur_intensity if not isinf(cur_intensity) else 0.0)
 *         total += intensities[i]
 */

#line 1018 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_cur_intensity = (__pyx_v_p_i / __pyx_v_factorial_acc);

    /* "ms_deisotope/_c/averagine.pyx":1019
 *         factorial_acc *= i
 *         cur_intensity = p_i / factorial_acc
 *         intensities[i] = (cur_intensity if not isinf(cur_intensity) else 0.0)             # <<<<<<<<<<<<<<
 *         total += intensities[i]
 * 
 */

#line 1019 "ms_deisotope/_c/averagine.pyx"
    if (((!(isinf(__pyx_v_cur_intensity) != 0)) != 0)) {

#line 1019 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_6 = __pyx_v_cur_intensity;

#line 1019 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 1019 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_6 = 0.0;

#line 1019 "ms_deisotope/_c/averagine.pyx"
    }

#line 1019 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1019, __pyx_L1_error)

#line 1019 "ms_deisotope/_c/averagine.pyx"
    (__pyx_v_intensities[__pyx_t_7]) = __pyx_t_6;

    /* "ms_deisotope/_c/averagine.pyx":1020
 *         cur_intensity = p_i / factorial_acc
 *         intensities[i] = (cur_intensity if not isinf(cur_intensity) else 0.0)
 *         total += intensities[i]             # <<<<<<<<<<<<<<
 * 
 *     result = []
 */

#line 1020 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1020, __pyx_L1_error)

#line 1020 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_total = (__pyx_v_total + (__pyx_v_intensities[__pyx_t_7]));

    /* "ms_deisotope/_c/averagine.pyx":1015
 *     intensities = <double*>malloc(sizeof(double) * n_peaks)
 *     intensities[0] = 1.0
 *     for i in range(1, n_peaks):             # <<<<<<<<<<<<<<
 *         p_i *= lmbda
 *         factorial_acc *= i
 */

#line 1015 "ms_deisotope/_c/averagine.pyx"
  }

#line 1015 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":1022
 *         total += intensities[i]
 * 
 *     result = []             # <<<<<<<<<<<<<<
 *     iso_shift = isotopic_shift(charge)
 *     mz = mass_charge_ratio(mass, charge)
 */

#line 1022 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1022, __pyx_L1_error)

#line 1022 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 1022 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_result = ((PyObject*)__pyx_t_2);

#line 1022 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":1023
 * 
 *     result = []
 *     iso_shift = isotopic_shift(charge)             # <<<<<<<<<<<<<<
 *     mz = mass_charge_ratio(mass, charge)
 * 
 */

#line 1023 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_8.__pyx_n = 1;

#line 1023 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_8.charge = __pyx_v_charge;

#line 1023 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_6 = __pyx_f_12ms_deisotope_2_c_9averagine_isotopic_shift(0, &__pyx_t_8); 

#line 1023 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_iso_shift = __pyx_t_6;

  /* "ms_deisotope/_c/averagine.pyx":1024
 *     result = []
 *     iso_shift = isotopic_shift(charge)
 *     mz = mass_charge_ratio(mass, charge)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n_peaks):
 */

#line 1024 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_mz = __pyx_f_12ms_deisotope_2_c_9averagine_mass_charge_ratio(__pyx_v_mass, __pyx_v_charge, NULL);

  /* "ms_deisotope/_c/averagine.pyx":1026
 *     mz = mass_charge_ratio(mass, charge)
 * 
 *     for i in range(n_peaks):             # <<<<<<<<<<<<<<
 *         result.append(TheoreticalPeak._create(mz + i * iso_shift, intensities[i] / total, charge))
 * 
 */

#line 1026 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n_peaks); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1026, __pyx_L1_error)

#line 1026 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 1026 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1026, __pyx_L1_error)

#line 1026 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_5);

#line 1026 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 1026 "ms_deisotope/_c/averagine.pyx"
  if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {

#line 1026 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_2 = __pyx_t_5; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;

#line 1026 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = NULL;

#line 1026 "ms_deisotope/_c/averagine.pyx"
  } else {
    __pyx_t_3 = -1; 
#line 1026 "ms_deisotope/_c/averagine.pyx"
__pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1026, __pyx_L1_error)

#line 1026 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_2);

#line 1026 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1026, __pyx_L1_error)

#line 1026 "ms_deisotope/_c/averagine.pyx"
  }

#line 1026 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

#line 1026 "ms_deisotope/_c/averagine.pyx"
  for (;;) {

#line 1026 "ms_deisotope/_c/averagine.pyx"
    if (likely(!__pyx_t_4)) {

#line 1026 "ms_deisotope/_c/averagine.pyx"
      if (likely(PyList_CheckExact(__pyx_t_2))) {

#line 1026 "ms_deisotope/_c/averagine.pyx"
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;

#line 1026 "ms_deisotope/_c/averagine.pyx"
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS

#line 1026 "ms_deisotope/_c/averagine.pyx"
        __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(0, 1026, __pyx_L1_error)

#line 1026 "ms_deisotope/_c/averagine.pyx"
        #else

#line 1026 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1026, __pyx_L1_error)

#line 1026 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_5);

#line 1026 "ms_deisotope/_c/averagine.pyx"
        #endif

#line 1026 "ms_deisotope/_c/averagine.pyx"
      } else {

#line 1026 "ms_deisotope/_c/averagine.pyx"
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;

#line 1026 "ms_deisotope/_c/averagine.pyx"
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS

#line 1026 "ms_deisotope/_c/averagine.pyx"
        __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(0, 1026, __pyx_L1_error)

#line 1026 "ms_deisotope/_c/averagine.pyx"
        #else

#line 1026 "ms_deisotope/_c/averagine.pyx"
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1026, __pyx_L1_error)

#line 1026 "ms_deisotope/_c/averagine.pyx"
        __Pyx_GOTREF(__pyx_t_5);

#line 1026 "ms_deisotope/_c/averagine.pyx"
        #endif

#line 1026 "ms_deisotope/_c/averagine.pyx"
      }
    } else 
#line 1026 "ms_deisotope/_c/averagine.pyx"
{

#line 1026 "ms_deisotope/_c/averagine.pyx"
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);

#line 1026 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(!__pyx_t_5)) {

#line 1026 "ms_deisotope/_c/averagine.pyx"
        PyObject* exc_type = PyErr_Occurred();

#line 1026 "ms_deisotope/_c/averagine.pyx"
        if (exc_type) {

#line 1026 "ms_deisotope/_c/averagine.pyx"
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();

#line 1026 "ms_deisotope/_c/averagine.pyx"
          else __PYX_ERR(0, 1026, __pyx_L1_error)

#line 1026 "ms_deisotope/_c/averagine.pyx"
        }

#line 1026 "ms_deisotope/_c/averagine.pyx"
        break;

#line 1026 "ms_deisotope/_c/averagine.pyx"
      }

#line 1026 "ms_deisotope/_c/averagine.pyx"
      __Pyx_GOTREF(__pyx_t_5);

#line 1026 "ms_deisotope/_c/averagine.pyx"
    }

#line 1026 "ms_deisotope/_c/averagine.pyx"
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);

#line 1026 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = 0;

    /* "ms_deisotope/_c/averagine.pyx":1027
 * 
 *     for i in range(n_peaks):
 *         result.append(TheoreticalPeak._create(mz + i * iso_shift, intensities[i] / total, charge))             # <<<<<<<<<<<<<<
 * 
 *     free(intensities)
 */

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_mz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1027, __pyx_L1_error)

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_5);

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_iso_shift); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1027, __pyx_L1_error)

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_9 = PyNumber_Multiply(__pyx_v_i, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1027, __pyx_L1_error)

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_9);

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1027, __pyx_L1_error)

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1027, __pyx_L1_error)

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1027, __pyx_L1_error)

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_1 = ((PyObject *)__pyx_vtabptr_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak->_create(__pyx_t_6, ((__pyx_v_intensities[__pyx_t_7]) / __pyx_v_total), __pyx_v_charge)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1027, __pyx_L1_error)

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __Pyx_GOTREF(__pyx_t_1);

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 1027, __pyx_L1_error)

#line 1027 "ms_deisotope/_c/averagine.pyx"
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "ms_deisotope/_c/averagine.pyx":1026
 *     mz = mass_charge_ratio(mass, charge)
 * 
 *     for i in range(n_peaks):             # <<<<<<<<<<<<<<
 *         result.append(TheoreticalPeak._create(mz + i * iso_shift, intensities[i] / total, charge))
 * 
 */

#line 1026 "ms_deisotope/_c/averagine.pyx"
  }

#line 1026 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":1029
 *         result.append(TheoreticalPeak._create(mz + i * iso_shift, intensities[i] / total, charge))
 * 
 *     free(intensities)             # <<<<<<<<<<<<<<
 *     return TheoreticalIsotopicPattern(result, origin=mz)
 */

#line 1029 "ms_deisotope/_c/averagine.pyx"
  free(__pyx_v_intensities);

  /* "ms_deisotope/_c/averagine.pyx":1030
 * 
 *     free(intensities)
 *     return TheoreticalIsotopicPattern(result, origin=mz)             # <<<<<<<<<<<<<<
 */

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(((PyObject *)__pyx_r));

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1030, __pyx_L1_error)

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_v_result);

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_v_result);

#line 1030 "ms_deisotope/_c/averagine.pyx"
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_result);

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1030, __pyx_L1_error)

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_mz); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1030, __pyx_L1_error)

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_9);

#line 1030 "ms_deisotope/_c/averagine.pyx"
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_origin, __pyx_t_9) < 0) __PYX_ERR(0, 1030, __pyx_L1_error)

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern), __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1030, __pyx_L1_error)

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_9);

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)__pyx_t_9);

#line 1030 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_9 = 0;

#line 1030 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

  /* "ms_deisotope/_c/averagine.pyx":1003
 * 
 * @cython.cdivision
 * cpdef TheoreticalIsotopicPattern poisson_approximate(double mass, size_t n_peaks, double lambda_factor=1800.0, int charge=1):             # <<<<<<<<<<<<<<
 *     cdef:
 *         double lmbda = mass / lambda_factor
 */

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_5);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_9);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.poisson_approximate", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_result);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_v_i);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF((PyObject *)__pyx_r);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
/* Python wrapper */

#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_3poisson_approximate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
static char __pyx_doc_12ms_deisotope_2_c_9averagine_2poisson_approximate[] = "poisson_approximate(double mass, size_t n_peaks, double lambda_factor=1800.0, int charge=1) -> TheoreticalIsotopicPattern";

#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pw_12ms_deisotope_2_c_9averagine_3poisson_approximate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_mass
#line 1003 "ms_deisotope/_c/averagine.pyx"
;
  size_t __pyx_v_n_peaks
#line 1003 "ms_deisotope/_c/averagine.pyx"
;
  double __pyx_v_lambda_factor
#line 1003 "ms_deisotope/_c/averagine.pyx"
;
  int __pyx_v_charge
#line 1003 "ms_deisotope/_c/averagine.pyx"
;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("poisson_approximate (wrapper)", 0);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mass,&__pyx_n_s_n_peaks,&__pyx_n_s_lambda_factor,&__pyx_n_s_charge,0};

#line 1003 "ms_deisotope/_c/averagine.pyx"
    PyObject* values[4] = {0,0,0,0};

#line 1003 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(__pyx_kwds)) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
      Py_ssize_t kw_args;

#line 1003 "ms_deisotope/_c/averagine.pyx"
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);

#line 1003 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {
        case  4: 
#line 1003 "ms_deisotope/_c/averagine.pyx"
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);

#line 1003 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  3: 
#line 1003 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 1003 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 1003 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 1003 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  1: 
#line 1003 "ms_deisotope/_c/averagine.pyx"
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 1003 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 1003 "ms_deisotope/_c/averagine.pyx"
        case  0: break;
        default: 
#line 1003 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 1003 "ms_deisotope/_c/averagine.pyx"
      }

#line 1003 "ms_deisotope/_c/averagine.pyx"
      kw_args = PyDict_Size(__pyx_kwds);

#line 1003 "ms_deisotope/_c/averagine.pyx"
      switch (pos_args) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
        case  0:

#line 1003 "ms_deisotope/_c/averagine.pyx"
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mass)) != 0)) kw_args--;
        else 
#line 1003 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 1003 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 1003 "ms_deisotope/_c/averagine.pyx"
        case  1:

#line 1003 "ms_deisotope/_c/averagine.pyx"
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_peaks)) != 0)) kw_args--;

#line 1003 "ms_deisotope/_c/averagine.pyx"
        else {
          __Pyx_RaiseArgtupleInvalid("poisson_approximate", 0, 2, 4, 1); 
#line 1003 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 1003, __pyx_L3_error)

#line 1003 "ms_deisotope/_c/averagine.pyx"
        }

#line 1003 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 1003 "ms_deisotope/_c/averagine.pyx"
        case  2:

#line 1003 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lambda_factor);

#line 1003 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[2] = value; kw_args--; }

#line 1003 "ms_deisotope/_c/averagine.pyx"
        }

#line 1003 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;

#line 1003 "ms_deisotope/_c/averagine.pyx"
        case  3:

#line 1003 "ms_deisotope/_c/averagine.pyx"
        if (kw_args > 0) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge);

#line 1003 "ms_deisotope/_c/averagine.pyx"
          if (value) { values[3] = value; kw_args--; }

#line 1003 "ms_deisotope/_c/averagine.pyx"
        }

#line 1003 "ms_deisotope/_c/averagine.pyx"
      }

#line 1003 "ms_deisotope/_c/averagine.pyx"
      if (unlikely(kw_args > 0)) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "poisson_approximate") < 0)) __PYX_ERR(0, 1003, __pyx_L3_error)

#line 1003 "ms_deisotope/_c/averagine.pyx"
      }

#line 1003 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: 
#line 1003 "ms_deisotope/_c/averagine.pyx"
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);

#line 1003 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  3: 
#line 1003 "ms_deisotope/_c/averagine.pyx"
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);

#line 1003 "ms_deisotope/_c/averagine.pyx"
        CYTHON_FALLTHROUGH;
        case  2: 
#line 1003 "ms_deisotope/_c/averagine.pyx"
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);

#line 1003 "ms_deisotope/_c/averagine.pyx"
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);

#line 1003 "ms_deisotope/_c/averagine.pyx"
        break;
        default: 
#line 1003 "ms_deisotope/_c/averagine.pyx"
goto __pyx_L5_argtuple_error;

#line 1003 "ms_deisotope/_c/averagine.pyx"
      }

#line 1003 "ms_deisotope/_c/averagine.pyx"
    }

#line 1003 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_mass = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mass == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1003, __pyx_L3_error)

#line 1003 "ms_deisotope/_c/averagine.pyx"
    __pyx_v_n_peaks = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_n_peaks == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1003, __pyx_L3_error)

#line 1003 "ms_deisotope/_c/averagine.pyx"
    if (values[2]) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_lambda_factor = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_lambda_factor == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1003, __pyx_L3_error)

#line 1003 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_lambda_factor = ((double)1800.0);

#line 1003 "ms_deisotope/_c/averagine.pyx"
    }

#line 1003 "ms_deisotope/_c/averagine.pyx"
    if (values[3]) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_charge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1003, __pyx_L3_error)

#line 1003 "ms_deisotope/_c/averagine.pyx"
    } else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
      __pyx_v_charge = ((int)1);

#line 1003 "ms_deisotope/_c/averagine.pyx"
    }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L4_argument_unpacking_done;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("poisson_approximate", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); 
#line 1003 "ms_deisotope/_c/averagine.pyx"
__PYX_ERR(0, 1003, __pyx_L3_error)

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_L3_error:;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.poisson_approximate", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return NULL;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = 
#line 1003 "ms_deisotope/_c/averagine.pyx"
__pyx_pf_12ms_deisotope_2_c_9averagine_2poisson_approximate(__pyx_self, __pyx_v_mass, __pyx_v_n_peaks, __pyx_v_lambda_factor, __pyx_v_charge);

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_pf_12ms_deisotope_2_c_9averagine_2poisson_approximate(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_mass, size_t __pyx_v_n_peaks, double __pyx_v_lambda_factor, int __pyx_v_charge) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_r = NULL;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyDeclarations

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *__pyx_t_1 = NULL;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_poisson_approximate __pyx_t_2;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  int __pyx_lineno = 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  const char *__pyx_filename = NULL;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  int __pyx_clineno = 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannySetupContext("poisson_approximate", 0);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_r);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.__pyx_n = 2;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.lambda_factor = __pyx_v_lambda_factor;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2.charge = __pyx_v_charge;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = ((PyObject *)__pyx_f_12ms_deisotope_2_c_9averagine_poisson_approximate(__pyx_v_mass, __pyx_v_n_peaks, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error)

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = __pyx_t_1;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
  /* function exit code */

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_AddTraceback("ms_deisotope._c.averagine.poisson_approximate", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_r = NULL;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XGIVEREF(__pyx_r);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return __pyx_r;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_Averagine __pyx_vtable_12ms_deisotope_2_c_9averagine_Averagine;

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_tp_new_12ms_deisotope_2_c_9averagine_Averagine(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *p;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    o = (*t->tp_alloc)(t, 0);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  } else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!o)) return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p->__pyx_vtab = __pyx_vtabptr_12ms_deisotope_2_c_9averagine_Averagine;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p->base_composition = ((PyObject*)Py_None); Py_INCREF(Py_None);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static void __pyx_tp_dealloc_12ms_deisotope_2_c_9averagine_Averagine(PyObject *o) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *p = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if CYTHON_USE_TP_FINALIZE

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    if (PyObject_CallFinalizerFromDealloc(o)) return;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject_GC_UnTrack(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_CLEAR(p->base_composition);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  (*Py_TYPE(o)->tp_free)(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_tp_traverse_12ms_deisotope_2_c_9averagine_Averagine(PyObject *o, visitproc v, void *a) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  int e;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *p = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (p->base_composition) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    e = (*v)(p->base_composition, a); if (e) return e;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_tp_clear_12ms_deisotope_2_c_9averagine_Averagine(PyObject *o) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject* tmp;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *p = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  tmp = ((PyObject*)p->base_composition);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p->base_composition = ((PyObject*)Py_None); Py_INCREF(Py_None);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_XDECREF(tmp);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_sq_item_12ms_deisotope_2_c_9averagine_Averagine(PyObject *o, Py_ssize_t i) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *r;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_DECREF(x);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return r;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_getprop_12ms_deisotope_2_c_9averagine_9Averagine_base_mass(PyObject *o, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_9base_mass_1__get__(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_setprop_12ms_deisotope_2_c_9averagine_9Averagine_base_mass(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (v) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_9base_mass_3__set__(o, v);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    PyErr_SetString(PyExc_NotImplementedError, "__del__");

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return -1;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_getprop_12ms_deisotope_2_c_9averagine_9Averagine_base_composition(PyObject *o, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_1__get__(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_setprop_12ms_deisotope_2_c_9averagine_9Averagine_base_composition(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (v) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_3__set__(o, v);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_16base_composition_5__del__(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyMethodDef __pyx_methods_12ms_deisotope_2_c_9averagine_Averagine[] = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"__reduce__", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_3__reduce__, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_2__reduce__},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"__getstate__", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_5__getstate__, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_4__getstate__},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"__setstate__", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_7__setstate__, METH_O, __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_6__setstate__},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"scale", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_11scale, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_10scale},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"isotopic_cluster", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_13isotopic_cluster, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_12isotopic_cluster},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"keys", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_19keys, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_18keys},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"values", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_21values, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_20values},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"items", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_23items, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_9Averagine_22items},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {0, 0, 0, 0}

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static struct PyGetSetDef __pyx_getsets_12ms_deisotope_2_c_9averagine_Averagine[] = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {(char *)"base_mass", __pyx_getprop_12ms_deisotope_2_c_9averagine_9Averagine_base_mass, __pyx_setprop_12ms_deisotope_2_c_9averagine_9Averagine_base_mass, (char *)"base_mass: 'double'", 0},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {(char *)"base_composition", __pyx_getprop_12ms_deisotope_2_c_9averagine_9Averagine_base_composition, __pyx_setprop_12ms_deisotope_2_c_9averagine_9Averagine_base_composition, (char *)"base_composition: dict", 0},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {0, 0, 0, 0, 0}

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PySequenceMethods __pyx_tp_as_sequence_Averagine = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_length*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_concat*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_repeat*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_sq_item_12ms_deisotope_2_c_9averagine_Averagine, /*sq_item*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_slice*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_ass_item*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_ass_slice*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_contains*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_inplace_concat*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_inplace_repeat*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyMappingMethods __pyx_tp_as_mapping_Averagine = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*mp_length*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_15__getitem__, /*mp_subscript*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*mp_ass_subscript*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyTypeObject __pyx_type_12ms_deisotope_2_c_9averagine_Averagine = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyVarObject_HEAD_INIT(0, 0)

#line 1003 "ms_deisotope/_c/averagine.pyx"
  "ms_deisotope._c.averagine.Averagine", /*tp_name*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  sizeof(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine), /*tp_basicsize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_itemsize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_dealloc_12ms_deisotope_2_c_9averagine_Averagine, /*tp_dealloc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX < 0x030800b4

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_print*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b4

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_vectorcall_offset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_getattr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_setattr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_MAJOR_VERSION < 3

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_compare*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_MAJOR_VERSION >= 3

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_async*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_25__repr__, /*tp_repr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_number*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  &__pyx_tp_as_sequence_Averagine, /*tp_as_sequence*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  &__pyx_tp_as_mapping_Averagine, /*tp_as_mapping*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_29__hash__, /*tp_hash*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_9__call__, /*tp_call*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_str*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_getattro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_setattro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_buffer*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  "Averagine(base_composition)\nAn isotopic model which can be used to interpolate the composition\n    of a class of molecule given an average monomer composition and a theoretical\n    polymer mass\n\n    Implements the :class:`Mapping` interface.\n\n    Attributes\n    ----------\n    base_composition: Mapping\n        A mapping from element symbol to average count (float) of that element\n        for the average monomer\n    base_mass : float\n        The base mass of the average monomer. Calculated from :attr:`base_composition`\n    ", /*tp_doc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_traverse_12ms_deisotope_2_c_9averagine_Averagine, /*tp_traverse*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_clear_12ms_deisotope_2_c_9averagine_Averagine, /*tp_clear*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_27__richcmp__, /*tp_richcompare*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_weaklistoffset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_17__iter__, /*tp_iter*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_iternext*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_methods_12ms_deisotope_2_c_9averagine_Averagine, /*tp_methods*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_members*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_getsets_12ms_deisotope_2_c_9averagine_Averagine, /*tp_getset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_base*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_dict*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_descr_get*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_descr_set*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_dictoffset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_9Averagine_1__init__, /*tp_init*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_alloc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_new_12ms_deisotope_2_c_9averagine_Averagine, /*tp_new*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_free*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_is_gc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_bases*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_mro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_cache*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_subclasses*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_weaklist*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_del*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_version_tag*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030400a1

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_finalize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_vectorcall*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_print*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_pypy_flags*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern;

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *__pyx_freelist_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern[1000000];

#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_freecount_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern = 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_tp_new_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *p;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern)))) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    o = (PyObject*)__pyx_freelist_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern[--__pyx_freecount_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern];

#line 1003 "ms_deisotope/_c/averagine.pyx"
    memset(o, 0, sizeof(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern));

#line 1003 "ms_deisotope/_c/averagine.pyx"
    (void) PyObject_INIT(o, t);

#line 1003 "ms_deisotope/_c/averagine.pyx"
    PyObject_GC_Track(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  } else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    o = (*t->tp_alloc)(t, 0);

#line 1003 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(!o)) return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p->__pyx_vtab = __pyx_vtabptr_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p->peaklist = ((PyObject*)Py_None); Py_INCREF(Py_None);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static void __pyx_tp_dealloc_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern(PyObject *o) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *p = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject_GC_UnTrack(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_CLEAR(p->peaklist);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern < 1000000) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern)))) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    __pyx_freelist_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern[__pyx_freecount_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern++] = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  } else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    (*Py_TYPE(o)->tp_free)(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_tp_traverse_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern(PyObject *o, visitproc v, void *a) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  int e;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *p = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (p->peaklist) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    e = (*v)(p->peaklist, a); if (e) return e;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_tp_clear_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern(PyObject *o) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject* tmp;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *p = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  tmp = ((PyObject*)p->peaklist);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p->peaklist = ((PyObject*)Py_None); Py_INCREF(Py_None);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_XDECREF(tmp);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_sq_item_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern(PyObject *o, Py_ssize_t i) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *r;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_DECREF(x);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return r;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_getprop_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_monoisotopic_mz(PyObject *o, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_15monoisotopic_mz_1__get__(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_getprop_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_peaklist(PyObject *o, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_1__get__(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_setprop_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_peaklist(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (v) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_3__set__(o, v);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8peaklist_5__del__(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_getprop_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_origin(PyObject *o, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6origin_1__get__(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_setprop_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_origin(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (v) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6origin_3__set__(o, v);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    PyErr_SetString(PyExc_NotImplementedError, "__del__");

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return -1;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_getprop_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_offset(PyObject *o, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6offset_1__get__(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_setprop_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_offset(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (v) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_6offset_3__set__(o, v);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    PyErr_SetString(PyExc_NotImplementedError, "__del__");

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return -1;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyMethodDef __pyx_methods_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern[] = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"clone", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_9clone, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_8clone},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"__reduce__", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_11__reduce__, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_10__reduce__},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"ignore_below", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_13ignore_below, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_12ignore_below},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"shift", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_15shift, METH_O, __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_14shift},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"truncate_after", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_17truncate_after, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_16truncate_after},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"scale", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_19scale, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_18scale},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"basepeak_index", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_21basepeak_index, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_20basepeak_index},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"normalize", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_23normalize, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_22normalize},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"scale_raw", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_25scale_raw, METH_O, __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_24scale_raw},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"drop_last_peak", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_27drop_last_peak, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_26drop_last_peak},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"total", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_29total, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_28total},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"_eq", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_33_eq, METH_O, __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_32_eq},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"incremental_truncation", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_37incremental_truncation, METH_O, __pyx_doc_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_36incremental_truncation},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {0, 0, 0, 0}

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static struct PyGetSetDef __pyx_getsets_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern[] = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {(char *)"monoisotopic_mz", __pyx_getprop_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_monoisotopic_mz, 0, (char *)0, 0},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {(char *)"peaklist", __pyx_getprop_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_peaklist, __pyx_setprop_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_peaklist, (char *)"peaklist: list", 0},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {(char *)"origin", __pyx_getprop_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_origin, __pyx_setprop_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_origin, (char *)"origin: 'double'", 0},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {(char *)"offset", __pyx_getprop_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_offset, __pyx_setprop_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_offset, (char *)"offset: 'double'", 0},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {0, 0, 0, 0, 0}

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PySequenceMethods __pyx_tp_as_sequence_TheoreticalIsotopicPattern = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_7__len__, /*sq_length*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_concat*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_repeat*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_sq_item_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern, /*sq_item*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_slice*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_ass_item*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_ass_slice*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_contains*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_inplace_concat*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_inplace_repeat*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyMappingMethods __pyx_tp_as_mapping_TheoreticalIsotopicPattern = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_7__len__, /*mp_length*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_3__getitem__, /*mp_subscript*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*mp_ass_subscript*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyTypeObject __pyx_type_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyVarObject_HEAD_INIT(0, 0)

#line 1003 "ms_deisotope/_c/averagine.pyx"
  "ms_deisotope._c.averagine.TheoreticalIsotopicPattern", /*tp_name*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  sizeof(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern), /*tp_basicsize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_itemsize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_dealloc_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern, /*tp_dealloc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX < 0x030800b4

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_print*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b4

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_vectorcall_offset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_getattr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_setattr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_MAJOR_VERSION < 3

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_compare*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_MAJOR_VERSION >= 3

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_async*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_31__repr__, /*tp_repr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_number*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  &__pyx_tp_as_sequence_TheoreticalIsotopicPattern, /*tp_as_sequence*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  &__pyx_tp_as_mapping_TheoreticalIsotopicPattern, /*tp_as_mapping*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_hash*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_call*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_str*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_getattro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_setattro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_buffer*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  "TheoreticalIsotopicPattern(peaklist, origin, offset=None)\nRepresent a theoretical isotopic peak list\n\n    Attributes\n    ----------\n    peaklist: list of :class:`brainpy.TheoreticalPeak`\n        The theoretical isotopic pattern peak list\n    origin: float\n        The monoisotopic peak's m/z\n    ", /*tp_doc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_traverse_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern, /*tp_traverse*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_clear_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern, /*tp_clear*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_35__richcmp__, /*tp_richcompare*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_weaklistoffset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_5__iter__, /*tp_iter*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_iternext*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_methods_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern, /*tp_methods*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_members*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_getsets_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern, /*tp_getset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_base*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_dict*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_descr_get*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_descr_set*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_dictoffset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_1__init__, /*tp_init*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_alloc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_new_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern, /*tp_new*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_free*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_is_gc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_bases*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_mro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_cache*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_subclasses*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_weaklist*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_del*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_version_tag*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030400a1

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_finalize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_vectorcall*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_print*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_pypy_flags*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_vtabstruct_12ms_deisotope_2_c_9averagine_AveragineCache __pyx_vtable_12ms_deisotope_2_c_9averagine_AveragineCache;

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_tp_new_12ms_deisotope_2_c_9averagine_AveragineCache(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *p;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  o = (*t->tp_alloc)(t, 0);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (unlikely(!o)) return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p->__pyx_vtab = __pyx_vtabptr_12ms_deisotope_2_c_9averagine_AveragineCache;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p->backend = ((PyObject*)Py_None); Py_INCREF(Py_None);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p->averagine = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)Py_None); Py_INCREF(Py_None);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static void __pyx_tp_dealloc_12ms_deisotope_2_c_9averagine_AveragineCache(PyObject *o) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *p = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject_GC_UnTrack(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_CLEAR(p->backend);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_CLEAR(p->averagine);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  (*Py_TYPE(o)->tp_free)(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_tp_traverse_12ms_deisotope_2_c_9averagine_AveragineCache(PyObject *o, visitproc v, void *a) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  int e;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *p = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (p->backend) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    e = (*v)(p->backend, a); if (e) return e;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (p->averagine) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    e = (*v)(((PyObject *)p->averagine), a); if (e) return e;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_tp_clear_12ms_deisotope_2_c_9averagine_AveragineCache(PyObject *o) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject* tmp;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *p = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *)o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  tmp = ((PyObject*)p->backend);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p->backend = ((PyObject*)Py_None); Py_INCREF(Py_None);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_XDECREF(tmp);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  tmp = ((PyObject*)p->averagine);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p->averagine = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *)Py_None); Py_INCREF(Py_None);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_XDECREF(tmp);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_sq_item_12ms_deisotope_2_c_9averagine_AveragineCache(PyObject *o, Py_ssize_t i) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *r;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_DECREF(x);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return r;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_getprop_12ms_deisotope_2_c_9averagine_14AveragineCache_backend(PyObject *o, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_1__get__(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_setprop_12ms_deisotope_2_c_9averagine_14AveragineCache_backend(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (v) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_3__set__(o, v);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7backend_5__del__(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_getprop_12ms_deisotope_2_c_9averagine_14AveragineCache_averagine(PyObject *o, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_1__get__(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_setprop_12ms_deisotope_2_c_9averagine_14AveragineCache_averagine(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (v) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_3__set__(o, v);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_9averagine_5__del__(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_getprop_12ms_deisotope_2_c_9averagine_14AveragineCache_cache_truncation(PyObject *o, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_16cache_truncation_1__get__(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_setprop_12ms_deisotope_2_c_9averagine_14AveragineCache_cache_truncation(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (v) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_16cache_truncation_3__set__(o, v);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    PyErr_SetString(PyExc_NotImplementedError, "__del__");

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return -1;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_getprop_12ms_deisotope_2_c_9averagine_14AveragineCache_enabled(PyObject *o, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7enabled_1__get__(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_setprop_12ms_deisotope_2_c_9averagine_14AveragineCache_enabled(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (v) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7enabled_3__set__(o, v);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    PyErr_SetString(PyExc_NotImplementedError, "__del__");

#line 1003 "ms_deisotope/_c/averagine.pyx"
    return -1;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyMethodDef __pyx_methods_12ms_deisotope_2_c_9averagine_AveragineCache[] = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"__reduce__", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_3__reduce__, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_2__reduce__},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"__getstate__", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_5__getstate__, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_4__getstate__},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"__setstate__", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_7__setstate__, METH_O, __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_6__setstate__},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"make_cache_key", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_9make_cache_key, METH_O, __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_8make_cache_key},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"isotopic_cluster", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_11isotopic_cluster, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_10isotopic_cluster},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"keys", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_19keys, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_18keys},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"values", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_21values, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_20values},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"items", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_23items, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_22items},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"clear", (PyCFunction)__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_27clear, METH_NOARGS, __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_26clear},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"populate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_29populate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12ms_deisotope_2_c_9averagine_14AveragineCache_28populate},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {0, 0, 0, 0}

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static struct PyGetSetDef __pyx_getsets_12ms_deisotope_2_c_9averagine_AveragineCache[] = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {(char *)"backend", __pyx_getprop_12ms_deisotope_2_c_9averagine_14AveragineCache_backend, __pyx_setprop_12ms_deisotope_2_c_9averagine_14AveragineCache_backend, (char *)"backend: dict", 0},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {(char *)"averagine", __pyx_getprop_12ms_deisotope_2_c_9averagine_14AveragineCache_averagine, __pyx_setprop_12ms_deisotope_2_c_9averagine_14AveragineCache_averagine, (char *)"averagine: ms_deisotope._c.averagine.Averagine", 0},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {(char *)"cache_truncation", __pyx_getprop_12ms_deisotope_2_c_9averagine_14AveragineCache_cache_truncation, __pyx_setprop_12ms_deisotope_2_c_9averagine_14AveragineCache_cache_truncation, (char *)"cache_truncation: 'double'", 0},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {(char *)"enabled", __pyx_getprop_12ms_deisotope_2_c_9averagine_14AveragineCache_enabled, __pyx_setprop_12ms_deisotope_2_c_9averagine_14AveragineCache_enabled, (char *)"enabled: 'bool'", 0},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {0, 0, 0, 0, 0}

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PySequenceMethods __pyx_tp_as_sequence_AveragineCache = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_length*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_concat*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_repeat*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_sq_item_12ms_deisotope_2_c_9averagine_AveragineCache, /*sq_item*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_slice*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_ass_item*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_ass_slice*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_contains*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_inplace_concat*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*sq_inplace_repeat*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyMappingMethods __pyx_tp_as_mapping_AveragineCache = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*mp_length*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_15__getitem__, /*mp_subscript*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*mp_ass_subscript*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyTypeObject __pyx_type_12ms_deisotope_2_c_9averagine_AveragineCache = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyVarObject_HEAD_INIT(0, 0)

#line 1003 "ms_deisotope/_c/averagine.pyx"
  "ms_deisotope._c.averagine.AveragineCache", /*tp_name*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  sizeof(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache), /*tp_basicsize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_itemsize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_dealloc_12ms_deisotope_2_c_9averagine_AveragineCache, /*tp_dealloc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX < 0x030800b4

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_print*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b4

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_vectorcall_offset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_getattr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_setattr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_MAJOR_VERSION < 3

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_compare*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_MAJOR_VERSION >= 3

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_async*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_25__repr__, /*tp_repr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_number*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  &__pyx_tp_as_sequence_AveragineCache, /*tp_as_sequence*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  &__pyx_tp_as_mapping_AveragineCache, /*tp_as_mapping*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_hash*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_13__call__, /*tp_call*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_str*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_getattro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_setattro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_buffer*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  "AveragineCache(averagine, backend=None, double cache_truncation=1.)\nA wrapper around a :class:`Averagine` instance which will cache isotopic patterns\n    produced for new (m/z, charge) pairs and reuses it for nearby m/z values\n\n    Attributes\n    ----------\n    averagine : :class:`~Averagine`\n        The averagine to use to generate new isotopic patterns\n    cache_truncation : float\n        Number of decimal places to round off the m/z for caching purposes\n    ", /*tp_doc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_traverse_12ms_deisotope_2_c_9averagine_AveragineCache, /*tp_traverse*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_clear_12ms_deisotope_2_c_9averagine_AveragineCache, /*tp_clear*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_31__richcmp__, /*tp_richcompare*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_weaklistoffset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_17__iter__, /*tp_iter*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_iternext*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_methods_12ms_deisotope_2_c_9averagine_AveragineCache, /*tp_methods*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_members*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_getsets_12ms_deisotope_2_c_9averagine_AveragineCache, /*tp_getset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_base*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_dict*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_descr_get*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_descr_set*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_dictoffset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_pw_12ms_deisotope_2_c_9averagine_14AveragineCache_1__init__, /*tp_init*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_alloc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_new_12ms_deisotope_2_c_9averagine_AveragineCache, /*tp_new*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_free*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_is_gc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_bases*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_mro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_cache*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_subclasses*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_weaklist*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_del*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_version_tag*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030400a1

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_finalize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_vectorcall*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_print*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_pypy_flags*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ *__pyx_freelist_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__[8];

#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_freecount_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ = 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_tp_new_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__)))) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    o = (PyObject*)__pyx_freelist_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__[--__pyx_freecount_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__];

#line 1003 "ms_deisotope/_c/averagine.pyx"
    memset(o, 0, sizeof(struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__));

#line 1003 "ms_deisotope/_c/averagine.pyx"
    (void) PyObject_INIT(o, t);

#line 1003 "ms_deisotope/_c/averagine.pyx"
    PyObject_GC_Track(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  } else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    o = (*t->tp_alloc)(t, 0);

#line 1003 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(!o)) return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static void __pyx_tp_dealloc_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__(PyObject *o) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ *p = (struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ *)o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject_GC_UnTrack(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_CLEAR(p->__pyx_v_self);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__)))) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    __pyx_freelist_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__[__pyx_freecount_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__++] = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ *)o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  } else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    (*Py_TYPE(o)->tp_free)(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_tp_traverse_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__(PyObject *o, visitproc v, void *a) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  int e;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ *p = (struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ *)o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (p->__pyx_v_self) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_tp_clear_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__(PyObject *o) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject* tmp;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ *p = (struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ *)o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  tmp = ((PyObject*)p->__pyx_v_self);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  p->__pyx_v_self = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *)Py_None); Py_INCREF(Py_None);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_XDECREF(tmp);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyTypeObject __pyx_type_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyVarObject_HEAD_INIT(0, 0)

#line 1003 "ms_deisotope/_c/averagine.pyx"
  "ms_deisotope._c.averagine.__pyx_scope_struct____repr__", /*tp_name*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  sizeof(struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__), /*tp_basicsize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_itemsize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_dealloc_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__, /*tp_dealloc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX < 0x030800b4

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_print*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b4

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_vectorcall_offset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_getattr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_setattr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_MAJOR_VERSION < 3

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_compare*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_MAJOR_VERSION >= 3

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_async*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_repr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_number*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_sequence*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_mapping*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_hash*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_call*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_str*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_getattro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_setattro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_buffer*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_doc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_traverse_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__, /*tp_traverse*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_clear_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__, /*tp_clear*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_richcompare*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_weaklistoffset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_iter*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_iternext*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_methods*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_members*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_getset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_base*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_dict*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_descr_get*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_descr_set*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_dictoffset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_init*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_alloc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_new_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__, /*tp_new*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_free*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_is_gc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_bases*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_mro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_cache*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_subclasses*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_weaklist*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_del*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_version_tag*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030400a1

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_finalize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_vectorcall*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_print*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_pypy_flags*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr *__pyx_freelist_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr[8];

#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_freecount_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr = 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject *__pyx_tp_new_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject *o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr)))) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    o = (PyObject*)__pyx_freelist_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr[--__pyx_freecount_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr];

#line 1003 "ms_deisotope/_c/averagine.pyx"
    memset(o, 0, sizeof(struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr));

#line 1003 "ms_deisotope/_c/averagine.pyx"
    (void) PyObject_INIT(o, t);

#line 1003 "ms_deisotope/_c/averagine.pyx"
    PyObject_GC_Track(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  } else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    o = (*t->tp_alloc)(t, 0);

#line 1003 "ms_deisotope/_c/averagine.pyx"
    if (unlikely(!o)) return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static void __pyx_tp_dealloc_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr(PyObject *o) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr *)o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyObject_GC_UnTrack(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_CLEAR(p->__pyx_outer_scope);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_CLEAR(p->__pyx_v_p);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_CLEAR(p->__pyx_t_0);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr)))) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    __pyx_freelist_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr[__pyx_freecount_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr *)o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  } else {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    (*Py_TYPE(o)->tp_free)(o);

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_tp_traverse_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  int e;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr *)o;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (p->__pyx_outer_scope) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (p->__pyx_v_p) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    e = (*v)(p->__pyx_v_p, a); if (e) return e;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  if (p->__pyx_t_0) {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    e = (*v)(p->__pyx_t_0, a); if (e) return e;

#line 1003 "ms_deisotope/_c/averagine.pyx"
  }

#line 1003 "ms_deisotope/_c/averagine.pyx"
  return 0;

#line 1003 "ms_deisotope/_c/averagine.pyx"
}

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyTypeObject __pyx_type_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  PyVarObject_HEAD_INIT(0, 0)

#line 1003 "ms_deisotope/_c/averagine.pyx"
  "ms_deisotope._c.averagine.__pyx_scope_struct_1_genexpr", /*tp_name*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  sizeof(struct __pyx_obj_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr), /*tp_basicsize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_itemsize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_dealloc_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr, /*tp_dealloc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX < 0x030800b4

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_print*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b4

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_vectorcall_offset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_getattr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_setattr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_MAJOR_VERSION < 3

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_compare*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_MAJOR_VERSION >= 3

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_async*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_repr*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_number*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_sequence*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_mapping*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_hash*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_call*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_str*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_getattro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_setattro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_as_buffer*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_doc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_traverse_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr, /*tp_traverse*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_clear*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_richcompare*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_weaklistoffset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_iter*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_iternext*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_methods*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_members*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_getset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_base*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_dict*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_descr_get*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_descr_set*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_dictoffset*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_init*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_alloc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  __pyx_tp_new_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr, /*tp_new*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_free*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_is_gc*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_bases*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_mro*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_cache*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_subclasses*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_weaklist*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_del*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_version_tag*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030400a1

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_finalize*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_vectorcall*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_print*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000

#line 1003 "ms_deisotope/_c/averagine.pyx"
  0, /*tp_pypy_flags*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyMethodDef __pyx_methods[] = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"isotopic_shift", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12ms_deisotope_2_c_9averagine_1isotopic_shift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12ms_deisotope_2_c_9averagine_isotopic_shift},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {"poisson_approximate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_12ms_deisotope_2_c_9averagine_3poisson_approximate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12ms_deisotope_2_c_9averagine_2poisson_approximate},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {0, 0, 0, 0}

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
#if PY_MAJOR_VERSION >= 3

#line 1003 "ms_deisotope/_c/averagine.pyx"
#if CYTHON_PEP489_MULTI_PHASE_INIT

#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
static int __pyx_pymod_exec_averagine(PyObject* module); /*proto*/

#line 1003 "ms_deisotope/_c/averagine.pyx"
static PyModuleDef_Slot __pyx_moduledef_slots[] = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {Py_mod_create, (void*)__pyx_pymod_create},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {Py_mod_exec, (void*)__pyx_pymod_exec_averagine},

#line 1003 "ms_deisotope/_c/averagine.pyx"
  {0, NULL}

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"
#endif

#line 1003 "ms_deisotope/_c/averagine.pyx"


#line 1003 "ms_deisotope/_c/averagine.pyx"
static struct PyModuleDef __pyx_moduledef = {

#line 1003 "ms_deisotope/_c/averagine.pyx"
    PyModuleDef_HEAD_INIT,

#line 1003 "ms_deisotope/_c/averagine.pyx"
    "averagine",

#line 1003 "ms_deisotope/_c/averagine.pyx"
    0, /* m_doc */

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if CYTHON_PEP489_MULTI_PHASE_INIT

#line 1003 "ms_deisotope/_c/averagine.pyx"
    0, /* m_size */

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #else

#line 1003 "ms_deisotope/_c/averagine.pyx"
    -1, /* m_size */

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
    __pyx_methods /* m_methods */,

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #if CYTHON_PEP489_MULTI_PHASE_INIT

#line 1003 "ms_deisotope/_c/averagine.pyx"
    __pyx_moduledef_slots, /* m_slots */

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #else

#line 1003 "ms_deisotope/_c/averagine.pyx"
    NULL, /* m_reload */

#line 1003 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
    NULL, /* m_traverse */

#line 1003 "ms_deisotope/_c/averagine.pyx"
    NULL, /* m_clear */

#line 1003 "ms_deisotope/_c/averagine.pyx"
    NULL /* m_free */

#line 1003 "ms_deisotope/_c/averagine.pyx"
};

#line 1003 "ms_deisotope/_c/averagine.pyx"
#endif

#line 1003 "ms_deisotope/_c/averagine.pyx"
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_0_3f, __pyx_k_0_3f, sizeof(__pyx_k_0_3f), 0, 0, 1, 0},
  {&__pyx_n_s_Averagine, __pyx_k_Averagine, sizeof(__pyx_k_Averagine), 0, 0, 1, 1},
  {&__pyx_n_s_AveragineCache, __pyx_k_AveragineCache, sizeof(__pyx_k_AveragineCache), 0, 0, 1, 1},
  {&__pyx_kp_s_AveragineCache_r, __pyx_k_AveragineCache_r, sizeof(__pyx_k_AveragineCache_r), 0, 0, 1, 0},
  {&__pyx_kp_s_Averagine_r, __pyx_k_Averagine_r, sizeof(__pyx_k_Averagine_r), 0, 0, 1, 0},
  {&__pyx_kp_s_C_12, __pyx_k_C_12, sizeof(__pyx_k_C_12), 0, 0, 1, 0},
  {&__pyx_kp_s_C_13, __pyx_k_C_13, sizeof(__pyx_k_C_13), 0, 0, 1, 0},
  {&__pyx_n_s_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 0, 1, 1},
  {&__pyx_n_s_IGNORE_BELOW, __pyx_k_IGNORE_BELOW, sizeof(__pyx_k_IGNORE_BELOW), 0, 0, 1, 1},
  {&__pyx_kp_s_Isotopic_Pattern_has_length_0_f, __pyx_k_Isotopic_Pattern_has_length_0_f, sizeof(__pyx_k_Isotopic_Pattern_has_length_0_f), 0, 0, 1, 0},
  {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1},
  {&__pyx_n_s_PROTON, __pyx_k_PROTON, sizeof(__pyx_k_PROTON), 0, 0, 1, 1},
  {&__pyx_n_s_PROTON_2, __pyx_k_PROTON_2, sizeof(__pyx_k_PROTON_2), 0, 0, 1, 1},
  {&__pyx_n_s_TRUNCATE_AFTER, __pyx_k_TRUNCATE_AFTER, sizeof(__pyx_k_TRUNCATE_AFTER), 0, 0, 1, 1},
  {&__pyx_kp_s_The_polarity_of_min_charge_must, __pyx_k_The_polarity_of_min_charge_must, sizeof(__pyx_k_The_polarity_of_min_charge_must), 0, 0, 1, 0},
  {&__pyx_n_s_TheoreticalIsotopicPattern, __pyx_k_TheoreticalIsotopicPattern, sizeof(__pyx_k_TheoreticalIsotopicPattern), 0, 0, 1, 1},
  {&__pyx_kp_s_TheoreticalIsotopicPattern_0_4f, __pyx_k_TheoreticalIsotopicPattern_0_4f, sizeof(__pyx_k_TheoreticalIsotopicPattern_0_4f), 0, 0, 1, 0},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_kp_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 0},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_averagine, __pyx_k_averagine, sizeof(__pyx_k_averagine), 0, 0, 1, 1},
  {&__pyx_n_s_backend, __pyx_k_backend, sizeof(__pyx_k_backend), 0, 0, 1, 1},
  {&__pyx_n_s_base_composition, __pyx_k_base_composition, sizeof(__pyx_k_base_composition), 0, 0, 1, 1},
  {&__pyx_n_s_basepeak, __pyx_k_basepeak, sizeof(__pyx_k_basepeak), 0, 0, 1, 1},
  {&__pyx_n_s_brainpy, __pyx_k_brainpy, sizeof(__pyx_k_brainpy), 0, 0, 1, 1},
  {&__pyx_n_s_cache_truncation, __pyx_k_cache_truncation, sizeof(__pyx_k_cache_truncation), 0, 0, 1, 1},
  {&__pyx_n_s_calculate_mass, __pyx_k_calculate_mass, sizeof(__pyx_k_calculate_mass), 0, 0, 1, 1},
  {&__pyx_n_s_charge, __pyx_k_charge, sizeof(__pyx_k_charge), 0, 0, 1, 1},
  {&__pyx_n_s_charge_carrier, __pyx_k_charge_carrier, sizeof(__pyx_k_charge_carrier), 0, 0, 1, 1},
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_n_s_experimental_distribution, __pyx_k_experimental_distribution, sizeof(__pyx_k_experimental_distribution), 0, 0, 1, 1},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_ignore_below, __pyx_k_ignore_below, sizeof(__pyx_k_ignore_below), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_intensity, __pyx_k_intensity, sizeof(__pyx_k_intensity), 0, 0, 1, 1},
  {&__pyx_n_s_isotopic_cluster, __pyx_k_isotopic_cluster, sizeof(__pyx_k_isotopic_cluster), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
  {&__pyx_n_s_lambda_factor, __pyx_k_lambda_factor, sizeof(__pyx_k_lambda_factor), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_mass, __pyx_k_mass, sizeof(__pyx_k_mass), 0, 0, 1, 1},
  {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
  {&__pyx_n_s_max_charge, __pyx_k_max_charge, sizeof(__pyx_k_max_charge), 0, 0, 1, 1},
  {&__pyx_n_s_max_mz, __pyx_k_max_mz, sizeof(__pyx_k_max_mz), 0, 0, 1, 1},
  {&__pyx_n_s_meanscale, __pyx_k_meanscale, sizeof(__pyx_k_meanscale), 0, 0, 1, 1},
  {&__pyx_n_s_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 0, 1, 1},
  {&__pyx_n_s_min_charge, __pyx_k_min_charge, sizeof(__pyx_k_min_charge), 0, 0, 1, 1},
  {&__pyx_n_s_min_mz, __pyx_k_min_mz, sizeof(__pyx_k_min_mz), 0, 0, 1, 1},
  {&__pyx_n_s_monoisotopic_mz, __pyx_k_monoisotopic_mz, sizeof(__pyx_k_monoisotopic_mz), 0, 0, 1, 1},
  {&__pyx_n_s_ms_deisotope__c_averagine, __pyx_k_ms_deisotope__c_averagine, sizeof(__pyx_k_ms_deisotope__c_averagine), 0, 0, 1, 1},
  {&__pyx_n_s_ms_deisotope_constants, __pyx_k_ms_deisotope_constants, sizeof(__pyx_k_ms_deisotope_constants), 0, 0, 1, 1},
  {&__pyx_n_s_mz, __pyx_k_mz, sizeof(__pyx_k_mz), 0, 0, 1, 1},
  {&__pyx_n_s_n_peaks, __pyx_k_n_peaks, sizeof(__pyx_k_n_peaks), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1},
  {&__pyx_n_s_origin, __pyx_k_origin, sizeof(__pyx_k_origin), 0, 0, 1, 1},
  {&__pyx_n_s_peaklist, __pyx_k_peaklist, sizeof(__pyx_k_peaklist), 0, 0, 1, 1},
  {&__pyx_n_s_py_calculate_mass, __pyx_k_py_calculate_mass, sizeof(__pyx_k_py_calculate_mass), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_capi, __pyx_k_pyx_capi, sizeof(__pyx_k_pyx_capi), 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_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_repr___locals_genexpr, __pyx_k_repr___locals_genexpr, sizeof(__pyx_k_repr___locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_scale, __pyx_k_scale, sizeof(__pyx_k_scale), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_store, __pyx_k_store, sizeof(__pyx_k_store), 0, 0, 1, 1},
  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_top3, __pyx_k_top3, sizeof(__pyx_k_top3), 0, 0, 1, 1},
  {&__pyx_n_s_truncate_after, __pyx_k_truncate_after, sizeof(__pyx_k_truncate_after), 0, 0, 1, 1},
  {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 49, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 594, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 767, __pyx_L1_error)
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(0, 801, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyDict_Type_keys.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3005 = PyInt_FromLong(3005); if (unlikely(!__pyx_int_3005)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  if (__Pyx_ExportVoidPtr(__pyx_n_s_PROTON, (void *)&__pyx_v_12ms_deisotope_2_c_9averagine_PROTON, "double") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("mass_charge_ratio", (void (*)(void))__pyx_f_12ms_deisotope_2_c_9averagine_mass_charge_ratio, "double (double, int, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_mass_charge_ratio *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("neutral_mass", (void (*)(void))__pyx_f_12ms_deisotope_2_c_9averagine_neutral_mass, "double (double, int, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_neutral_mass *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("slide", (void (*)(void))__pyx_f_12ms_deisotope_2_c_9averagine_slide, "void (double, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("scale_dict", (void (*)(void))__pyx_f_12ms_deisotope_2_c_9averagine_scale_dict, "PyObject *(PyObject *, double)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("isotopic_shift", (void (*)(void))__pyx_f_12ms_deisotope_2_c_9averagine_isotopic_shift, "double (int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_isotopic_shift *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("poisson_approximate", (void (*)(void))__pyx_f_12ms_deisotope_2_c_9averagine_poisson_approximate, "struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(double, size_t, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_poisson_approximate *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __pyx_vtabptr_12ms_deisotope_2_c_9averagine_Averagine = &__pyx_vtable_12ms_deisotope_2_c_9averagine_Averagine;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_Averagine.scale = (PyObject *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *, double, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_scale *__pyx_optional_args))__pyx_f_12ms_deisotope_2_c_9averagine_9Averagine_scale;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_Averagine.isotopic_cluster = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *, double, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine_isotopic_cluster *__pyx_optional_args))__pyx_f_12ms_deisotope_2_c_9averagine_9Averagine_isotopic_cluster;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_Averagine._isotopic_cluster = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_Averagine *, double, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_9Averagine__isotopic_cluster *__pyx_optional_args))__pyx_f_12ms_deisotope_2_c_9averagine_9Averagine__isotopic_cluster;
  if (PyType_Ready(&__pyx_type_12ms_deisotope_2_c_9averagine_Averagine) < 0) __PYX_ERR(0, 104, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12ms_deisotope_2_c_9averagine_Averagine.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12ms_deisotope_2_c_9averagine_Averagine.tp_dictoffset && __pyx_type_12ms_deisotope_2_c_9averagine_Averagine.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12ms_deisotope_2_c_9averagine_Averagine.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (__Pyx_SetVtable(__pyx_type_12ms_deisotope_2_c_9averagine_Averagine.tp_dict, __pyx_vtabptr_12ms_deisotope_2_c_9averagine_Averagine) < 0) __PYX_ERR(0, 104, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Averagine, (PyObject *)&__pyx_type_12ms_deisotope_2_c_9averagine_Averagine) < 0) __PYX_ERR(0, 104, __pyx_L1_error)
  __pyx_ptype_12ms_deisotope_2_c_9averagine_Averagine = &__pyx_type_12ms_deisotope_2_c_9averagine_Averagine;
  __pyx_vtabptr_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern = &__pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern._create = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(PyObject *, double, double))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__create;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.clone = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern._eq = (int (*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, PyObject *, int __pyx_skip_dispatch))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__eq;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern._eq_inst = (int (*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__eq_inst;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.ignore_below = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_ignore_below *__pyx_optional_args))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_ignore_below;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.truncate_after = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_truncate_after *__pyx_optional_args))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_truncate_after;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.shift = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, double, int __pyx_skip_dispatch))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_shift;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.scale = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale *__pyx_optional_args))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.scale_raw = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, double, int __pyx_skip_dispatch))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_scale_raw;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.drop_last_peak = (double (*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_drop_last_peak;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.total = (double (*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_total;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.normalize = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_normalize;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern._scale = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, PyObject *, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__scale *__pyx_optional_args))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern__scale;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.clone_shift = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, double))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone_shift;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.get = (struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, Py_ssize_t))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.get_size = (size_t (*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_size;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.get_monoisotopic_mz = (double (*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_monoisotopic_mz;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.get_processed_peaks = (PyObject *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_get_processed_peaks;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.basepeak_index = (size_t (*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, int __pyx_skip_dispatch))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_basepeak_index;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.incremental_truncation = (PyObject *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *, double, int __pyx_skip_dispatch))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_incremental_truncation;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.clone_drop_last = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *))__pyx_f_12ms_deisotope_2_c_9averagine_26TheoreticalIsotopicPattern_clone_drop_last;
  if (PyType_Ready(&__pyx_type_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.tp_dictoffset && __pyx_type_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  if (__Pyx_SetVtable(__pyx_type_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern.tp_dict, __pyx_vtabptr_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_TheoreticalIsotopicPattern, (PyObject *)&__pyx_type_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
  __pyx_ptype_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern = &__pyx_type_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern;
  __pyx_vtabptr_12ms_deisotope_2_c_9averagine_AveragineCache = &__pyx_vtable_12ms_deisotope_2_c_9averagine_AveragineCache;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_AveragineCache._make_cache_key = (double (*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *, double))__pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache__make_cache_key;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_AveragineCache.has_mz_charge_pair = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *, double, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_has_mz_charge_pair *__pyx_optional_args))__pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache_has_mz_charge_pair;
  __pyx_vtable_12ms_deisotope_2_c_9averagine_AveragineCache.isotopic_cluster = (struct __pyx_obj_12ms_deisotope_2_c_9averagine_TheoreticalIsotopicPattern *(*)(struct __pyx_obj_12ms_deisotope_2_c_9averagine_AveragineCache *, double, int __pyx_skip_dispatch, struct __pyx_opt_args_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster *__pyx_optional_args))__pyx_f_12ms_deisotope_2_c_9averagine_14AveragineCache_isotopic_cluster;
  if (PyType_Ready(&__pyx_type_12ms_deisotope_2_c_9averagine_AveragineCache) < 0) __PYX_ERR(0, 838, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12ms_deisotope_2_c_9averagine_AveragineCache.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12ms_deisotope_2_c_9averagine_AveragineCache.tp_dictoffset && __pyx_type_12ms_deisotope_2_c_9averagine_AveragineCache.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12ms_deisotope_2_c_9averagine_AveragineCache.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  if (__Pyx_SetVtable(__pyx_type_12ms_deisotope_2_c_9averagine_AveragineCache.tp_dict, __pyx_vtabptr_12ms_deisotope_2_c_9averagine_AveragineCache) < 0) __PYX_ERR(0, 838, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_AveragineCache, (PyObject *)&__pyx_type_12ms_deisotope_2_c_9averagine_AveragineCache) < 0) __PYX_ERR(0, 838, __pyx_L1_error)
  __pyx_ptype_12ms_deisotope_2_c_9averagine_AveragineCache = &__pyx_type_12ms_deisotope_2_c_9averagine_AveragineCache;
  if (PyType_Ready(&__pyx_type_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__) < 0) __PYX_ERR(0, 752, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__.tp_dictoffset && __pyx_type_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__ = &__pyx_type_12ms_deisotope_2_c_9averagine___pyx_scope_struct____repr__;
  if (PyType_Ready(&__pyx_type_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 756, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr.tp_dictoffset && __pyx_type_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr = &__pyx_type_12ms_deisotope_2_c_9averagine___pyx_scope_struct_1_genexpr;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule("brainpy._c.composition"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7brainpy_2_c_11composition_PyComposition = __Pyx_ImportType(__pyx_t_1, "brainpy._c.composition", "PyComposition", sizeof(struct __pyx_obj_7brainpy_2_c_11composition_PyComposition), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7brainpy_2_c_11composition_PyComposition) __PYX_ERR(2, 123, __pyx_L1_error)
  __pyx_vtabptr_7brainpy_2_c_11composition_PyComposition = (struct __pyx_vtabstruct_7brainpy_2_c_11composition_PyComposition*)__Pyx_GetVtable(__pyx_ptype_7brainpy_2_c_11composition_PyComposition->tp_dict); if (unlikely(!__pyx_vtabptr_7brainpy_2_c_11composition_PyComposition)) __PYX_ERR(2, 123, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("brainpy._c.isotopic_distribution"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak = __Pyx_ImportType(__pyx_t_1, "brainpy._c.isotopic_distribution", "TheoreticalPeak", sizeof(struct __pyx_obj_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak) __PYX_ERR(3, 63, __pyx_L1_error)
  __pyx_vtabptr_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak = (struct __pyx_vtabstruct_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak*)__Pyx_GetVtable(__pyx_ptype_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak->tp_dict); if (unlikely(!__pyx_vtabptr_7brainpy_2_c_21isotopic_distribution_TheoreticalPeak)) __PYX_ERR(3, 63, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", 
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(4, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(5, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(6, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("brainpy._speedup"); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7brainpy_8_speedup_Element = __Pyx_ImportType(__pyx_t_1, "brainpy._speedup", "Element", sizeof(struct __pyx_obj_7brainpy_8_speedup_Element), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7brainpy_8_speedup_Element) __PYX_ERR(7, 13, __pyx_L1_error)
  __pyx_vtabptr_7brainpy_8_speedup_Element = (struct __pyx_vtabstruct_7brainpy_8_speedup_Element*)__Pyx_GetVtable(__pyx_ptype_7brainpy_8_speedup_Element->tp_dict); if (unlikely(!__pyx_vtabptr_7brainpy_8_speedup_Element)) __PYX_ERR(7, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("ms_peak_picker._c.peak_set"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_14ms_peak_picker_2_c_8peak_set_PeakBase = __Pyx_ImportType(__pyx_t_1, "ms_peak_picker._c.peak_set", "PeakBase", sizeof(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakBase), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_14ms_peak_picker_2_c_8peak_set_PeakBase) __PYX_ERR(8, 2, __pyx_L1_error)
  __pyx_vtabptr_14ms_peak_picker_2_c_8peak_set_PeakBase = (struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_PeakBase*)__Pyx_GetVtable(__pyx_ptype_14ms_peak_picker_2_c_8peak_set_PeakBase->tp_dict); if (unlikely(!__pyx_vtabptr_14ms_peak_picker_2_c_8peak_set_PeakBase)) __PYX_ERR(8, 2, __pyx_L1_error)
  __pyx_ptype_14ms_peak_picker_2_c_8peak_set_FittedPeak = __Pyx_ImportType(__pyx_t_1, "ms_peak_picker._c.peak_set", "FittedPeak", sizeof(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_FittedPeak), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_14ms_peak_picker_2_c_8peak_set_FittedPeak) __PYX_ERR(8, 12, __pyx_L1_error)
  __pyx_vtabptr_14ms_peak_picker_2_c_8peak_set_FittedPeak = (struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_FittedPeak*)__Pyx_GetVtable(__pyx_ptype_14ms_peak_picker_2_c_8peak_set_FittedPeak->tp_dict); if (unlikely(!__pyx_vtabptr_14ms_peak_picker_2_c_8peak_set_FittedPeak)) __PYX_ERR(8, 12, __pyx_L1_error)
  __pyx_ptype_14ms_peak_picker_2_c_8peak_set_PeakSet = __Pyx_ImportType(__pyx_t_1, "ms_peak_picker._c.peak_set", "PeakSet", sizeof(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSet), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_14ms_peak_picker_2_c_8peak_set_PeakSet) __PYX_ERR(8, 29, __pyx_L1_error)
  __pyx_vtabptr_14ms_peak_picker_2_c_8peak_set_PeakSet = (struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_PeakSet*)__Pyx_GetVtable(__pyx_ptype_14ms_peak_picker_2_c_8peak_set_PeakSet->tp_dict); if (unlikely(!__pyx_vtabptr_14ms_peak_picker_2_c_8peak_set_PeakSet)) __PYX_ERR(8, 29, __pyx_L1_error)
  __pyx_ptype_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed = __Pyx_ImportType(__pyx_t_1, "ms_peak_picker._c.peak_set", "PeakSetIndexed", sizeof(struct __pyx_obj_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed) __PYX_ERR(8, 83, __pyx_L1_error)
  __pyx_vtabptr_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed = (struct __pyx_vtabstruct_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed*)__Pyx_GetVtable(__pyx_ptype_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed->tp_dict); if (unlikely(!__pyx_vtabptr_14ms_peak_picker_2_c_8peak_set_PeakSetIndexed)) __PYX_ERR(8, 83, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __pyx_t_1 = PyImport_ImportModule("brainpy._c.composition"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "nist_mass", (void **)&__pyx_vp_7brainpy_2_c_11composition_nist_mass, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "PROTON", (void **)&__pyx_vp_7brainpy_2_c_11composition_PROTON, "double") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "_ElementTable", (void **)&__pyx_vp_7brainpy_2_c_11composition__ElementTable, "struct __pyx_t_7brainpy_2_c_11composition_ElementHashTable *") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("brainpy._c.isotopic_constants"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "DEFAULT_ISOTOPIC_CONSTANTS_SIZE", (void **)&__pyx_vp_7brainpy_2_c_18isotopic_constants_DEFAULT_ISOTOPIC_CONSTANTS_SIZE, "size_t") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("brainpy._speedup"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "nist_mass", (void **)&__pyx_vp_7brainpy_8_speedup_nist_mass, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "PROTON", (void **)&__pyx_vp_7brainpy_8_speedup_PROTON, "double") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "periodic_table", (void **)&__pyx_vp_7brainpy_8_speedup_periodic_table, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("ms_peak_picker._c.peak_set"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "INTERVAL_INDEX_SIZE", (void **)&__pyx_vp_14ms_peak_picker_2_c_8peak_set_INTERVAL_INDEX_SIZE, "size_t") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __pyx_t_1 = PyImport_ImportModule("brainpy._c.isotopic_distribution"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_ImportFunction(__pyx_t_1, "_isotopic_variants", (void (**)(void))&__pyx_f_7brainpy_2_c_21isotopic_distribution__isotopic_variants, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7brainpy_2_c_21isotopic_distribution__isotopic_variants *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("brainpy._speedup"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_ImportFunction(__pyx_t_1, "calculate_mass", (void (**)(void))&__pyx_f_7brainpy_8_speedup_calculate_mass, "double (PyObject *, struct __pyx_opt_args_7brainpy_8_speedup_calculate_mass *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initaveragine(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initaveragine(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_averagine(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_averagine(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_averagine(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  double __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'averagine' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_averagine(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  PyEval_InitThreads();
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("averagine", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_ms_deisotope___c__averagine) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "ms_deisotope._c.averagine")) {
      if (unlikely(PyDict_SetItemString(modules, "ms_deisotope._c.averagine", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  if (unlikely(__Pyx_modinit_variable_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_variable_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "ms_deisotope/_c/averagine.pyx":15
 * from libc.stdlib cimport malloc, free
 * 
 * from brainpy import PROTON as _PROTON, calculate_mass as _py_calculate_mass             # <<<<<<<<<<<<<<
 * from brainpy._c.isotopic_distribution cimport _isotopic_variants
 * from brainpy._c.isotopic_distribution cimport TheoreticalPeak
 */

#line 15 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)

#line 15 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 15 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_n_s_PROTON);

#line 15 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_n_s_PROTON);

#line 15 "ms_deisotope/_c/averagine.pyx"
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PROTON);

#line 15 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_n_s_calculate_mass);

#line 15 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_n_s_calculate_mass);

#line 15 "ms_deisotope/_c/averagine.pyx"
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_calculate_mass);

#line 15 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_brainpy, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)

#line 15 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 15 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 15 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PROTON); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)

#line 15 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 15 "ms_deisotope/_c/averagine.pyx"
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PROTON_2, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)

#line 15 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 15 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_calculate_mass); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)

#line 15 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 15 "ms_deisotope/_c/averagine.pyx"
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_py_calculate_mass, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)

#line 15 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 15 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "ms_deisotope/_c/averagine.pyx":23
 * 
 * 
 * from ms_deisotope.constants import (TRUNCATE_AFTER, IGNORE_BELOW)             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 23 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)

#line 23 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 23 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_n_s_TRUNCATE_AFTER);

#line 23 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_n_s_TRUNCATE_AFTER);

#line 23 "ms_deisotope/_c/averagine.pyx"
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_TRUNCATE_AFTER);

#line 23 "ms_deisotope/_c/averagine.pyx"
  __Pyx_INCREF(__pyx_n_s_IGNORE_BELOW);

#line 23 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_n_s_IGNORE_BELOW);

#line 23 "ms_deisotope/_c/averagine.pyx"
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_IGNORE_BELOW);

#line 23 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_ms_deisotope_constants, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)

#line 23 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 23 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 23 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_TRUNCATE_AFTER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)

#line 23 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 23 "ms_deisotope/_c/averagine.pyx"
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TRUNCATE_AFTER, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)

#line 23 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 23 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_IGNORE_BELOW); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)

#line 23 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 23 "ms_deisotope/_c/averagine.pyx"
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_IGNORE_BELOW, __pyx_t_2) < 0) __PYX_ERR(0, 23, __pyx_L1_error)

#line 23 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 23 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":56
 * 
 * cdef double PROTON
 * PROTON = _PROTON             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 56 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PROTON_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)

#line 56 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 56 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 56, __pyx_L1_error)

#line 56 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 56 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_12ms_deisotope_2_c_9averagine_PROTON = __pyx_t_3;

  /* "ms_deisotope/_c/averagine.pyx":63
 * 
 * 
 * cdef double neutral_mass(double mz,  int z, double charge_carrier=PROTON):             # <<<<<<<<<<<<<<
 *     return (mz * abs(z)) - (z * charge_carrier)
 * 
 */

#line 63 "ms_deisotope/_c/averagine.pyx"
  __pyx_k_ = __pyx_v_12ms_deisotope_2_c_9averagine_PROTON;

  /* "ms_deisotope/_c/averagine.pyx":68
 * 
 * @cython.cdivision
 * cdef double mass_charge_ratio(double neutral_mass, int z, double charge_carrier=PROTON):             # <<<<<<<<<<<<<<
 *     return (neutral_mass + (z * charge_carrier)) / abs(z)
 * 
 */

#line 68 "ms_deisotope/_c/averagine.pyx"
  __pyx_k__2 = __pyx_v_12ms_deisotope_2_c_9averagine_PROTON;

  /* "ms_deisotope/_c/averagine.pyx":136
 *         self.base_mass = float(mass)
 * 
 *     def __call__(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95,             # <<<<<<<<<<<<<<
 *                  double ignore_below=0.0):
 *         out = self.isotopic_cluster(mz, charge, charge_carrier, truncate_after, ignore_below)
 */

#line 136 "ms_deisotope/_c/averagine.pyx"
  __pyx_k__3 = __pyx_v_12ms_deisotope_2_c_9averagine_PROTON;

  /* "ms_deisotope/_c/averagine.pyx":142
 * 
 *     @cython.cdivision
 *     cpdef dict scale(self, double mz, int charge=1, double charge_carrier=PROTON):             # <<<<<<<<<<<<<<
 *         """Given an m/z and a charge state, interpolate the composition
 *         of the polymer with the matching neutral mass
 */

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_k__4 = __pyx_v_12ms_deisotope_2_c_9averagine_PROTON;

#line 142 "ms_deisotope/_c/averagine.pyx"
  __pyx_k__4 = __pyx_v_12ms_deisotope_2_c_9averagine_PROTON;

  /* "ms_deisotope/_c/averagine.pyx":191
 *         return scaled
 * 
 *     cdef TheoreticalIsotopicPattern _isotopic_cluster(self, double mz, int charge=1, double charge_carrier=PROTON,             # <<<<<<<<<<<<<<
 *                                                       double truncate_after=0.95, double ignore_below=0.0):
 *         cdef:
 */

#line 191 "ms_deisotope/_c/averagine.pyx"
  __pyx_k__5 = __pyx_v_12ms_deisotope_2_c_9averagine_PROTON;

  /* "ms_deisotope/_c/averagine.pyx":213
 *         return isotopic_pattern
 * 
 *     cpdef TheoreticalIsotopicPattern isotopic_cluster(self, double mz, int charge=1, double charge_carrier=PROTON,             # <<<<<<<<<<<<<<
 *                                                       double truncate_after=0.95, double ignore_below=0.0):
 *         """Generate a theoretical isotopic pattern for the given m/z and charge state, thresholded
 */

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_k__6 = __pyx_v_12ms_deisotope_2_c_9averagine_PROTON;

#line 213 "ms_deisotope/_c/averagine.pyx"
  __pyx_k__6 = __pyx_v_12ms_deisotope_2_c_9averagine_PROTON;

  /* "ms_deisotope/_c/averagine.pyx":888
 * 
 *     @cython.cdivision
 *     cdef TheoreticalIsotopicPattern has_mz_charge_pair(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95,             # <<<<<<<<<<<<<<
 *                                  double ignore_below=0.0):
 *         cdef:
 */

#line 888 "ms_deisotope/_c/averagine.pyx"
  __pyx_k__8 = __pyx_v_12ms_deisotope_2_c_9averagine_PROTON;

  /* "ms_deisotope/_c/averagine.pyx":918
 * 
 *     cpdef TheoreticalIsotopicPattern isotopic_cluster(
 *                                 self, double mz, int charge=1, double charge_carrier=PROTON,             # <<<<<<<<<<<<<<
 *                                 double truncate_after=0.95, double ignore_below=0.0):
 *         """Generate a theoretical isotopic pattern for the given m/z and charge state, thresholded
 */

#line 918 "ms_deisotope/_c/averagine.pyx"
  __pyx_k__9 = __pyx_v_12ms_deisotope_2_c_9averagine_PROTON;

  /* "ms_deisotope/_c/averagine.pyx":917
 *             return tid
 * 
 *     cpdef TheoreticalIsotopicPattern isotopic_cluster(             # <<<<<<<<<<<<<<
 *                                 self, double mz, int charge=1, double charge_carrier=PROTON,
 *                                 double truncate_after=0.95, double ignore_below=0.0):
 */

#line 917 "ms_deisotope/_c/averagine.pyx"
  __pyx_k__9 = __pyx_v_12ms_deisotope_2_c_9averagine_PROTON;

  /* "ms_deisotope/_c/averagine.pyx":948
 *         return self.has_mz_charge_pair(mz, charge, charge_carrier, truncate_after, ignore_below)
 * 
 *     def __call__(self, double mz, int charge=1, double charge_carrier=PROTON, double truncate_after=0.95,             # <<<<<<<<<<<<<<
 *                  double ignore_below=0.0):
 *         out = self.isotopic_cluster(mz, charge, charge_carrier, truncate_after, ignore_below)
 */

#line 948 "ms_deisotope/_c/averagine.pyx"
  __pyx_k__10 = __pyx_v_12ms_deisotope_2_c_9averagine_PROTON;

  /* "ms_deisotope/_c/averagine.pyx":974
 *         self.backend.clear()
 * 
 *     def populate(self, min_mz=10, max_mz=3005, min_charge=1, max_charge=8, charge_carrier=PROTON,             # <<<<<<<<<<<<<<
 *                  truncate_after=TRUNCATE_AFTER, ignore_below=IGNORE_BELOW):
 *         sign = min_charge / abs(min_charge)
 */

#line 974 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_12ms_deisotope_2_c_9averagine_PROTON); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 974, __pyx_L1_error)

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __pyx_k__11 = __pyx_t_1;

#line 974 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_1);

#line 974 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":975
 * 
 *     def populate(self, min_mz=10, max_mz=3005, min_charge=1, max_charge=8, charge_carrier=PROTON,
 *                  truncate_after=TRUNCATE_AFTER, ignore_below=IGNORE_BELOW):             # <<<<<<<<<<<<<<
 *         sign = min_charge / abs(min_charge)
 *         assert sign == (max_charge / abs(max_charge)), "The polarity of min_charge must match the polarity of max_charge"
 */

#line 975 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_TRUNCATE_AFTER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 975, __pyx_L1_error)

#line 975 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 975 "ms_deisotope/_c/averagine.pyx"
  __pyx_k__12 = __pyx_t_1;

#line 975 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_1);

#line 975 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

#line 975 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IGNORE_BELOW); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 975, __pyx_L1_error)

#line 975 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 975 "ms_deisotope/_c/averagine.pyx"
  __pyx_k__13 = __pyx_t_1;

#line 975 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GIVEREF(__pyx_t_1);

#line 975 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = 0;

  /* "ms_deisotope/_c/averagine.pyx":994
 * 
 * cdef double _neutron_shift
 * _neutron_shift = _py_calculate_mass({"C[13]": 1}) - _py_calculate_mass({"C[12]": 1})             # <<<<<<<<<<<<<<
 * 
 * 
 */

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_py_calculate_mass); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 994, __pyx_L1_error)

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 994 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 994, __pyx_L1_error)

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 994 "ms_deisotope/_c/averagine.pyx"
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_s_C_13, __pyx_int_1) < 0) __PYX_ERR(0, 994, __pyx_L1_error)

#line 994 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 994, __pyx_L1_error)

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_4);

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_py_calculate_mass); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 994, __pyx_L1_error)

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_2);

#line 994 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 994, __pyx_L1_error)

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 994 "ms_deisotope/_c/averagine.pyx"
  if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_C_12, __pyx_int_1) < 0) __PYX_ERR(0, 994, __pyx_L1_error)

#line 994 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 994, __pyx_L1_error)

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_5);

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 994 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 994, __pyx_L1_error)

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

#line 994 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 994, __pyx_L1_error)

#line 994 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 994 "ms_deisotope/_c/averagine.pyx"
  __pyx_v_12ms_deisotope_2_c_9averagine__neutron_shift = __pyx_t_3;

  /* "ms_deisotope/_c/averagine.pyx":1
 * # cython: embedsignature=True             # <<<<<<<<<<<<<<
 * 
 * cimport cython
 */

#line 1 "ms_deisotope/_c/averagine.pyx"
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)

#line 1 "ms_deisotope/_c/averagine.pyx"
  __Pyx_GOTREF(__pyx_t_1);

#line 1 "ms_deisotope/_c/averagine.pyx"
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)

#line 1 "ms_deisotope/_c/averagine.pyx"
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

#line 1 "ms_deisotope/_c/averagine.pyx"


#line 1 "ms_deisotope/_c/averagine.pyx"
  /*--- Wrapped vars code ---*/

#line 1 "ms_deisotope/_c/averagine.pyx"


#line 1 "ms_deisotope/_c/averagine.pyx"
  goto __pyx_L0;

#line 1 "ms_deisotope/_c/averagine.pyx"
  __pyx_L1_error:;

#line 1 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_1);

#line 1 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_2);

#line 1 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_4);

#line 1 "ms_deisotope/_c/averagine.pyx"
  __Pyx_XDECREF(__pyx_t_5);

#line 1 "ms_deisotope/_c/averagine.pyx"
  if (__pyx_m) {

#line 1 "ms_deisotope/_c/averagine.pyx"
    if (__pyx_d) {

#line 1 "ms_deisotope/_c/averagine.pyx"
      __Pyx_AddTraceback("init ms_deisotope._c.averagine", __pyx_clineno, __pyx_lineno, __pyx_filename);

#line 1 "ms_deisotope/_c/averagine.pyx"
    }

#line 1 "ms_deisotope/_c/averagine.pyx"
    Py_CLEAR(__pyx_m);

#line 1 "ms_deisotope/_c/averagine.pyx"
  } else if (!PyErr_Occurred()) {

#line 1 "ms_deisotope/_c/averagine.pyx"
    PyErr_SetString(PyExc_ImportError, "init ms_deisotope._c.averagine");

#line 1 "ms_deisotope/_c/averagine.pyx"
  }

#line 1 "ms_deisotope/_c/averagine.pyx"
  __pyx_L0:;

#line 1 "ms_deisotope/_c/averagine.pyx"
  __Pyx_RefNannyFinishContext();

#line 1 "ms_deisotope/_c/averagine.pyx"
  #if CYTHON_PEP489_MULTI_PHASE_INIT

#line 1 "ms_deisotope/_c/averagine.pyx"
  return (__pyx_m != NULL) ? 0 : -1;

#line 1 "ms_deisotope/_c/averagine.pyx"
  #elif PY_MAJOR_VERSION >= 3

#line 1 "ms_deisotope/_c/averagine.pyx"
  return __pyx_m;

#line 1 "ms_deisotope/_c/averagine.pyx"
  #else

#line 1 "ms_deisotope/_c/averagine.pyx"
  return;

#line 1 "ms_deisotope/_c/averagine.pyx"
  #endif

#line 1 "ms_deisotope/_c/averagine.pyx"
}

#line 1 "cython_utility"

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

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

/* 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();
    else state = (PyGILState_STATE)0;
#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
}

/* 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_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
                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(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
                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(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;
}

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

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->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

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

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

/* 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
#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG)
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
    if (likely(PyCFunction_Check(func)))
#endif
    {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (__Pyx_PyFastCFunction_Check(func)) {
            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

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    return __Pyx_IterFinish();
}

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

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* UnpackUnboundCMethod */
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod0 */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_ASSUME_SAFE_MACROS
    args = PyTuple_New(1);
    if (unlikely(!args)) goto bad;
    Py_INCREF(self);
    PyTuple_SET_ITEM(args, 0, self);
#else
    args = PyTuple_Pack(1, self);
    if (unlikely(!args)) goto bad;
#endif
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    Py_DECREF(args);
bad:
    return result;
}

/* py_dict_keys */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_keys, d);
    else
        return PyDict_Keys(d);
}

/* py_dict_values */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_values, d);
    else
        return PyDict_Values(d);
}

/* py_dict_items */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d);
    else
        return PyDict_Items(d);
}

/* pyfrozenset_new */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
    if (it) {
        PyObject* result;
#if CYTHON_COMPILING_IN_PYPY
        PyObject* args;
        args = PyTuple_Pack(1, it);
        if (unlikely(!args))
            return NULL;
        result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
        Py_DECREF(args);
        return result;
#else
        if (PyFrozenSet_CheckExact(it)) {
            Py_INCREF(it);
            return it;
        }
        result = PyFrozenSet_New(it);
        if (unlikely(!result))
            return NULL;
        if ((PY_VERSION_HEX >= 0x031000A1) || likely(PySet_GET_SIZE(result)))
            return result;
        Py_DECREF(result);
#endif
    }
#if CYTHON_USE_TYPE_SLOTS
    return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#else
    return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#endif
}

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr = NULL;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* RaiseException */
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* BytesEquals */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* None */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* StringJoin */
#if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
}
#endif

/* py_abs */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
    if (likely(Py_SIZE(n) == -1)) {
        return PyLong_FromLong(((PyLongObject*)n)->ob_digit[0]);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    {
        PyObject *copy = _PyLong_Copy((PyLongObject*)n);
        if (likely(copy)) {
            __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
        }
        return copy;
    }
#else
    return PyNumber_Negative(n);
#endif
}
#endif

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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

/* PyObject_GenericGetAttrNoDict */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

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

/* TypeImport */
#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* GetVTable */
static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ImportFrom */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* CLineInTraceback */
#ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = NULL;
    PyObject *py_funcname = NULL;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_srcfile = NULL;
    py_srcfile = PyString_FromString(filename);
    if (!py_srcfile) goto bad;
    #endif
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        if (!py_funcname) goto bad;
        funcname = PyUnicode_AsUTF8(py_funcname);
        if (!funcname) goto bad;
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        if (!py_funcname) goto bad;
        #endif
    }
    #if PY_MAJOR_VERSION < 3
    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);
    #else
    py_code = PyCode_NewEmpty(filename, funcname, py_line);
    #endif
    Py_XDECREF(py_funcname);  // XDECREF since it's only set on Py3 if cline
    return py_code;
bad:
    Py_XDECREF(py_funcname);
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_srcfile);
    #endif
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject *ptype, *pvalue, *ptraceback;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) {
            /* If the code object creation fails, then we should clear the
               fetched exception references and propagate the new exception */
            Py_XDECREF(ptype);
            Py_XDECREF(pvalue);
            Py_XDECREF(ptraceback);
            goto bad;
        }
        __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

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

/* CIntFromPy */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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 size_t __Pyx_PyInt_As_size_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    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);
    }
}

/* CIntFromPy */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

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

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* 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;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    #endif
    *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

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (descr != NULL) {
        *method = descr;
        return 0;
    }
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(name));
#endif
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod1 */
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
}

/* CoroutineBase */
#include <structmember.h>
#include <frameobject.h>
#if PY_VERSION_HEX >= 0x030b00a6
  #ifndef Py_BUILD_CORE
    #define Py_BUILD_CORE 1
  #endif
  #include "internal/pycore_frame.h"
#endif
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __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 (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_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;
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
#define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check(gen)) {
        msg = "can't send non-None value to a just-started coroutine";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact(gen)) {
        msg = "can't send non-None value to a just-started async generator";
    #endif
    } else {
        msg = "can't send non-None value to a just-started generator";
    }
    PyErr_SetString(PyExc_TypeError, msg);
}
#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            return __Pyx_Coroutine_NotStartedError((PyObject*)self);
        }
    }
    if (unlikely(self->resume_label == -1)) {
        return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_type) {
        #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
        #else
        if (exc_state->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            assert(f->f_back == NULL);
            #if PY_VERSION_HEX >= 0x030B00A1
            f->f_back = PyThreadState_GetFrame(tstate);
            #else
            Py_XINCREF(tstate->frame);
            f->f_back = tstate->frame;
            #endif
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    self->is_running = 1;
    retval = self->body((PyObject *) self, tstate, value);
    self->is_running = 0;
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    return retval;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *exc_tb = exc_state->exc_traceback;
    if (likely(exc_tb)) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
#endif
    }
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
    if (unlikely(!retval)) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        if (!__Pyx_PyErr_Occurred()) {
            PyObject *exc = PyExc_StopIteration;
            #ifdef __Pyx_AsyncGen_USED
            if (__Pyx_AsyncGen_CheckExact(gen))
                exc = __Pyx_PyExc_StopAsyncIteration;
            #endif
            __Pyx_PyErr_SetNone(exc);
        }
    }
    return retval;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
static CYTHON_INLINE
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
#if PY_VERSION_HEX <= 0x030A00A1
    return _PyGen_Send(gen, arg);
#else
    PyObject *result;
    if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
        if (PyAsyncGen_CheckExact(gen)) {
            assert(result == Py_None);
            PyErr_SetNone(PyExc_StopAsyncIteration);
        }
        else if (result == Py_None) {
            PyErr_SetNone(PyExc_StopIteration);
        }
        else {
            _PyGen_SetStopIterationValue(result);
        }
        Py_CLEAR(result);
    }
    return result;
#endif
}
#endif
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    ret = __Pyx_Coroutine_SendEx(gen, val, 0);
    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(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    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_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : 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, 0);
    }
    return __Pyx_Coroutine_MethodReturn(self, 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_Check(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
    } 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(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } 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, 0);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
    return __Pyx_Coroutine_Close(self);
}
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(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    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, 1);
    if (unlikely(retval)) {
        const char *msg;
        Py_DECREF(retval);
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
#if PY_VERSION_HEX < 0x03060000
            msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
#else
            msg = "async generator ignored GeneratorExit";
#endif
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
            goto throw_here;
        }
        gen->is_running = 1;
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            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;
            }
            if (likely(args)) {
                ret = PyObject_CallObject(meth, args);
            } else {
                ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
            }
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(self, ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
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);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_frame);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    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 && CYTHON_USE_TP_FINALIZE
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (Py_REFCNT(self) > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt == 0);
    __Pyx_SET_REFCNT(self, 1);
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
#if PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
#else
        {PyObject *msg;
        char *cmsg;
        #if CYTHON_COMPILING_IN_PYPY
        msg = NULL;
        cmsg = (char*) "coroutine was never awaited";
        #else
        char *cname;
        PyObject *qualname;
        qualname = gen->gi_qualname;
        cname = PyString_AS_STRING(qualname);
        msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
        if (unlikely(!msg)) {
            PyErr_Clear();
            cmsg = (char*) "coroutine was never awaited";
        } else {
            cmsg = PyString_AS_STRING(msg);
        }
        #endif
        if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
            PyErr_WriteUnraisable(self);
        Py_XDECREF(msg);}
#endif
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *res = __Pyx_Coroutine_Close(self);
        if (unlikely(!res)) {
            if (PyErr_Occurred())
                PyErr_WriteUnraisable(self);
        } else {
            Py_DECREF(res);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if !CYTHON_USE_TP_FINALIZE
    assert(Py_REFCNT(self) > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = Py_REFCNT(self);
        _Py_NewReference(self);
        __Pyx_SET_REFCNT(self, refcnt);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(Py_TYPE(self)) &&
           _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, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    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 PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *frame = self->gi_frame;
    if (!frame) {
        if (unlikely(!self->gi_code)) {
            Py_RETURN_NONE;
        }
        frame = (PyObject *) PyFrame_New(
            PyThreadState_Get(),            /*PyThreadState *tstate,*/
            (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
            __pyx_d,                 /*PyObject *globals,*/
            0                               /*PyObject *locals*/
        );
        if (unlikely(!frame))
            return NULL;
        self->gi_frame = frame;
    }
    Py_INCREF(frame);
    return frame;
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
    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;
    Py_XINCREF(code);
    gen->gi_code = code;
    gen->gi_frame = NULL;
    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 */
#ifndef CYTHON_REGISTER_ABCS
#define CYTHON_REGISTER_ABCS 1
#endif
#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 (CYTHON_REGISTER_ABCS && !abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
        if (!module) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_MAJOR_VERSION >= 3) ?
                        "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_Method, 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")},
    {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {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},
    {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
     (char*) PyDoc_STR("Frame 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 CYTHON_USE_TP_FINALIZE
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if CYTHON_USE_TP_FINALIZE
    __Pyx_Coroutine_del,
#elif PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
    0,
#endif
};
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __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[5];
    int same=1, i, found_dot;
    const char* rt_from_call = Py_GetVersion();
    PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    found_dot = 0;
    for (i = 0; i < 4; i++) {
        if (!ctversion[i]) {
            same = (rt_from_call[i] < '0' || rt_from_call[i] > '9');
            break;
        }
        if (rt_from_call[i] != ctversion[i]) {
            same = 0;
            break;
        }
    }
    if (!same) {
        char rtversion[5] = {'\0'};
        char message[200];
        for (i=0; i<4; ++i) {
            if (rt_from_call[i] == '.') {
                if (found_dot) break;
                found_dot = 1;
            } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') {
                break;
            }
            rtversion[i] = rt_from_call[i];
        }
        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;
}

/* VoidPtrExport */
static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig) {
    PyObject *d;
    PyObject *cobj = 0;
    d = PyDict_GetItem(__pyx_d, __pyx_n_s_pyx_capi);
    Py_XINCREF(d);
    if (!d) {
        d = PyDict_New();
        if (!d)
            goto bad;
        if (__Pyx_PyObject_SetAttrStr(__pyx_m, __pyx_n_s_pyx_capi, d) < 0)
            goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItem(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

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

/* VoidPtrImport */
#ifndef __PYX_HAVE_RT_ImportVoidPtr
#define __PYX_HAVE_RT_ImportVoidPtr
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, name);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C variable %.200s",
                PyModule_GetName(module), name);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    *p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), name, sig, desc);
        goto bad;
    }
    *p = PyCObject_AsVoidPtr(cobj);}
#endif
    if (!(*p))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

/* FunctionImport */
#ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#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;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
    return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
#if PY_MAJOR_VERSION < 3
  } else if (likely(PyInt_CheckExact(o))) {
    return PyInt_AS_LONG(o);
#endif
  } else {
    Py_ssize_t ival;
    PyObject *x;
    x = PyNumber_Index(o);
    if (!x) return -1;
    ival = PyInt_AsLong(x);
    Py_DECREF(x);
    return ival;
  }
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
