def test_Transmutation_invalidReactionTypes(self): data = {"products": [""], "branch": 1.0} errorCount = 0 for _ in range(0, 5): rxn = randomString(3) data["type"] = rxn if rxn in transmutations.TRANSMUTATION_TYPES: self.assertIsNotNone(transmutations.Transmutation(None, data)) else: with self.assertRaises(exceptions.InvalidSelectionError): errorCount += 1 transmutations.Transmutation(None, data) self.assertGreater(errorCount, 2)
def test_Transmutation_validReactionTypes(self): data = {"products": [""]} for rxn in transmutations.TRANSMUTATION_TYPES: data["type"] = rxn temp = transmutations.Transmutation(None, data) self.assertEqual(temp.type, rxn) self.assertEqual(temp.productParticle, transmutations.PRODUCT_PARTICLES.get(temp.type))
def _processBurnData(self, burnInfo): """ Process YAML burn transmutation, decay, and spontaneous fission data for this nuclide. This clears out any existing transmutation/decay information before processing. Parameters ---------- burnInfo: list List of dictionaries containing burn information for the current nuclide """ self.decays = [] self.trans = [] for nuclideBurnCategory in burnInfo: # Check that the burn category has only one defined burn type if len(nuclideBurnCategory) > 1: raise ValueError( "Improperly defined ``burn-chain`` of {}. {} should be a single burn type.".format( self, nuclideBurnCategory.keys() ) ) nuclideBurnType = list(nuclideBurnCategory.keys())[0] if nuclideBurnType == self.TRANSMUTATION: self.trans.append( transmutations.Transmutation( self, nuclideBurnCategory[nuclideBurnType] ) ) elif nuclideBurnType == self.DECAY: self.decays.append( transmutations.DecayMode(self, nuclideBurnCategory[nuclideBurnType]) ) elif nuclideBurnType == self.SPONTANEOUS_FISSION: self.nuSF = nuclideBurnCategory[nuclideBurnType] else: raise Exception( "Undefined Burn Data {} for {}. Expected {}, {}, or {}." "".format( nuclideBurnType, self, self.TRANSMUTATION, self.DECAY, self.SPONTANEOUS_FISSION, ) )
def test_Transmutation_productParticle(self): temp = transmutations.Transmutation(None, { "products": [""], "type": "nalph" }) self.assertEqual(temp.productParticle, "HE4")