Parameter distributions

Constructors

A distribution is constructed by one of the following:

distr = ba.DistributionGate(start, stop, n_samples=25)
distr = ba.DistributionCosine(mean, sigma, n_samples = 25)
distr = ba.DistributionGaussian(mean, std_dev, n_samples=25, rel_samplig_width=2)
distr = ba.DistributionLorentz(mean, hwhm, n_samples=25, rel_samplig_width=2)
distr = ba.DistributionLogNormal(median, sigma_scale_param, n_samples=25, rel_samplig_width=2)
Usage

Parameter distributions are either supplied to beam divergence or detector resolution classes as described there, or they are used programmatically.

In programmatical usage, the function call

parsamples = distr.distributionSamples()

returns a vector of parameter samples. Each ParameterSample has a value and a weight. The sample (scattering target) model is then constructed as incoherent sum of components with given parameter values and weights. For instance, in the PolydisperseCylinders example, a layout is filled with uncorrelated particles:

distr = ba.DistributionGaussian(10*nm, 1*nm)
for parsample in distr.distributionSamples():
    ff = ba.Cylinder(parsample.value, 5*nm)
    particle = ba.Particle(material_Particle, ff)
    layout.addParticle(particle, parsample.weight)
Examples