Generated by Cython 0.29.32
Yellow lines hint at Python interaction.
Click on a line that starts with a "+
" to see the C code that Cython generated for it.
Raw output: _crystallography.cpp
+001: # This file is part of OM.
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
002: #
003: # OM is free software: you can redistribute it and/or modify it under the terms of
004: # the GNU General Public License as published by the Free Software Foundation, either
005: # version 3 of the License, or (at your option) any later version.
006: #
007: # OM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
008: # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
009: # PURPOSE. See the GNU General Public License for more details.
010: #
011: # You should have received a copy of the GNU General Public License along with OnDA.
012: # If not, see <http://www.gnu.org/licenses/>.
013: #
014: # Copyright 2020 -2023 SLAC National Accelerator Laboratory
015: #
016: # Based on OnDA - Copyright 2014-2019 Deutsches Elektronen-Synchrotron DESY,
017: # a research centre of the Helmholtz Association.
018: """
019: Peakfinder8 extension.
020:
021: This extension contains an implementation of Cheetah's 'peakfinder8' peak detection
022: algorithm.
023: """
024: from libcpp.vector cimport vector
025: from libc.stdlib cimport malloc, free
026: from libc.stdint cimport int8_t
027:
+028: import numpy
__pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
029:
030: cdef extern from "peakfinder8.hh":
031:
032: ctypedef struct tPeakList:
033: long nPeaks
034: long nHot
035: float peakResolution
036: float peakResolutionA
037: float peakDensity
038: float peakNpix
039: float peakTotal
040: int memoryAllocated
041: long nPeaks_max
042:
043: float *peak_maxintensity
044: float *peak_totalintensity
045: float *peak_sigma
046: float *peak_snr
047: float *peak_npix
048: float *peak_com_x
049: float *peak_com_y
050: long *peak_com_index
051: float *peak_com_x_assembled
052: float *peak_com_y_assembled
053: float *peak_com_r_assembled
054: float *peak_com_q
055: float *peak_com_res
056:
057: void allocatePeakList(tPeakList* peak_list, long max_num_peaks)
058: void freePeakList(tPeakList peak_list)
059:
060: cdef extern from "peakfinder8.hh":
061:
062: int peakfinder8(tPeakList *peaklist, float *data, char *mask, float *pix_r,
063: int rstats_num_pix, int *rstats_pidx, int *rstats_radius, int fast,
064: long asic_nx, long asic_ny, long nasics_x, long nasics_y,
065: float ADCthresh, float hitfinderMinSNR,
066: long hitfinderMinPixCount, long hitfinderMaxPixCount,
067: long hitfinderLocalBGRadius, char* outliersMask);
068:
069:
+070: def peakfinder_8(int max_num_peaks, float[:,::1] data, char[:,::1] mask,
/* Python wrapper */ static PyObject *__pyx_pw_2om_10algorithms_16_crystallography_1peakfinder_8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_2om_10algorithms_16_crystallography_peakfinder_8[] = "\n peakfinder_8(max_num_peaks, data, mask, pix_r, asic_nx, asic_ny, nasics_x, nasics_y, adc_thresh, hitfinder_min_snr, hitfinder_min_pix_count, hitfinder_max_pix_count, hitfinder_local_bg_radius)\n \n Peakfinder8 peak detection.\n\n This function finds peaks in a detector data frame using the 'peakfinder8'\n strategy from the Cheetah software package. The 'peakfinder8' peak detection\n strategy is described in the following publication:\n\n A. Barty, R. A. Kirian, F. R. N. C. Maia, M. Hantke, C. H. Yoon, T. A. White,\n and H. N. Chapman, \"Cheetah: software for high-throughput reduction and\n analysis of serial femtosecond x-ray diffraction data\", J Appl Crystallogr,\n vol. 47, pp. 1118-1131 (2014).\n\n Arguments:\n\n max_num_peaks (:obj:`int`): The maximum number of peaks that will be retrieved\n from each data frame. Additional peaks will be ignored.\n\n data (:obj:`numpy.ndarray`): The detector data frame on which the peak finding\n must be performed (as an numpy array of float32).\n\n mask (:obj:`numpy.ndarray`): A numpy array of int8 storing a mask. The map can\n be used to mark areas of the data frame that must be excluded from the peak\n search. \n\n * The map must be a numpy array of the same shape as the data frame on\n which the algorithm will be applied.\n\n * Each pixel in the map must have a value of either 0, meaning that\n the corresponding pixel in the data frame should be ignored, or 1,\n meaning that the corresponding pixel should be included in the\n search.\n\n * The map is only used to exclude areas from the peak search: the data\n is not modified in any way.\n\n pix_r (:obj:`numpy.ndarray`): A numpy array of float32 with radius information.\n\n * The array must have the same shape as the data frame on which the\n "" algorithm will be applied.\n\n * Each element of the array must store, for the corresponding pixel in the\n data frame, the distance in pixels from the origin of the detector\n reference system (usually the center of the detector).\n\n asic_nx (:obj:`int`):: The fs size in pixels of each detector panel in the data\n frame.\n\n asic_ny (:obj:`int`):: The ss size in pixels of each detector panel in the data\n frame.\n\n nasics_x (:obj:`int`): The number of panels along the fs axis of the data\n frame.\n\n nasics_y (:obj:`int`): The number of panels along the ss axis of the data\n frame.\n\n adc_thresh (:obj:`float`):: The minimum ADC threshold for peak detection.\n\n hitfinder_min_snr (:obj:`float`): The minimum signal-to-noise ratio for peak\n detection.\n\n hitfinder_min_pix_count (:obj:`int`): The minimum size of a peak in pixels.\n\n hitfinder_max_pixel_count (:obj:`int`): The maximum size of a peak in pixels.\n\n local_bg_radius: The radius for the estimation of the local background in\n pixels.\n\n Returns:\n\n :obj:`Tuple[int, List[float], List[float], List[float], List[float], List[float], List[float]`: A tuple storing information about the detected peaks. The\n tuple has the following elements:\n\n * The first entry stores the number of peaks that were detected in the data\n frame.\n\n * The second entry is a list storing the fractional fs indexes that locate\n thedetected peaks in the data frame.\n \n * The third entry is a list storing the fractional ss indexes that locate the\n the detected peaks in the data frame.\n \n * The fourth entry is a list storing the integrated intensities for the\n detected peaks.\n \n * The fifth entry is a list storing the number"" of pixels that make up each\n detected peak.\n\n * The sixth entry is a list storing, for each peak, the value of the pixel\n with the maximum intensity.\n \n * The seventh entry is a list storing the signal-to-noise ratio of each\n detected peak.\n "; static PyMethodDef __pyx_mdef_2om_10algorithms_16_crystallography_1peakfinder_8 = {"peakfinder_8", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2om_10algorithms_16_crystallography_1peakfinder_8, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2om_10algorithms_16_crystallography_peakfinder_8}; static PyObject *__pyx_pw_2om_10algorithms_16_crystallography_1peakfinder_8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_max_num_peaks; __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_mask = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_pix_r = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_v_rstats_num_pix; __Pyx_memviewslice __pyx_v_rstats_pidx = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_rstats_radius = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_v_fast; long __pyx_v_asic_nx; long __pyx_v_asic_ny; long __pyx_v_nasics_x; long __pyx_v_nasics_y; float __pyx_v_adc_thresh; float __pyx_v_hitfinder_min_snr; long __pyx_v_hitfinder_min_pix_count; long __pyx_v_hitfinder_max_pix_count; long __pyx_v_hitfinder_local_bg_radius; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("peakfinder_8 (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_num_peaks,&__pyx_n_s_data,&__pyx_n_s_mask,&__pyx_n_s_pix_r,&__pyx_n_s_rstats_num_pix,&__pyx_n_s_rstats_pidx,&__pyx_n_s_rstats_radius,&__pyx_n_s_fast,&__pyx_n_s_asic_nx,&__pyx_n_s_asic_ny,&__pyx_n_s_nasics_x,&__pyx_n_s_nasics_y,&__pyx_n_s_adc_thresh,&__pyx_n_s_hitfinder_min_snr,&__pyx_n_s_hitfinder_min_pix_count,&__pyx_n_s_hitfinder_max_pix_count,&__pyx_n_s_hitfinder_local_bg_radius,0}; PyObject* values[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16); CYTHON_FALLTHROUGH; case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); CYTHON_FALLTHROUGH; case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); CYTHON_FALLTHROUGH; case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); CYTHON_FALLTHROUGH; case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); CYTHON_FALLTHROUGH; case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); CYTHON_FALLTHROUGH; case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); CYTHON_FALLTHROUGH; case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); CYTHON_FALLTHROUGH; case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); CYTHON_FALLTHROUGH; case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_num_peaks)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 1); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mask)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 2); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pix_r)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 3); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rstats_num_pix)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 4); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rstats_pidx)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 5); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rstats_radius)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 6); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fast)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 7); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_asic_nx)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 8); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_asic_ny)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 9); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nasics_x)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 10); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nasics_y)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 11); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_adc_thresh)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 12); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 13: if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hitfinder_min_snr)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 13); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 14: if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hitfinder_min_pix_count)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 14); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 15: if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hitfinder_max_pix_count)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 15); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 16: if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hitfinder_local_bg_radius)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, 16); __PYX_ERR(0, 70, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "peakfinder_8") < 0)) __PYX_ERR(0, 70, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 17) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); values[7] = PyTuple_GET_ITEM(__pyx_args, 7); values[8] = PyTuple_GET_ITEM(__pyx_args, 8); values[9] = PyTuple_GET_ITEM(__pyx_args, 9); values[10] = PyTuple_GET_ITEM(__pyx_args, 10); values[11] = PyTuple_GET_ITEM(__pyx_args, 11); values[12] = PyTuple_GET_ITEM(__pyx_args, 12); values[13] = PyTuple_GET_ITEM(__pyx_args, 13); values[14] = PyTuple_GET_ITEM(__pyx_args, 14); values[15] = PyTuple_GET_ITEM(__pyx_args, 15); values[16] = PyTuple_GET_ITEM(__pyx_args, 16); } __pyx_v_max_num_peaks = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_max_num_peaks == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L3_error) __pyx_v_data = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data.memview)) __PYX_ERR(0, 70, __pyx_L3_error) __pyx_v_mask = __Pyx_PyObject_to_MemoryviewSlice_d_dc_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mask.memview)) __PYX_ERR(0, 70, __pyx_L3_error) __pyx_v_pix_r = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_pix_r.memview)) __PYX_ERR(0, 71, __pyx_L3_error) __pyx_v_rstats_num_pix = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_rstats_num_pix == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L3_error) __pyx_v_rstats_pidx = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rstats_pidx.memview)) __PYX_ERR(0, 71, __pyx_L3_error) __pyx_v_rstats_radius = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rstats_radius.memview)) __PYX_ERR(0, 72, __pyx_L3_error) __pyx_v_fast = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_fast == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L3_error) __pyx_v_asic_nx = __Pyx_PyInt_As_long(values[8]); if (unlikely((__pyx_v_asic_nx == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L3_error) __pyx_v_asic_ny = __Pyx_PyInt_As_long(values[9]); if (unlikely((__pyx_v_asic_ny == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L3_error) __pyx_v_nasics_x = __Pyx_PyInt_As_long(values[10]); if (unlikely((__pyx_v_nasics_x == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error) __pyx_v_nasics_y = __Pyx_PyInt_As_long(values[11]); if (unlikely((__pyx_v_nasics_y == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error) __pyx_v_adc_thresh = __pyx_PyFloat_AsFloat(values[12]); if (unlikely((__pyx_v_adc_thresh == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error) __pyx_v_hitfinder_min_snr = __pyx_PyFloat_AsFloat(values[13]); if (unlikely((__pyx_v_hitfinder_min_snr == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L3_error) __pyx_v_hitfinder_min_pix_count = __Pyx_PyInt_As_long(values[14]); if (unlikely((__pyx_v_hitfinder_min_pix_count == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L3_error) __pyx_v_hitfinder_max_pix_count = __Pyx_PyInt_As_long(values[15]); if (unlikely((__pyx_v_hitfinder_max_pix_count == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L3_error) __pyx_v_hitfinder_local_bg_radius = __Pyx_PyInt_As_long(values[16]); if (unlikely((__pyx_v_hitfinder_local_bg_radius == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("peakfinder_8", 1, 17, 17, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 70, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("om.algorithms._crystallography.peakfinder_8", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_2om_10algorithms_16_crystallography_peakfinder_8(__pyx_self, __pyx_v_max_num_peaks, __pyx_v_data, __pyx_v_mask, __pyx_v_pix_r, __pyx_v_rstats_num_pix, __pyx_v_rstats_pidx, __pyx_v_rstats_radius, __pyx_v_fast, __pyx_v_asic_nx, __pyx_v_asic_ny, __pyx_v_nasics_x, __pyx_v_nasics_y, __pyx_v_adc_thresh, __pyx_v_hitfinder_min_snr, __pyx_v_hitfinder_min_pix_count, __pyx_v_hitfinder_max_pix_count, __pyx_v_hitfinder_local_bg_radius); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_2om_10algorithms_16_crystallography_peakfinder_8(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_max_num_peaks, __Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_mask, __Pyx_memviewslice __pyx_v_pix_r, int __pyx_v_rstats_num_pix, __Pyx_memviewslice __pyx_v_rstats_pidx, __Pyx_memviewslice __pyx_v_rstats_radius, int __pyx_v_fast, long __pyx_v_asic_nx, long __pyx_v_asic_ny, long __pyx_v_nasics_x, long __pyx_v_nasics_y, float __pyx_v_adc_thresh, float __pyx_v_hitfinder_min_snr, long __pyx_v_hitfinder_min_pix_count, long __pyx_v_hitfinder_max_pix_count, long __pyx_v_hitfinder_local_bg_radius) { tPeakList __pyx_v_peak_list; int __pyx_v_i; float __pyx_v_peak_x; float __pyx_v_peak_y; float __pyx_v_peak_value; std::vector<double> __pyx_v_peak_list_x; std::vector<double> __pyx_v_peak_list_y; std::vector<long> __pyx_v_peak_list_index; std::vector<double> __pyx_v_peak_list_value; std::vector<double> __pyx_v_peak_list_npix; std::vector<double> __pyx_v_peak_list_maxi; std::vector<double> __pyx_v_peak_list_sigma; std::vector<double> __pyx_v_peak_list_snr; long __pyx_v_num_peaks; long __pyx_v_peak_index; PyObject *__pyx_v_peak_npix = NULL; PyObject *__pyx_v_peak_maxi = NULL; PyObject *__pyx_v_peak_sigma = NULL; PyObject *__pyx_v_peak_snr = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("peakfinder_8", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_14); __Pyx_XDECREF(__pyx_t_16); __Pyx_XDECREF(__pyx_t_17); __Pyx_XDECREF(__pyx_t_18); __Pyx_XDECREF(__pyx_t_19); __Pyx_XDECREF(__pyx_t_20); __Pyx_XDECREF(__pyx_t_21); __Pyx_XDECREF(__pyx_t_22); __Pyx_XDECREF(__pyx_t_23); __Pyx_AddTraceback("om.algorithms._crystallography.peakfinder_8", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_peak_npix); __Pyx_XDECREF(__pyx_v_peak_maxi); __Pyx_XDECREF(__pyx_v_peak_sigma); __Pyx_XDECREF(__pyx_v_peak_snr); __PYX_XDEC_MEMVIEW(&__pyx_v_data, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_mask, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_pix_r, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_rstats_pidx, 1); __PYX_XDEC_MEMVIEW(&__pyx_v_rstats_radius, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__20 = PyTuple_Pack(36, __pyx_n_s_max_num_peaks, __pyx_n_s_data, __pyx_n_s_mask, __pyx_n_s_pix_r, __pyx_n_s_rstats_num_pix, __pyx_n_s_rstats_pidx, __pyx_n_s_rstats_radius, __pyx_n_s_fast, __pyx_n_s_asic_nx, __pyx_n_s_asic_ny, __pyx_n_s_nasics_x, __pyx_n_s_nasics_y, __pyx_n_s_adc_thresh, __pyx_n_s_hitfinder_min_snr, __pyx_n_s_hitfinder_min_pix_count, __pyx_n_s_hitfinder_max_pix_count, __pyx_n_s_hitfinder_local_bg_radius, __pyx_n_s_peak_list, __pyx_n_s_i, __pyx_n_s_peak_x, __pyx_n_s_peak_y, __pyx_n_s_peak_value, __pyx_n_s_peak_list_x, __pyx_n_s_peak_list_y, __pyx_n_s_peak_list_index, __pyx_n_s_peak_list_value, __pyx_n_s_peak_list_npix, __pyx_n_s_peak_list_maxi, __pyx_n_s_peak_list_sigma, __pyx_n_s_peak_list_snr, __pyx_n_s_num_peaks, __pyx_n_s_peak_index, __pyx_n_s_peak_npix, __pyx_n_s_peak_maxi, __pyx_n_s_peak_sigma, __pyx_n_s_peak_snr); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20); /* … */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2om_10algorithms_16_crystallography_1peakfinder_8, NULL, __pyx_n_s_om_algorithms__crystallography); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_peakfinder_8, __pyx_t_1) < 0) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(17, 0, 36, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_cython__crystallography_pyx, __pyx_n_s_peakfinder_8, 70, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 70, __pyx_L1_error)
071: float[:,::1] pix_r, int rstats_num_pix, int[:] rstats_pidx,
072: int[:] rstats_radius, int fast, long asic_nx, long asic_ny,
073: long nasics_x, long nasics_y, float adc_thresh,
074: float hitfinder_min_snr, long hitfinder_min_pix_count,
075: long hitfinder_max_pix_count, long hitfinder_local_bg_radius):
076: """
077: peakfinder_8(max_num_peaks, data, mask, pix_r, asic_nx, asic_ny, nasics_x, \
078: nasics_y, adc_thresh, hitfinder_min_snr, hitfinder_min_pix_count, \
079: hitfinder_max_pix_count, hitfinder_local_bg_radius)
080:
081: Peakfinder8 peak detection.
082:
083: This function finds peaks in a detector data frame using the 'peakfinder8'
084: strategy from the Cheetah software package. The 'peakfinder8' peak detection
085: strategy is described in the following publication:
086:
087: A. Barty, R. A. Kirian, F. R. N. C. Maia, M. Hantke, C. H. Yoon, T. A. White,
088: and H. N. Chapman, "Cheetah: software for high-throughput reduction and
089: analysis of serial femtosecond x-ray diffraction data", J Appl Crystallogr,
090: vol. 47, pp. 1118-1131 (2014).
091:
092: Arguments:
093:
094: max_num_peaks (:obj:`int`): The maximum number of peaks that will be retrieved
095: from each data frame. Additional peaks will be ignored.
096:
097: data (:obj:`numpy.ndarray`): The detector data frame on which the peak finding
098: must be performed (as an numpy array of float32).
099:
100: mask (:obj:`numpy.ndarray`): A numpy array of int8 storing a mask. The map can
101: be used to mark areas of the data frame that must be excluded from the peak
102: search.
103:
104: * The map must be a numpy array of the same shape as the data frame on
105: which the algorithm will be applied.
106:
107: * Each pixel in the map must have a value of either 0, meaning that
108: the corresponding pixel in the data frame should be ignored, or 1,
109: meaning that the corresponding pixel should be included in the
110: search.
111:
112: * The map is only used to exclude areas from the peak search: the data
113: is not modified in any way.
114:
115: pix_r (:obj:`numpy.ndarray`): A numpy array of float32 with radius information.
116:
117: * The array must have the same shape as the data frame on which the
118: algorithm will be applied.
119:
120: * Each element of the array must store, for the corresponding pixel in the
121: data frame, the distance in pixels from the origin of the detector
122: reference system (usually the center of the detector).
123:
124: asic_nx (:obj:`int`):: The fs size in pixels of each detector panel in the data
125: frame.
126:
127: asic_ny (:obj:`int`):: The ss size in pixels of each detector panel in the data
128: frame.
129:
130: nasics_x (:obj:`int`): The number of panels along the fs axis of the data
131: frame.
132:
133: nasics_y (:obj:`int`): The number of panels along the ss axis of the data
134: frame.
135:
136: adc_thresh (:obj:`float`):: The minimum ADC threshold for peak detection.
137:
138: hitfinder_min_snr (:obj:`float`): The minimum signal-to-noise ratio for peak
139: detection.
140:
141: hitfinder_min_pix_count (:obj:`int`): The minimum size of a peak in pixels.
142:
143: hitfinder_max_pixel_count (:obj:`int`): The maximum size of a peak in pixels.
144:
145: local_bg_radius: The radius for the estimation of the local background in
146: pixels.
147:
148: Returns:
149:
150: :obj:`Tuple[int, List[float], List[float], List[float], List[float], \
151: List[float], List[float]`: A tuple storing information about the detected peaks. The
152: tuple has the following elements:
153:
154: * The first entry stores the number of peaks that were detected in the data
155: frame.
156:
157: * The second entry is a list storing the fractional fs indexes that locate
158: thedetected peaks in the data frame.
159:
160: * The third entry is a list storing the fractional ss indexes that locate the
161: the detected peaks in the data frame.
162:
163: * The fourth entry is a list storing the integrated intensities for the
164: detected peaks.
165:
166: * The fifth entry is a list storing the number of pixels that make up each
167: detected peak.
168:
169: * The sixth entry is a list storing, for each peak, the value of the pixel
170: with the maximum intensity.
171:
172: * The seventh entry is a list storing the signal-to-noise ratio of each
173: detected peak.
174: """
175: cdef tPeakList peak_list
+176: allocatePeakList(&peak_list, max_num_peaks)
allocatePeakList((&__pyx_v_peak_list), __pyx_v_max_num_peaks);
177:
+178: peakfinder8(&peak_list, &data[0, 0], &mask[0,0], &pix_r[0, 0], rstats_num_pix,
__pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = -1; if (__pyx_t_1 < 0) { __pyx_t_1 += __pyx_v_data.shape[0]; if (unlikely(__pyx_t_1 < 0)) __pyx_t_3 = 0; } else if (unlikely(__pyx_t_1 >= __pyx_v_data.shape[0])) __pyx_t_3 = 0; if (__pyx_t_2 < 0) { __pyx_t_2 += __pyx_v_data.shape[1]; if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 1; } else if (unlikely(__pyx_t_2 >= __pyx_v_data.shape[1])) __pyx_t_3 = 1; if (unlikely(__pyx_t_3 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_3); __PYX_ERR(0, 178, __pyx_L1_error) } __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_3 = -1; if (__pyx_t_4 < 0) { __pyx_t_4 += __pyx_v_mask.shape[0]; if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0; } else if (unlikely(__pyx_t_4 >= __pyx_v_mask.shape[0])) __pyx_t_3 = 0; if (__pyx_t_5 < 0) { __pyx_t_5 += __pyx_v_mask.shape[1]; if (unlikely(__pyx_t_5 < 0)) __pyx_t_3 = 1; } else if (unlikely(__pyx_t_5 >= __pyx_v_mask.shape[1])) __pyx_t_3 = 1; if (unlikely(__pyx_t_3 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_3); __PYX_ERR(0, 178, __pyx_L1_error) } __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_3 = -1; if (__pyx_t_6 < 0) { __pyx_t_6 += __pyx_v_pix_r.shape[0]; if (unlikely(__pyx_t_6 < 0)) __pyx_t_3 = 0; } else if (unlikely(__pyx_t_6 >= __pyx_v_pix_r.shape[0])) __pyx_t_3 = 0; if (__pyx_t_7 < 0) { __pyx_t_7 += __pyx_v_pix_r.shape[1]; if (unlikely(__pyx_t_7 < 0)) __pyx_t_3 = 1; } else if (unlikely(__pyx_t_7 >= __pyx_v_pix_r.shape[1])) __pyx_t_3 = 1; if (unlikely(__pyx_t_3 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_3); __PYX_ERR(0, 178, __pyx_L1_error) } /* … */ (void)(peakfinder8((&__pyx_v_peak_list), (&(*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_data.data + __pyx_t_1 * __pyx_v_data.strides[0]) )) + __pyx_t_2)) )))), (&(*((char *) ( /* dim=1 */ ((char *) (((char *) ( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_4 * __pyx_v_mask.strides[0]) )) + __pyx_t_5)) )))), (&(*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_pix_r.data + __pyx_t_6 * __pyx_v_pix_r.strides[0]) )) + __pyx_t_7)) )))), __pyx_v_rstats_num_pix, __pyx_t_8, __pyx_t_10, __pyx_v_fast, __pyx_v_asic_nx, __pyx_v_asic_ny, __pyx_v_nasics_x, __pyx_v_nasics_y, __pyx_v_adc_thresh, __pyx_v_hitfinder_min_snr, __pyx_v_hitfinder_min_pix_count, __pyx_v_hitfinder_max_pix_count, __pyx_v_hitfinder_local_bg_radius, NULL));
+179: &rstats_pidx[0] if rstats_pidx is not None else NULL,
if (((((PyObject *) __pyx_v_rstats_pidx.memview) != Py_None) != 0)) { __pyx_t_9 = 0; __pyx_t_3 = -1; if (__pyx_t_9 < 0) { __pyx_t_9 += __pyx_v_rstats_pidx.shape[0]; if (unlikely(__pyx_t_9 < 0)) __pyx_t_3 = 0; } else if (unlikely(__pyx_t_9 >= __pyx_v_rstats_pidx.shape[0])) __pyx_t_3 = 0; if (unlikely(__pyx_t_3 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_3); __PYX_ERR(0, 179, __pyx_L1_error) } __pyx_t_8 = (&(*((int *) ( /* dim=0 */ (__pyx_v_rstats_pidx.data + __pyx_t_9 * __pyx_v_rstats_pidx.strides[0]) )))); } else { __pyx_t_8 = NULL; }
+180: &rstats_radius[0] if rstats_radius is not None else NULL,
if (((((PyObject *) __pyx_v_rstats_radius.memview) != Py_None) != 0)) { __pyx_t_9 = 0; __pyx_t_3 = -1; if (__pyx_t_9 < 0) { __pyx_t_9 += __pyx_v_rstats_radius.shape[0]; if (unlikely(__pyx_t_9 < 0)) __pyx_t_3 = 0; } else if (unlikely(__pyx_t_9 >= __pyx_v_rstats_radius.shape[0])) __pyx_t_3 = 0; if (unlikely(__pyx_t_3 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_3); __PYX_ERR(0, 180, __pyx_L1_error) } __pyx_t_10 = (&(*((int *) ( /* dim=0 */ (__pyx_v_rstats_radius.data + __pyx_t_9 * __pyx_v_rstats_radius.strides[0]) )))); } else { __pyx_t_10 = NULL; }
181: fast, asic_nx, asic_ny, nasics_x, nasics_y, adc_thresh,
182: hitfinder_min_snr, hitfinder_min_pix_count, hitfinder_max_pix_count,
183: hitfinder_local_bg_radius, NULL)
184:
185: cdef int i
186: cdef float peak_x, peak_y, peak_value
187: cdef vector[double] peak_list_x
188: cdef vector[double] peak_list_y
189: cdef vector[long] peak_list_index
190: cdef vector[double] peak_list_value
191: cdef vector[double] peak_list_npix
192: cdef vector[double] peak_list_maxi
193: cdef vector[double] peak_list_sigma
194: cdef vector[double] peak_list_snr
195:
+196: num_peaks = peak_list.nPeaks
__pyx_t_11 = __pyx_v_peak_list.nPeaks; __pyx_v_num_peaks = __pyx_t_11;
197:
+198: if num_peaks > max_num_peaks:
__pyx_t_12 = ((__pyx_v_num_peaks > __pyx_v_max_num_peaks) != 0); if (__pyx_t_12) { /* … */ }
+199: num_peaks = max_num_peaks
__pyx_v_num_peaks = __pyx_v_max_num_peaks;
200:
+201: for i in range(0, num_peaks):
__pyx_t_11 = __pyx_v_num_peaks; __pyx_t_13 = __pyx_t_11; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_13; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
202:
+203: peak_x = peak_list.peak_com_x[i]
__pyx_v_peak_x = (__pyx_v_peak_list.peak_com_x[__pyx_v_i]);
+204: peak_y = peak_list.peak_com_y[i]
__pyx_v_peak_y = (__pyx_v_peak_list.peak_com_y[__pyx_v_i]);
+205: peak_index = peak_list.peak_com_index[i]
__pyx_v_peak_index = (__pyx_v_peak_list.peak_com_index[__pyx_v_i]);
+206: peak_value = peak_list.peak_totalintensity[i]
__pyx_v_peak_value = (__pyx_v_peak_list.peak_totalintensity[__pyx_v_i]);
+207: peak_npix = peak_list.peak_npix[i]
__pyx_t_14 = PyFloat_FromDouble((__pyx_v_peak_list.peak_npix[__pyx_v_i])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_XDECREF_SET(__pyx_v_peak_npix, __pyx_t_14); __pyx_t_14 = 0;
+208: peak_maxi = peak_list.peak_maxintensity[i]
__pyx_t_14 = PyFloat_FromDouble((__pyx_v_peak_list.peak_maxintensity[__pyx_v_i])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_XDECREF_SET(__pyx_v_peak_maxi, __pyx_t_14); __pyx_t_14 = 0;
+209: peak_sigma = peak_list.peak_sigma[i]
__pyx_t_14 = PyFloat_FromDouble((__pyx_v_peak_list.peak_sigma[__pyx_v_i])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_XDECREF_SET(__pyx_v_peak_sigma, __pyx_t_14); __pyx_t_14 = 0;
+210: peak_snr = peak_list.peak_snr[i]
__pyx_t_14 = PyFloat_FromDouble((__pyx_v_peak_list.peak_snr[__pyx_v_i])); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_XDECREF_SET(__pyx_v_peak_snr, __pyx_t_14); __pyx_t_14 = 0;
211:
+212: peak_list_x.push_back(peak_x)
try {
__pyx_v_peak_list_x.push_back(__pyx_v_peak_x);
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 212, __pyx_L1_error)
}
+213: peak_list_y.push_back(peak_y)
try {
__pyx_v_peak_list_y.push_back(__pyx_v_peak_y);
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 213, __pyx_L1_error)
}
+214: peak_list_index.push_back(peak_index)
try {
__pyx_v_peak_list_index.push_back(__pyx_v_peak_index);
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 214, __pyx_L1_error)
}
+215: peak_list_value.push_back(peak_value)
try {
__pyx_v_peak_list_value.push_back(__pyx_v_peak_value);
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 215, __pyx_L1_error)
}
+216: peak_list_npix.push_back(peak_npix)
__pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_v_peak_npix); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L1_error) try { __pyx_v_peak_list_npix.push_back(__pyx_t_15); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 216, __pyx_L1_error) }
+217: peak_list_maxi.push_back(peak_maxi)
__pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_v_peak_maxi); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L1_error) try { __pyx_v_peak_list_maxi.push_back(__pyx_t_15); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 217, __pyx_L1_error) }
+218: peak_list_sigma.push_back(peak_sigma)
__pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_v_peak_sigma); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error) try { __pyx_v_peak_list_sigma.push_back(__pyx_t_15); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 218, __pyx_L1_error) }
+219: peak_list_snr.push_back(peak_snr)
__pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_v_peak_snr); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L1_error) try { __pyx_v_peak_list_snr.push_back(__pyx_t_15); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 219, __pyx_L1_error) } }
220:
+221: freePeakList(peak_list)
freePeakList(__pyx_v_peak_list);
222:
+223: return (peak_list_x, peak_list_y, peak_list_value, peak_list_index,
__Pyx_XDECREF(__pyx_r); __pyx_t_14 = __pyx_convert_vector_to_py_double(__pyx_v_peak_list_x); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_16 = __pyx_convert_vector_to_py_double(__pyx_v_peak_list_y); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __pyx_t_17 = __pyx_convert_vector_to_py_double(__pyx_v_peak_list_value); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_17); __pyx_t_18 = __pyx_convert_vector_to_py_long(__pyx_v_peak_list_index); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); /* … */ __pyx_t_23 = PyTuple_New(8); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_23); __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_17); __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_23, 3, __pyx_t_18); __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_23, 4, __pyx_t_19); __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_23, 5, __pyx_t_20); __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_23, 6, __pyx_t_21); __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_23, 7, __pyx_t_22); __pyx_t_14 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_r = __pyx_t_23; __pyx_t_23 = 0; goto __pyx_L0;
+224: peak_list_npix, peak_list_maxi, peak_list_sigma, peak_list_snr)
__pyx_t_19 = __pyx_convert_vector_to_py_double(__pyx_v_peak_list_npix); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_20 = __pyx_convert_vector_to_py_double(__pyx_v_peak_list_maxi); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); __pyx_t_21 = __pyx_convert_vector_to_py_double(__pyx_v_peak_list_sigma); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_22 = __pyx_convert_vector_to_py_double(__pyx_v_peak_list_snr); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_22);