Skip to content
import marimo as mo

Hello cellpy (marimo)

Tiny spike showing that marimo notebooks can appear in the cellpy docs. The page you are reading was exported with marimo-md-export — static markdown plus embedded outputs, no Pyodide in the site.

Source: 01_hello_cellpy.py — run locally with marimo edit docs/examples/marimo/01_hello_cellpy.py.

import matplotlib.pyplot as plt

from cellpy.utils import example_data
c = example_data.cellpy_file()
n_cycles = c.get_number_of_cycles()
mo.md(f"Loaded the bundled example cellpy file — **{n_cycles}** cycles.")

Loaded the bundled example cellpy file — 304 cycles.

# Keep the figure light: a few summary points, PNG-friendly matplotlib.
summary = c.data.summary
cycles = summary[c.schema.summary.cycle_num]
charge = summary[c.schema.summary.charge_capacity]

fig, ax = plt.subplots(figsize=(6, 3.5))
ax.plot(cycles, charge, marker="o", markersize=3, linewidth=1)
ax.set_xlabel("Cycle")
ax.set_ylabel("Charge capacity")
ax.set_title("Example cell — charge capacity vs cycle")
fig.tight_layout()
fig

png