- C++ 52%
- C 45.4%
- CMake 1.6%
- Shell 1%
| argp | ||
| componant | ||
| dlfcn-win32 | ||
| doc | ||
| eisgenerator | ||
| examples | ||
| pkgconfig | ||
| .gitmodules | ||
| accumplot.sh | ||
| basicmath.cpp | ||
| bench.cpp | ||
| CMakeLists.txt | ||
| compcache.cpp | ||
| compcache.h | ||
| compile-win.cpp | ||
| compile.cpp | ||
| compile.h | ||
| crossW64.cmake | ||
| density.p | ||
| gpl-3.0.txt | ||
| kissplotcsv | ||
| lgpl-3.0.txt | ||
| linearregession.cpp | ||
| linearregession.h | ||
| log.cpp | ||
| main.cpp | ||
| model.cpp | ||
| normalize.cpp | ||
| options.h | ||
| package-win.sh | ||
| randomgen.cpp | ||
| randomgen.h | ||
| README.md | ||
| strops.cpp | ||
| strops.h | ||
| symmetry.cpp | ||
| test.cpp | ||
| translators.cpp | ||
eisgenerator
eisgenerator is a shared library (libeisgenerator.so) and CLI application that allows one to generate EIS spectra with high performance. The target application is generating test and example datasets for machine learning applications.
eisgenerator's development and target platform is UNIX, but it should compile on nigh on any platform
Compile/Install
Requirements
- git
- c++20 capable compiler (GCC, CLANG)
- cmake 3.20 or later
- optional:
- gnuplot in $PATH
Procedure (UNIX)
In a console do:
- git clone https://git-ce.rwth-aachen.de/carl_philipp.klemm/eisgenerator.git
- cd eisgenerator
- mkdir build
- cd build
- cmake ..
- make
- sudo make install
Cross-compile for windows on UNIX
- Have the mingw cross-compile toolchain installed
- git clone https://git-ce.rwth-aachen.de/carl_philipp.klemm/eisgenerator.git
- cd eisgenerator
- mkdir build
- cd build
- cmake -DCMAKE_TOOLCHAIN_FILE=./crossW64.cmake ..
- make
Basic usage of CLI application
Generate spectra
eisgenerator_export --model="r{1e3}-r{100}c{1e-6}" --omega=1-1e6 --omegasteps=100
flags:
--model: model string, format is similar to RHD RelaxIS except that the implicit operator is parallel instead of serial, IE. "rc" is a resistor and condenser in parallel while "r-c" is the same in series and that parameters can be passed by adding {number} after the parameter, if an element requires more than one parameter they are specified by adding several comma separated values in between the brackets like so: {420, 56}
- Supported Elements
- c: capacitor
- one parameter: capacitance {C}
- r: resistor
- one parameter: resistance {R}
- l: inductor
- one parameter: inductance {L}
- w: warburg element (infinite)
- one parameter: Warburg coefficient {A}
- p: constant phase element
- two parameters: {Q, alpha}
- t: closed transmititon line
- four parameters: {R, Q, a, l}
- o: open (reflecting) transmititon line
- four parameters: {R, Q, a, l}
- c: capacitor
--omega: range of frequency values (in rad/s) to sweep
--omegasteps: amount of steps to take in the range specified by --omega
Ranges and parameter sweeps
Instead of a single value, a parameter can be given as a range: start~end steps it linearly, start~endL logarithmically. As soon as one element carries a range the model becomes a parameter sweep over the cross product of all ranges, and --param sets how many steps every range gets.
A single range can override that with its own step count, appended after a colon:
eisgenerator_export --model="r{101e5L:8}p{1e-91e-6L:12, 0.6~0.95:3}"
Here r gets 8 steps, Q 12 and alpha 3, regardless of --param. This is how to spend steps where they matter: the CPE exponent is the least sensitive parameter in a model string, Y0 among the most, and the total cost is the product of all counts. find-range prints the counts it used, so its output can be fed back in unchanged.
find-range also probes each parameter on its own (all others parked at the centre of their range) and reports how far the spectra travel in decades of |Z| as that one parameter sweeps. From that it derives how many steps each parameter needs to stay resolved, and prints a paste-ready model string carrying those counts. When fully resolving every parameter would cost more spectra than the sweep you asked for, the counts are scaled down together to fit the budget and a warning explains that the counts are a floor: prefer narrowing the widest ranges over cutting counts below it.
further flags can be found with: eisgenerator_export --help
Equivalent parameter permutations
Many models have parameter assignments that produce exactly the same spectrum. In
eisgenerator_export --model="r{100}c{1e-6}-r{333}c{1e-9}" --mode=permutations
the two rc groups can be exchanged, so the tool prints
r{333}c{1e-09}-r{100}c{1e-06}
These are parameter symmetries: values move between the slots of the same model string. Exchanging two elements that keep their own values, r{100}c{1e-6} for c{1e-6}r{100}, is only a relabelling of the topology and is not reported.
What is interchangeable is decided by fitting each element's parameters to the other's impedance curve and requiring the residual to stay under --permutation-tolerance (1e-3 by default), then confirming every reported permutation against the spectrum of the whole circuit. That catches the cases a structural comparison would miss:
- a CPE standing in for a capacitor at
alpha=1, for a Warburg atalpha=0.5and for a resistor atalpha=0, sor{100}p{1e-6,1}-r{333}c{1e-9}has one permutation andr{100}p{1e-6,0.9}-r{333}c{1e-9}has none - nested groups, which are flattened first because series and parallel are associative, so
r{1}-(r{2}-r{3})reports all 6 orderings of the three resistances rather than just the inner pair - combinations, so
(r{1}-r{2})(r{3}-r{4})reports 7: swap either pair, or both, or the two serials
Cost is a few dozen circuit evaluations regardless of the model, plus one per reported permutation; the count itself grows factorially with the size of a symmetric group, so --mode=permutations stops after 4096 candidates and says so. For a sweep model the values are taken from sweep step 0, which is representative since symmetry does not depend on the values.
Useful for generating training data: every permutation printed is a distinct label for a spectrum a fit cannot tell apart, so either deduplicate against this list or expect the fit to land on any one of them.
The same is available from the library as eis::Model::getEquivalentParameterPermutations().
Plot Spectra
requires gnuplot in $PATH
eisgenerator_plot --model="r{1e3}-r{100}c{1e-6}" --omega=1-1e6 --log --omegasteps=100
Generates Nyquist plot of model specified, allows the usage of the same flags as eisgenerator_export
Linking
it is best to link to this library with the help of pkg-config as this provides platform a agnostic to query for paths and flags. Almost certainly, pkg-config is already integrated into your buildsystem.
Python bindings
python bindings can be build separately from: eisgeneratorpy