summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Mulansky <mario.mulansky@gmx.net>2015-04-24 16:48:24 +0200
committerMario Mulansky <mario.mulansky@gmx.net>2015-04-24 16:48:24 +0200
commitf7ad8e6b23f706a2371e2bc25b533b59f8dea137 (patch)
treebbd02213ea45d93d76ed7e6517bbabd3bef279ab
parent9c205e3b54c5fe0a8917dfb94aad1d1e0f40aca0 (diff)
renamed interval -> edges in load functions
-rw-r--r--pyspike/spikes.py20
-rw-r--r--test/test_distance.py2
-rw-r--r--test/test_spikes.py4
3 files changed, 13 insertions, 13 deletions
diff --git a/pyspike/spikes.py b/pyspike/spikes.py
index 128873d..9401b6e 100644
--- a/pyspike/spikes.py
+++ b/pyspike/spikes.py
@@ -14,11 +14,11 @@ from pyspike import SpikeTrain
############################################################
# spike_train_from_string
############################################################
-def spike_train_from_string(s, interval, sep=' ', is_sorted=False):
+def spike_train_from_string(s, edges, sep=' ', is_sorted=False):
""" Converts a string of times into a :class:`pyspike.SpikeTrain`.
:param s: the string with (ordered) spike times.
- :param interval: interval defining the edges of the spike train.
+ :param edges: interval defining the edges of the spike train.
Given as a pair of floats (T0, T1) or a single float T1, where T0=0 is
assumed.
:param sep: The separator between the time numbers, default=' '.
@@ -27,15 +27,15 @@ def spike_train_from_string(s, interval, sep=' ', is_sorted=False):
:returns: :class:`pyspike.SpikeTrain`
"""
if not(is_sorted):
- return SpikeTrain(np.sort(np.fromstring(s, sep=sep)), interval)
+ return SpikeTrain(np.sort(np.fromstring(s, sep=sep)), edges)
else:
- return SpikeTrain(np.fromstring(s, sep=sep), interval)
+ return SpikeTrain(np.fromstring(s, sep=sep), edges)
############################################################
# load_spike_trains_txt
############################################################
-def load_spike_trains_from_txt(file_name, interval=None,
+def load_spike_trains_from_txt(file_name, edges,
separator=' ', comment='#', is_sorted=False):
""" Loads a number of spike trains from a text file. Each line of the text
file should contain one spike train as a sequence of spike times separated
@@ -44,10 +44,10 @@ def load_spike_trains_from_txt(file_name, interval=None,
spike trains.
:param file_name: The name of the text file.
- :param interval: A pair (T_start, T_end) of values representing the
- start and end time of the spike train measurement
- or a single value representing the end time, the
- T_start is then assuemd as 0.
+ :param edges: A pair (T_start, T_end) of values representing the
+ start and end time of the spike train measurement
+ or a single value representing the end time, the
+ T_start is then assuemd as 0.
:param separator: The character used to seprate the values in the text file
:param comment: Lines starting with this character are ignored.
:param sort: If true, the spike times are order via `np.sort`, default=True
@@ -58,7 +58,7 @@ def load_spike_trains_from_txt(file_name, interval=None,
for line in spike_file:
if len(line) > 1 and not line.startswith(comment):
# use only the lines with actual data and not commented
- spike_train = spike_train_from_string(line, interval,
+ spike_train = spike_train_from_string(line, edges,
separator, is_sorted)
spike_trains.append(spike_train)
return spike_trains
diff --git a/test/test_distance.py b/test/test_distance.py
index 88cf40e..0059001 100644
--- a/test/test_distance.py
+++ b/test/test_distance.py
@@ -262,7 +262,7 @@ def test_multi_spike_sync():
# multivariate regression test
spike_trains = spk.load_spike_trains_from_txt("test/SPIKE_Sync_Test.txt",
- interval=[0, 4000])
+ edges=[0, 4000])
# extract all spike times
spike_times = np.array([])
for st in spike_trains:
diff --git a/test/test_spikes.py b/test/test_spikes.py
index 6e11c07..d4eb131 100644
--- a/test/test_spikes.py
+++ b/test/test_spikes.py
@@ -16,7 +16,7 @@ import pyspike as spk
def test_load_from_txt():
spike_trains = spk.load_spike_trains_from_txt("test/PySpike_testdata.txt",
- interval=(0, 4000))
+ edges=(0, 4000))
assert len(spike_trains) == 40
# check the first spike train
@@ -49,7 +49,7 @@ def check_merged_spikes(merged_spikes, spike_trains):
def test_merge_spike_trains():
# first load the data
spike_trains = spk.load_spike_trains_from_txt("test/PySpike_testdata.txt",
- interval=(0, 4000))
+ edges=(0, 4000))
merged_spikes = spk.merge_spike_trains([spike_trains[0], spike_trains[1]])
# test if result is sorted