summaryrefslogtreecommitdiff
path: root/pyspike
diff options
context:
space:
mode:
Diffstat (limited to 'pyspike')
-rw-r--r--pyspike/isi_distance.py54
-rw-r--r--pyspike/spike_distance.py47
-rw-r--r--pyspike/spike_sync.py36
3 files changed, 77 insertions, 60 deletions
diff --git a/pyspike/isi_distance.py b/pyspike/isi_distance.py
index 122e11d..e91dce2 100644
--- a/pyspike/isi_distance.py
+++ b/pyspike/isi_distance.py
@@ -20,14 +20,22 @@ def isi_profile(*args, **kwargs):
Valid call structures::
- isi_profile(st1, st2) # returns the bi-variate profile
+ isi_profile(st1, st2) # returns the bi-variate profile
isi_profile(st1, st2, st3) # multi-variate profile of 3 spike trains
spike_trains = [st1, st2, st3, st4] # list of spike trains
- isi_profile(spike_trains) # profile of the list of spike trains
+ isi_profile(spike_trains) # profile of the list of spike trains
isi_profile(spike_trains, indices=[0, 1]) # use only the spike trains
# given by the indices
+ The multivariate ISI distance profile for a set of spike trains is defined
+ as the average ISI-profile of all pairs of spike-trains:
+
+ .. math:: <I(t)> = \\frac{2}{N(N-1)} \\sum_{<i,j>} I^{i,j},
+
+ where the sum goes over all pairs <i,j>
+
+
:returns: The isi-distance profile :math:`I(t)`
:rtype: :class:`.PieceWiseConstFunc`
"""
@@ -43,10 +51,9 @@ def isi_profile(*args, **kwargs):
# isi_profile_bi
############################################################
def isi_profile_bi(spike_train1, spike_train2):
- """ Bi-variate ISI-profile.
- Computes the isi-distance profile :math:`I(t)` of the two given
- spike trains. Returns the profile as a PieceWiseConstFunc object.
- See :func:`.isi_profile`.
+ """ Specific function to compute a bivariate ISI-profile. This is a
+ deprecated function and should not be called directly. Use
+ :func:`.isi_profile` to compute ISI-profiles.
:param spike_train1: First spike train.
:type spike_train1: :class:`.SpikeTrain`
@@ -85,12 +92,10 @@ Falling back to slow python backend.")
# isi_profile_multi
############################################################
def isi_profile_multi(spike_trains, indices=None):
- """ computes the multi-variate isi distance profile for a set of spike
- trains. That is the average isi-distance of all pairs of spike-trains:
+ """ Specific function to compute the multivariate ISI-profile for a set of
+ spike trains. This is a deprecated function and should not be called
+ directly. Use :func:`.isi_profile` to compute ISI-profiles.
- .. math:: <I(t)> = \\frac{2}{N(N-1)} \\sum_{<i,j>} I^{i,j},
-
- where the sum goes over all pairs <i,j>
:param spike_trains: list of :class:`.SpikeTrain`
:param indices: list of indices defining which spike trains to use,
@@ -115,6 +120,14 @@ def isi_distance(*args, **kwargs):
.. math:: D_I = \\int_{T_0}^{T_1} I(t) dt.
+ In the multivariate case it is the integral over the multivariate
+ ISI-profile, i.e. the average profile over all spike train pairs:
+
+ .. math:: D_I = \\int_0^T \\frac{2}{N(N-1)} \\sum_{<i,j>} I^{i,j},
+
+ where the sum goes over all pairs <i,j>
+
+
Valid call structures::
@@ -139,14 +152,12 @@ def isi_distance(*args, **kwargs):
############################################################
-# isi_distance_bi
+# _isi_distance_bi
############################################################
def isi_distance_bi(spike_train1, spike_train2, interval=None):
- """ Computes the ISI-distance :math:`D_I` of the given spike trains. The
- isi-distance is the integral over the isi distance profile
- :math:`I(t)`:
-
- .. math:: D_I = \\int_{T_0}^{T_1} I(t) dt.
+ """ Specific function to compute the bivariate ISI-distance.
+ This is a deprecated function and should not be called directly. Use
+ :func:`.isi_distance` to compute ISI-distances.
:param spike_train1: First spike train.
:type spike_train1: :class:`.SpikeTrain`
@@ -181,12 +192,9 @@ def isi_distance_bi(spike_train1, spike_train2, interval=None):
# isi_distance_multi
############################################################
def isi_distance_multi(spike_trains, indices=None, interval=None):
- """ computes the multi-variate isi-distance for a set of spike-trains.
- That is the time average of the multi-variate spike profile:
-
- .. math:: D_I = \\int_0^T \\frac{2}{N(N-1)} \\sum_{<i,j>} I^{i,j},
-
- where the sum goes over all pairs <i,j>
+ """ Specific function to compute the multivariate ISI-distance.
+ This is a deprecfated function and should not be called directly. Use
+ :func:`.isi_distance` to compute ISI-distances.
:param spike_trains: list of :class:`.SpikeTrain`
:param indices: list of indices defining which spike trains to use,
diff --git a/pyspike/spike_distance.py b/pyspike/spike_distance.py
index 7acb959..0fd86c1 100644
--- a/pyspike/spike_distance.py
+++ b/pyspike/spike_distance.py
@@ -28,6 +28,13 @@ def spike_profile(*args, **kwargs):
spike_profile(spike_trains, indices=[0, 1]) # use only the spike trains
# given by the indices
+ The multivariate spike-distance profile is defined as the average of all
+ pairs of spike-trains:
+
+ .. math:: <S(t)> = \\frac{2}{N(N-1)} \\sum_{<i,j>} S^{i, j}`,
+
+ where the sum goes over all pairs <i,j>
+
:returns: The spike-distance profile :math:`S(t)`
:rtype: :class:`.PieceWiseConstLin`
"""
@@ -43,9 +50,9 @@ def spike_profile(*args, **kwargs):
# spike_profile_bi
############################################################
def spike_profile_bi(spike_train1, spike_train2):
- """ Computes the spike-distance profile :math:`S(t)` of the two given spike
- trains. Returns the profile as a PieceWiseLinFunc object. The SPIKE-values
- are defined positive :math:`S(t)>=0`.
+ """ Specific function to compute a bivariate SPIKE-profile. This is a
+ deprecated function and should not be called directly. Use
+ :func:`.spike_profile` to compute SPIKE-profiles.
:param spike_train1: First spike train.
:type spike_train1: :class:`.SpikeTrain`
@@ -86,12 +93,9 @@ Falling back to slow python backend.")
# spike_profile_multi
############################################################
def spike_profile_multi(spike_trains, indices=None):
- """ Computes the multi-variate spike distance profile for a set of spike
- trains. That is the average spike-distance of all pairs of spike-trains:
-
- .. math:: <S(t)> = \\frac{2}{N(N-1)} \\sum_{<i,j>} S^{i, j}`,
-
- where the sum goes over all pairs <i,j>
+ """ Specific function to compute a multivariate SPIKE-profile. This is a
+ deprecated function and should not be called directly. Use
+ :func:`.spike_profile` to compute SPIKE-profiles.
:param spike_trains: list of :class:`.SpikeTrain`
:param indices: list of indices defining which spike trains to use,
@@ -128,6 +132,13 @@ def spike_distance(*args, **kwargs):
spike_distance(spike_trains, indices=[0, 1]) # use only the spike trains
# given by the indices
+ In the multivariate case, the spike distance is given as the integral over
+ the multivariate profile, that is the average profile of all spike train
+ pairs:
+
+ .. math:: D_S = \\int_0^T \\frac{2}{N(N-1)} \\sum_{<i,j>}
+ S^{i, j} dt
+
:returns: The spike-distance :math:`D_S`.
:rtype: double
"""
@@ -144,11 +155,9 @@ def spike_distance(*args, **kwargs):
# spike_distance_bi
############################################################
def spike_distance_bi(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 spike distance profile
- :math:`S(t)`:
-
- .. math:: D_S = \int_{T_0}^{T_1} S(t) dt.
+ """ Specific function to compute a bivariate SPIKE-distance. This is a
+ deprecated function and should not be called directly. Use
+ :func:`.spike_distance` to compute SPIKE-distances.
:param spike_train1: First spike train.
:type spike_train1: :class:`.SpikeTrain`
@@ -183,13 +192,9 @@ def spike_distance_bi(spike_train1, spike_train2, interval=None):
# spike_distance_multi
############################################################
def spike_distance_multi(spike_trains, indices=None, interval=None):
- """ Computes the multi-variate spike distance for a set of spike trains.
- That is the time average of the multi-variate spike profile:
-
- .. math:: D_S = \\int_0^T \\frac{2}{N(N-1)} \\sum_{<i,j>}
- S^{i, j} dt
-
- where the sum goes over all pairs <i,j>
+ """ Specific function to compute a multivariate SPIKE-distance. This is a
+ deprecated function and should not be called directly. Use
+ :func:`.spike_distance` to compute SPIKE-distances.
:param spike_trains: list of :class:`.SpikeTrain`
:param indices: list of indices defining which spike trains to use,
diff --git a/pyspike/spike_sync.py b/pyspike/spike_sync.py
index ccb09d9..617dd86 100644
--- a/pyspike/spike_sync.py
+++ b/pyspike/spike_sync.py
@@ -34,6 +34,11 @@ def spike_sync_profile(*args, **kwargs):
spike_sync_profile(sts, indices=[0, 1]) # use only the spike trains
# given by the indices
+ In the multivariate case, the profile is defined as the number of
+ coincidences for each spike in the set of spike trains divided by the
+ number of spike trains pairs involving the spike train of containing this
+ spike, which is the number of spike trains minus one (N-1).
+
:returns: The spike-sync profile :math:`S_{sync}(t)`.
:rtype: :class:`pyspike.function.DiscreteFunction`
"""
@@ -49,10 +54,9 @@ def spike_sync_profile(*args, **kwargs):
# spike_sync_profile_bi
############################################################
def spike_sync_profile_bi(spike_train1, spike_train2, max_tau=None):
- """ Computes the spike-synchronization profile S_sync(t) of the two given
- spike trains. Returns the profile as a DiscreteFunction object. The S_sync
- values are either 1 or 0, indicating the presence or absence of a
- coincidence.
+ """ Specific function to compute a bivariate SPIKE-Sync-profile. This is a
+ deprecated function and should not be called directly. Use
+ :func:`.spike_sync_profile` to compute SPIKE-Sync-profiles.
:param spike_train1: First spike train.
:type spike_train1: :class:`pyspike.SpikeTrain`
@@ -98,11 +102,9 @@ Falling back to slow python backend.")
# spike_sync_profile_multi
############################################################
def spike_sync_profile_multi(spike_trains, indices=None, max_tau=None):
- """ Computes the multi-variate spike synchronization profile for a set of
- spike trains. For each spike in the set of spike trains, the multi-variate
- profile is defined as the number of coincidences divided by the number of
- spike trains pairs involving the spike train of containing this spike,
- which is the number of spike trains minus one (N-1).
+ """ Specific function to compute a multivariate SPIKE-Sync-profile.
+ This is a deprecated function and should not be called directly. Use
+ :func:`.spike_sync_profile` to compute SPIKE-Sync-profiles.
:param spike_trains: list of :class:`pyspike.SpikeTrain`
:param indices: list of indices defining which spike trains to use,
@@ -176,6 +178,9 @@ def spike_sync(*args, **kwargs):
spike_sync(spike_trains, indices=[0, 1]) # use only the spike trains
# given by the indices
+ The multivariate SPIKE-Sync is again defined as the overall ratio of all
+ coincidence values divided by the total number of spikes.
+
:returns: The spike synchronization value.
:rtype: `double`
"""
@@ -192,11 +197,9 @@ def spike_sync(*args, **kwargs):
# spike_sync_bi
############################################################
def spike_sync_bi(spike_train1, spike_train2, interval=None, max_tau=None):
- """ Computes the spike synchronization value SYNC of the given spike
- trains. The spike synchronization value is the computed as the total number
- of coincidences divided by the total number of spikes:
-
- .. math:: SYNC = \sum_n C_n / N.
+ """ Specific function to compute a bivariate SPIKE-Sync value.
+ This is a deprecated function and should not be called directly. Use
+ :func:`.spike_sync` to compute SPIKE-Sync values.
:param spike_train1: First spike train.
:type spike_train1: :class:`pyspike.SpikeTrain`
@@ -219,8 +222,9 @@ def spike_sync_bi(spike_train1, spike_train2, interval=None, max_tau=None):
# spike_sync_multi
############################################################
def spike_sync_multi(spike_trains, indices=None, interval=None, max_tau=None):
- """ Computes the multi-variate spike synchronization value for a set of
- spike trains.
+ """ Specific function to compute a multivariate SPIKE-Sync value.
+ This is a deprecated function and should not be called directly. Use
+ :func:`.spike_sync` to compute SPIKE-Sync values.
:param spike_trains: list of :class:`pyspike.SpikeTrain`
:param indices: list of indices defining which spike trains to use,