# Attenuation correction for sample shape

In cases of strongly scattering or absorbing samples, the detected scattering intensity is lower than the 'true' scattering. Moreover, for oddly-shaped samples, the extinction of scattering may be anisotropic: some parts of the detector image are more attenuated than others because of the differing path-lengths through the sample.

## Formulation

In the following, we assume a transmission-scattering (TSAXS) experiment.

The measured scattering, ${\displaystyle S_{m}}$, at a particular scattering angle ${\displaystyle (\Theta _{o},\chi _{o})}$ (where ${\displaystyle \Theta _{o}}$ is the full (${\displaystyle 2\theta }$) scattering angle between the scattered ray and the incident beam, and ${\displaystyle \chi _{o}}$ is the azimuthal angle: ${\displaystyle \chi =0^{\circ }}$ corresponds to the ${\displaystyle q_{z}}$ axis, whereas ${\displaystyle \chi =90^{\circ }}$ is along the ${\displaystyle q_{r}}$ axis) can be computed by summing the scattering contributions for all the elements along the beam path through the sample.

We define a realspace coordinate system ${\displaystyle (x,y,z)}$ where z points vertically, y points along the beam direction, and x points horizontally with respect to the sample. Let the sample size along the beam direction be L. Defining the point where the beam first enters the sample as ${\displaystyle (0,0,0)}$ we write:

{\displaystyle {\begin{alignedat}{2}S_{m}(\Theta _{o},\chi _{o})=\int \limits _{l=0}^{l=L}S(l)\mathrm {d} l\end{alignedat}}}

The scattering from a particular location within the sample is affected by two attenuation effects:

1. The beam flux within the sample decreases due to absorption/scattering, such that the flux at position ${\displaystyle l}$ is not the incident flux, ${\displaystyle I_{0}}$ but attenuated to:
${\displaystyle I(l)=I_{0}e^{-\alpha l}}$
where ${\displaystyle \alpha }$ is (Beer-Lambert like) extinction coefficient. If the 'true' scattering probability is given by ${\displaystyle \sigma }$ (i.e. ${\displaystyle I_{0}\sigma }$ is the scattering observed in the absence of attenuation), then the scattering at ${\displaystyle l}$ is:
${\displaystyle S(l)=I(l)\sigma =I_{0}e^{-\alpha l}\sigma }$
2. The scattered radiation is itself attenuated as it passes through the sample. Let this path-length (from scattering location ${\displaystyle (0,l,0)}$ until it exits the sample along the direction ${\displaystyle (\Theta _{o},\chi _{o})}$) be denoted ${\displaystyle p(l)}$. In such a case, the scattering that exits the sample is:
{\displaystyle {\begin{alignedat}{2}S(l)&=I(l)\sigma \times \mathrm {attenuation} (l)\\&=I_{0}e^{-\alpha l}\sigma e^{-\alpha p(l)}\\&=I_{0}\sigma e^{-\alpha (l+p(l))}\\\end{alignedat}}}

The measured scattering is thus:

{\displaystyle {\begin{alignedat}{2}S_{m}(\Theta _{o},\chi _{o})&=\int \limits _{l=0}^{L}I_{0}\sigma e^{-\alpha (l+p(l))}\mathrm {d} l\\&=I_{0}\sigma \int \limits _{0}^{L}e^{-\alpha (l+p(l))}\mathrm {d} l\\\end{alignedat}}}

The integral of course depends on the form of ${\displaystyle p(l)}$ which depends on the sample shape. Note that in the limiting case of weak attenuation (${\displaystyle \alpha \approx 0}$), we obtain the very simple result:

{\displaystyle {\begin{alignedat}{2}S_{m}(\Theta _{o},\chi _{o})&=I_{0}\sigma \int \limits _{0}^{L}e^{0}\mathrm {d} l\\&=I_{0}\sigma L\\\end{alignedat}}}

As expected, scattering intensity scales with the scattering volume.

## Normalization

