### Specular simulation with a footprint correction

This example demonstrates taking into account the beam footprint correction in specular simulations.

Footprint effect originates from non-infinite sizes of beam and sample. Then at small incident angles $\alpha_i$ the beam irradiates an area bigger than the area of the sample. Exact footprint impact depends on the ratio between the widths of beam and sample as well as on the shape of the beam.

When taking into account footprint correction, there are two possible options for the beam shape in BornAgain:

• Square beam — the beam has sharp edges and square cross-section, its intensity is uniformly distributed.
• Gaussian beam — the beam is infinite in space, while its intensity has Gaussian distribution along the radius of the beam.

The footprint correction for square beam is defined by FootprintSquare command, which has the signature

<footprint_object> = FootprintSquare(beam_to_sample_width_ratio)


Here <footprint_object> is an object later passed to the simulation, while beam_to_sample_width_ratio defines the ratio between the widths of beam and sample.

In the case of the Gaussian beam the footprint object is created with

<footprint_object> = FootprintGauss(beam_to_sample_width_ratio)


The command signature is exactly the same as in the case with the square beam, but the beam width required for beam_to_sample_width_ratio is now defined as the beam diameter associated with the intensity level equal to $I_0 \cdot e^{-\frac{1}{2}}$, where $I_0$ is the on-axis (maximal) intensity.

In this example a square beam is considered, with beam_to_sample_width_ratio being equal to $0.01$. The incident angle range was made rather small in this example (from $0.0$ to $0.6$ degrees) in order to emphasize the footprint impact at small incident angles. In other respects this example exactly matches the reflectometry simulation tutorial.

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35  #!/usr/bin/env python3 """ Specular simulation with footprint correction for a square beam """ from matplotlib import pyplot as plt import bornagain as ba from bornagain import angstrom, ba_plot as bp, deg, std_samples sample = std_samples.alternating_layers() def simulate(footprint, title): n = bp.simargs['n'] scan = ba.AlphaScan(n, 0.6*deg/n, 0.6*deg) scan.setWavelength(1.54*angstrom) scan.setFootprintFactor(footprint) simulation = ba.SpecularSimulation(scan, sample) result = simulation.simulate() result.setTitle(title) return result if __name__ == '__main__': bp.parse_args(sim_n=500, legendloc='lower left') beam_sample_ratio = 0.01 # beam-to-sample size ratio results = [ simulate(ba.FootprintSquare(beam_sample_ratio), "With footprint"), simulate(None, "Without footprint"), ] bp.plot_multicurve_specular(results) 
Examples/specular/FootprintCorrection.py