KKCalc2#

kkcalc2 is a comprehensive toolkit for calculating Kramers Kronig transforms of X-ray absorption/dispersion data, and is built to the feature-rich standards of xraysoftmat.

pypi zenodo Documentation Coverage Status pre-commit.ci status

PyTest Linting Documentation

Python SemVer Code style: black Ruff Code doc: numpydoc

Introduction#

kkcalc2 is an open-source python package to calculate the Kramers-Kronig (inverse) transform of X-ray absorption (dispersion) data:

$$f_2(E) = \frac{2}{\pi} P \int_{0}^{\infty}\frac{x f_1(x)}{x^2 - E^2} dx + \mathcal{Z}^\star$$

where $f_1$ and $f_2$ are the real and imaginary parts of the complex index of refraction, respectively, $\mathcal{Z}^\star$ is the relativistic correction, and $P$ denotes the Cauchy principal value at ($x=E$).

kkcalc2 uses a polynomial representation algorithm developed by Watts [1].

This package provides an object oriented API, to evaluate optical constants (index of refraction, absorption and dispersion, etc.), extend measurement spectra with databases, or can be accessed through a PyQT6 GUI interface. Documentation can be found at readthedocs, and releases (including documentation and executable builds) can be found at github.

References#

KKCalc2 Features#

Feature

Description

Extension & Scaling

Extend and normalise your NEXAFS/XANES the Henke and Briggs/Lighthill atomic scattering databases.
Achieve smooth baselines and more accurate transforms.
Stitch together multiple datasets.

Relativistic Correction

Use material composition to automatically calculate the relativistic correction $mathcal{f}^{0}$.

Visualization

PyQt6 GUI for processing

Typing

Enumerated NEXAFS detection sources.
Type hints for all functions and classes.