Пример #1
0
def toENDF6(self, flags, targetInfo, weight=None, MT=None):

    NE = len(self)
    EInFactor = PQUModule.PQU(1, self.axes[-1].unit).getValueAs('eV')
    if (weight is None):
        weight = [[self[0].value * EInFactor, 1.0],
                  [self[-1].value * EInFactor, 1.0]]
    EInInterpolation = gndToENDF6Module.gndToENDF2PlusDInterpolationFlag(
        self.interpolation, self.interpolationQualifier)
    C1, C2, LAW, LANG = 0, 0, 0, 0
    if (MT == 527): C1, C2, LAW, LANG = 11, 5.438675e-4, 1, 2
    ENDFDataList = [ endfFormatsModule.endfContLine( C1, C2, 0, 1, 1, len( weight ) ) ] + \
        endfFormatsModule.endfInterpolationList( [ len( weight ), 2 ] ) + endfFormatsModule.endfNdDataList( weight ) + \
        [ endfFormatsModule.endfContLine( 0, 0, LAW, LANG, 1, NE ) ] + endfFormatsModule.endfInterpolationList( [ NE, EInInterpolation ] )
    for energy in self:
        if (MT == 527):
            ENDFDataList.append(
                endfFormatsModule.endfContLine(0, energy.value * EInFactor,
                                               0, 0, 2 * len(energy),
                                               len(energy)))
            ENDFDataList += endfFormatsModule.endfNdDataList(energy,
                                                             xUnit='eV',
                                                             yUnit='1/eV')
        else:
            if (isinstance(energy, regionsModule.regions1d)):
                interpolations, data = [], []
                for region in energy:
                    regionData = region.copyDataToXYs(xUnitTo='eV',
                                                      yUnitTo='1/eV')
                    if (len(data) > 0):
                        if (data[-1] == regionData[0]): regionData.pop(0)
                    data += regionData
                    interpolations.append(len(data))
                    interpolations.append(
                        gndToENDF6Module.gndToENDFInterpolationFlag(
                            region.interpolation))
                NR, NE = len(interpolations) / 2, interpolations[-2]
                ENDFDataList.append(
                    endfFormatsModule.endfContLine(0, energy.value * EInFactor,
                                                   0, 0, NR, NE))
                ENDFDataList += endfFormatsModule.endfInterpolationList(
                    interpolations)
                ENDFDataList += endfFormatsModule.endfNdDataList(data)
            else:
                interpolation = gndToENDF6Module.gndToENDFInterpolationFlag(
                    energy.interpolation)
                ENDFDataList.append(
                    endfFormatsModule.endfContLine(0, energy.value * EInFactor,
                                                   0, 0, 1, len(energy)))
                ENDFDataList += endfFormatsModule.endfInterpolationList(
                    [len(energy), interpolation])
                ENDFDataList += endfFormatsModule.endfNdDataList(energy,
                                                                 xUnit='eV',
                                                                 yUnit='1/eV')
    return (1, ENDFDataList)
Пример #2
0
def toENDF6List(self, targetInfo):

    nPoints = 2
    interpolationFlatData = [nPoints, 2]
    endfMult = endfFormatsModule.endfNdDataList(
        [targetInfo['EMin'], self.value, targetInfo['EMax'], self.value])
    return (interpolationFlatData, nPoints, endfMult)
Пример #3
0
def toENDF6(self, flags, targetInfo):

    MF6 = [endfFormatsModule.endfContLine(0, 0, 0, 0, 1, len(self))]
    EInInterpolation = gndToENDF6Module.gndToENDF2PlusDInterpolationFlag(
        self.interpolation, self.interpolationQualifier)
    energyConversionFactor = PQUModule.PQU(1,
                                           self.axes[-1].unit).getValueAs('eV')
    MF6 += endfFormatsModule.endfInterpolationList(
        [len(self), EInInterpolation])
    for oneEin in self:
        muInterpolation = gndToENDF6Module.gndToENDF2PlusDInterpolationFlag(
            self.interpolation, self.interpolationQualifier)
        Ein = oneEin.value * energyConversionFactor
        numMu = len(oneEin)
        MF6 += [endfFormatsModule.endfContLine(0, Ein, 0, 0, 1, numMu)]
        MF6 += endfFormatsModule.endfInterpolationList(
            [numMu, muInterpolation])
        for entries in oneEin:
            pdf_of_EpInterpolation = gndToENDF6Module.gndToENDFInterpolationFlag(
                self.interpolation)
            mu = entries.value
            numEout = len(entries)
            MF6 += [endfFormatsModule.endfContLine(0, mu, 0, 0, 1, numEout)]
            MF6 += endfFormatsModule.endfInterpolationList(
                [numEout, pdf_of_EpInterpolation])
            xys = entries.copyDataToXYs(xUnitTo='eV', yUnitTo='1/eV')
            MF6 += endfFormatsModule.endfNdDataList(xys)
    return (7, standardsModule.frames.labToken, MF6)
