unix line endings

This commit is contained in:
2024-03-22 17:32:06 +01:00
parent 80620d1f14
commit 1eb006e9bd
3 changed files with 134 additions and 134 deletions

View File

@ -1 +1 @@
int peakfinder8(tPeakList*, float*, char*, float*, long, long, long, long, float, float, long, long, long); int peakfinder8(tPeakList*, float*, char*, float*, long, long, long, long, float, float, long, long, long);

View File

@ -1,118 +1,118 @@
cimport numpy cimport numpy
from libcpp.vector cimport vector from libcpp.vector cimport vector
from libc.stdlib cimport malloc, free from libc.stdlib cimport malloc, free
# #
# PEAKFINDER 8 # PEAKFINDER 8
# #
cdef extern from "peakfinders.h": cdef extern from "peakfinders.h":
ctypedef struct tPeakList: ctypedef struct tPeakList:
long nPeaks long nPeaks
long nHot long nHot
float peakResolution float peakResolution
float peakResolutionA float peakResolutionA
float peakDensity float peakDensity
float peakNpix float peakNpix
float peakTotal float peakTotal
int memoryAllocated int memoryAllocated
long nPeaks_max long nPeaks_max
float *peak_maxintensity float *peak_maxintensity
float *peak_totalintensity float *peak_totalintensity
float *peak_sigma float *peak_sigma
float *peak_snr float *peak_snr
float *peak_npix float *peak_npix
float *peak_com_x float *peak_com_x
float *peak_com_y float *peak_com_y
long *peak_com_index long *peak_com_index
float *peak_com_x_assembled float *peak_com_x_assembled
float *peak_com_y_assembled float *peak_com_y_assembled
float *peak_com_r_assembled float *peak_com_r_assembled
float *peak_com_q float *peak_com_q
float *peak_com_res float *peak_com_res
void allocatePeakList(tPeakList* peak_list, long max_num_peaks) void allocatePeakList(tPeakList* peak_list, long max_num_peaks)
void freePeakList(tPeakList peak_list) void freePeakList(tPeakList peak_list)
cdef extern from "peakfinder8.hh": cdef extern from "peakfinder8.hh":
int peakfinder8( int peakfinder8(
tPeakList *peaklist, tPeakList *peaklist,
float *data, float *data,
char *mask, char *mask,
float *pix_r, float *pix_r,
long asic_nx, long asic_nx,
long asic_ny, long asic_ny,
long nasics_x, long nasics_x,
long nasics_y, long nasics_y,
float ADCthresh, float ADCthresh,
float hitfinderMinSNR, float hitfinderMinSNR,
long hitfinderMinPixCount, long hitfinderMinPixCount,
long hitfinderMaxPixCount, long hitfinderMaxPixCount,
long hitfinderLocalBGRadius long hitfinderLocalBGRadius
) )
def peakfinder_8( def peakfinder_8(
int max_num_peaks, int max_num_peaks,
numpy.ndarray[numpy.float32_t, ndim=2, mode="c"] data, numpy.ndarray[numpy.float32_t, ndim=2, mode="c"] data,
numpy.ndarray[numpy.int8_t, ndim=2, mode="c"] mask, numpy.ndarray[numpy.int8_t, ndim=2, mode="c"] mask,
numpy.ndarray[numpy.float32_t, ndim=2, mode="c"] pix_r, numpy.ndarray[numpy.float32_t, ndim=2, mode="c"] pix_r,
long asic_nx, long asic_nx,
long asic_ny, long asic_ny,
long nasics_x, long nasics_x,
long nasics_y, long nasics_y,
float adc_thresh, float adc_thresh,
float hitfinder_min_snr, float hitfinder_min_snr,
long hitfinder_min_pix_count, long hitfinder_min_pix_count,
long hitfinder_max_pix_count, long hitfinder_max_pix_count,
long hitfinder_local_bg_radius long hitfinder_local_bg_radius
): ):
cdef numpy.int8_t *mask_pointer = &mask[0,0] cdef numpy.int8_t *mask_pointer = &mask[0,0]
cdef char *mask_char_pointer = <char*> mask_pointer cdef char *mask_char_pointer = <char*> mask_pointer
cdef tPeakList peak_list cdef tPeakList peak_list
allocatePeakList(&peak_list, max_num_peaks) allocatePeakList(&peak_list, max_num_peaks)
peakfinder8( peakfinder8(
&peak_list, &peak_list,
&data[0,0], &data[0,0],
mask_char_pointer, mask_char_pointer,
&pix_r[0,0], &pix_r[0,0],
asic_nx, asic_nx,
asic_ny, asic_ny,
nasics_x, nasics_x,
nasics_y, nasics_y,
adc_thresh, adc_thresh,
hitfinder_min_snr, hitfinder_min_snr,
hitfinder_min_pix_count, hitfinder_min_pix_count,
hitfinder_max_pix_count, hitfinder_max_pix_count,
hitfinder_local_bg_radius hitfinder_local_bg_radius
) )
cdef int i cdef int i
cdef float peak_x, peak_y, peak_value cdef float peak_x, peak_y, peak_value
cdef vector[double] peak_list_x cdef vector[double] peak_list_x
cdef vector[double] peak_list_y cdef vector[double] peak_list_y
cdef vector[double] peak_list_value cdef vector[double] peak_list_value
num_peaks = peak_list.nPeaks num_peaks = peak_list.nPeaks
if num_peaks > max_num_peaks: if num_peaks > max_num_peaks:
num_peaks = max_num_peaks num_peaks = max_num_peaks
for i in range(0, num_peaks): for i in range(0, num_peaks):
peak_x = peak_list.peak_com_x[i] peak_x = peak_list.peak_com_x[i]
peak_y = peak_list.peak_com_y[i] peak_y = peak_list.peak_com_y[i]
peak_value = peak_list.peak_totalintensity[i] peak_value = peak_list.peak_totalintensity[i]
peak_list_x.push_back(peak_x) peak_list_x.push_back(peak_x)
peak_list_y.push_back(peak_y) peak_list_y.push_back(peak_y)
peak_list_value.push_back(peak_value) peak_list_value.push_back(peak_value)
freePeakList(peak_list) freePeakList(peak_list)
return (peak_list_x, peak_list_y, peak_list_value) return (peak_list_x, peak_list_y, peak_list_value)

View File

@ -1,15 +1,15 @@
peakfinder8_include_dir = 'peakfinder8/' peakfinder8_include_dir = 'peakfinder8/'
peakfinder8_library_dir = 'peakfinder8/' peakfinder8_library_dir = 'peakfinder8/'
from distutils.core import setup , Extension from distutils.core import setup , Extension
from Cython.Build import cythonize from Cython.Build import cythonize
import numpy import numpy
peakfinder8_ext = Extension ( "peakfinder8_extension" , sources = [ "peakfinder8/cython/peakfinder8_extension.pyx"] , peakfinder8_ext = Extension ( "peakfinder8_extension" , sources = [ "peakfinder8/cython/peakfinder8_extension.pyx"] ,
include_dirs = [ peakfinder8_include_dir, numpy.get_include() ], include_dirs = [ peakfinder8_include_dir, numpy.get_include() ],
library_dirs = [ peakfinder8_library_dir ], library_dirs = [ peakfinder8_library_dir ],
libraries=["peakfinder8"], libraries=["peakfinder8"],
language = "c++" ) language = "c++" )
setup ( name = "peakfinder8_extension" , ext_modules = cythonize ( peakfinder8_ext )) setup ( name = "peakfinder8_extension" , ext_modules = cythonize ( peakfinder8_ext ))