BornAgain can compute depth-dependent material profiles from a sample model.
ba.materialProfileSLD 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.
The generated z grid is a tuple, while the profile values are NumPy arrays. The outputs are:
z, a tuple of z values in nm,sld, an array of complex SLD values in
$ \mathrm{\AA}^{-2} $,mag_x, an array of magnetization values in $ A/m $.The output can be plotted e.g. with the MatPlotLib command
matplotlib.pyplot.plot(z, np.real(sld))
For full examples, see