In [1]:
width = 981 * 0.172
print("Width = ", width, " mm")
In [2]:
height = 1043 * 0.172
print("Height = ", height, " mm")
Positions
In [3]:
u0 = 600 * 0.172
print ("u0 = ", round(u0, 2), " mm")
In [4]:
v0 = 350 * 0.172
print("v0 = ", round(v0, 2), " mm")
In [8]:
import numpy as np
angle_fwhm = np.degrees(0.3e-3)
print("Angular divergency = ", round(angle_fwhm, 3), " degrees")
$\sigma=\frac{\text{FWHM}}{2\sqrt{2\log 2}}$
In [11]:
divider = 2*np.sqrt(2*np.log(2)) # approximately equal to 2.355
sigma = angle_fwhm/divider
print("sigma = ", round(sigma,3))
Finally, beam divergency settings will look as follows
The distribution widget should show the following plot
In [12]:
sigma = 0.172/2.355
print("SigmaX = SigmaY = ", round(sigma, 3))
Finally, the resolution function is defined as
In this exercise we have defined the same resolution width in both directions. However, for some instruments the resolution in $X$ and $Y$ directions may be different.
Multi layer object.Basic particle layout object. Connect it to the upper layer.Box particle. Connect it to the Particle layout.Material to start the Material editor widget.Create new material Si with $\delta=5.78\cdot 10^{-6}$ and $\beta=1.02\cdot 10^{-7}$. For this exercise we use Refractive index based material. More about material kinds in BornAgain in later tutorials.
After you've selected substrate material to be Si, click on the Particle ans set it's material to Si too.
Run Simulation button in Simulation view. After the simulation has finished, BornAgain should automaticaly switch to Job view screen. Click Properties on the top panel. Change Axes Units from mm to q-space. Change the Min value of the y-axis to 0. Click Save button on the top panel to save the plot as .png file. The result should look like shown below.
In [13]:
from IPython.display import Image
imgfile = "img/sim1.png"
Image(url=imgfile)
Out[13]:
Fourier button on the top panel. The Fourier transform should look as shown below.
In [17]:
fftfile = "img/sim1_fft.png"
Image(url=fftfile)
Out[17]:
Projections view in the top right corner.Choose the horizontal line on the right panel to create a horizontal projection. Position it at $Q_z=0.4$. Click to the floppy disk to save projection to a text file. The result should look as shown below.
In [18]:
%matplotlib inline
In [33]:
import numpy as np
import matplotlib.pyplot as plt
projfile = "data/proj2.txt"
data = np.loadtxt(projfile)
plt.semilogy(data[:,0], data[:,1], color='k')
plt.xlabel(r'$Q_y$ (nm$^{-1}$)')
plt.ylabel('Intensity (a. u.)')
plt.title(r"Horizontal slice at $Q_z=0.4$ nm$^{-1}$");
In [34]:
projfile = "data/proj1.txt"
data = np.loadtxt(projfile)
plt.semilogy(data[:,0], data[:,1], color='r')
plt.xlabel(r'$Q_z$ (nm$^{-1}$)')
plt.ylabel('Intensity (a. u.)')
plt.title(r"Vertical slice at $Q_y=0$ nm$^{-1}$")
plt.xlim(0.0, 2.3);
Real Time Activity in the right bottom corner. Vary the sample parameters.
In [ ]: