Scan models

Scans are needed to construct simulations of types reflectometry, off-specular scattering, depth probe.

There are three types of scan:

  • Alpha scans, for instruments that are mechanically scanning the grazing angle $\alpha_\text{i}$;
  • Lambda scans, for instruments that are scanning the wavelength $\lambda$;
  • Qz scans, for both angular-scanning or time-of-flight instruments.

Common properties

All scan types have intensity:

scan.setIntensity(intensity)

Polarization and analyzer can be assigned to the scan when needed (for specular and off-specular simulations).

scan.setPolarization(polarization) # for specular & off-specular
scan.setAnalyzer(analyzer) # for specular

Alpha scans

To specify a scan with n equidistant points in the grazing angle $\alpha_\text{i}$, use

scan = ba.AlphaScan(n, alpha_start, alpha_stop)

Usage is demonstrated by most examples in Examples/specular .

For other sequences of $\alpha_\text{i}$ values, use the more generic

alpha_list = ba.ListScan("alpha_i (rad)", [0*deg, 0.01*deg, ... 1.2*deg]) # all points
scan = ba.AlphaScan(alpha_list)

After constructing a scan, set the wavelength and optionally the azimuthal angle and a constant offset $\delta\alpha_\text{i}$ using

scan.setWavelength(lambda)
scan.setAzimuthalAngle(phi)

scan.setAlphaOffset(dalpha)

alpha, lambda, phi may also have distributions, then create them and assign to the scan:

scan.setWavelengthDistribution(lambda_distr)
scan.setGrazingAngleDistribution(alpha_distr)
scan.setAzimuthalAngleDistribution(phi_distr)

Footprint can be assigned to the alpha scan (for specular and off-specular simulations).

scan.setFootprint(footprint) # for specular & off-specular

Lambda scans

To specify a scan with n equidistant points in the neutron/X-ray wavelength $\lambda$, use

scan = ba.LambdaScan(n, lambda_start, lambda_stop)

To specify a scan with any other sequence of $\lambda$ values, use

lambda_list = ba.ListScan("lambda (nm)", [0.6*nm, 0.61*nm, ... 0.7*nm]) # all points
scan = ba.LambdaScan(lambda_list)

After constructing a scan, set the grazing angle and optionally the azimuthal angle using

scan.setGrazingAngle(alpha)
scan.setAzimuthalAngle(phi)

alpha, lambda, phi may also have distributions, then create them and assign to the scan:

scan.setWavelengthDistribution(lambda_distr)
scan.setGrazingAngleDistribution(alpha_distr)
scan.setAzimuthalAngleDistribution(phi_distr)

Footprint can be assigned to the lambda scan (for specular and off-specular simulations).

scan.setFootprint(footprint) # for specular & off-specular

Usage in off-specular scattering is demonstrated by Examples/specular/OffspecLambda.py .

See also the example page off-specular simulation.

Qz scans

To specify a scan with n equidistant steps in the vertical wavenumber $q_z$, use

scan = ba.QzScan(n, qz_start, qz_stop)

For other sequences of $q_z$ values, use the more generic

qz_list = ba.ListScan("q_z (1/nm)", [0.01/nm, 0.02/nm, ... 1.2/nm]) # all points
scan = ba.QzScan(qz_list)

A third alternative consists in passing a NumPy array,

import numpy as np
qz_vector = np.linspace(0.01, 1, n)
scan = ba.QzScan(qz_vector)

After constructing a scan, a constant offset $\delta q_z$ can be set using

scan.setOffset(dqz)

To specify q-resolution one needs at first create corresponding distribution distr but then there are three ways to specify a q-resolution.

  1. Set absolute value of resolution, given in units of 1/nm:
scan.setAbsoluteQResolution(distr, dq)
  1. Set relative value of resolution, given as fraction of $q_z$ value at each point of scan:
scan.setRelativeQResolution(distr, dq_rel)
  1. Set individual absolute value of resolution, given as vector of the same length n:
dq_vector = 0.03*np.linspace(0.01, 1, n)  # dq-values in "1/nm"
scan.setVectorResolution(distr, dq_vector)

As Qz scan does not contain full information about simulation geometry, it is incompatible with footprint.

alpha, lambda, phi and thair distributions cannot be set.

Usage is demonstrated in page time-of-flight reflectometry.

Handling of resolution will change soon. The current API is demonstrated in page time-of-flight reflectometry with resolution.