Пример #4
0
def toENDF6List(self, targetInfo):

    nPoints = len(self)
    interpolationFlatData = [
        nPoints,
        gndToENDF6Module.gndToENDFInterpolationFlag(self.interpolation)
    ]
    endfMult = endfFormatsModule.endfNdDataList(
        self.copyDataToXYs(xUnitTo='eV'))
    return (interpolationFlatData, nPoints, endfMult)
Пример #5
0
def toENDF6_oneRegion(self, EInFactor, startingIndex=0):

    ENDFDataList = []
    for index, energy_in in enumerate(self[startingIndex:]):
        ENDFDataList += [
            endfFormatsModule.endfContLine(0., energy_in.value * EInFactor, 0,
                                           0, 1, len(energy_in))
        ]
        ENDFDataList += endfFormatsModule.endfInterpolationList([
            len(energy_in),
            gndToENDF6Module.gndToENDFInterpolationFlag(
                energy_in.interpolation)
        ])
        ENDFDataList += endfFormatsModule.endfNdDataList(energy_in,
                                                         xUnit='eV',
                                                         yUnit='1/eV')
    EInInterpolation = gndToENDF6Module.gndToENDF2PlusDInterpolationFlag(
        self.interpolation, self.interpolationQualifier)
    return (len(self[startingIndex:]), EInInterpolation, ENDFDataList)
Пример #6
0
    def angularPointwiseEnergy2ENDF6(self, targetInfo):

        interpolation = gndToENDF6Module.gndToENDFInterpolationFlag(
            self.interpolation)
        energy_in_eV = self.value * energyConversionFactor
        if (targetInfo['doMF4AsMF6']):
            ENDFDataList = [
                endfFormatsModule.endfContLine(0, energy_in_eV,
                                               interpolation + 10, 0,
                                               2 * len(self), len(self))
            ]
        else:
            ENDFDataList = [
                endfFormatsModule.endfContLine(0, energy_in_eV, 0, 0, 1,
                                               len(self))
            ]
            ENDFDataList += endfFormatsModule.endfInterpolationList(
                [len(self), interpolation])
        ENDFDataList += endfFormatsModule.endfNdDataList(self)
        return (ENDFDataList)
Пример #7
0
def toENDF6(self, flags, targetInfo, weight=None):

    interpolations, ENDFDataList, length = [], [], 0
    EInFactor = PQUModule.PQU(1, self.axes[-1].unit).getValueAs('eV')
    for ridx, region in enumerate(self):
        startingIndex = 0
        if ridx > 0 and region[0].copyDataToXYs() == self[
                ridx - 1][-1].copyDataToXYs():
            startingIndex = 1
        lengthSub, EInInterpolation, ENDFDataListSub = toENDF6_oneRegion(
            region, EInFactor, startingIndex)
        length += lengthSub
        interpolations += [length, EInInterpolation]
        ENDFDataList += ENDFDataListSub
    if (weight is None):
        weight = [[self[0][0].value * EInFactor, 1.0],
                  [self[-1][-1].value * EInFactor, 1.0]]
    NR = len(interpolations) / 2
    NE = interpolations[-2]
    ENDFDataList = [ endfFormatsModule.endfContLine( 0, 0, 0, 1, 1, len( weight ) ) ] + \
            endfFormatsModule.endfInterpolationList( [ len( weight ), 2 ] ) + endfFormatsModule.endfNdDataList( weight ) + \
            [ endfFormatsModule.endfContLine( 0, 0, 0, 0, NR, NE ) ] + endfFormatsModule.endfInterpolationList( interpolations ) + \
            ENDFDataList
    return (1, ENDFDataList)
Пример #8
0
def toENDF6(self, flags, targetInfo, weight=None):

    U, EFL, EFH = 0, 0, 0
    if (self.LF == 12):
        EFL, EFH = self.EFL.getValueAs('eV'), self.EFH.getValueAs('eV')
    else:
        U = self.U.getValueAs('eV')
    parameter1 = self.parameter1.data
    energyFactor = float(
        PQUModule.PQU('1 eV') / PQUModule.PQU(1, parameter1.axes[1].unit))
    if (weight is None):
        weight = [[energyFactor * parameter1[0][0], 1.0],
                  [energyFactor * parameter1[-1][0], 1.0]]
        interpolation = 2
    elif (hasattr(weight, 'axes')):
        interpolation = gndToENDF6Module.gndToENDFInterpolationFlag(
            weight.interpolation)
    else:
        interpolation = 2
    ENDFDataList = [ endfFormatsModule.endfContLine( U, 0, 0, self.LF, 1, len( weight ) ) ] + \
        endfFormatsModule.endfInterpolationList( [ len( weight ), interpolation ] ) + endfFormatsModule.endfNdDataList( weight )
    ENDFDataList += endfFormatsModule.toTAB1(parameter1,
                                             'eV',
                                             'eV',
                                             C1=EFL,
                                             C2=EFH)
    if (self.parameter2 is not None):
        parameter2 = self.parameter2.data
        yUnit = ''
        if (self.LF in [5, 11]): yUnit = '1/eV'
        ENDFDataList += endfFormatsModule.toTAB1(parameter2, 'eV', yUnit)
    return (1, ENDFDataList)