Welcome to ILTpy’s documentation
ILTpy (/ɪltˈpaɪ/) is a python library for performing regularized inversion of one-dimensional or multi-dimensional data without non-negativity constraint. Contributions to respective distributions with both positive and negative sign are determined. Primary applications include magnetic resonance (NMR, EPR), and electrochemical impedance spectroscopy (distribution of relaxation times; DRT).
Applications
Laplace inversion, or inverse Laplace transform (ILT), of relaxation time and diffusion data to calculate distributions of respective parameters. Negative contributions may be caused, for example, by exchange processes.
Deconvolution of impedance spectra with the Debye kernel, representing both the dielectric properties and interface processes in an electrochemical system. Negative contributions are obtained by inductive contributions.
Quick Start
Install ILTpy:
python -m pip install ilt-py-lib
A workflow using ILTpy and synthetic exponential decay data with noise is shown below.
First, we generate some synthetic data for analysis :
# --- Simulate synthetic data ---
import numpy as np
def kww(t, taus, betas, amps):
"""Kohlrausch–Williams–Watts function"""
return sum(a * np.exp(-(t / tau) ** b) for tau, b, a in zip(taus, betas, amps))
# Time vector (input sampling points)
t_syn = np.linspace(0, 1024,1024)
# Simulate data with two components at 10 and 100 with different amplitudes
data_syn = kww(t_syn, taus=[10,100], betas=[1, 1], amps=[1, 0.5])
# Add noise to the simulated data
noise_level = 0.01
data_syn = data_syn + np.random.randn(t_syn.size)*noise_level
# scale data so that noise variance is 1 before analysis using ILTpy
data_syn = data_syn/noise_level
Data analysis using ILTpy :
# --- ILTpy workflow ---
# assuming data_syn and t_syn are numpy arrays with the data and the sampling vector.
# Import ILTpy
import iltpy as ilt
# Load the data into iltpy using iltload
synILT = ilt.iltload(data=data_syn, t=t_syn)
# Specify parameters and initialize inversion
tau = np.logspace(-1, 4, 100) # output sampling points
synILT.init(tau=tau, kernel=ilt.Exponential())
# Perform inversion
synILT.invert()
Starting iterations ...
100%|██████████| 100/100 [00:00<00:00, 423.44it/s]
Done.
## Reporting
# Save the results
synILT.report(filepath='syn_data_ILT.txt')
# Plot the results
from iltpy.output.plotting import iltplot
iltplot(synILT)
The synthetic data consisted of two components with time constants 10 and 100, which is reproduced in the distribution after inversion.
The residuals obtained after inversion are random and devoid of systematic features, indicating a good fit to the data and a compatible kernel.
Tip
Check the sidebar for more detailed installation instructions, help with getting started and various examples.