11from functools import partial
2- from typing import Any
2+ from typing import Any , Literal
33
44import scipp as sc
55
@@ -13,8 +13,48 @@ def compute_transmission_map(
1313 beam_direction : sc .Variable ,
1414 wavelength : sc .Variable ,
1515 detector_position : sc .Variable ,
16- quadrature_kind : Any = 'medium' ,
16+ quadrature_kind : Literal [ 'cheap' , 'medium' , 'expensive' ] | Any = 'medium' ,
1717) -> sc .DataArray :
18+ """
19+ Computes transmission probability of single-scattered neutrons.
20+
21+ Computes the probability that a neutron is transmitted to
22+ ``detector_position`` given that it travelled in ``beam_direction`` and
23+ scattered incoherently a single time when passing through the sample.
24+
25+ .. math::
26+ C(\\ mathbf{p}, \\ lambda) = \\ int_{Sample} \\ exp{(-\\ mu(\\ lambda)
27+ L(\\ mathbf{p}, \\ mathbf{x}))} \\ d\\ mathbf{x}
28+
29+ where :math:`L` is the length of the path through the sample,
30+ :math:`\\ mu` is the material dependent attenuation factor,
31+ and :math:`\\ mathbf{p}` is the ``detector_position``.
32+
33+ Parameters
34+ ----------
35+ sample_shape:
36+ The size and shape of the sample.
37+ sample_material:
38+ The sample material, this parameter determines the
39+ absorption and scattering coefficients.
40+ beam_direction:
41+ The direction of the incoming beam.
42+ wavelength:
43+ An array of wavelengths for which to evaluate the transmission fraction.
44+ detector_position:
45+ An array of vectors representing the scattering directions
46+ where the transmission fraction is evaluated.
47+ quadrature_kind:
48+ What kind of quadrature to use.
49+ A denser quadrature makes the result more accurate but takes longer to compute.
50+ What options exists depend on the sample shape.
51+
52+ Returns
53+ -------
54+ :
55+ the transmission fraction as a function of detector_position and wavelength
56+
57+ """
1858 points , weights = sample_shape .quadrature (quadrature_kind )
1959 transmission = _integrate_transmission_fraction (
2060 partial (
0 commit comments