Add check in Decay.decay_constant for erroneous half-life

This commit is contained in:
Paul Romano 2022-05-24 12:47:36 -05:00
parent 7fcc204726
commit 19494cccd0

View file

@ -465,11 +465,10 @@ class Decay(EqualityMixin):
@property
def decay_constant(self):
if hasattr(self.half_life, 'n'):
return log(2.)/self.half_life
else:
mu, sigma = self.half_life
return ufloat(log(2.)/mu, log(2.)/mu**2*sigma)
if self.half_life.n == 0.0:
name = self.nuclide['name']
raise ValueError(f"{name} is listed as unstable but has a zero half-life.")
return log(2.)/self.half_life
@property
def decay_energy(self):