Commit 633ddc98 authored by Gordian Edenhofer's avatar Gordian Edenhofer Committed by Philipp Arras
Browse files

PoissonianEnergy: Yield descriptive error messages

parent b3bf7cd9
Pipeline #112068 passed with stages
in 21 minutes and 14 seconds
......@@ -374,9 +374,11 @@ class PoissonianEnergy(LikelihoodEnergyOperator):
def __init__(self, d):
if not isinstance(d, Field) or not np.issubdtype(d.dtype, np.integer):
raise TypeError
te = "data is of invalid data-type; counts need to be integers"
raise TypeError(te)
if np.any(d.val < 0):
raise ValueError
ve = "count data is negative and thus can not be Poissonian"
raise ValueError(ve)
self._d = d
self._domain = DomainTuple.make(d.domain)
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