quchip.chip.transformations.plumbing¶
Control retargeting and graph reconstruction shared by transformations.
Handlers identify removed targets and choose the reduced physics. These helpers keep source settings and connect converted equipment to the rebuilt components.
Functions
|
Return the producer notes of |
|
Classify lines and resolve retarget rules before computing the reduction. |
|
Apply retarget rules and reconnect equipment to the retained graph. |
|
Rebuild the retained graph with the source's calculation settings. |
Classes
|
A removed control target and the error when no retarget rule exists. |
- class quchip.chip.transformations.plumbing.StrandedLine(rule_target, missing_rule_message)[source]¶
Bases:
objectA removed control target and the error when no retarget rule exists.
- quchip.chip.transformations.plumbing.plan_stranded_lines(equipment, classify, result_kind)[source]¶
Classify lines and resolve retarget rules before computing the reduction.
classify(line)returnsNonefor a survivor or aStrandedLinefor a removed target.result_kindselects the rule (edge,leaf-foldorcrosskerr). Missing rules raise the target’s message. Return surviving lines and(line, rule)pairs in source order. The rules are applied only after the reduced model and the emitted edges exist.
- quchip.chip.transformations.plumbing.inherited_notes(chip)[source]¶
Return the producer notes of
chip’s effective terms, prefixed by their labels.A reduction folds every earlier effective contribution into its own, so the approximations those contributions state also apply to the result.
- quchip.chip.transformations.plumbing.rebuild_chip(source_chip, *, devices, couplings, port_replacements=None, effective_terms=None, baths=None)[source]¶
Rebuild the retained graph with the source’s calculation settings.
Keep the backend, basis, approximation, space policy, label and surviving state shorthand. Filter per-device frames to retained labels. Copy baths and effective terms, unless replacements are supplied. Removed port targets need explicit replacements. Control equipment is attached separately.
- quchip.chip.transformations.plumbing.reattach_equipment(source_chip, final_chip, equipment, survivor_lines, retarget_plan, *, mode_label, result_kind, edges, notes)[source]¶
Apply retarget rules and reconnect equipment to the retained graph.
Rules receive the source, reduced chip, removed target and emitted edges through
RetargetContext. Their notes are appended tonotes. Surviving lines and transforms are copied. Converted operators are marked as already using retained coordinates. Without equipment, do nothing.