native_data = Native.ElectronPhotonRelaxationDataContainer(h_native_file_name) energy_grid = native_data.getElectronEnergyGrid() tot_elastic_cs = native_data.getTotalElasticCrossSection() cutoff_cs = native_data.getCutoffElasticCrossSection() screen_rutherford_cs = native_data.getScreenedRutherfordElasticCrossSection() screen_rutherford_index = native_data.getScreenedRutherfordElasticCrossSectionThresholdEnergyIndex( ) moment_cs = native_data.getMomentPreservingCrossSection() moment_index = native_data.getMomentPreservingCrossSectionThresholdEnergyIndex( ) #### #### Hybrid Distribution/Reaction Unit Test Check #### cutoff_dist = Collision.createCutoffElasticDistribution( native_data, 1.0, "LinLinLog", True, 1e-15) elastic_energy_grid = native_data.getElasticAngularEnergyGrid() #print "CrossSectionRatio: ",'%.18e' % hybrid_dist.getCrossSectionRatio(1e-4) #print "SamplingRatio: ",'%.18e' % hybrid_dist.getSamplingRatio( 1e-4) #print "Sample Hybrid at ", energy #random_numbers = numpy.append(numpy.arange(0.0,1.0-1e-12, 0.001)) #random_numbers = numpy.append(random_numbers,sampling_ratio) #random_numbers = numpy.concatenate([random_numbers,numpy.arange(sampling_ratio*1.001,1.0, 0.001)]) #random_numbers = numpy.append(random_numbers,1.0-1e-15) #Prng.RandomNumberGenerator.setFakeStream(random_numbers) #print "New Sample Impl" #new_sample = [None] * (len( random_numbers )) #for i in range(0,len(random_numbers)):
file_name = datadir + data_list.get('electroatomic_file_path') native_data = Native.ElectronPhotonRelaxationDataContainer(file_name) energy_grid = native_data.getElectronEnergyGrid() elastic_energy_grid = native_data.getElasticAngularEnergyGrid() cs_reduction = native_data.getMomentPreservingCrossSectionReduction() hybrid_reaction = Collision.createHybridElasticReaction( native_data, 0.9, False, True, 1e-15) cutoff_reaction = Collision.createCutoffElasticReaction( native_data, 1.0, False, True, 1e-15) analog_reaction = Collision.createAnalogElasticReaction( native_data, False, True, 1e-15) hybrid_dist = Collision.createHybridElasticDistribution( native_data, 0.9, False, True, 1e-15) cutoff_dist = Collision.createCutoffElasticDistribution( native_data, 1.0, False, True, 1e-15) analog_dist = Collision.createAnalogElasticDistribution( native_data, False, True, 1e-15) bin_index = 4 energy = elastic_energy_grid[bin_index] mp_cs_reduction = cs_reduction[bin_index] cutoff_cs = native_data.getCutoffElasticCrossSection() moment_cs = native_data.getMomentPreservingCrossSection() moment_index = native_data.getMomentPreservingCrossSectionThresholdEnergyIndex( ) index = 0 for i in range(0, energy_grid.size): if energy_grid[i] <= energy:
### -------------------------------------------------------------------------- ## file_names = [ '/home/lkersting/frensie/src/packages/test_files/ace/test_h_epr14_ace_file.txt' ] table_names = ['1000.14p'] for j in range(0, len(table_names)): print "\n----------------------------" print "-----", table_names[j], "Tests -----" print "----------------------------" ace_file = ACE.ACEFileHandler(file_names[j], table_names[j], 1) ace_data = ACE.XSSEPRDataExtractor(ace_file.getTableNXSArray(), ace_file.getTableJXSArray(), ace_file.getTableXSSArray()) cutoff_dist = Collision.createCutoffElasticDistribution(ace_data) ### ### Cutoff Distribution PyFrensie Unit Test Check ### energies = [1e5, 1e-3, 4e-4] angles = [0.0, 0.9] print "\n\tEvaluate" for energy in energies: print "Energy = ", energy for angle in angles: pdf = cutoff_dist.evaluate(energy, angle) print '\teval[', angle, '] = ', '%.16e' % pdf print "\n\tEvaluate PDF"