Skip to main content

Electrochemical impedance spectroscopy fitting and parameter identification tools.

Project description

eisfit

eisfit is an open-source Python package for fitting electrochemical impedance spectroscopy (EIS) data and identifying equivalent-circuit parameters.

The base model is:

Z = jωL + R0 + (R1 || CPE1) + (R2 || CPE2) + tail

Two low-frequency tail models are available:

CPE tail, default:       tail = 1 / (Qd * (jω)^nd)
Warburg tail:            tail = σ / sqrt(jω)

The CPE version keeps Qd and nd free. The Warburg version is the traditional semi-infinite Warburg form, equivalent to a CPE exponent fixed at n = 0.5 with a single fitted coefficient σ.

CPE parameters:

[L, R0, R1, Q1, n1, R2, Q2, n2, Qd, nd]

Warburg parameters:

[L, R0, R1, Q1, n1, R2, Q2, n2, sigma]

Features

  • CSV and Excel EIS data loading with flexible column matching
  • Multi-start bounded least-squares fitting
  • Robust loss and impedance-modulus weighting options
  • Python functions and command-line interface
  • Excel/PNG output generation for local analysis
  • Public demo notebook for the Zenodo-derived repository dataset

Dataset attribution

The repository EIS_dataset example files are from:

M. Moertelmaier, M. Kasper, and S. Clark, "EIS data of 54 21700 cells", Zenodo, May 26, 2025. doi: 10.5281/zenodo.15422339.

The included metadata reports a CC-BY 4.0 license for the dataset. Keep this attribution if you redistribute the data. The PyPI package distributions intentionally do not bundle the dataset; use your own EIS files after installation.

Installation

After PyPI release:

pip install eisfit

For local development:

pip install -e ".[dev]"

Minimal package only:

pip install -e .

Python usage

Simple array-based use:

from eisfit import fit, load_eis

freq, Zexp = load_eis("my_eis.csv")

cpe = fit(freq, Zexp)                  # default tail="cpe"
warburg = fit(freq, Zexp, tail="warburg")

print(cpe.parameters)
print(cpe.rmse, cpe.nrmse)

One-line file-based use:

from eisfit import fit_file

result = fit_file("my_eis.csv", tail="cpe")
warburg = fit_file("my_eis.csv", tail="warburg")

Advanced use with full configuration:

from eisfit import FitConfig, fit_model_eis, load_eis

freq, Zexp = load_eis("my_eis.csv")
cfg = FitConfig(tail="cpe", n_starts=80, seed=7, max_nfev=8000)
result = fit_model_eis(freq, Zexp, cfg=cfg)

Command-line usage

Fit one file with the default CPE tail and write Excel/PNG outputs:

eisfit my_eis.csv --out-dir outputs --n-starts 40

Fit the same file with a semi-infinite Warburg tail:

eisfit my_eis.csv --tail warburg --out-dir outputs --n-starts 40

Batch fit a folder:

eisfit my_eis_folder --pattern "*.csv" --out-dir outputs --n-starts 20

Public notebook

Use examples/demo_fit_zenodo_dataset.ipynb with the repository dataset for a clean public demo.

Development checks

pytest
python -m compileall src tests

Release

PyPI releases are built from the clean public branch. See RELEASE.md for the Trusted Publishing setup and tag-based release workflow.

License

Package code is released under the MIT License. Dataset files retain their original dataset license and attribution requirements.

Project details


Download files

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

Source Distribution

eisfit-0.1.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

eisfit-0.1.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file eisfit-0.1.0.tar.gz.

File metadata

  • Download URL: eisfit-0.1.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for eisfit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fd141cf491da95fd42c6078d6046671b8e313769591b5a48df4b2d73daeed73f
MD5 6ec6b2c5f8d688edb8aeda79cacc0ea0
BLAKE2b-256 7cfc1cc23caeaeda0a12fd3d21c2290f44de6cc85b5fda5da6049712946efbb5

See more details on using hashes here.

Provenance

The following attestation bundles were made for eisfit-0.1.0.tar.gz:

Publisher: publish.yml on shiyunliu-battery/Battery-EIS-Fit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eisfit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: eisfit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for eisfit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90d03f9ca0314249f00d42f2ff8342fb99c9235e8d1f129f23c4d436579e25e3
MD5 aa000ee3434742a03628c1162c38ec0f
BLAKE2b-256 d272a4b99896298076796c2dc12b88cde38504cb426f2534324b0d52ffca2d06

See more details on using hashes here.

Provenance

The following attestation bundles were made for eisfit-0.1.0-py3-none-any.whl:

Publisher: publish.yml on shiyunliu-battery/Battery-EIS-Fit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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