Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion DEPRECATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ uv run python -m cellpy._deprecation

| Name | Replacement | Introduced | Removal |
| --- | --- | --- | --- |
| `legacy header attribute access (headers_normal / _summary / _step_table)` | `c.schema.raw / c.schema.steps / c.schema.summary` | 2.0 | 2.1 |
14 changes: 4 additions & 10 deletions cellpy/_deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,10 @@ def write_deprecations_md(path: str | Path) -> None:
def _seed_known_deprecations() -> None:
"""Register deprecations that exist before any runtime call (for doc generation)."""
# make_new_cell was removed in 2.1 (E3, #715) -- use CellpyCell.vacant.
# Legacy header attribute access (headers_normal.voltage_txt, hdr_steps.cycle,
# hdr_summary[...]) is shimmed to the native cellpycore schema names at the
# native-headers flip (D6). One summary row here; the shim warns per attribute
# at runtime (cellpy.parameters.legacy_header_shim).
_register(
"legacy header attribute access (headers_normal / _summary / _step_table)",
"c.schema.raw / c.schema.steps / c.schema.summary",
removal="2.1",
introduced="2.0",
)
# Legacy header attribute access (headers_normal / _summary / _step_table,
# the legacy_header_shim) was removed in 2.1 (E3, #715) -- use c.schema.raw /
# c.schema.steps / c.schema.summary. No longer registered here.

# cellpy.utils.easyplot was removed in 2.0 (#544); it is no longer a
# pending deprecation, so it is dropped from the registry / DEPRECATIONS.md.

Expand Down
4 changes: 2 additions & 2 deletions cellpy/parameters/cell_schema.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""The public column-name API for a cell (native-headers Phase 4, issue #558).

``CellpyCell.schema`` answers one question: *what is this column called on the
frames this cell is carrying?* It is the sanctioned replacement for the legacy
frames this cell is carrying?* It is the replacement for the legacy
``headers_normal`` / ``headers_step_table`` / ``headers_summary`` attributes,
which are now a deprecation shim (``legacy_header_shim``, D6).
which were a deprecation shim in 2.0 and were removed in 2.1 (E3, #715).

>>> c = cellpy.get(...) # doctest: +SKIP
>>> c.data.raw[c.schema.raw.potential] # doctest: +SKIP
Expand Down
193 changes: 0 additions & 193 deletions cellpy/parameters/legacy_header_shim.py

This file was deleted.

31 changes: 9 additions & 22 deletions cellpy/readers/cellreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,8 @@ def __init__(
native_schema (bool): the runtime column schema (native-headers
flip, Stage 5a). Defaults to True in cellpy 2: frames are kept
in native cellpy-core column names and the polars engine runs
directly (no legacy rename sandwich); legacy attribute access
(``headers_normal.voltage_txt``, ...) is carried by the D6 shim
(``legacy_header_shim``). Set False for the legacy bridge
directly (no legacy rename sandwich); use ``self.schema`` for
column names. Set False for the legacy bridge
(``OldCellpyCellCore``, legacy column names) — the path for v8
byte round-trips and ``merge`` until native merge lands (5b).
``get_cap`` / exporters / plotting work on a native cell via the
Expand Down Expand Up @@ -320,24 +319,12 @@ def __init__(
self.cellpy_datadir = internals.OtherPath(config.paths.cellpydatadir)
self.auto_dirs = config.reader.auto_dirs # v2.0

# - headers and instruments
# Native-headers flip (Stage 5a): on the native runtime the Data frames
# carry native cellpycore column names, so substitute the legacy
# Headers* objects with the D6 shims that resolve legacy attribute access
# (headers_normal.voltage_txt, ...) to the native column name — with a
# DeprecationWarning for renamed columns, silently for columns the flip
# leaves unchanged. The legacy path keeps the plain Headers* singletons.
if self.native_schema:
from cellpy.parameters.legacy_header_shim import build_legacy_shims

_shims = build_legacy_shims(self.core.schema)
self.headers_normal = _shims["headers_normal"]
self.headers_summary = _shims["headers_summary"]
self.headers_step_table = _shims["headers_step_table"]
else:
self.headers_normal = headers_normal
self.headers_summary = headers_summary
self.headers_step_table = headers_step_table
# - instruments
# The per-instance ``headers_normal`` / ``headers_summary`` /
# ``headers_step_table`` attributes were a 2.0 deprecation shim mapping
# legacy attribute access (``headers_normal.voltage_txt``, ...) to native
# cellpycore column names. Removed in 2.1 — use ``self.schema`` (the
# ``CellSchema`` view over ``core.schema``) for column names instead.
self.instrument_factory = instrument_factory # injected (#520) or None
self.register_instrument_readers()
self.set_instrument()
Expand Down Expand Up @@ -4035,7 +4022,7 @@ def filtered_summary(
"""Return a filtered copy of the summary DataFrame.

Thin wrapper around :func:`cellpy.filters.filter_summary` that
resolves the rate column names from ``self.headers_summary``.
resolves the rate column names from ``self.schema.summary``.
See the underlying function for the full range semantics; in
short ``(low, high)`` keeps rows where ``low < value <= high``
and ``{"value": v, "delta": d}`` keeps rows where
Expand Down
12 changes: 6 additions & 6 deletions cellpy/readers/instruments/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def _process_cellpy_object(name, c, out):

print(f"loaded the file - now lets see what we got")
raw = c.data.raw
hdr = c.headers_normal
hdr = c.schema.raw
print(raw.head())
c.make_step_table()

Expand All @@ -289,14 +289,14 @@ def _process_cellpy_object(name, c, out):
constrained_layout=True,
sharex=True,
)
raw.plot(x=hdr.test_time_txt, y=hdr.voltage_txt, ax=ax1)
raw.plot(x=hdr.test_time_txt, y=hdr.current_txt, ax=ax2)
raw.plot(x=hdr.test_time, y=hdr.potential, ax=ax1)
raw.plot(x=hdr.test_time, y=hdr.current, ax=ax2)
raw.plot(
x=hdr.test_time_txt,
y=[hdr.charge_capacity_txt, hdr.discharge_capacity_txt],
x=hdr.test_time,
y=[hdr.cumulative_charge_capacity, hdr.cumulative_discharge_capacity],
ax=ax3,
)
raw.plot(x=hdr.test_time_txt, y=hdr.cycle_index_txt, ax=ax4)
raw.plot(x=hdr.test_time, y=hdr.cycle_num, ax=ax4)
fig_1.suptitle(f"{name.name}", fontsize=16)

n = c.get_number_of_cycles()
Expand Down
Loading
Loading