No description
  • C++ 96.6%
  • CMake 3.4%
Find a file
2025-04-01 16:30:57 +02:00
eisfit Add jacobian aproximation 2025-02-10 15:30:02 +01:00
pkgconfig inital commit 2025-02-09 09:41:04 +01:00
batchproblem.cpp Split into mulitple translation units 2025-04-01 16:30:57 +02:00
batchproblem.h Split into mulitple translation units 2025-04-01 16:30:57 +02:00
bounds.cpp Split into mulitple translation units 2025-04-01 16:30:57 +02:00
bounds.h Split into mulitple translation units 2025-04-01 16:30:57 +02:00
CMakeLists.txt Split into mulitple translation units 2025-04-01 16:30:57 +02:00
constants.h Split into mulitple translation units 2025-04-01 16:30:57 +02:00
diagnostics.cpp Split into mulitple translation units 2025-04-01 16:30:57 +02:00
diagnostics.h Split into mulitple translation units 2025-04-01 16:30:57 +02:00
fit.cpp Split into mulitple translation units 2025-04-01 16:30:57 +02:00
gpl-3.0.txt inital commit 2025-02-09 09:41:04 +01:00
log.cpp inital commit 2025-02-09 09:41:04 +01:00
log.h inital commit 2025-02-09 09:41:04 +01:00
main.cpp Add jacobian aproximation 2025-02-10 15:30:02 +01:00
modelscript.cpp Split into mulitple translation units 2025-04-01 16:30:57 +02:00
modelscript.h Split into mulitple translation units 2025-04-01 16:30:57 +02:00
options.h Add jacobian aproximation 2025-02-10 15:30:02 +01:00
problem.cpp Split into mulitple translation units 2025-04-01 16:30:57 +02:00
problem.h Split into mulitple translation units 2025-04-01 16:30:57 +02:00
README.md inital commit 2025-02-09 09:41:04 +01:00
util.cpp Split into mulitple translation units 2025-04-01 16:30:57 +02:00
util.h Split into mulitple translation units 2025-04-01 16:30:57 +02:00

libeisfit

libeisfit is a shared library (libeisfit.so) and CLI application that fits equivalent circuit models (ECMs) to measured EIS spectra. The parameters are optimised in log10 space with Levenberg-Marquardt using an exact Jacobian from autograd through the TorchScript from libeisgenerator. The search runs multiple starts from random points in the elements' own ranges, and by basin hopping one parameter at a time, first inside the bounds the model string spells out and then inside a widened box.

The library reports per-parameter values with one-sigma uncertainties, residual diagnostics (rms, noise floor, residual autocorrelation, condition number) and a fits / marginal / does-not-fit verdict. eisFitBatch() fits a whole batch of spectra against one shared frequency grid with one backward pass serving the Jacobians of all fits.

Compile/Install

Requirements

  • c++20 capable compiler (GCC, CLANG)
  • cmake 3.23 or later
  • pkg-config
  • libtorch
  • libeisgenerator
  • libkisstype

Procedure

  • mkdir build && cd build
  • cmake .. && make
  • sudo make install

Basic usage of the CLI application

Fit one circuit to one spectrum:

eisfit -f spec.csv -m r-rp

Fit every csv in a directory tree in batches and write the spectra of the fitted circuits:

eisfit -R -f dir/ -m 'lr-p(r-w)' -o fitted/

The exit code is 4 when a spectrum does not fit.

Using the library

#include <eisfit/fit.h>

FitResult fit = eisFit(spectra, omegas, "r-rp");
if(fit.success && fit.verdict == FIT_VERDICT_FIT)
	std::cout<<fittedModelString("r-rp", fit.parameters)<<"\n";

spectra is complex, one entry per frequency, omegas the angular frequencies in rad/s. eisFitBatch() takes one spectrum per row against a shared grid and returns one FitResult per row.