Skip to content
Snippets Groups Projects
Commit 4139e29a authored by Kipp Cannon's avatar Kipp Cannon
Browse files

SNRPDF: silence math domain error

- when initializing an SNR PDF cache with new entries, a math domain error
  can occur when an instrument combination is impossible.  this patch fixes
  it
- it's very odd that this code worked in the past.  Python must be changing
  its behaviour.  commit 29a7482f contains
  both the original version of this code and the data file it successfully
  generated at the time ... so ... it must have worked.  I don't know what
  else to say, but I'm not crazy.
parent e11f5c45
No related branches found
No related tags found
No related merge requests found
......@@ -423,7 +423,7 @@ class SNRPDF(object):
with numpy.errstate(divide = "ignore"):
lnbinnedarray.array = numpy.log(lnbinnedarray.array)
pdf = rate.InterpBinnedArray(lnbinnedarray, fill_value = NegInf)
self.snr_joint_pdf_cache[key] = self.cacheentry(math.log(P_instruments[instruments]), pdf, binnedarray)
self.snr_joint_pdf_cache[key] = self.cacheentry(math.log(P_instruments[instruments]) if P_instruments[instruments] else NegInf, pdf, binnedarray)
@staticmethod
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment