Beispiel #1
0
 def test_nucBase_AllAbundancesAddToOne(self):
     for zz in range(1, 102):
         clides = nuclideBases.isotopes(zz)
         # We only process nuclides with measured masses. Some are purely theoretical, mostly over z=100
         self.assertTrue(len(clides) > 0,
                         msg="z={} unexpectedly has no nuclides".format(zz))
         total = sum([nn.abundance for nn in clides if nn.a > 0])
         self.assertAlmostEqual(
             any([nn.abundance > 0 for nn in clides]),
             total,
             delta=1e-4,
             msg="Abundance ({}) not 1.0 for nuclideBases:\n  {}"
             "".format(total, "\n  ".join(repr(nn) for nn in clides)),
         )
Beispiel #2
0
 def test_nucBases_Z295RaisesException(self):
     with self.assertRaises(Exception):
         nuclideBases.isotopes(295)
Beispiel #3
0
 def test_nucBases_NegativeZRaisesException(self):
     for _ in range(0, 5):
         with self.assertRaises(Exception):
             nuclideBases.isotopes(random.randint(-1000, -1))