Skip to content
Switch branches/tags


Pre-processing software for serial electron diffraction data using Python. See for example results.

Diffractem is intended for usage within Jupyter notebooks - get a set of examples here:

Critical dependencies are CrystFEL 0.10.0 or higher (, available at, and pinkIndexer, available at


To use most features you will also need an installation of CrystFEL and pinkIndexer.

Create conda enivronment

We strongly suggest to use the Anaconda3 Python distribution/package manager, and create a dedicated environment within it for diffractem (and CrystFEL). If you do not have Anaconda installed, it is sufficient to obtain the minimal Miniconda of the conda package manager at

Once installed, please create a new anaconda environment for diffractem, without installing any packages, and activate it:

conda create -n diffractem -c conda-forge
conda activate diffractem

Install CrystFEL and pinkIndexer

It is probably worth checking if you already have an installation of CrystFEL (>=0.10.0) with pinkIndexer in your computing environment (e.g. via SBgrid). If so, you can skip this section and proceed with the installation of diffractem below. Otherwise, as you might not want the new CrystFEL version to interfere with a potentially existing (or future) installation of standard CrystFEL (or are not allowed to), or don't have sudo rights on your computer, we suggest to install them directly into the location of our anaconda environment.

Please first make sure that all dependencies for compiling CrystFEL are installed:

[N.B. If you're having trouble fulfilling CrystFELs dependencies e.g. because you do not have root access to install them or they are not included in your distribution's package repository, also consider installing them using conda. As a common example, if you are using Ubuntu 16.04, which comes with a too old version of cmake, you may want to run conda install cmake.]

Here is a complete sequence of steps to install pinkIndexer and CrystFEL, assuming you're installing CrystFEL directly from the repository at DESY (alternatively, you can download the latest release at

git clone
git clone
cd pinkindexer
mkdir build
cd build
make -j `nproc`
make install
cd ../../crystfel
mkdir build
cd build
make -j `nproc`
make install
cd ../..

If you prefer to install CrystFEL globally, just omit the -DCMAKE_INSTALL_PREFIX parameters and skip the export PKG_CONFIG_PATH line. After that, running indexamajig --version should return something similar to CrystFEL: 0.10.0+<some commit hash>.

Install Python and Jupyter

Now, install a basic Python with Jupyter into your environment. We recommend using jupyterlab for interaction with diffractem. If you prefer the classic jupyter, you can use it instead in the command below.

conda install -c conda-forge python=3.8 numpy jupyterlab ipywidgets ipympl

Install diffractem

Finally install diffractem itself, either from PyPi:

pip install diffractem

or, if you want to play/develop a bit more and stay up-to-date, you can clone this git repository and install diffractem in developer mode:

git clone
cd diffractem
pip install -e .

Now you should be ready to go! To get started, why don't you download the example notebooks:

git clone

And get example raw data at MPDL Edmond:

And when you're ready to go: just make your own branches of the notebooks for your own projects, and have fun!

diffractem, (C) 2019-2021 Robert Bücker,

peakfinder8, (C) 2014-2019 Deutsches Elektronen-Synchrotron DESY