Skip to content

Commit

Permalink
Revert some changes causing performance regression
Browse files Browse the repository at this point in the history
  • Loading branch information
tritemio committed Feb 9, 2015
1 parent aa0c1c6 commit 0d55235
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions fretbursts/burstsearch/burstsearchlib_c.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ To compile run::
python setup.py build_ext --inplace
"""
from builtins import range, zip

import sys
import numpy as np
cimport numpy as np


cdef pprint(s):
"""Print immediately, even if inside a busy loop."""
sys.stdout.write(s)
Expand Down Expand Up @@ -49,13 +49,14 @@ def bsearch_c(np.int64_t[:] t, np.int16_t L, np.int16_t m, np.float64_t T,
"""
cdef int i, i_start, i_end
cdef np.int64_t burst_start, burst_end, t1, t2
cdef np.int8_t[:] above_min_rate = np.empty(t.size - m + 1, dtype='int8')
cdef np.int8_t[:] above_min_rate = np.empty(t.size - m + 1,
dtype=np.int8)
cdef np.int8_t in_burst = False

if verbose: pprint('C Burst search: %s\n' % label)
bursts = []

for i in range(t.size-m+1):
for i in xrange(t.size-m+1):
if (t[i+m-1] - t[i]) <= T:
if not in_burst:
i_start = i
Expand Down Expand Up @@ -105,7 +106,7 @@ def mch_count_ph_in_bursts_c(mburst, Mask):
for i,b in enumerate(bursts):
# Counts donors between start and end of current burst b
#num_ph[i] = mask[b[iistart]:b[iiend]+1].sum()
for ii in range(b[iistart],b[iiend]+1):
for ii in xrange(b[iistart], b[iiend]+1):
num_ph[i] += mask[ii]
#count_ph_in_bursts(bursts, mask).astype(float)
Num_ph.append(num_ph.astype(np.float))
Expand Down

0 comments on commit 0d55235

Please sign in to comment.