summaryrefslogtreecommitdiff
path: root/pyspike/cython_distance.pyx
diff options
context:
space:
mode:
authorMario Mulansky <mario.mulansky@gmx.net>2014-10-02 14:30:02 +0200
committerMario Mulansky <mario.mulansky@gmx.net>2014-10-02 14:30:02 +0200
commit7bbbf06c23e8eb727f45dc47d6613fb7d03f4c8f (patch)
treef631e7ce814e6ca4d3aba2e75b6443f4b0351b86 /pyspike/cython_distance.pyx
parent99730806c22f79089d4cdaf2a1ce713712ad557b (diff)
+isi distance matrix with examples
Diffstat (limited to 'pyspike/cython_distance.pyx')
-rw-r--r--pyspike/cython_distance.pyx5
1 files changed, 3 insertions, 2 deletions
diff --git a/pyspike/cython_distance.pyx b/pyspike/cython_distance.pyx
index 23ffc37..2be8525 100644
--- a/pyspike/cython_distance.pyx
+++ b/pyspike/cython_distance.pyx
@@ -29,6 +29,7 @@ import numpy as np
cimport numpy as np
from libc.math cimport fabs
+from libc.math cimport fmax
DTYPE = np.float
ctypedef np.float_t DTYPE_t
@@ -56,7 +57,7 @@ def isi_distance_cython(double[:] s1,
isi_values = np.empty(N1+N2-1)
with nogil: # release the interpreter to allow multithreading
- isi_values[0] = (nu1-nu2)/max(nu1,nu2)
+ isi_values[0] = (nu1-nu2)/fmax(nu1,nu2)
index1 = 0
index2 = 0
index = 1
@@ -84,7 +85,7 @@ def isi_distance_cython(double[:] s1,
nu1 = s1[index1+1]-s1[index1]
nu2 = s2[index2+1]-s2[index2]
# compute the corresponding isi-distance
- isi_values[index] = (nu1 - nu2) / max(nu1, nu2)
+ isi_values[index] = (nu1 - nu2) / fmax(nu1, nu2)
index += 1
# the last event is the interval end
spike_events[index] = s1[N1]