summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Mulansky <mario.mulansky@gmx.net>2014-10-22 22:34:41 +0200
committerMario Mulansky <mario.mulansky@gmx.net>2014-10-22 22:34:41 +0200
commit316f3650a469a5e487790df142f59dcf1efac609 (patch)
treeb6f4884917d3bac51e8b302c4c8f8cf6d04e4a64
parent11f05d9dac3711d89db37a043db3d9437958c6f3 (diff)
docs for interval averaging, fixed doc typos
-rw-r--r--pyspike/distances.py10
-rw-r--r--pyspike/function.py14
2 files changed, 17 insertions, 7 deletions
diff --git a/pyspike/distances.py b/pyspike/distances.py
index b0af24c..ae564d2 100644
--- a/pyspike/distances.py
+++ b/pyspike/distances.py
@@ -79,7 +79,7 @@ def spike_profile(spikes1, spikes2):
:param spikes1: ordered array of spike times with auxiliary spikes.
:param spikes2: ordered array of spike times with auxiliary spikes.
- :returns: The spike-distance profile :math:`S_{spike}(t).
+ :returns: The spike-distance profile :math:`S_{spike}(t)`.
:rtype: :class:`pyspike.function.PieceWiseLinFunc`
"""
@@ -110,7 +110,7 @@ Falling back to slow python backend.")
def spike_distance(spikes1, spikes2):
""" Computes the spike-distance S of the given spike trains. The
spike-distance is the integral over the isi distance profile S_spike(t):
- S = \int_^T S_spike(t) dt.
+ :math:`S = \int_^T S_spike(t) dt`.
:param spikes1: ordered array of spike times with auxiliary spikes.
:param spikes2: ordered array of spike times with auxiliary spikes.
@@ -131,7 +131,7 @@ def _generic_profile_multi(spike_trains, pair_distance_func, indices=None):
Computes the multi-variate distance for a set of spike-trains using the
pair_dist_func to compute pair-wise distances. That is it computes the
average distance of all pairs of spike-trains:
- S(t) = 2/((N(N-1)) sum_{<i,j>} S_{i,j},
+ :math:`S(t) = 2/((N(N-1)) sum_{<i,j>} S_{i,j}`,
where the sum goes over all pairs <i,j>.
Args:
- spike_trains: list of spike trains
@@ -254,14 +254,16 @@ def isi_distance_multi(spike_trains, indices=None):
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:
- S_spike(t) = 2/((N(N-1)) sum_{<i,j>} S_{spike}^{i, j},
+ :math:`S_spike(t) = 2/((N(N-1)) sum_{<i,j>} S_{spike}^{i, j}`,
where the sum goes over all pairs <i,j>
+
:param spike_trains: list of spike trains
:param indices: list of indices defining which spike trains to use,
if None all given spike trains are used (default=None)
:type indices: list or None
:returns: The averaged spike profile :math:`<S_{spike}>(t)`
:rtype: :class:`pyspike.function.PieceWiseLinFunc`
+
"""
return _generic_profile_multi(spike_trains, spike_profile, indices)
diff --git a/pyspike/function.py b/pyspike/function.py
index e340096..d53042f 100644
--- a/pyspike/function.py
+++ b/pyspike/function.py
@@ -42,7 +42,7 @@ class PieceWiseConstFunc(object):
""" Checks if the function is equal to another function up to `decimal`
precision.
- :param: other: another :class:`PieceWiseConstFunc`
+ :param other: another :class:`PieceWiseConstFunc`
:returns: True if the two functions are equal up to `decimal` decimals,
False otherwise
:rtype: bool
@@ -78,8 +78,12 @@ class PieceWiseConstFunc(object):
""" Computes the average of the piece-wise const function:
:math:`a = 1/T int_0^T f(x) dx` where T is the length of the interval.
+ :param interval: averaging interval given as a pair of floats, if None
+ the average over the whole function is computed.
+ :type interval: Pair of floats or None.
:returns: the average a.
:rtype: double
+
"""
if interval is None:
# no interval given, average over the whole spike train
@@ -160,7 +164,7 @@ class PieceWiseLinFunc:
def copy(self):
""" Returns a copy of itself
- :rtype: :class`PieceWiseLinFunc`
+ :rtype: :class:`PieceWiseLinFunc`
"""
return PieceWiseLinFunc(self.x, self.y1, self.y2)
@@ -168,7 +172,7 @@ class PieceWiseLinFunc:
""" Checks if the function is equal to another function up to `decimal`
precision.
- :param: other: another :class:`PieceWiseLinFunc`
+ :param other: another :class:`PieceWiseLinFunc`
:returns: True if the two functions are equal up to `decimal` decimals,
False otherwise
:rtype: bool
@@ -203,8 +207,12 @@ class PieceWiseLinFunc:
""" Computes the average of the piece-wise linear function:
:math:`a = 1/T int_0^T f(x) dx` where T is the length of the interval.
+ :param interval: averaging interval given as a pair of floats, if None
+ the average over the whole function is computed.
+ :type interval: Pair of floats or None.
:returns: the average a.
:rtype: double
+
"""
def intermediate_value(x0, x1, y0, y1, x):