From c8f524db6e1add464aa3596ea46534c21096589e Mon Sep 17 00:00:00 2001 From: Mario Mulansky Date: Mon, 18 May 2015 15:08:24 +0200 Subject: cosmetics --- pyspike/PieceWiseConstFunc.py | 2 ++ pyspike/PieceWiseLinFunc.py | 1 + 2 files changed, 3 insertions(+) diff --git a/pyspike/PieceWiseConstFunc.py b/pyspike/PieceWiseConstFunc.py index 6d7a845..2705443 100644 --- a/pyspike/PieceWiseConstFunc.py +++ b/pyspike/PieceWiseConstFunc.py @@ -37,6 +37,7 @@ class PieceWiseConstFunc(object): "Invalid time: " + str(t) ind = np.searchsorted(self.x, t, side='right') + if isinstance(t, collections.Sequence): # t is a sequence of values # correct the cases t == x[0], t == x[-1] @@ -56,6 +57,7 @@ class PieceWiseConstFunc(object): val_ind = np.arange(len(ind))[ind_at_spike] # and for the arrays self.x, y1, y2 xy_ind = ind[ind_at_spike] + # use the middle of the left and right ISI value value[val_ind] = 0.5 * (self.y[xy_ind-1] + self.y[xy_ind-2]) return value else: # t is a single value diff --git a/pyspike/PieceWiseLinFunc.py b/pyspike/PieceWiseLinFunc.py index 03c2da2..c0dd475 100644 --- a/pyspike/PieceWiseLinFunc.py +++ b/pyspike/PieceWiseLinFunc.py @@ -44,6 +44,7 @@ class PieceWiseLinFunc: "Invalid time: " + str(t) ind = np.searchsorted(self.x, t, side='right') + if isinstance(t, collections.Sequence): # t is a sequence of values # correct the cases t == x[0], t == x[-1] -- cgit v1.2.3