pyFAI : azimuthal integration for 2D detectors

This software was developed (or is under development) within the higher education and research community. Its stability can vary (see fields below) and its working state is not guaranteed.
Higher Edu - Research dev card
  • Creation or important update: 14/12/11
  • Minor correction: 07/09/13
  • Index card author: Jérôme Kieffer (ESRF)
  • Theme leader: Dirk Hoffmann (Centre de Physique des Particules de Marseille (CPPM-IN2P3))
General software features

PyFAI is a Python library for azimuthal integration; it allows the conversion of diffraction images taken with 2D detectors like CCD cameras into X-Ray powder patterns that can be used by other software like Rietveld refinement tools (i.e. FullProf), phase analysis or texture analysis.

As PyFAI is a library, its main goal is to be integrated in other tools like PyMca or EDNA. To perform online data analysis, the precise description of the experimental setup has to be known. This is the reason why PyFAI includes geometry optimization code working on "powder rings" of reference samples. Alternatively, PyFAI can also import geometries fitted with other tools like Fit2D.

PyFAI has been designed to work with any kind of detector with any geometry (transmission, reflection, off-axis, ...). It uses the Python library Fabio to read most images taken by diffractometer (Fabio officially supports 12 manufacturers and 20 different image formats).

Context in which the software is used

2D detectors (CCD, CMOS or pixel detectors, ...) have progressively replaced punctual detectors over the 15 last years in the world of diffraction (single crystal, powder diffraction WAXS or small angle scattering SAXS). Those detectors, with wide sensitive area, have spatial resolution of dozens of microns and provide millions of pixels. PyFAI can be used on SAXS and WAXS data to reduce them into 1D (azimuthal integration) or 2D (transformation known as caking).

In order to transform detector images into data to be used by scientists it is necessary to:

  • subtract dark current (correction for the read-out noise)
  • divide by flat-field (correction for the relative sensitivity of pixels or scintillator inhomogeneities)
  • correct for the pixel position (defects of the optical fiber taper)
  • mask out dead pixels
  • convert pixel position from Cartesian space (x,y) to Polar space (2theta, chi)

PyFAI is able to compute all those corrections. Special care has been taken to conserve intensity and surface density by pixel splitting during the re-binning process (which is close to a histogram, but with pixel splitting). The algorithm used is implemented in numpy to provide a bullet-proof version, but faster and more precise version have been implemented in Cython and in OpenCL to achieve best performances with modern graphic cards.

An additional piece of software allows a fast and reliable calibration of the geometry of the experimental setup; allowing online analysis of the data.

Publications related to software