Skip to main content

A fast, lean library for modeling and fitting equivalent circuit models for electrochemical impedance spectroscopy data.

Project description

PyImpedanceModel

PyImpedanceModel is a lightweight python framework for modeling electrical impedance models.

Example data fit

In its current form, it can be used to setup generic equivalent-circuit models (e.g. for generating dummy electrical impedance spectroscopy (EIS) data) and to fit models to real-world impedance data.

Simple example scripts for a) seeting up arbitrary models, and b) fit a model to real-world data can be found in the repo.

Usage

In its most basic form, a model can be initialized as follows:

from PyImpedanceModel import *

model = ImpedanceModel([R(), (R(), C())])

Model notation: Model elements in square brackets will be interpreted as connected in series. Elements in round brackets will be treated as connected in parallel. Both types can be combined to set up more complex models.

Example for simple model containing a resistor in series with a capacitor (R-C):

model = ImpedanceModel([R(), C()])

Example for a simple parallel resistor-capacitor circuit:

model = ImpedanceModel((R(), C()))

A standard Randles model (https://en.wikipedia.org/wiki/Randles_circuit) can be set up as follows:

model = ImpedanceModel([R(20), (C(0.000025), [R(100), W(300)])])
model.evaluate(frequency_Hz = ImpedanceModel.get_log_frequency_range(800, 1))

The evaluate method allows to pass a user-defined frequency. In this case, this is used to rebuild the Randles circuit from Wikipedia.

Implemented model elements

The following equivalent circuit elements are added:

Ideal resistor R(R_Ohm = 0.01)

An ideal Ohmic resistor with resistance R in Ohm.

Ideal capacitor C(C_F = 300)

An ideal capacitor with capacitance C in F.

Ideal inductor L(L_H = 1e-12)

An ideal inductor with inductance L in H.

Constant-phase element (CPE) for non-ideal capcitors CPE(Q0_Ohm_p_s_n = 30, n_1 = 0.95)

In most cases ideal capacitors are insufficient for describing real-world capacitive impedance behaviors.

For such cases, a constant-phase element (short CPE) can be implemented. A very good introduction to CPEs can be found here: [https://lithiuminventory.com/experimental-electrochemistry/eis/constant-phase-element/index.html]

CPE in parallel to a resistor R_CPE(R_Ohm: = 0.01, tau_s: = 1, n_1: = 0.95)

As CPEs are often used in parallel with an Ohmic resistor (often called ZARC element), this element can be used to model such a circuit. It also replaces the capacitance parameter with a time constant (tau = R*C) which really helps understanding the connection to distribution of relaxation times (DRT).

A brief ressource on ZARC elements can be found here: [https://www.zimmerpeacocktech.com/2022/02/18/the-zarc-element/]

Semi-inifite diffusion - Warburg W(Aw_Ohm_p_s_sqrt = 1e-6)

Warburg elements are used to model semi-infinite, linear diffusion behaviors in impedance spectra. Its basically a frequentcy-independent 45° CPE. Aw is the Warburg constant.

Finite-length, closed, or transmissive Warburg FLW(Z_0_Ohm: = 1e2, tau_s: = 1)

This element can be used to model transmissive mass-transport through thin layers with a finite length (see https://lithiuminventory.com/experimental-electrochemistry/eis/diffusion-impedance/index.html).

Finite-space, open, or reflective Warburg FLW(Z_0_Ohm: = 1e2, tau_s: = 1)

This element can be used to model reflective diffusion as it appears in porous electrodes (see https://lithiuminventory.com/experimental-electrochemistry/eis/diffusion-impedance/index.html).

Gerischer element (classic version) G(R_Ohm: = 0.01, tau_s: = 1)

The Gerischer impedance can be used to analyze porous electrodes with a asymmetric, distributed impedance behavior. (see https://doi.org/10.1016/S0167-2738(02)00185-6 for more information)

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyimpedancemodel-1.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyimpedancemodel-1.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file pyimpedancemodel-1.0.tar.gz.

File metadata

  • Download URL: pyimpedancemodel-1.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for pyimpedancemodel-1.0.tar.gz
Algorithm Hash digest
SHA256 c37b5e66282cc59e8bc162a3b063ad8486c1815fff4f010d47a943c26ca0a46a
MD5 9855753e4a5e629d6a43805bcae1bff6
BLAKE2b-256 946f8d383023a266fec6be97a533da6eb7140482aceaf696ad9a70bbca647398

See more details on using hashes here.

File details

Details for the file pyimpedancemodel-1.0-py3-none-any.whl.

File metadata

  • Download URL: pyimpedancemodel-1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for pyimpedancemodel-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5976c919f803ed6542a96d7834797cbcda93f2b1f4679ae47341a653f3ab112b
MD5 35f42d1d7da9dd4ccb4077b632fce06d
BLAKE2b-256 7b9e9c4bff8023b91e991e4dfc10de5988e251861139d72f184ac103a451f845

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page