# Model modifiers on BornAgain

file:///usr/share/doc/bornagain/html/ref/other/index.html Recent content in Model modifiers on BornAgain Hugo en-us

# Rotation

file:///usr/share/doc/bornagain/html/ref/other/rotation.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/ref/other/rotation.html <h2 id="particle-rotation">Particle rotation</h2> <h5 id="constructors">Constructors</h5> <p>Rotations are created by the following constructors:</p> <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># Euler z-x-z sequence of rotations</span> </span></span><span class="line"><span class="cl"><span class="n">RotationEuler</span><span class="p">(</span><span class="n">alpha</span><span class="p">,</span> <span class="n">beta</span><span class="p">,</span> <span class="n">gamma</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1"># rotation around X axis by given angle</span> </span></span><span class="line"><span class="cl"><span class="n">RotationX</span><span class="p">(</span><span class="n">angle</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1"># rotation around Y axis by given angle</span> </span></span><span class="line"><span class="cl"><span class="n">RotationY</span><span class="p">(</span><span class="n">angle</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1"># rotation around Z axis by given angle</span> </span></span><span class="line"><span class="cl"><span class="n">RotationZ</span><span class="p">(</span><span class="n">angle</span><span class="p">)</span> </span></span></code></pre></div><p>Angle arguments are understood in radians. Use <code>*deg</code> to convert from degrees.</p> <p>The Euler angles <code>alpha</code>, <code>beta</code>, <code>gamma</code> refer to the <code>z-x'-z''</code> convention:</p>

# Distributions

file:///usr/share/doc/bornagain/html/ref/other/distributions.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/ref/other/distributions.html <h2 id="parameter-distributions">Parameter distributions</h2> <h5 id="constructors">Constructors</h5> <p>A distribution is constructed by one of the following:</p> <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">distr</span> <span class="o">=</span> <span class="n">ba</span><span class="o">.</span><span class="n">DistributionGate</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">stop</span><span class="p">,</span> <span class="n">n_samples</span><span class="o">=</span><span class="mi">25</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">distr</span> <span class="o">=</span> <span class="n">ba</span><span class="o">.</span><span class="n">DistributionCosine</span><span class="p">(</span><span class="n">mean</span><span class="p">,</span> <span class="n">hwhm</span><span class="p">,</span> <span class="n">n_samples</span> <span class="o">=</span> <span class="mi">25</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">distr</span> <span class="o">=</span> <span class="n">ba</span><span class="o">.</span><span class="n">DistributionGaussian</span><span class="p">(</span><span class="n">mean</span><span class="p">,</span> <span class="n">std_dev</span><span class="p">,</span> <span class="n">n_samples</span><span class="o">=</span><span class="mi">25</span><span class="p">,</span> <span class="n">rel_samplig_width</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">distr</span> <span class="o">=</span> <span class="n">ba</span><span class="o">.</span><span class="n">DistributionLorentz</span><span class="p">(</span><span class="n">mean</span><span class="p">,</span> <span class="n">hwhm</span><span class="p">,</span> <span class="n">n_samples</span><span class="o">=</span><span class="mi">25</span><span class="p">,</span> <span class="n">rel_samplig_width</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">distr</span> <span class="o">=</span> <span class="n">ba</span><span class="o">.</span><span class="n">DistributionLogNormal</span><span class="p">(</span><span class="n">median</span><span class="p">,</span> <span class="n">scale_param</span><span class="p">,</span> <span class="n">n_samples</span><span class="o">=</span><span class="mi">25</span><span class="p">,</span> <span class="n">rel_samplig_width</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> </span></span></code></pre></div><h5 id="usage">Usage</h5> <p>Parameter distributions are either supplied to beam divergence or detector resolution classes as described there, or they are used programmatically.</p> <p>In programmatical usage, the function call</p> <pre tabindex="0"><code>parsamples = distr.distributionSamples() </code></pre><p>returns a vector of parameter samples. Each <code>ParameterSample</code> has a <code>value</code> and a <code>weight</code>. The sample (scattering target) model is then constructed as incoherent sum of components with given parameter values and weights. For instance, in the <a href="file:///usr/share/doc/bornagain/html/ref/sample/particle/ex/polydispersity">PolydisperseCylinders example</a>, a layout is filled with uncorrelated particles:</p>