Skip to main content

darfix: Data analysis for dark-field X-ray microscopy


In order to fulfil the needs of the growing dark-field X-ray microscopy community, darfix, a Python software package to process imaging data, has been developed at beamline ID06-HXM. darfix provides a set of modules for systematic processing of large datasets with a friendly graphical user interface.

  • Share

darfix is a new Python-based data analysis package that provides an extensive set of tools for fast processing and visualisation of imaging data, specifically dark-field X-ray microscopy (DFXM). DFXM is a recent X-ray diffraction imaging method that enables 3D mapping of strain and orientation of embedded features in mm-sized samples with high angular and spatial resolution. A prototype hard X-ray microscope is currently being transferred from ESRF beamline ID06-HXM to the fully optimised EBS flagship beamline ID03. The new instrument will enable researchers to conduct extensive studies in metallurgy, ceramics, functional oxides and biominerals. darfix provides crucial tools for standardised data treatment and systematic processing of large datasets for the DFXM community and beyond, making it an essential open access resource for researchers.

While darfix was originally developed for the analysis of DFXM data, the data analysis functions provided are sufficiently general to find application in other X-ray imaging techniques; for example, rocking curve imaging and section topography. darfix offers a comprehensive set of image processing methods specifically designed for the analysis of DFXM scans, as illustrated in Figure 1. All functions can be accessed directly via a Python library, or via a workflow graphical user interface (GUI).


Fig 1.jpg

Click image to enlarge

Fig. 1: darfix data pre-processing thread, as visualised in the GUI, finalised by the grain plot widget. Top and bottom green brackets correspond to pre-processing, blue brackets correspond to analysis and visualisation. The data pre-processing can be followed: raw data centre of mass (COM), after noise removal, after shift correction. The grain plot output for m and c centre of mass is shown, as well as the mosaicity map with an orientation distribution colour key as inset. 

The methods are grouped into three categories: data selection, pre-processing algorithms, and analysis and visualisation of results. The pre-processing tools are fully compatible with other imaging techniques and include features such as selection of region of interest, noise removal and shift correction. The analysis tools enable fast visualisation of datasets, pixel-wise rocking curve fitting and blind source separation, which allows for signal decoupling through advanced techniques. darfix also provides fitting tools for data processing and analysis of orientation and strain maps, eliminating the need for the development of custom scripts by each user group. With darfix, the DFXM community has access to a user-friendly package that simplifies data processing and enables more efficient research.

In conclusion, darfix is a powerful and adaptable Python package for analysing DFXM and X-ray diffraction topography data. Its modular structure and workflow make it easy to add new tools and functionalities in the form of widgets, ensuring that darfix can evolve to meet the changing needs of the user community and future DFXM developments. Additionally, the software can process data from other imaging techniques as long as the file inputs are in ESRF data format (.edf) or HDF5. Most importantly, darfix provides a fast, systematic and accessible means of processing data, making it an invaluable resource for researchers working in this field. For more information, see


Principal publication and authors
darfix: Data analysis for dark-field X-ray microscopy. J. Garriga Ferrer, R. Rodríguez-Lamas, H. Payno, W. De Nolf, P. Cook, V.A. Solé Jover, C. Yildirim, C. Detlefs, J. Synchrotron Radiat. 30, 527-537 (2023),