예제 #1
0
 def test_DecayMode_invalidReactionTypes(self):
     data = {"products": [""], "branch": 1.0, "halfLifeInSeconds": 1.0}
     for _ in range(0, 25):
         rxn = randomString(3)
         data["type"] = rxn
         if rxn in transmutations.DECAY_MODES:
             self.assertIsNotNone(transmutations.DecayMode(None, data))
         else:
             with self.assertRaises(exceptions.InvalidSelectionError):
                 transmutations.DecayMode(None, data)
예제 #2
0
    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,
                    )
                )
예제 #3
0
 def test_DecayMode_validReactionTypes(self):
     data = {"products": [""], "branch": 1.0, "halfLifeInSeconds": 1.0}
     for rxn in transmutations.DECAY_MODES:
         data["type"] = rxn
         decay = transmutations.DecayMode(None, data)
         self.assertEqual(decay.type, rxn)