Header-object attributes for column lookups in helpers and filters (#538)#542
Merged
Conversation
#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>
|
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. |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 wouldAttributeError/ trip the specific-column deprecation path.filters/summary.py—filter_summary'srate_columnsdefault was a hard-coded("charge_c_rate", "discharge_c_rate")tuple; now defaults toNoneand resolves fromHeadersSummaryin the body, mirroringfilters/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 areget_capcurve-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 toHeadersNormal) 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
on = ["charge"], a step-type literal, correctly left)test_helpers.py+test_filters_summary.py+test_batch.py: 72 passedfilter_summarydefault and explicit-override paths verified equivalentfull (linux / uv)is the authoritative post-edit gateRefs #538
🤖 Generated with Claude Code