diff options
author | Mario Mulansky <mario.mulansky@gmx.net> | 2015-04-24 16:43:12 +0200 |
---|---|---|
committer | Mario Mulansky <mario.mulansky@gmx.net> | 2015-04-24 16:43:12 +0200 |
commit | 9c205e3b54c5fe0a8917dfb94aad1d1e0f40aca0 (patch) | |
tree | 66923e767bc9a20daf1534fd26919c20a8a38652 /pyspike/SpikeTrain.py | |
parent | c3e58aeb00ef2a386a4c6a620e4e13652c55aed5 (diff) |
renamed interval -> edges in SpikeTrain
Diffstat (limited to 'pyspike/SpikeTrain.py')
-rw-r--r-- | pyspike/SpikeTrain.py | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/pyspike/SpikeTrain.py b/pyspike/SpikeTrain.py index 89520c9..d586fe0 100644 --- a/pyspike/SpikeTrain.py +++ b/pyspike/SpikeTrain.py @@ -6,29 +6,24 @@ Distributed under the BSD License """ import numpy as np -import collections class SpikeTrain(object): """ Class representing spike trains for the PySpike Module.""" - def __init__(self, spike_times, interval): + def __init__(self, spike_times, edges): """ Constructs the SpikeTrain :param spike_times: ordered array of spike times. - :param interval: 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 edges: The edges of the spike train. Given as a pair of floats + (T0, T1) or a single float T1, where then T0=0 is assumed. """ # TODO: sanity checks self.spikes = np.array(spike_times, dtype=float) - # check if interval is as sequence - if not isinstance(interval, collections.Sequence): - # treat value as end time and assume t_start = 0 + try: + self.t_start = float(edges[0]) + self.t_end = float(edges[1]) + except: self.t_start = 0.0 - self.t_end = float(interval) - else: - # extract times from sequence - self.t_start = float(interval[0]) - self.t_end = float(interval[1]) + self.t_end = float(edges) |