/cdiutils

A python package to help Coherent Diffraction Imaging (CDI) practionionners in their analysis.

Primary LanguagePython

cdiutils

DOI

My python package to help Bragg Coherent X-ray Diffraction Imaging (BCDI) practitioners in their analysis and visualisation workflow. I developped the package during my PhD.

The package allows for the handling of the three main stages of a BCDI data processing workflow:

  • the proprocessing (data centering and cropping)
  • the phase retrieval using PyNX.
  • the post processing (orthogonalization, phase manipulation, strain computation etc.)

It is assumed that the phase retrieval is carried out by the PyNX package (see http://ftp.esrf.fr/pub/scisoft/PyNX/doc/). The BcdiPipeline class runs the three stages and can manage connection to different machines if required (GPU for phase retrieval).

Pre- and post-processing do not require GPUs and can be run using the present package (cdiutils backend) or the bcdi package (see https://github.com/carnisj/bcdi) (bcdi backend).

The package also provide utility fonctions to analyze processed data and plot them for potential publications.

Installation

You can install the package with the following command:

pip install git+https://github.com/clatlan/cdiutils.git

Upgrade your environment with a new version of the package:

pip install -I --no-deps git+https://github.com/clatlan/cdiutils.git

Getting started

Once the package is installed, you can try it right away using the notebook template directly accessible with the command:

prepare_bcdi_notebook.py [path_to_destination]

This will generate a notebook template at the given destination.

Processing BCDI data

Once data are processed, the BcdiPipeline instance saves the data in .npz, .h5 .cxi and .vti files following the CXI file format convention (see https://www.cxidb.org/cxi.html). It also plots summary and debug figures such as:

  • Summary Slice Plot summary
  • Isosurface determination isosurface
  • Different strain computation methods strain
  • Orthogonalization in the direct space ortho

Slice plot

cdiutils.plot.slice.plot_3D_volume_slices function

  • Bragg electron density slice plot

Electron density

  • Comparing contour of support

Contour

  • Phase slice plot

Phase

Cross section quiver

cdiutils.plot.quiver.quiver_plot

  • The cross section quiver allows to plot cross section of strain and displacement field on the same plot. Cross Section Quiver
  • For different conditions Quivers
  • Can also be used to plot the curves/arrows only arrows
  • Can also be used to plot basic cross sections strain

Diffraction pattern plots in the reciprocal space

cdiutils.plot.slice.plot_diffraction_patterns

Diffraction Patterns