summaryrefslogtreecommitdiff
path: root/pyspike/spike_distance.py
diff options
context:
space:
mode:
authorMario Mulansky <mario.mulansky@gmx.net>2015-12-14 17:25:53 +0100
committerMario Mulansky <mario.mulansky@gmx.net>2015-12-14 17:25:53 +0100
commitf7b90618f01d4dbf015b3d21c6c06dec8d26bd9f (patch)
tree799a2fa0e0f7558ece400de15ca8d1358565c066 /pyspike/spike_distance.py
parentd985f3a8de6ae840c8a127653b3d9affb1a8aa40 (diff)
parent9061f2a0c13134e53f937d730295a421fd671ea3 (diff)
Merge pull request #20 from mariomulansky/develop
Develop merge for version 0.4
Diffstat (limited to 'pyspike/spike_distance.py')
-rw-r--r--pyspike/spike_distance.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/pyspike/spike_distance.py b/pyspike/spike_distance.py
index ac2d260..e418283 100644
--- a/pyspike/spike_distance.py
+++ b/pyspike/spike_distance.py
@@ -2,6 +2,9 @@
# Copyright 2014-2015, Mario Mulansky <mario.mulansky@gmx.net>
# Distributed under the BSD License
+from __future__ import absolute_import
+
+import pyspike
from pyspike import PieceWiseLinFunc
from pyspike.generic import _generic_profile_multi, _generic_distance_multi, \
_generic_distance_matrix
@@ -31,14 +34,15 @@ def spike_profile(spike_train1, spike_train2):
# cython implementation
try:
- from cython.cython_profiles import spike_profile_cython \
+ from .cython.cython_profiles import spike_profile_cython \
as spike_profile_impl
except ImportError:
- print("Warning: spike_profile_cython not found. Make sure that \
+ if not(pyspike.disable_backend_warning):
+ print("Warning: spike_profile_cython not found. Make sure that \
PySpike is installed by running\n 'python setup.py build_ext --inplace'!\n \
Falling back to slow python backend.")
# use python backend
- from cython.python_backend import spike_distance_python \
+ from .cython.python_backend import spike_distance_python \
as spike_profile_impl
times, y_starts, y_ends = spike_profile_impl(
@@ -54,7 +58,8 @@ Falling back to slow python backend.")
############################################################
def spike_distance(spike_train1, spike_train2, interval=None):
""" Computes the spike-distance :math:`D_S` of the given spike trains. The
- spike-distance is the integral over the isi distance profile :math:`S(t)`:
+ spike-distance is the integral over the spike distance profile
+ :math:`S(t)`:
.. math:: D_S = \int_{T_0}^{T_1} S(t) dt.
@@ -73,7 +78,7 @@ def spike_distance(spike_train1, spike_train2, interval=None):
# distance over the whole interval is requested: use specific function
# for optimal performance
try:
- from cython.cython_distances import spike_distance_cython \
+ from .cython.cython_distances import spike_distance_cython \
as spike_distance_impl
return spike_distance_impl(spike_train1.get_spikes_non_empty(),
spike_train2.get_spikes_non_empty(),