BCDI stands for Bragg coherent X-ray diffraction imaging. It can be used for:
- pre-processing BCDI and forward CDI data (masking aliens, detector gaps ...) before phase retrieval
- post-processing phased data (phase offset and phase ramp removal, averaging, apodization, ...)
- data analysis on diffraction data (stereographic projection, angular cross-correlation analysis, domain orientation fitting ...)
- data analysis on phased data (resolution calculation, statistics on the retrieved strain ...)
- simulation of diffraction intensity (including noise, detector gaps, displacement field ...)
- creating figures for publication using templates
Considering that most parts of the analysis pipeline are actually beamline-independent, we tried to reuse as much as possible code, and leverage inheritance when it comes to facility or beamline-dependent details.
BCDI can be used as a python library with the following main modules:
- :mod:`bcdi.algorithms`: PSF and image deconvolution using Richardson-Lucy algorithm
- :mod:`bcdi.experiment`: definition of the experimental geometry (beamline, setup, detector, diffractometer...).
- :mod:`bcdi.facet_recognition`: Stereographic projection of a diffraction peak or a reconstructed crystal. Automatic detection of reconstructed facets and statistics on facet strain.
- :mod:`bcdi.graph` : generation of plots using predefined templates.
- :mod:`bcdi.postprocessing`: methods for post-processing the complex output of a phasing algorithm.
- :mod:`bcdi.preprocessing`: methods for pre-processing the diffraction intensity in Bragg CDI or forward CDI geometry.
- :mod:`bcdi.simulation`: in BCDI geometry, calculation of the diffraction intensity based on FFT or kinematical sum. It can include a displacement field, noise, detector gaps etc... In forward CDI geometry, calculation of the Bragg peak positions in 3D for a mesocrystal, knowing the unit cell and unit cell parameter.
- :mod:`bcdi.utils`: data loading, fitting functions, validation functions ...
- :mod:`bcdi.xcca`: X-ray cross-correlation analysis related methods
The central module is :mod:`bcdi.experiment`, which contains all setup-related implementation. This is the place where to look at if you want to add support for a new beamline or detector.
We would like to acknowledge the following packages:
- xrayutilities: (c) Dominik Kriegner, Eugen Wintersberger. See: J. Appl. Cryst. 46, 1162-1170 (2013).
- nxsReady: (c) Andrea Resta @ SOLEIL SIXS
- image_registration.py: original code from Xianhui Xiao @ APS Sector 2. See: Opt. Lett. 33, 156-158 (2008).
- Some functions were adapted from PyNX: (c) Vincent Favre-Nicolin. See: http://ftp.esrf.fr/pub/scisoft/PyNX/ and J. Appl. Cryst. 49, 1842-1848 (2016).
The following third-party packages are required:
- numpy, scipy, scikit-image, matplotlib, pyqt5, vtk, h5py, hdf5plugin, fabio, silx, xrayutilities
- lmfit: for scripts performing fits
- pytest: to run the tests
- pytables: to load the devices dictionnary for SIXS data
- moviepy, imagemagick or ffmpeg for creating movies
BCDI is available from:
- Python Package Index:
pip install bcdi
- Most updated version on GitHub
- upgrade your version with the latest changes from GitHub:
pip install --upgrade git+https://github.com/carnisj/bcdi.git
Not that there are issues with installing scikit-image within an Anaconda environment. In such situation, the workaround is to create instead a virtual environment using pip.
Please send feedback in GitHub.
If you use BCDI for scientific work, please consider including a citation (DOI: 10.5281/zenodo.3257616).
The BCDI library is distributed with a CeCILL-B license (an open-source license similar to the FreeBSD one). See http://cecill.info/licences/Licence_CeCILL-B_V1-en.html
The documentation is available at: https://bcdi.readthedocs.io/en/latest/