cs_reduction = native_data.getMomentPreservingCrossSectionReduction() moment_cs = native_data.getTotalElasticCrossSection() discrete_energy_grid = native_data.getElasticAngularEnergyGrid() interps = ["LogLogLog", "LinLinLin", "LinLinLog"] energies = [1e-4, 1e-3, 1e5 ] interps = ["LogLogLog"] energies = [1e-4] for interp in interps: print "\n----------------------------" print "--- ",interp," Pb Tests ---" print "----------------------------" hybrid_dist = Electron.createHybridElasticDistribution_LinLogCorrelated(native_data, 0.9, 1e-14 ) cutoff_dist = Electron.createCutoffElasticDistribution_LinLogCorrelated(native_data, 0.9, 1e-14) full_cutoff_dist = Electron.createCutoffElasticDistribution_LinLogCorrelated(native_data, 1.0, 1e-14) if interp == "LinLinLin": hybrid_dist = Electron.createHybridElasticDistribution_LinLinCorrelated(native_data, 0.9, 1e-14) cutoff_dist = Electron.createCutoffElasticDistribution_LinLinCorrelated(native_data, 0.9, 1e-14) full_cutoff_dist = Electron.createCutoffElasticDistribution_LinLinCorrelated(native_data, 1.0, 1e-14) elif interp == "LogLogLog": hybrid_dist = Electron.createHybridElasticDistribution_LogLogCorrelated(native_data, 0.9, 1e-14) cutoff_dist = Electron.createCutoffElasticDistribution_LogLogCorrelated(native_data, 0.9, 1e-14) full_cutoff_dist = Electron.createCutoffElasticDistribution_LogLogCorrelated(native_data, 1.0, 1e-14) ### ### Get Sampling Ratios ### # print '\n--- Calculate Sampling Ratios ---'
ylims = [[0.0, 0.02], [0.0, 0.02]] ### -------------------------------------------------------------------------- ## ### Coupled Plots ### -------------------------------------------------------------------------- ## # filename = datadir + 'epr_native_' + str(atomic_number) + '.xml' filename = datadir + 'test_epr_' + str(atomic_number) + '_native.xml' native_data = Native.ElectronPhotonRelaxationDataContainer(filename) energy_grid = native_data.getElasticAngularEnergyGrid() # Distributions if interp == "Correlated": # Distributions coupled_dist1 = Electron.createCoupledElasticDistribution_LogLogCorrelated( native_data, MonteCarlo.ONE_D_UNION, 1e-15) coupled_dist2 = Electron.createCoupledElasticDistribution_LogLogCorrelated( native_data, MonteCarlo.TWO_D_UNION, 1e-15) coupled_dist3 = Electron.createCoupledElasticDistribution_LogLogCorrelated( native_data, MonteCarlo.MODIFIED_TWO_D_UNION, 1e-15) # Reactions coupled_reaction = Electron.createCoupledElasticReaction_LogLogCorrelated( native_data, MonteCarlo.TWO_D_UNION, 1e-15) elif interp == "Direct": # Distributions coupled_dist = Electron.createCoupledElasticDistribution_LogLogDirect( native_data, MonteCarlo.ONE_D_UNION, 1e-15) coupled_dist2 = Electron.createCoupledElasticDistribution_LogLogDirect( native_data, MonteCarlo.TWO_D_UNION, 1e-15)
) ### ### Coupled Distribution/Reaction Unit Test Check ### interps = ["LinLinLog", "LogLogLog", "LinLinLin"] methods = ["Simplified Union", "One D Union", "Two D Union"] energies = [1.0e+5, 6.625E+01, 200.0] interps = ["LogLogLog"] methods = [Electron.SIMPLIFIED_UNION] energies = [1.0e+5, 6.625E+01, 200.0] for interp in interps: print "\n-----", interp, "-----\n" for method in methods: coupled_dist = Electron.createCoupledElasticDistribution_LinLogCorrelated( native_data, method, 1e-15) if interp == "LogLogLog": coupled_dist = Electron.createCoupledElasticDistribution_LogLogCorrelated( native_data, method, 1e-15) elif interp == "LinLinLin": coupled_dist = Electron.createCoupledElasticDistribution_LinLinCorrelated( native_data, method, 1e-15) print "\n----- ", method, " -----\n" print "\t -- Evaluate --" angles = [-0.01, 0.0, 0.71, 0.999999, 1.0] for energy in energies: print "Energy = ", energy for angle in angles: pdf = coupled_dist.evaluate(energy, angle)
import PyFrensie.Utility.Prng as Prng import PyFrensie.MonteCarlo.Collision as Collision import PyFrensie.MonteCarlo.Electron as Electron import numpy import matplotlib.pyplot as plt Utility.initFrensiePrng() ### -------------------------------------------------------------------------- ## ### Forward Atomic Excitation ### -------------------------------------------------------------------------- ## native_file_name = '/home/software/mcnpdata/native/epr/epr_native_1_v1.xml' # native_file_name = '/home/lkersting/frensie/src/packages/test_files/native/test_epr_1_native.xml' native_data = Native.ElectronPhotonRelaxationDataContainer(native_file_name) dist = Electron.createAtomicExcitationDistribution(native_data) energies = [0.01, 1.0, 5.0, 9.50367370e-03] # print "\t -- Evaluate --" # for energy in energies: # print "Energy = ",energy # if energy == 1e5: # outgoing_energies = [1e-5, 1.0, 10.0] # else: # outgoing_energies = [1e-5, 1e-4, 5e-4] # for e_out in outgoing_energies: # pdf = dist.evaluate( energy, e_out ) # print '\teval[','%.6e' %e_out,']\t= ','%.16e' % pdf # print "\n\t-- Evaluate PDF --"
energies = [1.0e+5, 6.625E+01, 200.0] interps = ["LogLogLog"] methods = [Electron.SIMPLIFIED_UNION] energies = [0.314, 0.521] for interp in interps: print "\n-----", interp, "-----\n" coupled_react = None coupled_dist = None decoupled_react = None cutoff_dist = None for method in methods: if interp == "LinLinLog": # Coupled Reaction coupled_react = Electron.createCoupledElasticReaction_LinLogCorrelated( native_data, method, 1e-15) # Coupled Distribution coupled_dist = Electron.createCoupledElasticDistribution_LinLogCorrelated( native_data, method, 1e-15) # Decoupled Reaction decoupled_react = Electron.createDecoupledElasticReaction_LinLogCorrelated( native_data, 1e-15) # Cutoff Distribution cutoff_dist = Electron.createCutoffElasticDistribution_LinLogCorrelated( native_data, 0.999999, 1e-15) if interp == "LogLogLog": # Coupled Reaction coupled_react = Electron.createCoupledElasticReaction_LogLogCorrelated( native_data, method, 1e-15) # Coupled Distribution coupled_dist = Electron.createCoupledElasticDistribution_LogLogCorrelated(
# ylims = [ [0.0,0.02], [0.0,0.02] ] ### -------------------------------------------------------------------------- ## ### Hybrid Plots ### -------------------------------------------------------------------------- ## # filename = datadir + 'epr_native_' + str(atomic_number) + '.xml' filename = datadir + 'test_epr_' + str(atomic_number) + '_native.xml' native_data = Native.ElectronPhotonRelaxationDataContainer(filename) energy_grid = native_data.getElasticAngularEnergyGrid() # Distributions if interp == "Correlated": # Distributions coupled_dist = Electron.createCoupledElasticDistribution_LogLogCorrelated( native_data, MonteCarlo.TWO_D_UNION, 1e-15) cutoff_dist = Electron.createCutoffElasticDistribution_LogLogCorrelated( native_data, 1.0, 1e-15) hybrid_dist = Electron.createHybridElasticDistribution_LogLogCorrelated( native_data, 0.9, 1e-15) # Reactions coupled_reaction = Electron.createCoupledElasticReaction_LogLogCorrelated( native_data, MonteCarlo.TWO_D_UNION, 1e-15) cutoff_reaction = Electron.createCutoffElasticReaction_LogLogCorrelated( native_data, 1.0, 1e-15) mp_reaction = Electron.createMomentPreservingElasticReaction_LogLogCorrelated( native_data, 0.9, 1e-15) elif interp == "Direct": # Distributions
au_electron_prop = au_properties.getSharedElectroatomicDataProperties( Data.ElectroatomicDataProperties.ACE_EPR_FILE, 14) file_name = datadir + au_electron_prop.filePath() table_start = au_electron_prop.fileStartLine() table_name = au_electron_prop.tableName() ### -------------------------------------------------------------------------- ## ### ACE Elastic Check ### -------------------------------------------------------------------------- ## ace_file = ACE.ACEFileHandler(file_name, table_name, table_start) xss_extractor = ACE.XSSEPRDataExtractor(ace_file.getTableNXSArray(), ace_file.getTableJXSArray(), ace_file.getTableXSSArray()) decoupled_react = Electron.createDecoupledElasticReaction(xss_extractor) ### ### Decoupled Distribution/Reaction Check ### energies = [15.7, 10.0] n = 100 electron = MonteCarlo.ElectronState(0) bank = MonteCarlo.ParticleBank() for energy in energies: fig, ax = plt.subplots() print "\t -- React 256 keV--"