probe.resolution - Beam resolution calculations¶
Compute angle from \(Q\) and wavelength. |
|
Compute wavelength from \(Q\) and angle. |
|
Compute \(Q\) from angle and wavelength. |
|
Convert neutron time-of-flight to wavelength. |
|
Construct bin edges E from bin centers L. |
|
Return bin centers from low to high preserving a fixed resolution. |
|
Determine the wavelength dispersion from bin centers L. |
|
Broaden an existing dQ by the given divergence. |
|
Convert a calculated Q resolution and wavelength dispersion to angular divergence. |
|
Convert a calculated Q resolution and angular divergence to a wavelength dispersion. |
|
Convert wavelength dispersion and angular divergence to \(Q\) resolution. |
|
Calculate divergence due to slit and sample geometry. |
|
Compute the slit widths for the standard scanning reflectometer fixed-opening-fixed geometry. |
Resolution calculations
- refl1d.probe.resolution.QL2T(Q=None, L=None)[source]¶
Compute angle from \(Q\) and wavelength.
\[\theta = \sin^{-1}( |Q| \lambda / 4 \pi )\]Returns \(\theta\)°.
- refl1d.probe.resolution.QT2L(Q=None, T=None)[source]¶
Compute wavelength from \(Q\) and angle.
\[\lambda = 4 \pi \sin( \theta )/Q\]Returns \(\lambda\)Å.
- refl1d.probe.resolution.TL2Q(T: ArrayLike, L: ArrayLike)[source]¶
Compute \(Q\) from angle and wavelength.
\[Q = 4 \pi \sin(\theta) / \lambda\]Returns \(Q\) Å-1
- refl1d.probe.resolution.TOF2L(d_moderator, TOF)[source]¶
Convert neutron time-of-flight to wavelength.
\[\lambda = (t/d) (h/n_m)\]where:
\(\lambda\) is wavelength in Å\(t\) is time-of-flight in \(u\)s\(h\) is Planck’s constant in erg seconds\(n_m\) is the neutron mass in g
- refl1d.probe.resolution.binedges(L)[source]¶
Construct bin edges E from bin centers L.
Assuming fixed \(\omega = \Delta\lambda/\lambda\) in the bins, the edges will be spaced logarithmically at:
\[\begin{split}E_0 &= \min \lambda \\ E_{i+1} &= E_i + \omega E_i = E_i (1+\omega)\end{split}\]with centers \(L\) half way between the edges:
\[L_i = (E_i+E_{i+1})/2 = (E_i + E_i (1+\omega))/2 = E_i (2 + \omega)/2\]Solving for \(E_i\), we can recover the edges from the centers:
\[E_i = L_i \frac{2}{2+\omega}\]The final edge, \(E_{n+1}\), does not have a corresponding center \(L_{n+1}\) so we must determine it from the previous edge \(E_n\):
\[E_{n+1} = L_n \frac{2}{2+\omega}(1+\omega)\]The fixed \(\omega\) can be retrieved from the ratio of any pair of bin centers using:
\[\frac{L_{i+1}}{L_i} = \frac{ (E_{i+2}+E_{i+1})/2 }{ (E_{i+1}+E_i)/2 } = \frac{ (E_{i+1}(1+\omega)+E_{i+1} } { (E_i(1+\omega)+E_i } = \frac{E_{i+1}}{E_i} = \frac{E_i(1+\omega)}{E_i} = 1 + \omega\]
- refl1d.probe.resolution.bins(low, high, dLoL)[source]¶
Return bin centers from low to high preserving a fixed resolution.
low, high are the minimum and maximum wavelength. dLoL is the desired resolution FWHM \(\Delta\lambda/\lambda\) for the bins.
- refl1d.probe.resolution.binwidths(L)[source]¶
Determine the wavelength dispersion from bin centers L.
The wavelength dispersion \(\Delta\lambda\) is just the difference between consecutive bin edges, so:
\[\Delta L_i = E_{i+1}-E_{i} = (1+\omega) E_i - E_i = \omega E_i = \frac{2 \omega}{2+\omega} L_i\]where \(E\) and \(\omega\) are as defined in
binedges()
.
- refl1d.probe.resolution.dQ_broadening(dQ, L, T, dT, width)[source]¶
Broaden an existing dQ by the given divergence.
dQ Å-1, with 1-\(\sigma\) \(Q\) resolution L Å T, dT °, with FWHM angular divergence width °, with FWHM increased angular divergence
The calculation is derived by substituting \(\Delta\theta' = \Delta\theta + \omega\) for sample broadening \(\omega\) into the resolution estimate \((\Delta Q/Q)^2 = (\Delta\lambda/\lambda)^2 + (\Delta\theta/\tan\theta)^2\).
- refl1d.probe.resolution.dQdL2dT(Q, dQ, L, dL)[source]¶
Convert a calculated Q resolution and wavelength dispersion to angular divergence.
Q, dQ Å-1 \(Q\) and 1-\(\sigma\) \(Q\) resolution L, dL ° angle and FWHM angular divergence
Returns FWHM Deltatheta$
- refl1d.probe.resolution.dQdT2dLoL(Q, dQ, T, dT)[source]¶
Convert a calculated Q resolution and angular divergence to a wavelength dispersion.
Q, dQ Å-1 \(Q\) and 1-\(\sigma\) \(Q\) resolution T, dT ° angle and FWHM angular divergence
Returns FWHM \(\Delta\lambda/\lambda\)
- refl1d.probe.resolution.dTdL2dQ(T: ArrayLike, dT: ArrayLike, L: ArrayLike, dL: ArrayLike)[source]¶
Convert wavelength dispersion and angular divergence to \(Q\) resolution.
T, dT (degrees) angle and FWHM angular divergence L, dL (Angstroms) wavelength and FWHM wavelength dispersion
Returns 1-\(\sigma\) \(\Delta Q\)
Given \(Q = 4 \pi sin(\theta)/\lambda\), this follows directly from gaussian error propagation using
..math:
\Delta Q^2 &= \left(\frac{\partial Q}{\partial \lambda}\right)^2\Delta\lambda^2 + \left(\frac{\partial Q}{\partial \theta}\right)^2\Delta\theta^2 &= Q^2 \left(\frac{\Delta \lambda}{\lambda}\right)^2 + Q^2 \left(\frac{\Delta \theta}{\tan \theta}\right)^2 &= Q^2 \left(\frac{\Delta \lambda}{\lambda}\right)^2 + \left(\frac{4\pi\cos\theta\,\Delta\theta}{\lambda}\right)^2
with the final form chosen to avoid cancellation at \(Q=0\).
- refl1d.probe.resolution.divergence(T=None, slits=None, distance=None, sample_width=10000000000.0, sample_broadening=0)[source]¶
Calculate divergence due to slit and sample geometry.
- Parameters:
- Tfloat OR [float] | degrees
incident angles
- slitsfloat OR (float, float) | mm
s1, s2 slit openings for slit 1 and slit 2
- distance(float, float) | mm
d1, d2 distance from sample to slit 1 and slit 2
- sample_widthfloat | mm
w, width of the sample
- sample_broadeningfloat | degrees FWHM
additional divergence caused by sample
- Returns:
- dTfloat OR [float] | degrees FWHM
calculated angular divergence
Algorithm:
The divergence is based on the slit openings and the distance between the slits. For very small samples, where the slit opening is larger than the width of the sample across the beam, the sample itself acts like the second slit.
First find \(p\), the projection of the beam on the sample:
\[p &= w \sin\left(\frac{\pi}{180}\theta\right)\]Depending on whether \(p\) is larger than \(s_2\), determine the slit divergence \(\Delta\theta_d\) in radians:
\[\begin{split}\Delta\theta_d &= \left\{ \begin{array}{ll} \frac{1}{2}\frac{s_1+s_2}{d_1-d_2} & \mbox{if } p \geq s_2 \\ \frac{1}{2}\frac{s_1+p}{d_1} & \mbox{if } p < s_2 \end{array} \right.\end{split}\]In addition to the slit divergence, we need to add in any sample broadening \(\Delta\theta_s\) returning the total divergence in degrees:
\[\Delta\theta &= \frac{180}{\pi} \Delta\theta_d + \Delta\theta_s\]Reversing this equation, the sample broadening contribution can be measured from the full width at half maximum of the rocking curve, \(B\), measured in degrees at a particular angle and slit opening:
\[\Delta\theta_s = B - \frac{180}{\pi}\Delta\theta_d\]
- refl1d.probe.resolution.slit_widths(T=None, slits_at_Tlo=None, Tlo=90, Thi=90, slits_below=None, slits_above=None)[source]¶
Compute the slit widths for the standard scanning reflectometer fixed-opening-fixed geometry.
- Parameters:
- T[float] | degrees
Specular measurement angles.
- Tlo, Thifloat | degrees
Start and end of the opening region. The default if Tlo is not specified is to use fixed slits at slits_below for all angles.
- slits_below, slits_abovefloat OR [float, float] | mm
Slits outside opening region. The default is to use the values of the slits at the ends of the opening region.
- slits_at_Tlofloat OR [float, float] | mm
Slits at the start of the opening region.
- Returns:
- s1, s2[float] | mm
Slit widths for each theta.
Slits are assumed to be fixed below angle Tlo and above angle Thi, and opening at a constant dT/T between them.
Slit openings are defined by a tuple (s1, s2) or constant s=s1=s2. With no Tlo, the slits are fixed with widths defined by slits_below, which defaults to slits_at_Tlo. With no Thi, slits are continuously opening above Tlo.
Note
This function works equally well if angles are measured in radians and/or slits are measured in inches.