summaryrefslogtreecommitdiff
path: root/pyspike/DiscreteFunc.py
diff options
context:
space:
mode:
authorMario Mulansky <mario.mulansky@gmx.net>2017-10-04 22:01:52 -0700
committerMario Mulansky <mario.mulansky@gmx.net>2017-10-04 22:01:52 -0700
commit2af020ee53a006436fb69bf80b28d5a850ae8c43 (patch)
tree988d0be91bc678169fdc7934d5494dcf9f8f8768 /pyspike/DiscreteFunc.py
parent9fa10fe30e3216170f41ce47797c7a3a56e17a5f (diff)
parentde571efd0894f0332eadec7e4a2184f9a4ffaf25 (diff)
Merge branch 'master' of github.com:mariomulansky/PySpike
Diffstat (limited to 'pyspike/DiscreteFunc.py')
-rw-r--r--pyspike/DiscreteFunc.py9
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