Beispiel #1
0
datadir = '/home/software/mcnpdata/'
datadir = '/home/lkersting/frensie/src/packages/test_files/'
#datadir = '/home/lkersting/research/frensie-repos/lkersting/src/packages/test_files/'

source = Teuchos.FileInputSource(datadir + '/cross_sections.xml')
xml_obj = source.getObject()
cs_list = Teuchos.XMLParameterListReader().toParameterList(xml_obj)

h_data_list = cs_list.get('Al-Native')
pb_data_list = cs_list.get('Pb-Native')
h_adjoint_file_name = datadir + h_data_list.get(
    'adjoint_electroatomic_file_path')
h_native_file_name = datadir + h_data_list.get('electroatomic_file_path')
pb_native_file_name = datadir + pb_data_list.get('electroatomic_file_path')

h_native_data = Native.ElectronPhotonRelaxationDataContainer(
    h_native_file_name)
h_adjoint_data = Native.AdjointElectronPhotonRelaxationDataContainer(
    h_adjoint_file_name)
pb_native_data = Native.ElectronPhotonRelaxationDataContainer(
    pb_native_file_name)

energy_grid = h_native_data.getElectronEnergyGrid()
angular_energy_grid = h_native_data.getElasticAngularEnergyGrid()
print angular_energy_grid
shells = h_native_data.getSubshells()

for shell in shells:
    print h_native_data.getSubshellBindingEnergy(shell)

angular_energy_grid = pb_native_data.getElasticAngularEnergyGrid()
print angular_energy_grid
Beispiel #2
0
Utility.initFrensiePrng()

#datadir = '/home/software/mcnpdata/'
datadir = '/home/lkersting/frensie/src/packages/test_files/'

source = Teuchos.FileInputSource( datadir + '/cross_sections.xml' )
xml_obj = source.getObject()
cs_list = Teuchos.XMLParameterListReader().toParameterList( xml_obj )
data_list = cs_list.get( 'H-Native' )

# -------------------------------------------------------------------------- ##
#  Adjoint Brem Data
# -------------------------------------------------------------------------- ##
adjoint_file_name = datadir + data_list.get( 'adjoint_electroatomic_file_path' )
adjoint_data = Native.AdjointElectronPhotonRelaxationDataContainer( adjoint_file_name )
adjoint_energy_grid = adjoint_data.getAdjointElectronEnergyGrid()

###
###  Brem Distribution/Reaction Unit Test Check
###
adjoint_brem_cs = adjoint_data.getAdjointBremsstrahlungElectronCrossSection()

energy = 1e-5
print "energy = ", energy
print '\tcs = ','%.16e' % adjoint_brem_cs[0]

energy = 1e-3
index = 0
for i in range(0, adjoint_energy_grid.size ):
    if adjoint_energy_grid[i] <= energy:
Utility.initFrensiePrng()

#datadir = '/home/software/mcnpdata/'
datadir = '/home/lkersting/frensie/src/packages/test_files/'

source = Teuchos.FileInputSource(datadir + '/cross_sections.xml')
xml_obj = source.getObject()
cs_list = Teuchos.XMLParameterListReader().toParameterList(xml_obj)

### -------------------------------------------------------------------------- ##
###  Forward Elastic Unit Test Check
### -------------------------------------------------------------------------- ##
name = 'Pb-Native'
data_list = cs_list.get(name)
native_file_name = datadir + data_list.get('electroatomic_file_path')
native_data = Native.ElectronPhotonRelaxationDataContainer(native_file_name)

interps = ["LinLinLin", "LinLinLog"]
energies = [1e-4]

for interp in interps:
    print "\n----------------------------"
    print "--- ", interp, name, "Tests ---"
    print "----------------------------"

    hybrid_dist = Collision.createHybridElasticDistribution(
        native_data, 0.9, interp, True, 1e-14)

    ###
    ###  Sample
    ###
#! /usr/bin/env python
import PyFrensie.Data.Native as Native
import PyFrensie.Utility as Utility
import numpy as numpy

Utility.initFrensiePrng()

#datadir = '/home/software/mcnpdata/'
datadir = '/home/lkersting/research/frensie-repos/lkersting/src/packages/test_files/'

# -------------------------------------------------------------------------- ##
#  Electron Data
# -------------------------------------------------------------------------- ##

file_name = datadir + 'native/test_epr_1_native.xml'
native_data = Native.ElectronPhotonRelaxationDataContainer(file_name)

energy_grid = list(native_data.getBremsstrahlungEnergyGrid())

for i in range(len(energy_grid)):
    print "\n", i, "\n"
    energy = energy_grid[i]
    photon_energy = list(native_data.getBremsstrahlungPhotonEnergy(energy))
    photon_pdf = list(native_data.getBremsstrahlungPhotonPDF(energy))

    primary_energy = photon_energy[::-1]
    primary_pdf = photon_pdf[::-1]

    # Evaluate the energy of the primary electron energy at the incoming energy
    primary_energy = map(lambda x: energy - x, primary_energy)
    primary_energy[0] += 1e-10
# uncommented and that path to PyFrensie can be manually inserted.
# sys.path.insert(0, '/home/lkersting/research/frensie-repos/lkersting/lib/python2.7/site-packages/')

import PyFrensie.Utility as Utility
import PyFrensie.Data.Native as Native
import PyFrensie.MonteCarlo as MonteCarlo
import PyFrensie.DataGen.ElectronPhoton as ElectronPhoton

# Get the date for the table notes
today = str(datetime.datetime.today())
notes="This table was generated on " + today + ". It is for testing only!"

# Update adjoint Hydrogen data
print bcolors.BOLD + "Updating the adjoint H native test data ...\n" + bcolors.ENDC

h_epr_data = Native.ElectronPhotonRelaxationDataContainer( "test_epr_1_native.xml" )

generator_h = ElectronPhoton.StandardAdjointElectronPhotonRelaxationDataGenerator( h_epr_data, 1e-3, 20.0, 1e-5, 20.0 )

# Set default photon grid tolerances
generator_h.setDefaultPhotonGridConvergenceTolerance( 1e-3 )
generator_h.setDefaultPhotonGridAbsoluteDifferenceTolerance( 1e-42 )
generator_h.setDefaultPhotonGridDistanceTolerance( 1e-16 )

generator_h.setPhotonThresholdEnergyNudgeFactor( 1.0001 )
generator_h.setAdjointPairProductionEnergyDistNormConstantEvaluationTolerance( 1e-3 )
generator_h.setAdjointPairProductionEnergyDistNormConstantNudgeValue( 1e-6 )
generator_h.setAdjointTripletProductionEnergyDistNormConstantEvaluationTolerance( 1e-3 )
generator_h.setAdjointTripletProductionEnergyDistNormConstantNudgeValue( 1e-6 )
generator_h.setAdjointIncoherentMaxEnergyNudgeValue( 0.2 )
generator_h.setAdjointIncoherentEnergyToMaxEnergyNudgeValue( 1e-5 )