Revision 470d4aa5204283b1287e544b0c03287f342c6078 authored by Miriam Cabero on 24 April 2020, 09:15:20 UTC, committed by GitHub on 24 April 2020, 09:15:20 UTC
1 parent 4e6ed62
eventmgr_cython.pyx
import numpy
cimport numpy
from cython import wraparound, boundscheck, cdivision
ctypedef fused REALTYPE:
float
double
@boundscheck(False)
@wraparound(False)
@cdivision(True)
def findchirp_cluster_over_window_cython\
(numpy.ndarray[numpy.int32_t, ndim=1] times,
numpy.ndarray[REALTYPE, ndim=1] absvalues, int window_length,
numpy.ndarray[numpy.int32_t, ndim=1] indices, int tlen):
cdef int j = 0
cdef int curr_ind = 0
cdef int i
for i in range(tlen):
if ((times[i] - times[curr_ind]) > window_length):
j += 1
indices[j] = i
curr_ind = i
elif (absvalues[i] > absvalues[curr_ind]):
indices[j] = i
curr_ind = i
return j
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...