the python [D]ark field x-ray microscopy [A]nalysis & [R]econstruction [L]ibrary for rapid data [IN]spection & [G]raphing
If you use darling in your research, please cite the following papers.
Henningsson A, Frankus F T, Cretton A A W, Shukla A, Gayoso Padula A, La Bella M, Haack J, Staeck S, Poulsen H F and Winther G (2026) Multi-peak diffraction analysis for enhanced orientation mapping in dark-field X-ray microscopy of deformed metals using Darling. Submitted to the proceedings of the 46th Risø International Symposium on Materials Science: Characterization of Evolving Microstructures in Metals, IOP Conf. Ser.: Mater. Sci. Eng. In review as of May 13, 2026.
Shukla A, Henningsson A, Cretton A A W and Yildirim C (2026) Direct visualization, segmentation and quantification of dislocation cells in cold-rolled Fe-3% Si using dark-field X-ray microscopy. Submitted to the proceedings of the 46th Risø International Symposium on Materials Science: Characterization of Evolving Microstructures in Metals, IOP Conf. Ser.: Mater. Sci. Eng. In review as of May 13, 2026.BibTeX is available here: citation.bib
Darling collects many useful tools in the properties and transforms modules.
For example, it is possible to segment per-pixel peaks and extract features from them. Color-coding the the mean motor position of the first peak per pixel gives a mosaicity map as shown below.
import darling
# replace with your own data path
path_to_data, _, _ = darling.io.assets.domains()
dset = darling.DataSet(path_to_data, scan_id="1.1")
# segment per-pixel peaks and extract features
peakmap = darling.properties.peaks(dset.data, k=4, coordinates=dset.motors)
# color code the scan based on the first peak-maxima mean motor position
rgbmap, colorkey, colorgrid = darling.transforms.rgb(
peakmap.mean, coordinates=dset.motors
)
plt.figure()
plt.imshow(rgbmap)
plt.show()for more examples see the externally hosted documentation at https://axelhenningsson.github.io/darling/
From source the key is simply to clone and pip install
git clone https://github.com/AxelHenningsson/darling.git
cd darling
pip install -e .In general, you probably want to install in a fresh virtual environment as
python3 -m venv .venv_darling
source .venv_darling/bin/activate
git clone https://github.com/AxelHenningsson/darling.git
cd darling
pip install -e .use
source .venv_darling/bin/activatewhenever you want to activate the environment. To add your env into a jupyter kernel such that you can use it in an interactive notebook you may add the following two commands:
pip install ipykernel
python -m ipykernel install --user --name=darlingIn the main ESRF slurm Python jupyter kernel it is possible to do the following hack to get the latest darling running.
git clone https://github.com/AxelHenningsson/darling.git
sys.path.insert(0, os.path.abspath('./darling'))
import darlingThis trick is possible since that all dependencies of darling are already installed in the big Python jupyter kernel at ESRF.
The following snippet has also been verified to work on the ESRF slurm cluster 19 Dec 2024 in a browser terminal:
python3 -m venv .venv_darling
source .venv_darling/bin/activate
git clone https://github.com/AxelHenningsson/darling.git
cd darling
pip install -e .
pip install ipykernel
python -m ipykernel install --user --name=darlingThis appraoch should work on other clusters as well, as long as some user permission to install exists.
Darling hosts documentation at https://axelhenningsson.github.io/darling/
darling is written and maintained by:
with important early contributions from: Felix Tristan Frankus and Adam André William Cretton
The core ideas of this library was originally written during a beamtime at ESRF id03D.
If you are interested in collaborating with us on DFXM data analysis, please reach out to us at: naxhe@dtu.dk and we can discuss the possibilities.
