Technical documentation

pyFAI is a python library for Fast Azimuthal Integration. It may appear surprising that a python project is called "Fast" in a world where most other software are written in C or Fortran. It simply means that the integration is done by a single operation which leads an input pixel on the detector to a contribution to a diffraction pattern (without re-sampling or aliasing, ...), allowing optimization on this single algorithm and optimization of it's implementation (Cython, port to GPU, ...), and leaving the flexibility of python for everything else.

It is a set of programs and python library for geometry calibration and azimuthal integration using the same geometry as SPD and other programs from Peter Boesecke, allowing any detector orientation with the only constraint that the detector is supposed to be flat (common for CCD). All program try to use "S.I." system with C convention (fastest dimension last), so the pixel size is as [pixel_size_Y_in_m,pixel_size_X_in_m]; but fit2d spline file is often more convenient.

The algorithm for integration are based around weighted histograms of position arrays by image intensity (idea from Manuel Sanchez del Rio) with minor enhancement for sub-pixel rendering (cython implementation) or GPU porting (Dimitris Karkoulis)

pyFAI relies on many standard python libraries like numpy, scipy, matplotlib and fabio (part of the Fable project on sourceforge). It can also use FFTw3 with pyFFTw3 to speed up some image analysis parts.

There are currently 4 binaries:
  1. pyFAI-calib (was in former versions): A tool for determining the geometry of a detector using a reference sample. You will need to know the 2theta angle of each ring (ring extraction is automagic)
  2. Refine the wavelength from a set of images taken with various geometries. Those images have to be already calibrated with and an approximative wavelength. For numerical efficiency, the wavelength has to be provided in ANGSTROM (and not in meter).
  3. pyFAI-waxs (was in former version): does the azimuthal integration of series of files with a given geometry and outputs ASCII files with 2theta / I
  4. pyFAI-saxs (was saxs_integrate.pyin fromer version): As integrate except that the output data are in q-space (you will need to provide the wavelength) and the standard deviation is calculated as well (q / I / stdErr).

As Fit2D is a de-facto standard in powder diffraction at ESRF, pyFAI offers a compatibility mode to import or export experimental setup definition with Fit2D's geometry.