To normalize-out the effect of attenuation, one can simply divide by the integral:

{\displaystyle {\begin{alignedat}{2}S_{\mathrm {norm} }(\Theta _{o},\chi _{o})&={\frac {S_{m}(\Theta _{o},\chi _{o})}{\int _{0}^{L}e^{-\alpha (l+p(l))}\mathrm {d} l}}\\&=I_{0}\sigma \end{alignedat}}}

Of course in the case of weak attenuation the integral is simply L, and we are normalizing by the beam-path through the sample.

## Coordinates

For a vector that starts at ${\displaystyle (0,0,0)}$ and terminates at ${\displaystyle (x,y,z)}$, pointing along direction ${\displaystyle (\Theta _{o},\chi _{o})}$, the full length is:

${\displaystyle |\mathbf {v} |=v={\sqrt {x^{2}+y^{2}+z^{2}}}}$

We can consider triangles in various planes:

1. xz plane (looking along beam):
${\displaystyle \tan(90^{\circ }-\chi _{o})={\frac {z}{x}}}$
${\displaystyle \cos(90^{\circ }-\chi _{o})={\frac {x}{\sqrt {x^{2}+z^{2}}}}}$
${\displaystyle \sin(90^{\circ }-\chi _{o})={\frac {z}{\sqrt {x^{2}+z^{2}}}}}$
${\displaystyle \tan(\chi _{o})={\frac {x}{z}}}$
${\displaystyle \cos(\chi _{o})={\frac {z}{\sqrt {x^{2}+z^{2}}}}}$
${\displaystyle \sin(\chi _{o})={\frac {x}{\sqrt {x^{2}+z^{2}}}}}$
2. xy plane (looking from above):
${\displaystyle \tan(\omega _{xy})={\frac {x}{y}}}$
${\displaystyle \cos(\omega _{xy})={\frac {y}{\sqrt {x^{2}+y^{2}}}}}$
${\displaystyle \sin(\omega _{xy})={\frac {x}{\sqrt {x^{2}+y^{2}}}}}$
3. yz plane (looking from side):
${\displaystyle \tan(\omega _{yz})={\frac {z}{y}}}$
${\displaystyle \cos(\omega _{yz})={\frac {y}{\sqrt {y^{2}+z^{2}}}}}$
${\displaystyle \sin(\omega _{yz})={\frac {z}{\sqrt {y^{2}+z^{2}}}}}$
4. plane of beam elevation:
${\displaystyle \tan(\omega _{\mathrm {elevation} })={\frac {z}{\sqrt {x^{2}+y^{2}}}}}$
${\displaystyle \cos(\omega _{\mathrm {elevation} })={\frac {\sqrt {x^{2}+y^{2}}}{\sqrt {x^{2}+y^{2}+z^{2}}}}}$
${\displaystyle \sin(\omega _{\mathrm {elevation} })={\frac {z}{\sqrt {x^{2}+y^{2}+z^{2}}}}}$
5. plane of full scattering angle:
${\displaystyle \tan(\Theta _{o})={\frac {\sqrt {x^{2}+z^{2}}}{y}}}$
${\displaystyle \cos(\Theta _{o})={\frac {y}{\sqrt {x^{2}+y^{2}+z^{2}}}}}$
${\displaystyle \sin(\Theta _{o})={\frac {\sqrt {x^{2}+z^{2}}}{\sqrt {x^{2}+y^{2}+z^{2}}}}}$

### Height Z

If the vector's final point is at height ${\displaystyle z=Z}$:

{\displaystyle {\begin{alignedat}{2}v_{Z}&={\sqrt {x^{2}+y^{2}+Z^{2}}}\\&={\frac {\sqrt {x^{2}+Z^{2}}}{\sin(\Theta _{o})}}\\&={\frac {1}{\sin(\Theta _{o})}}{\sqrt {\left(Z\tan(\chi _{o})\right)^{2}+Z^{2}}}\\&={\frac {Z}{\sin(\Theta _{o})}}{\sqrt {\tan ^{2}(\chi _{o})+1}}\\&={\frac {Z}{\sin(\Theta _{o})}}\sec(\chi _{o})\\&={\frac {Z}{\sin(\Theta _{o})\cos(\chi _{o})}}\\\end{alignedat}}}

