Optical and magnetization profiles

BornAgain can compute depth-dependent material profiles from a sample model. ba.materialProfileSLD, ba.materialProfileRefractiveIndex and ba.magnetizationProfile return profile values. The matching z coordinates are generated with ba.generateZValues.

The same z grid is used for both profiles:

n_points = 400
z_min, z_max = ba.defaultMaterialProfileLimits(sample)
z = ba.generateZValues(n_points, z_min, z_max)
sld = ba.materialProfileSLD(sample, n_points, z_min, z_max)
mag_x = ba.magnetizationProfile(sample, "X", n_points, z_min, z_max)

Here sample is a user-defined sample model. The string argument of magnetizationProfile selects one component, "X", "Y", or "Z". The z range can be chosen explicitly or obtained from ba.defaultMaterialProfileLimits(sample). The convenience function ba.materialProfile(sample, n_points) chooses this range automatically and returns the z coordinates and complex SLD profile as two NumPy arrays.

For samples defined with SLDMaterial, materialProfileSLD returns rho_real + 1j*rho_absorption in Å⁻². The physical complex SLD uses rho_real - 1j*rho_absorption. For RefractiveMaterial, materialProfileRefractiveIndex returns the dimensionless index n = 1 - delta + 1j*beta.

Converting between these representations requires the wavelength in nm:

sld = ba.materialProfileSLD(sample, n_points, z_min, z_max,
                            wavelength=0.154*ba.nm)
n = ba.materialProfileRefractiveIndex(sample, n_points, z_min, z_max,
                                      wavelength=0.154*ba.nm)
Sample materials SLD profile Refractive-index profile
Constant SLD Wavelength optional Wavelength required
Constant refractive Wavelength required Wavelength optional
Tabulated Wavelength required Wavelength required
Mixed Wavelength required Wavelength required

Vacuum is compatible with either representation; a table with a single row counts as constant. Wavelengths must be finite and positive. Particle contributions are included in the slice averages; rough interfaces interpolate SLD, equivalently the squared refractive index.

The convenience function selects the representation with quantity:

z, n = ba.materialProfile(sample, quantity="refractive_index",
                          wavelength=0.154*ba.nm)
delta, beta = 1 - n.real, n.imag

Its default is quantity="sld". Both returned arrays use the same z grid. magnetizationProfile returns a real array in A/m and works without a wavelength. generateZValues returns a tuple of z coordinates in nm.

Use plot_material_profile to draw one or more real SLD profiles with explicit depth units, or plot the arrays directly with MatPlotLib.

For full examples, see