Skip to content

azint

azint is a python library for azimuthal integration of area detectors. The azimuthal integration is transformed into a sparse matrix vector multiplication for performance. Pixel splitting is done by subdividing each pixels into subpixels and assigning bins and weights for the individual subpixels. This can increase the precision of the transformation but also introduces correlation between neighboring bins.

The algorithm is described in more detail in this publication. Please cite the paper if you use azint.

\[ I_{bin} = \frac{ \sum_{pix \in bin} c^{pix}_{bin} \frac{I_{pix}}{\Omega_{pix} P_{pix}}}{\sum_{pix \in bin}c^{pix}_{bin}} \]

with the standard error of the mean

\[ SE_{bin} = \frac{ \sqrt{\sum_{pix \in bin} (c^{pix}_{bin})^2 \frac{\sigma^2_{pix}}{\Omega_{pix}^2 P_{pix}^2}}}{\sum_{pix \in bin}c^{pix}_{bin}} \]

The only error model implementent at the moment is the poisson error model with \(\sigma_{pix} = \sqrt{I_{pix}}\)

Geometry

The geometry in azint is identical to pyFAI to be compatible with poni files generated by pyFAI poni

Installation

conda install -c maxiv azint

Getting started

azint is using poni files from pyFAI to setup the azimuthal integrator

import fabio
import numpy as np
from azint import AzimuthalIntegrator

img = fabio.open('Eiger4M_Al2O3_13.45keV.edf').data
mask = fabio.open('mask.tif').data
# 1D integration
ai = AzimuthalIntegrator('test.poni', 
                          4, 
                          2000,
                          unit='q',
                          solid_angle=True,
                          mask=mask) 
I, error = ai.integrate(img)

import matplotlib.pyplot as plt
plt.figure()
plt.plot(ai.radial_axis, I)

# 2D integration
ai = AzimuthalIntegrator('test.poni', 
                          4, 
                          512, 
                          180, 
                          unit='q',
                          solid_angle=True,
                          mask=mask) 
I, error = ai.integrate(img)
plt.figure()
plt.imshow(I)