This has a minimum of ${\displaystyle v_{z}=Z}$ when ${\displaystyle (\Theta _{o},\chi _{o})=(90^{\circ },0^{\circ })}$.

### Depth L

If the vector's final position is at depth ${\displaystyle y=L}$:

{\displaystyle {\begin{alignedat}{2}v_{Y}&={\sqrt {x^{2}+L^{2}+z^{2}}}\\&={\frac {L}{\cos(\Theta _{o})}}\\\end{alignedat}}}

This has a minimum of ${\displaystyle v_{Y}=L}$ when ${\displaystyle \Theta _{o}=0^{\circ }}$.

### Width X

If the vector's final position is at width ${\displaystyle x=X}$:

{\displaystyle {\begin{alignedat}{2}v_{X}&={\sqrt {X^{2}+y^{2}+z^{2}}}\\&={\frac {\sqrt {X^{2}+z^{2}}}{\sin(\Theta _{o})}}\\&={\frac {1}{\sin(\Theta _{o})}}{\sqrt {X^{2}+\left({\frac {X}{\tan(\chi _{o})}}\right)^{2}}}\\&={\frac {|X|}{\sin(\Theta _{o})}}{\sqrt {1+{\frac {1}{\tan ^{2}(\chi _{o})}}}}\\&={\frac {X}{\sin(\Theta _{o})}}{\sqrt {\frac {\tan ^{2}(\chi _{o})+1}{\tan ^{2}(\chi _{o})}}}\\&={\frac {X}{\sin(\Theta _{o})}}{\frac {\sqrt {\tan ^{2}(\chi _{o})+1}}{\sqrt {\tan ^{2}(\chi _{o})}}}\\&={\frac {X}{\sin(\Theta _{o})}}{\frac {\sec(\chi _{o})}{\tan(\chi _{o})}}\\&={\frac {X\cos(\chi _{o})}{\sin(\Theta _{o})\cos(\chi _{o})\sin(\chi _{o})}}\\&={\frac {X}{\sin(\Theta _{o})\sin(\chi _{o})}}\\\end{alignedat}}}

This has a minimum of ${\displaystyle v_{X}=X}$ when ${\displaystyle (\Theta _{o},\chi _{o})=(90^{\circ },90^{\circ })}$.

## Rectangular prism

If the sample is a rectangular prism with dimensions ${\displaystyle (2X,2Y,2Z)=(2X,L,2Z)}$ and the beam falls upon the center of the xz front-face, then the beam travels a distance L through the sample, and the scattered radiation in any quadrant passes through the rectangular prism of size ${\displaystyle (X,L,Z)}$. The distance from ${\displaystyle (0,l,0)}$ to the exit-point from the sample is the distance to the closest sample face:

{\displaystyle {\begin{alignedat}{2}p\left(l\right)&=\mathrm {min} (d_{\mathrm {top} }(l),d_{\mathrm {back} }(l),d_{\mathrm {side} }(l))\\\end{alignedat}}}

The distances are:

{\displaystyle {\begin{alignedat}{2}d_{\mathrm {top} }(l)&=v_{Z}\\&={\frac {Z}{\sin(\Theta _{o})\cos(\chi _{o})}}\\\end{alignedat}}}
{\displaystyle {\begin{alignedat}{2}d_{\mathrm {back} }(l)&=v_{L-l}\\&={\frac {L-l}{\cos(\Theta _{o})}}\\\end{alignedat}}}
{\displaystyle {\begin{alignedat}{2}d_{\mathrm {side} }(l)&=v_{X}\\&={\frac {X}{\sin(\Theta _{o})\sin(\chi _{o})}}\\\end{alignedat}}}