1
from numpy import pi, exp, sqrt, cos
4
# TODO intro the version idea of peter's see email from him on Wednesday, 26 May 2010
6
def goertzel_inner(np.ndarray[np.float64_t, ndim=1] x, int N, int period):
7
"""returns the power from series x for period"""
9
cdef np.float64_t coeff, s, s_prev, s_prev2, power
11
coeff = 2.0 * cos(2 * pi / period)
15
s = x[n] + coeff * s_prev - s_prev2
19
power = sqrt(s_prev2**2 + s_prev**2 - coeff * s_prev2 * s_prev)
22
def ipdft_inner(np.ndarray[np.float64_t, ndim=1] x,
23
np.ndarray[np.complex128_t, ndim=1] X,
24
np.ndarray[np.complex128_t, ndim=1] W,
26
"""use this when repeated calls for window of same length are to be
29
cdef np.complex128_t w
39
def autocorr_inner(np.ndarray[np.float64_t, ndim=1] x, np.ndarray[np.float64_t, ndim=1] xc, int N):
42
for m in range(-N+1, N):
45
xc[m+N-1] += (x[n]*x[n-m])
47
def seq_to_symbols(char* seq, list motifs, int motif_length,
48
np.ndarray[np.uint8_t, ndim=1] result):
49
cdef int i, j, N, num_motifs
53
num_motifs = len(motifs)
54
motif_length = len(motifs[0])
55
for i in range(N - motif_length + 1):
56
got = seq[i: i+motif_length]
57
for j in range(num_motifs):
b'\\ No newline at end of file'