Skip to main content

rlkk

Regularized Linear Kramers-Kronig (rLKK)

Folder Implementation Info Version
MATLAB Matlab (function) recommended function version v5
MATLAB-script Matlab (script) for workflows in matlab v5
Python Python + Jupyter For Python implementations v5

Why rLKK?

rLKK can be used to evaluate the impedance spectrum data.

Given frequency vector "f" and complex impedance vector "Z"

rLKK constructs a new impedance spectrum "Zf"

If the deviation between "Zf" and "Z" is small (rule of thumb 1% or 2%), the measurement is validated (meaning it came from causal, linear and time-invariant conditions)

Otherwise, all points larger should either be eliminated or remeasured

More details: Kanoun, Olfa, and Ahmed Yahia Kallel. "High-performance efficient embedded systems for impedance spectroscopy: Challenges and potentials." Electrochimica Acta (2024): 144351.

rLKK can be used to 'correct' impedance spectrum

Condition: the nature of deviation is "white", meaning the deviation is centered around 0%

In general thermal and quantization noise satisfy this condition

rLKK must be used with extreme caution otherwise!

Use

rLKK requires a complex impedance spectrum "Z" and frequency vector "f"

Parameters:

  • Z (array[complex]) – complex-valued impedance spectrum contain (Array N-values)

  • f (array[double]) – frequency vector containing N values (Array N-values)

  • lambd (double or array[double]) – (Optional) lambd=1e-4: regularization parameter, can be a scalar (regularization value) or a vector (weight vector)

  • fx (array[double]) – (Optional) fx=logspace(-8,8,160): DRT Frequency vector M values

Returns:

  • Zf: reconstructed impedance spectrum (N values)

Return type: array[double]

Example:

Zf = rLKK(Z, f) #Calculates Zf based on Z and f
Zres = (np.abs(Zf) - np.abs(Z)) / np.abs(Zf) * 100 # calculate residuals in percent

#plot residuals, and 1%/-1% threshold
plt.stem(f, Zres)
plt.stem(f, Zres1)
plt.xscale('log')
plt.grid(True)
plt.box(True)
plt.plot(f, np.ones_like(f) * 1, 'k--', label='1% threshold')
plt.plot(f, np.ones_like(f) * -1, 'k--', label='-1% threshold')
plt.xlabel('Frequency in Hz')
plt.ylabel('Deviation in %')
plt.legend(loc='upper left', bbox_to_anchor=(1, 1))
plt.show()

it uses an internal "DRT frequency vector" (fx) which should be larger than measurement frequency "f" and encapsulate the different phenomena being measured

in addition, it uses a "regularization factor" (lambda): lambda should be around 10^-2 (10^-1 to 10^-6). larger lambda = more distortions and the algorithm should put more effort as measurements aren't reliable

If not sure, leave it as it is

Implementations

Current support: MATLAB, Python (Jupyter), Python

As of the moment, rLKK is implemented in MATLAB (Script and Function)

These are used since 2021 in MST, TU Chemnitz, internally and are validated multiple times

They are also "Octave" (Open Source)-compatible

The Python code is relatively new, and is used in MST

Graphical interface version is coming soon!

Cite and use case

Recommendation to cite this paper, if you have ever used rLKK

[Kallel2021] Kallel, Ahmed Yahia, and Olfa Kanoun. "Regularized linear kramers-kronig transform for consistency check of noisy impedance spectra with logarithmic frequency distribution." 2021 International Workshop on Impedance Spectroscopy (IWIS). IEEE, 2021.

As for why rLKK is better than conventional LKK and LKK-iterative is discussed in my Ph.D. Thesis, and in the following open access paper:

[Kanoun2024] Kanoun, Olfa, and Ahmed Yahia Kallel. "High-performance efficient embedded systems for impedance spectroscopy: Challenges and potentials." Electrochimica Acta (2024): 144351. rLKK makes sense to use more than the other methods because regularization is an established method to avoid influence from noise and distortions and all I did is to bring it to LKK testing.

Where rLKK was used and use case (live page):

https://scholar.google.de/scholar?oi=bibs&hl=de&cites=2453183610233729588

License

Licensed under MIT

Metadata

Release files for rLKK 5.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rLKK 5.0.0
File Size Uploaded
rlkk-5.0.0.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rLKK 5.0.0
File Interpreter ABI Platform
rlkk-5.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / rlkk-5.0.0.tar.gz

Download URL rlkk-5.0.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c39f7dddb14978b75ee88e81de6562ebab5eeecbe92e738ba0a621765fcf0cdc
BLAKE2b-256 checksum
How to use checksums
fc8f75161126ae15552a95b132dc3c6b5e767644d6065bcb3562dd4585416ffe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.9

Release files / rlkk-5.0.0-py3-none-any.whl

Download URL rlkk-5.0.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d02c0d3bede0ddb80e1fd38bf1519c399f6caf8454f05e7e85f8bf3ba8b7c1ac
BLAKE2b-256 checksum
How to use checksums
be2f32412f88033c976de8efc1734ec6fab4b4570a605227ca6fff7036168943
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

5.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page