summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Mulansky <mario.mulansky@gmx.net>2014-10-16 14:16:32 +0200
committerMario Mulansky <mario.mulansky@gmx.net>2014-10-16 14:16:32 +0200
commitd869d4d822c651ea3d094eaf17ba7732bf91136f (patch)
tree9b1633dc2166d5edd2d12960d467df590cd4be57
parent165b1e7c707324115ab2d21a78716ea2e243fc60 (diff)
new function names in examples and readme
-rw-r--r--.travis.yml2
-rw-r--r--Readme.md12
-rw-r--r--examples/plot.py4
-rw-r--r--pyspike/distances.py2
4 files changed, 10 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml
index 31df3bc..43f3ef7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,8 +7,6 @@ install:
- pip install -q cython
script:
-# - export PYTHONPATH=$PYTHONPATH:$TRAVIS_BUILD_DIR
- python setup.py build_ext --inplace
-# - cd test
- nosetests
diff --git a/Readme.md b/Readme.md
index c12b0b6..be42c4a 100644
--- a/Readme.md
+++ b/Readme.md
@@ -33,7 +33,6 @@ To install PySpike, simply download the source, e.g. from Github, and run the `s
Then you can run the tests using the `nosetests` test framework:
- cd test
nosetests
Finally, you should make PySpike's installation folder known to Python to be able to import pyspike in your own projects.
@@ -70,7 +69,7 @@ If you load spike trains yourself, i.e. from data files with different structure
Both the ISI and the SPIKE distance computation require the presence of auxiliary spikes, so make sure you have those in your spike trains:
spike_train = spk.add_auxiliary_spikes(spike_train, (T_start, T_end))
- # you provide only a single value, it is interpreted as T_end, while T_start=0
+ # if you provide only a single value, it is interpreted as T_end, while T_start=0
spike_train = spk.add_auxiliary_spikes(spike_train, T_end)
## Computing bi-variate distances
@@ -98,14 +97,17 @@ The following code loads some exemplary spike trains, computes the dissimilarity
spike_trains = spk.load_spike_trains_from_txt("PySpike_testdata.txt",
time_interval=(0, 4000))
- isi_profile = spk.isi_distance(spike_trains[0], spike_trains[1])
+ isi_profile = spk.isi_profile(spike_trains[0], spike_trains[1])
x, y = isi_profile.get_plottable_data()
plt.plot(x, y, '--k')
print("ISI distance: %.8f" % isi_profil.avrg())
plt.show()
-The ISI-profile is a piece-wise constant function, there the function `isi_distance` returns an instance of the `PieceWiseConstFunc` class.
-As above, this class allows you to obtain arrays that can be used to plot the function with `plt.plt`, but also to compute the absolute average, which amounts to the final scalar ISI-distance.
+The ISI-profile is a piece-wise constant function, there the function `isi_profile` returns an instance of the `PieceWiseConstFunc` class.
+As shown above, this class allows you to obtain arrays that can be used to plot the function with `plt.plt`, but also to compute the absolute average, which amounts to the final scalar ISI-distance.
+If you are only interested in the scalar ISI-distance and not the profile, you can simly use:
+
+ isi_dist = spk.isi_distance(spike_trains[0], spike_trains[1])
Furthermore, PySpike provides the `average_profile` function that can be used to compute the average profile of a list of given `PieceWiseConstFunc` instances.
diff --git a/examples/plot.py b/examples/plot.py
index 4ac8f5d..6da7f49 100644
--- a/examples/plot.py
+++ b/examples/plot.py
@@ -22,7 +22,7 @@ spike_trains = spk.load_spike_trains_from_txt("PySpike_testdata.txt",
for (i, spikes) in enumerate(spike_trains):
plt.plot(spikes, i*np.ones_like(spikes), 'o')
-f = spk.isi_distance(spike_trains[0], spike_trains[1])
+f = spk.isi_profile(spike_trains[0], spike_trains[1])
x, y = f.get_plottable_data()
plt.figure()
@@ -30,7 +30,7 @@ plt.plot(x, np.abs(y), '--k')
print("Average: %.8f" % f.avrg())
-f = spk.spike_distance(spike_trains[0], spike_trains[1])
+f = spk.spike_profile(spike_trains[0], spike_trains[1])
x, y = f.get_plottable_data()
print(x)
print(y)
diff --git a/pyspike/distances.py b/pyspike/distances.py
index e50772f..9056863 100644
--- a/pyspike/distances.py
+++ b/pyspike/distances.py
@@ -284,7 +284,7 @@ def isi_distance_matrix(spike_trains, indices=None):
distance_matrix = np.zeros((len(indices), len(indices)))
for i, j in pairs:
- d = isi_distance(spike_trains[i], spike_trains[j]).avrg()
+ d = isi_distance(spike_trains[i], spike_trains[j])
distance_matrix[i, j] = d
distance_matrix[j, i] = d
return distance_matrix