# Data analysis in neutron scattering

We here present an introduction to the vast field of data analysis in neutron scattering.

For each neutron scattering technique, there exists a suite of specialized analysis packages that will help the user obtain maximum information from the available data. This chapter is an attempt to illustrate the basis, common notions of data analysis, and to briefly cover a few of the most used analysis packages.

At present, this chapter is in development, but ready sections are presented here already now for completeness.

# Basic statistical tools

Were here present the basics of formal statistics needed to follow the mathematics behind the data analysis. This section can be studied independently of Data analysis packages that present an introduction to the actual data analysis packages.

## Counting statistics

For a single neutron, the probability of scattering into the detector will typically be much smaller than unity. However, real experiments deal with thousands to billions of neutrons onto the sample per second, so here the many small probabilities can give rise to a considerable total neutron count.

The actual count number, \(N_j\), during a certain counting time is drawn from a stochastic variable, \(N\), that follows a Poisson distribution \begin{equation} \label{eq:poisson} P({\rm count\; number\; is\; k}) = \exp(-\lambda) \frac{\lambda^k}{k!} , \end{equation} where \(\lambda\) is the (true) average number of counts for the given counting time. In other words, if the counting was repeated really many times, the mean count number would approach \(\lambda\); or \(\langle N \rangle \rightarrow \lambda\). For the Poisson distribution, the variance of the count number is \(\sigma^2(N) = \lambda\), meaning that the standard deviation is \begin{equation} \sigma(N) = \sqrt{\lambda} . \end{equation} In many cases one would approximate this distribution by a normal (or Gaussian) distribution \begin{equation} P(k) = \frac{1}{\sigma\sqrt{2\pi}} \exp(-(k-\mu)^2/(2 \sigma^2)) , \end{equation} with identical mean values, \(\mu = \lambda\) and \(\sigma^2 = \lambda\). This approximation is reasonable when the expected count rate is sufficiently large, \(\lambda > 10\). For a normal distribution, 68% of the times the count value will lie in the interval \({\mu}\pm\sigma\) - and 95% of the times in the interval \(\mu\pm 2\sigma\).

By one count experiment, one obtains the result \(N_1\). From this knowledge, the most likely value of \(\lambda\) is \begin{equation} \lambda_{\rm exp.} = N_1 . \end{equation} For this reason, one often replaces the (unknown) true mean value with the actual count number in the expression for the standard deviation (error bar) of the count number, reaching \(\sigma = \sqrt{N_1}\). Although neither this approximation nor the assumption of Gaussian statistics hold for small count numbers, they are in practice often used down to \(N_1=1\). For \(N_1=0\), a zero value of standard deviation will lead to unphysical results: The error is zero, meaning that the true count number {\bf must} be zero no matter how long you count. For this reason, a standard deviation value of \(\sigma = 1\) is often imposed for zero counts.

# Data analysis packages

This section will contain an overview of the most important data analysis packages in use in present neutron scattering. In particular, emphasis will be on the packages maintained by the ESS Data Management and Software Center (ESS-DMSC).

The contents of this section is planned to be written in the autumn 2019...

← Previous page: Instrumentation

→ Next page: Small angle neutron scattering, SANS