diff options
author | Mario Mulansky <mario.mulansky@gmx.net> | 2016-02-03 13:07:26 +0100 |
---|---|---|
committer | Mario Mulansky <mario.mulansky@gmx.net> | 2016-02-03 13:07:26 +0100 |
commit | b09561705ab9c67c93a384248f7c3bc9ad5bdd32 (patch) | |
tree | 077648ff6011c0ad48114d01f65e755223f0827a /pyspike/DiscreteFunc.py | |
parent | 2f48f27b55f63726216b6e674fb88b3790b59147 (diff) |
fixed spike-sync bug
fixed ugly bugs in code for computing multi-variate spike sync profile and
multi-variate spike sync value.
Diffstat (limited to 'pyspike/DiscreteFunc.py')
-rw-r--r-- | pyspike/DiscreteFunc.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/pyspike/DiscreteFunc.py b/pyspike/DiscreteFunc.py index fe97bc2..caad290 100644 --- a/pyspike/DiscreteFunc.py +++ b/pyspike/DiscreteFunc.py @@ -170,10 +170,6 @@ expected." start_ind, end_ind = get_indices(ival) value += np.sum(self.y[start_ind:end_ind]) multiplicity += np.sum(self.mp[start_ind:end_ind]) - if multiplicity == 0.0: - # empty profile, return spike sync of 1 - value = 1.0 - multiplicity = 1.0 return (value, multiplicity) def avrg(self, interval=None, normalize=True): @@ -190,7 +186,10 @@ expected." """ val, mp = self.integral(interval) if normalize: - return val/mp + if mp > 0: + return val/mp + else: + return 1.0 else: return val |