###  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
    ###
    print '\n--- Sampling ---'

    for energy in energies:
        print "\n\t Energy = ", energy
        random_numbers = [0.5, 0.9, 0.95, 1.0 - 1e-15]
        Prng.RandomNumberGenerator.setFakeStream(random_numbers)
        for rnd in random_numbers:
            energy, angle = hybrid_dist.sample(energy)
            print "\tsample[", energy, ",", '%.16e' % rnd, "] = ", '%.16e' % angle

### -------------------------------------------------------------------------- ##
Пример #2
0
# -------------------------------------------------------------------------- ##
data_list = cs_list.get('H-Native')
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