refnx - Neutron and X-ray reflectometry analysis in Python
refnx is a flexible, powerful, Python package for generalised curvefitting analysis, specifically neutron and X-ray reflectometry data.
It uses several scipy.optimize algorithms for fitting data, and estimating parameter uncertainties. As well as the scipy algorithms refnx uses the emcee Affine Invariant Markov chain Monte Carlo (MCMC) Ensemble sampler for Bayesian parameter estimation.
Reflectometry analysis uses a modular and object oriented approach to model parameterisation. Models are made up by sequences of components, frequently slabs of uniform scattering length density, but other components are available, including splines for freeform modelling of a scattering length density profile. These components allow the parameterisation of a model in terms of physically relevant parameters. The Bayesian nature of the package allows the specification of prior probabilities for the model, so parameter bounds can be described in terms of probability distribution functions. These priors not only applicable to any parameter, but can apply to any other user-definable knowledge about the system (such as adsorbed amount). Co-refinement of multiple contrast datasets is straightforward, with sharing of joint parameters across each model.
Various tutorials are available from the refnx YouTube channel, and there are GUI programs available on github as well.
The refnx package is free software, using a BSD licence. If you are interested in participating in this project please use the refnx github repository, all contributions are welcomed.
- Installation
- Getting started
- GUI
- Examples
- Co-refinement of multiple contrast datasets
- Inequality constraints with refnx
- Model selection using refnx and dynesty
- Analysing lipid membrane data
- Creating occupancy/volume fraction profiles
- Batch fitting
- Analytical SLD profiles
- Freeform modelling with maximum entropy
- Incoherent Summing for patchy surfaces
- Analysing non-spinflip polarised NR data
- Using different MC packages for Bayesian sampling
- Using
refnx
on a cluster with MPI
- Frequently Asked Questions
- What’s the best way to ask for help or submit a bug report?
- How should I cite refnx?
- How is instrumental resolution smearing handled?
- What are the units of scattering length density?
- What are the ‘fronting’ and ‘backing’ media?
- How do I open the standalone app on macOS Catalina?
- Can I save models/objectives to file?
- How do I install pyqt6?
- Testimonials
- API reference