Ejemplo n.º 1
0
 def _storeFissionYields(self, chunk):
     """store fission yields data"""
     fissProd, indYield, cumYield = [], [], []
     currVar = FIRST_WORD_REGEX.search(chunk[0]).group()  # NFY_902270_1
     # Obtain the parent ID: AAZZZ0/1, e.g., 922350
     parentFY = int(str2vec(currVar.split('_')[-2]))
     if 'E' in currVar.split('_')[-1]:  # e.g., NFY_902270_1E
         sclVal = SCALAR_REGEX.search(chunk[0])
         # energy must be stored on the reader
         self._energyFY = float(
             str2vec(chunk[0][sclVal.span()[0] + 1:sclVal.span()[1] - 2]))
         return  # thermal/epi/fast
     for tline in chunk:
         if '[' in tline or ']' in tline:
             continue
         tline = tline[:tline.find('%')]
         if len(tline.split()) == 3:
             val1, val2, val3 = str2vec(tline, out=list)
             fissProd.append(val1)
             indYield.append(val2)
             cumYield.append(val3)
     self.nfy[(parentFY, self._energyFY)] = {
         'fissProd': array(fissProd),
         'indYield': array(indYield),
         'cumYield': array(cumYield)
     }
Ejemplo n.º 2
0
 def _storeFluxRatio(self, chunk):
     """store flux ratios"""
     chunk0 = chunk[0]
     currVar = FIRST_WORD_REGEX.search(chunk0).group()
     # obtain the universe id
     univ = currVar.split('_')[-1]
     search = VEC_REGEX.search(chunk0)  # group flux values
     vals = str2vec(chunk0[search.span()[0] + 1:search.span()[1] - 2])
     self.fluxRatio[univ], self.fluxUnc[univ] = splitValsUncs(vals)
Ejemplo n.º 3
0
 def _storeMicroXS(self, chunk):
     """store micro cross-section and uncertainty values"""
     currXS, currUnc = {}, {}
     currVar = FIRST_WORD_REGEX.search(chunk[0]).group()
     # obtain the universe id
     univ = currVar.split('_')[-1]
     for tline in chunk:
         if '[' in tline or ']' in tline:
             continue
         if '%' in tline:
             tline = tline[:tline.index('%')]
         if len(tline.split()) > 3:
             values = str2vec(tline)
             # isotope, reaction type and isomeric state
             reactionData = (int(values[0]), int(values[1]), int(values[2]))
             currXS[reactionData], currUnc[reactionData] = splitValsUncs(
                 values[3:])
     self.xsVal[univ] = currXS
     self.xsUnc[univ] = currUnc
Ejemplo n.º 4
0
 def _getVarName(self, tline):
     """Obtains the variable name and converts it to a python-style name."""
     currVar = FIRST_WORD_REGEX.search(tline)
     if currVar is not None:
         # return serpent-style and python-style names
         return currVar.group(), convertVariableName(currVar.group())