Quantitative estimate of elemental composition by spectroscopic and imaging techniques using X-ray fluorescence requires the availability of accurate data of X-ray interaction with matter. Although a wide number of computer codes and data sets are reported in literature, none of them is presented in the form of freely available library functions which can be easily included in software applications for X-ray fluorescence. This work presents a compilation of data sets from different published works and an xraylib interface in the form of callable functions. Although the target applications are on X-ray fluorescence, cross sections of interactions like photoionization, coherent scattering and Compton scattering, as well as form factors and anomalous scattering functions, are also available.

xraylib provides access to some of the most respected databases of physical data in the field of X-rays. The core of xraylib is a library, written in ANSI C, containing over 40 functions to be used to retrieve data from these databases. This C library can be directly linked with any program written in C, C++ or Objective-C. Furthermore, the xraylib package contains bindings to several popular programming languages: Fortran 2003, Perl, Python, Java, IDL, Lua, Ruby, PHP and .NET, as well as a command-line utility which can be used as a pocket-calculator. Although not officially supported, xraylib has been reported to be useable from within Matlab and LabView.

The source code is known to compile and run on the following platforms: Linux, Mac OS X, Solaris, FreeBSD and Windows. It is very likely that xraylib will also work on other platforms: we would be grateful if you would report your successes in this regard. Please note that not all of the bindings are currently working on all platforms. A paper was published concerning xraylib by A. Brunetti, M. Sanchez del Rio, B. Golosio, A. Simionovici and A. Somogyi, “A library for X-ray matter interaction cross sections for X-ray fluorescence applications”, Spectrochimica Acta B 59 (2004) 1725-1731.

This paper was recently superseded by a new manuscript, covering all features of xraylib upto version 2.15.0, written by T. Schoonjans, A. Brunetti, B. Golosio, M. Sanchez del Rio, V. A. Solé, C. Ferrero and L. Vincze, named "The xraylib library for X-ray—matter interactions. Recent developments". You are kindly requested to include this paper in the reference list of your published work when you would decide to use xraylib for scientific purposes.

Website https://github.com/tschoonj/xraylib/wiki
Licenses BSD 3-Clause "New" or "Revised" License (BSD-3-Clause)
Categories Data analysis Database XRF Library
Software Requirements Compilation occurs via autotools (./configure, make, make install) so a bash shell is required, as well as compilers that are supported by autotools (Visual Studio C being a notable exception)
Hardware Requirements -
Platforms Mac OS Linux Windows
Languages C C++ C# Fortran IDL Java Lua Objective-C Pascal Perl PHP Python Ruby
Input Formats There are no input formats associated to this software.
Output Formats There are no output formats associated to this software.
Contact email xraylib@lists.ugent.be
At Diamond Light Source

xraylib is installed into the modules system and can be loaded via:

> module load xraylib

This will add update the LD_LIBRARY_PATH environment variable ensuring that the xraylib shared library can be found by your software that links against it.

If you would like to use the python bindings, or the command line executable, load the Python Anaconda distribution:

> module load python/ana
> python
Python 2.7.13 |Anaconda 1.7.0 (64-bit)| (default, Dec 20 2016, 23:09:15) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import xraylib
>>> xraylib.LineEnergy(26, xraylib.KL3_LINE)
Documentation / Tutorials

Usage instructions

  • A library for X-ray matter interaction cross sections for X-ray fluorescence applications. Antonio Brunetti, Manuel Sanchez del Rio, Bruno Golosio, Alexandre Simionovici and Andrea Somogyi. Spectrochimica Acta B, 59(10-11), 1725-1731, 2004. DOI
  • The xraylib library for X-ray--matter interactions. Recent developments. T. Schoonjans, A. Brunetti, B. Golosio, M. Sanchez del Rio, V. A. Solé, C. Ferrero and L. Vincze. Spectrochimica Acta Part B, 66(11-12), 776-784, 2011. DOI
Instruments ID16B-NA (ESRF) ID21 (ESRF)
No screenshots have been uploaded for this software.
This software is used at these institutes
No example datasets have been uploaded for this software.