Skip to content

Add Composition.expand_op_modes to resolve OP_Mode from presets - #13

Draft
lefi7z wants to merge 3 commits into
masterfrom
cursor/expand-op-modes-composition-c5fd
Draft

Add Composition.expand_op_modes to resolve OP_Mode from presets#13
lefi7z wants to merge 3 commits into
masterfrom
cursor/expand-op-modes-composition-c5fd

Conversation

@lefi7z

@lefi7z lefi7z commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

Adds Composition.expand_op_modes(presets) to produce a new composition where OP_Mode steps are replaced by the concrete set-values from a presets file.

  • Reuses translate_op_modes with check=False (expansion does not require a full reaction-parameter set on every step).
  • presets may be a path to the presets XML (parse_presets_file) or the parsed dict.
  • Copies max_runs, start_cycle, and spec_duration_ms unchanged; leaves the original composition untouched.

Usage

from pytrms.compose import Composition

co = Composition.load(open("Composition.json"))
expanded = co.expand_op_modes("presets.xml")
expanded.dump(open("Composition_resolved.json", "w"))
Open in Web Open in Cursor 

cursoragent and others added 2 commits August 6, 2026 10:09
Build a new Composition from translate_op_modes output so OP_Mode
placeholders become concrete set-values. Accepts a presets XML path or
the dict from parse_presets_file.

Co-authored-by: lefi7z <lefi7z@users.noreply.github.com>
Import os and parse_presets_file at module level; always call
translate_op_modes with check=False.

Co-authored-by: lefi7z <lefi7z@users.noreply.github.com>
@lefi7z

lefi7z commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

There are a lot more adresses of interest that would need to be considered here, e.g. the Flow-Controllers especially!

See cat presets_AME_20260616.xml |grep AdsPath |sort -u |sed -rn 's/^.*>(.*)<.*$/\1/ p' to list all paths (for this config), but the dictionary will need to be handcrafted.

Maybe it's not worth the effort right now..

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.

2 participants