Skip to content

v2: enable renumber_cycles=False (original per-test cycle numbers) in campaign merge #529

Description

@jepegit

Context

CellpyCell.merge(..., mode="campaign", renumber_cycles=False) raises
NotImplementedError with the message that it "requires per-test summary
support through the core bridge; tracked for the native-schema path (#511)"
(cellreader.py, campaign branch of merge()).

That blocker is gone. cellpycore 0.2.2 (core #136) delivered exactly the
missing pieces on the legacy bridge:

So the per-test grouping/windowing machinery the flag needs now exists end to
end on the legacy path — ahead of the native-schema runtime (#511 shipped the
opt-in, but campaign merge is not supported on native-schema cells yet).

Work

  • merger.campaign_fold: make the cycle offset conditional on
    renumber_cycles (data-point offsets must stay unconditional — raw
    data_point must remain globally unique for fid/step lookups).
  • Drop the NotImplementedError guard in CellpyCell.merge and forward the
    flag.
  • Decide/document consumer semantics for duplicate cycle numbers: with
    original numbering, (test_id, cycle) is the key — cycle-keyed consumers
    (get_cap(cycle=...), split_many, with_cycles, exporters) will see
    duplicate cycle numbers. Minimum bar: document that these operate on the
    union of matching cycles; anything smarter is follow-up.
  • Tests: campaign merge with renumber_cycles=False on the two-res-file
    fixture (tests/test_merge_campaign.py) — raw/steps/summary keep original
    per-test cycle numbers, test_id values stay {0, 1}, recomputed summary
    windows per test (cumulatives reset at the test boundary), and a v9
    round-trip preserves everything.

Refs

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    v2cellpy v2.0 epic work - PRs should target the master branch

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions