diff options
author | Mario Mulansky <mario.mulansky@gmx.net> | 2015-05-18 15:08:24 +0200 |
---|---|---|
committer | Mario Mulansky <mario.mulansky@gmx.net> | 2015-05-18 15:08:24 +0200 |
commit | c8f524db6e1add464aa3596ea46534c21096589e (patch) | |
tree | 997d0ceda0af02932db66d2efcedf40dbcd55769 /pyspike/PieceWiseConstFunc.py | |
parent | a61a14295e28e6e95fa510693a11ae8c78a552ab (diff) |
cosmetics
Diffstat (limited to 'pyspike/PieceWiseConstFunc.py')
-rw-r--r-- | pyspike/PieceWiseConstFunc.py | 2 |
1 files changed, 2 insertions, 0 deletions
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 |