Ejemplo n.º 1
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)
Ejemplo n.º 2
0
def toENDF6( self, flags, targetInfo ) :

    MT = 5
    EInInterpolation = gndToENDF6Module.gndToENDF2PlusDInterpolationFlag( self.interpolation, self.interpolationQualifier )
    EpInterpolation0 = gndToENDF6Module.gndToENDF2PlusDInterpolationFlag( self[0].interpolation, self[0].interpolationQualifier )
    if( EpInterpolation0 == 1 ) :       # flat interpolation
        LEP = 1
    elif( EpInterpolation0 == 2 ) :     # lin-lin interpolation
        LEP = 2
    else :
        raise 'hell - fix me'
    ENDFDataList = [ endfFormatsModule.endfContLine( 0, 0, 1, LEP, 1, len( self ) ) ]
    ENDFDataList += endfFormatsModule.endfInterpolationList( [ len( self ), EInInterpolation ] )
    energyInFactor = PQUModule.PQU( 1, self.axes[3].unit ).getValueAs( 'eV' )
    energyPFactor = PQUModule.PQU( 1, self.axes[2].unit ).getValueAs( 'eV' )
    for energyIn in self :
        if( not( isinstance( energyIn, multiD_XYsModule.XYs2d ) ) ) : raise 'hell - fix me'
        EpInterpolation = gndToENDF6Module.gndToENDF2PlusDInterpolationFlag( energyIn.interpolation, energyIn.interpolationQualifier )
        if( EpInterpolation != EpInterpolation0 ) : raise 'hell - fix me'
        NA, data = 0, []
        for energy_p in energyIn :
            if( not( isinstance( energy_p, series1dModule.LegendreSeries ) ) ) : raise 'hell - fix me'
            NA = max( len( energy_p ) , NA )
            coefficients = [ coefficient / energyPFactor for coefficient in energy_p ]
            data += [ energy_p.value * energyPFactor ] + coefficients
        ENDFDataList.append( endfFormatsModule.endfContLine( 0, energyIn.value * energyInFactor, 0, NA - 1, len( data ), len( data ) / ( NA + 1 ) ) )
        ENDFDataList += endfFormatsModule.endfDataList( data )
    LAW = 1
    return( LAW, ENDFDataList )
Ejemplo n.º 3
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)
Ejemplo n.º 4
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)
Ejemplo n.º 5
0
def toENDF6(self, flags, targetInfo):

    ENDFDataList = [endfFormatsModule.endfContLine(0, 0, 0, 0, 1, len(self))]
    interpolation = gndToENDF6Module.gndToENDF2PlusDInterpolationFlag(
        self.interpolation, self.interpolationQualifier)
    ENDFDataList += endfFormatsModule.endfInterpolationList(
        [len(self), interpolation])
    for energy_in in self:
        if (isinstance(energy_in, XYsModule.XYs1d)):
            ENDFDataList += gndToENDF6Module.angularPointwiseEnergy2ENDF6(
                energy_in, targetInfo)
        elif (isinstance(energy_in, series1dModule.LegendreSeries)):
            ENDFDataList += gndToENDF6Module.angularLegendreEnergy2ENDF6(
                energy_in, targetInfo)
        else:
            raise 'hell - fix me'
    if (not (targetInfo['doMF4AsMF6'])):
        ENDFDataList.append(endfFormatsModule.endfSENDLineNumber())
    return (0, 2, ENDFDataList)