Commit bc834e0f authored by Kipp Cannon's avatar Kipp Cannon

rate.BinnedLnPDF: don't trap exceptions in .normalize()

- check for 0 before taking log() instead of trapping ValueError so that the exception handling doesn't hide other issues.
Original: c5a11873399a0092a62053eff4bb4b2915ae7485
parent 0e1f0a03
......@@ -2212,10 +2212,7 @@ class BinnedLnPDF(BinnedDensity):
reported for those bins will be 0.
"""
self.norm = self.array.sum()
try:
self.norm = math.log(self.norm)
except ValueError:
self.norm = NegInf
self.norm = math.log(self.norm) if self.norm != 0. else NegInf
def to_xml(self, *args, **kwargs):
elem = super(BinnedLnPDF, self).to_xml(*args, **kwargs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment