nPDyn

nPDyn is a Python based API for analysis of neutron backscattering data.

The API aims at providing a lightweight, user-friendly and modular tool to process and analyze quasi-elastic neutron scattering (QENS) and fixed-window scans (FWS) obtained with backscattering spectroscopy.

nPDyn can be used in combination with other software for neutron data analysis such as Mantid. The API provides an interface to Mantid workspaces for that.

An important feature of nPDyn is the modelling interface, which is designed to be highly versatile and intuitive for multidimensional dataset with global and non-global parameters. The modelling in nPDyn is provided by builtin classes, params.Parameters, model.Model and model.Component. nPDyn provides also some helper functions to use lmfit as modelling backend. See Fit data for details.

Eventually, some plotting methods are available to examine processed data, model fitting and optimized parameters.

Installation:

Unix and Windows

For installation within your python framework, use:

make install

or

python3 setup.py install

On Windows, the path to the GSL library can be provided using:

python.exe setup.py install --gsl-path="my/path/to/GSL/root/dir/"

Getting started

The nPDyn API is organized around a sample.Sample class. This class inherits from the NumPy ndarray class with some extra features added, such as neutron scattering-specific attributes, binning, data correction algorithm, automatic error propagation and data fitting.

In a neutron backscattering experiment, there is not only the measurement of samples but also some calibration measurements like vanadium, empty cell and solvent signal (often \(\rm D_2O\)). Some methods of the sample.Sample class can be used to perform normalization or absorption correction using the dataset corresponding to vanadium or empty cell, respectively. These calibration dataset can be used also in the fit function to automatically add a background or perform a convolution with the resolution function.

Details regarding importation of data are available in the Import data section of the documentation.

Importantly, nPDyn provides versatile tools for model building and fitting to the data. See the section Fit data for details.

Finally, a plot.plot() method is provided for easy visualisation of the data and the fit results.

Indices and tables