quchip.chip.transformations.active_patch

Schedule-aware active-patch reduction: eliminate spectators, keep the driven patch.

The activity analysis is structural — scheduled targets plus hops coupling-graph steps. Amplitudes, detunings, and rigorous error bounds are declared out-of-scope refinements; the honesty signal is the per-step Schrieffer-Wolff validity carried on the result, plus a UserWarning (see _warn_on_poor_validity()) raised at fold time for any step whose validity comes back poor — the reduction still proceeds, but the caller is told which fold to distrust.

quchip.chip.transformations.active_patch.coupling_adjacency(chip)[source]

Device-label adjacency of the chip’s coupling graph.

Parameters:

chip (Chip)

Return type:

dict[str, set[str]]

quchip.chip.transformations.active_patch.active_labels(sequence, *, hops=1)[source]

Devices touched by the schedule, expanded hops coupling-graph steps.

Parameters:
Return type:

set[str]

quchip.chip.transformations.active_patch.graph_distances(adjacency, sources)[source]

BFS distance from sources; labels unreachable from them are absent.

Parameters:
Return type:

dict[str, int]

class quchip.chip.transformations.active_patch.ActivePatchResult(chip, sequence, active_labels, eliminated_labels, steps, notes)[source]

Bases: object

A reduced patch chip, the re-bound sequence, and the reduction’s honesty record.

Parameters:
chip

The patch chip: schedule-active devices plus whatever spectators active_patch() could not eliminate (unreachable, or where elimination itself declined — see notes).

Type:

Any

sequence

A QuantumSequence bound to chip, replaying the source sequence’s entries verbatim.

Type:

Any

active_labels

Sorted schedule-active device labels (never eliminated).

Type:

tuple[str, …]

eliminated_labels

Device labels actually folded away, in elimination order (farthest-from-active first).

Type:

tuple[str, …]

steps

The EliminationResult from each successful eliminate() call, verbatim and in eliminated_labels order — reshape nothing here; read .validity/.effective_params off the step objects through the convenience properties below.

Type:

tuple

notes

Every explicitly dropped or deferred piece of physics: unreachable spectators left in place, control lines stripped as unused, and (if elimination itself couldn’t proceed past some spectator) why the reduction stopped early — plus every step’s own notes.

Type:

tuple[str, …]

chip: Any
sequence: Any
active_labels: tuple[str, ...]
eliminated_labels: tuple[str, ...]
steps: tuple
notes: tuple[str, ...]
property validity: dict[str, Any]

{eliminated label: that step's .validity} — verbatim, per-coupling shape untouched.

property effective_params: dict[str, Any]

{eliminated label: that step's .effective_params} — verbatim, per-survivor shape untouched.

simulate(**kwargs)[source]

Solve the patch sequence (automatic partitioning still applies inside).

Parameters:

kwargs (Any)

Return type:

Any

quchip.chip.transformations.active_patch.active_patch(sequence, *, hops=1, method='sw')[source]

Reduce a chip to its schedule-active patch by eliminating spectators.

Spectators are eliminated one at a time via eliminate(), farthest-from-active first; every step’s validity metrics ride on the result untouched. Explicit opt-in — this approximates (Schrieffer-Wolff, or the exact dressed-spectrum route under method="exact"), unlike the exact automatic partitioning simulate() performs internally at solve time.

The elimination order and reachability are recomputed from the current reduced chip before every step, not just once up front: a fold can only ever add a bridging edge between the eliminated mode’s neighbors, never remove one, so a label’s distance from the active set can shorten but never make a previously reachable label unreachable — still, reading the graph fresh each time means a label that has already been folded away is never re-considered, and the order always reflects what eliminate will actually see. Bridging edges created by earlier folds may be Capacitive edges carrying g or TunableCapacitive edges carrying g_0. Both fold onward, so cycles among spectators reduce all the way down. If eliminate still declines a step (its typed NotImplementedError signal for an unsupported elimination — e.g. a Purcell decay fold onto a survivor that carries thermal occupation, which no collapse-channel API can represent without inventing physics that was never present), the reduction stops there: everything eliminated so far stays folded, and the remaining spectators — including the one that failed — are left on the patch chip untouched, with the reason recorded in notes.

Parameters:
  • sequence (QuantumSequence) – The schedule to reduce around.

  • hops (int) – Coupling-graph hops the active set expands beyond the scheduled targets (see active_labels()).

  • method (str) – Forwarded to eliminate() for every device elimination.

Return type:

ActivePatchResult