Skip to main content

toyo-battery

OSS Python toolkit for TOYO battery cycler data.

Reads output from TOYO System battery charge/discharge testers, computes cycle capacity, Coulombic efficiency, dQ/dV curves, and summary statistics. Pure Python, installable from PyPI — including into OriginLab's embedded Python.

Status: pre-alpha (0.0.x). Public API is unstable and may change without deprecation until 0.1.0.

Installation

# Core library only (numpy, pandas, scipy)
pip install toyo-battery

# Pick one or more extras:
pip install "toyo-battery[plot]"    # Matplotlib plotting
pip install "toyo-battery[plotly]"  # Plotly + Kaleido (static image export)
pip install "toyo-battery[cli]"     # toyo-battery CLI (typer + rich)
pip install "toyo-battery[gui]"     # Tk desktop app (matplotlib)

# Everything non-Origin in one shot
pip install "toyo-battery[all]"

The [origin] extra has no runtime deps — the toyo_battery.origin submodule imports originpro lazily, so it only works inside Origin's embedded Python (see below).

Quick start

from toyo_battery import Cell

cell = Cell.from_dir("path/to/cell_dir")

cell.chdis_df.to_csv("chdis.csv")   # charge/discharge V-Q curves per cycle
cell.cap_df.to_csv("cycle.csv")     # per-cycle capacity + Coulombic efficiency
cell.dqdv_df.to_csv("dqdv.csv")     # dQ/dV per cycle

Cell.from_dir() auto-detects three TOYO layouts: 連続データ.csv (native export), 連続データ_py.csv (pre-normalized), or 6-digit raw files with a *.PTN pattern file. Mass is read from the PTN file unless you pass mass=... (grams).

CLI

Install with pip install "toyo-battery[cli]". All subcommands accept one or more cell directories plus the shared options --mass, --encoding, --column-lang.

# {name}_chdis.csv / {name}_cap.csv / {name}_dqdv.csv per cell
toyo-battery process cell_A cell_B --out ./csvs

# chdis / cycle / dqdv PNGs (one figure per kind, one Axes per cell)
toyo-battery plot cell_A cell_B --out ./pngs \
    --kinds chdis,cycle,dqdv --cycles 1,10,50

# Single stat_table CSV spanning all cells at the given target cycles
toyo-battery stats cell_A cell_B --cycles 10,50 --out stats.csv

GUI

Install with pip install "toyo-battery[gui]" and launch:

python -m toyo_battery.gui

Tk app for interactive directory selection, plot-kind toggles, per-axis ranges, and Savitzky–Golay window tuning for dQ/dV.

Plotting from Python

Matplotlib and Plotly backends expose the same three functions — pick by import path:

from toyo_battery import Cell
from toyo_battery.plotting.matplotlib_backend import plot_chdis, plot_cycle, plot_dqdv
# or: from toyo_battery.plotting.plotly_backend import plot_chdis, plot_cycle, plot_dqdv

cells = [Cell.from_dir(p) for p in ("cell_A", "cell_B")]
fig = plot_cycle(cells)
fig.savefig("cycle.png", dpi=150, bbox_inches="tight")  # matplotlib
# fig.write_image("cycle.png")                          # plotly

Installing into Origin's embedded Python

Open Origin, then in the Origin Python console:

import subprocess
import sys

subprocess.check_call(
    [sys.executable, "-m", "pip", "install", "toyo-battery[origin]"]
)

The [origin] extra pulls in matplotlib so the Tk GUI works out of the box; the three .otpu graph templates ship inside the wheel. After install, one line opens the directory picker and pushes results into the active Origin project:

from toyo_battery.origin import launch_gui
launch_gui()

For scripted use, toyo_battery.origin.push_to_origin(cells, ...) populates the current Origin project with per-cell worksheets, template graphs, and a stat sheet. It imports originpro lazily, so the submodule is importable outside Origin (push_to_origin itself raises there).

To run the same Tk GUI outside Origin (matplotlib Toplevel previews, no Origin write-back), install the [gui] extra and call from toyo_battery.gui import launch_gui; launch_gui() instead.

See docs/ORIGIN_SETUP.md for the full workflow.

License

MIT — see LICENSE.

Metadata

Release files for toyo-battery 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for toyo-battery 0.0.3
File Size Uploaded Provenance Actions
toyo_battery-0.0.3.tar.gz 130.4 kB With provenance Details for toyo_battery-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for toyo-battery 0.0.3
File Interpreter ABI Platform Actions
toyo_battery-0.0.3-py3-none-any.whl Python 3 none any Details for toyo_battery-0.0.3-py3-none-any.whl

Total release size: 236.3 kB

Release files / toyo_battery-0.0.3.tar.gz

Download URL toyo_battery-0.0.3.tar.gz
Size 130.4 kB
Tags Source
SHA-256 checksum
How to use checksums
51e6b7b27efdbeb31a11422efd5a192805315c30bace4183c72e60b22abf1218
BLAKE2b-256 checksum
How to use checksums
be22f8f6b603b426cbd8a26b405e43880ade94de0eaffa3764b3d51b11cddd1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 22, 2026.

Transparency log

Release files / toyo_battery-0.0.3-py3-none-any.whl

Download URL toyo_battery-0.0.3-py3-none-any.whl
Size 106.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ce9d24c3fdd77fd46422b698ccd4be51b9dbfbb1734761bfa1c36cbaca847c8
BLAKE2b-256 checksum
How to use checksums
fa293482fd29ecc74b98c172a1ab23e8b59d99e9a143597ccc9b4f366cd559c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 22, 2026.

Transparency log

Security for toyo-battery 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for toyo_battery-0.0.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page