From 9c205e3b54c5fe0a8917dfb94aad1d1e0f40aca0 Mon Sep 17 00:00:00 2001 From: Mario Mulansky Date: Fri, 24 Apr 2015 16:43:12 +0200 Subject: renamed interval -> edges in SpikeTrain --- pyspike/SpikeTrain.py | 21 ++++++++------------- 1 file 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) -- cgit v1.2.3