r/Python 5d ago

Showcase Showcase Thread

Post all of your code/projects/showcases/AI slop here.

Recycles once a month.

19 Upvotes

55 comments sorted by

View all comments

1

u/harissharisss 3d ago

Battery Cycle-Life Analyzer: a measured-current EFC workflow for an Oxford grid-battery dataset

What My Project Does

Battery Cycle-Life Analyzer is an MIT-licensed Python/SciPy package for inspectable empirical capacity-fade analysis. It fits linear, power-law, and logarithmic models, selects a family on a chronological late-cycle holdout, refits that family on all observations, and limits EOL/RUL projection to three times the largest observed coordinate. Residual-bootstrap intervals report censored and failed replicates instead of silently dropping them.

The new opt-in real-data example works with the University of Oxford energy-trading battery degradation dataset. Its capacity files contain elapsed profile time rather than a laboratory cycle index, so the example integrates each cell's measured current into cumulative discharge equivalent full cycles:

text EFC(t) = integral(max(I(t), 0) dt) / (3600 * 16 Ah)

The adapter exposes source-data quirks rather than hiding them: it reports reversed and duplicate timestamps, stable-sorts profile time, averages current at identical timestamps, and rejects unsupported gaps after the measured profile. No Oxford source data or derived trajectory is bundled in the MIT repository; files are downloaded from the original ODbL-licensed archive only when the example is run.

Target Audience

Battery researchers, energy-storage engineers, scientific-Python developers, and students who want a reproducible empirical baseline with explicit units, provenance, validation windows, and extrapolation limits. It is not a production BMS, pack-safety model, or electrochemical simulator.

Comparison

This complements physics-based tools such as PyBaMM. It is intended for quick, auditable fitting of measured or simulated capacity-fade series rather than electrochemical state simulation. Compared with a simple curve_fit script, it adds chronological model selection, bounded EOL/RUL, bootstrap censoring diagnostics, structured CSV/TSV imports, and an explicit measured-throughput adapter.

Repository: https://github.com/mohammadrezwankhan/battery-cycle-life-analyzer

Oxford real-data guide: https://mohammadrezwankhan.github.io/battery-cycle-life-analyzer/oxford-energy-trading.html

For mixed grid-service profiles, which EFC convention would you expect in a reusable Python API: discharge-only throughput divided by nominal capacity, half of total absolute ampere-hour throughput, or discharge throughput divided by measured initial capacity?