Forward Smearing

Some instruments designed to measure small-angle scattering have intrinsic slit-smearing of the in their design. One such example is the Bonse-Hart design which uses single crystals to collimate the beam incident on the sample as well as to collimate the scattered beam beam that will reach the detector.

fig.smearing

Slit smearing geometry of the Bonse-Hart design.

Source Code Documentation

Forward smearing

Smear (q, I, dI) data given to the routine Smear() using the slit-length weighting function Plengt(). The integration used below goes only over the slit length (does not include either slit width or wavelength broadening).

For now, Plengt() describes a rectangular slit and the integration extends up to the length of the slit. This could be changed if desired.

To complete the smearing for the last data points, extrapolation is necessary from the given data. The functional form may be only one of those provided (others could be added).

For q values in between given data points, interpolation is used. Log interpolation is tried first. If this fails due to a ValueError Exception, linear interpolation is used.

Source Code Documentation

jldesmear.jl_api.smear.Plengt(l, slitlength)[source]

Slit-length weighting function, P_l(l)

\[\int_{-\infty}^{\infty} P_l(l) dl = 1\]

It is defined for a rectangular slit of length 2*slitlength (\(2l_o\)) and probability 1/(2*slitlength) (\(1/2l_o\)). It is zero elsewhere.:

                    P(l)
/--------------------|--------------------\
|                    |                    |
|                    |                    |
|      *****************************      | 1/2l_o
|      *             |             *      |
|      *             |             *      |
|      *             |             *      |
\*******-------------|-------------*******/ 0
      -l_o           0            l_o
Note:

integral( P(l) dl ) = 1.0

Note:

If you change this to a different functional form ... It is not necessary to change the limit of the integration if the functional form here is changed. You may, however, need more parameters.

Parameters:
  • l (float) – lookup value
  • slitlength (float) – slit length, l_o, as indicated above
Returns:

P_l(l)

Return type:

float

jldesmear.jl_api.smear.Smear(q, C, dC, extrapname, sFinal, slitlength, quiet=False, weighted_transition=True)[source]

Smear the data of C(q) into S(q) using the slit-length weighting function Plengt() and an extrapolation of the data to avoid truncation errors. Assume that Plengt() goes to zero for l > l_o (the slit length).

Also assume that the slit length function is symmetrical about l = zero.

\[S(q) = 2 \int_0^{l_o} P_l(l) \ C(\sqrt{q^2+l^2}) \ dl\]

This routine is written so that if Plengt() is changed (for example) to a Gaussian, that no further modification is necessary to the integration procedure. That is, this routine will integrate the data out to “slitlength” (l_o).

Parameters:
  • q (numpy.ndarray) – magnitude of scattering vector
  • C (numpy.ndarray) – unsmeared data is C(q) +/- dC(q)
  • dC (numpy.ndarray) – estimated uncertainties of C
  • extrapname (str) – one of constant | linear | powerlaw | Porod
  • sFinal (float) – fit extrapolation to I(q) for q >= sFinal
  • slitlength (float) – l_o, same units as q
  • quiet (bool) – if True, then no printed output from this routine
  • weighted_transition (bool) – if True, make a weighted transition between sFinal <= q < qMax
Returns:

tuple of (S, extrap)

Return type:

(numpy.ndarray, object)

Variables:

S (numpy.ndarray) – smeared version of C

jldesmear.jl_api.smear.get_Ic(qNow, sFinal, qMax, x, interp, extrap, weighted_transition=True)[source]

return the corrected intensity based on circular symmetry

jldesmear.jl_api.smear.prepare_extrapolation(q, C, dC, extrapname, sFinal)[source]

Pick the extrapolation function for smearing

Parameters:
  • q (numpy.ndarray) – magnitude of scattering vector
  • C (numpy.ndarray) – array (list) such that data is C(q) +/- dC(q)
  • dC (numpy.ndarray) – estimated uncertainties of C
  • extrapname (str) – one of constant, linear, powerlaw, or Porod
  • sFinal (float) – fit extrapolation to I(q) for q >= sFinal
Returns:

function object of selected extrapolation

Return type:

object