Skip to content

Header-object attributes for column lookups in helpers and filters (#538)#542

Merged
jepegit merged 1 commit into
masterfrom
538-raw-steps-summary-literals
Jul 17, 2026
Merged

Header-object attributes for column lookups in helpers and filters (#538)#542
jepegit merged 1 commit into
masterfrom
538-raw-steps-summary-literals

Conversation

@jepegit

@jepegit jepegit commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

Native-headers Phase-0 prerequisite (#538). Two behavior-identical changes:

  • utils/helpers.py — 32 base-name string-keyed lookups (hdr_summary["charge_capacity"], hdr_steps["rate_avr"], …) → attribute access. The postfix/specific columns (*_gravimetric, areal_*) are deliberately left as string-key lookups: those names are composed, not direct attributes (report §8-5), and converting them would AttributeError / trip the specific-column deprecation path.
  • filters/summary.pyfilter_summary's rate_columns default was a hard-coded ("charge_c_rate", "discharge_c_rate") tuple; now defaults to None and resolves from HeadersSummary in the body, mirroring filters/cycles.py (report §9.2).

Scope correction (important)

Implementing this surfaced that #538's original file list was over-broad — the scan tool matches strings, and most of its hits outside helpers/filters are not raw/steps/summary header literals:

  • plotutils.py — the "cycle" / "voltage" / "direction" hits are get_cap curve-frame columns (e.g. df.sort_values(by=["cycle", "direction"])). These belong to the CurveCols adoption, v2 pre-flip: adopt cellpycore CurveCols as the canonical capacity-curve schema #540 — fixing them here (mapping to HeadersNormal) would be a latent bug after the flip.
  • ocv_rlx.py — the "charge" / "discharge" / "ir" hits are step-type values (.isin(["discharge"])) and dict keys (result_dict["ir"]), not header columns. These belong to a separate StepType-constants migration (report §8 step-type note).

I'll re-scope #538 and file the StepType issue after merge.

Test plan

  • Scan: helpers + filters in-scope findings ~40 → 1 (the lone remaining is on = ["charge"], a step-type literal, correctly left)
  • test_helpers.py + test_filters_summary.py + test_batch.py: 72 passed
  • filter_summary default and explicit-override paths verified equivalent
  • ruff: no new findings vs master
  • full (linux / uv) is the authoritative post-edit gate

Refs #538

🤖 Generated with Claude Code

#538)

Native-headers Phase-0 prerequisite. Two changes:

- utils/helpers.py: the base-name string-keyed lookups
  (hdr_summary["charge_capacity"], hdr_steps["rate_avr"], ...) become
  attribute access (32 sites). The postfix/specific columns
  (*_gravimetric, areal_*) are intentionally left as string-key lookups
  since those names are composed, not direct attributes (report §8-5).
- filters/summary.py: filter_summary's rate_columns default was a
  hard-coded ("charge_c_rate", "discharge_c_rate") tuple; it now defaults
  to None and resolves from HeadersSummary in the body, mirroring
  filters/cycles.py (report §9.2).

Behavior is identical (attribute and subscript return the same value).

Scope note: the scan tool's other hits in plotutils.py are get_cap
curve-frame columns (belong to the CurveCols work, #540) and those in
ocv_rlx.py are step-type values / dict keys (a separate StepType-constants
migration), not raw/steps/summary header literals. Refs #538.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cursor

cursor Bot commented Jul 17, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@jepegit
jepegit merged commit 1e67f28 into master Jul 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant