quchip.inverse_design.observables

Target-spec construction for fit_a_dress.

The fit takes two independent target channels from the user (coupling_targets, observable_targets) and merges them with each device’s current freq/anharmonicity — which act as default anchors — into a single flat tuple of TargetSpec records. Explicit observable targets always override same-(kind, label) device defaults; couplings contribute a target only when listed in coupling_targets.

Functions

build_target_specs(chip, coupling_targets[, ...])

Merge device defaults, coupling targets, and explicit observables.

infer_coupling_mode(coupling[, override])

Infer whether a coupling's strength is targeted as "g", "chi", or "zz".

Classes

TargetSpec(kind, label, target)

A single optimization target.

class quchip.inverse_design.observables.TargetSpec(kind, label, target)[source]

Bases: object

A single optimization target.

Parameters:
kind

Observable kind — one of "freq", "anharmonicity", "chi", "zz", "exchange", "g".

Type:

str

label

Device label, (label_a, label_b) tuple, or coupling label that locates this target on the chip.

Type:

Any

target

Desired value in GHz.

Type:

float

kind: str
label: Any
target: float
quchip.inverse_design.observables.infer_coupling_mode(coupling, override=None)[source]

Infer whether a coupling’s strength is targeted as "g", "chi", or "zz".

When both devices are computational, the user almost always cares about the static zz; a qubit-resonator pair is instead best anchored by the dispersive chi; everything else is fit through the bare coupling strength. An explicit override short circuits the heuristic — including to "chi" on a pair that would not otherwise infer it; build_target_specs() validates that a "chi" target always has exactly one computational endpoint, whichever path selected it.

Parameters:
  • coupling – The coupling whose mode is being inferred.

  • override (str | None) – Explicit mode ("g", "chi", or "zz"), or None to use the computational-endpoint heuristic.

Returns:

"g", "chi", or "zz".

Return type:

str

quchip.inverse_design.observables.build_target_specs(chip, coupling_targets, observable_targets=None)[source]

Merge device defaults, coupling targets, and explicit observables.

The returned ordering is:

  1. For every device, the dressed 0→1 transition frequency (chip.freq(device)) is anchored. Computational devices also anchor on the dressed anharmonicity (chip.dressed_anharmonicity(device)). Anchoring the dressed observable rather than the bare device attribute makes the defaults model-agnostic — Duffing, charge-basis transmon, and fluxonium all expose a dressed 0→1 spacing, even when the bare parametrization is wholly different (no freq or anharmonicity attribute).

  2. One coupling target per entry in coupling_targets, with mode resolved via infer_coupling_mode() (override if a string mode is supplied, heuristic otherwise).

  3. Every explicit entry from observable_targets.

An explicit (kind, label) in observable_targets suppresses the same-(kind, label) default from steps 1 and 2, so the user never ends up with duplicate anchors for the same quantity.

Returns:

Merged specs in the order documented above.

Return type:

tuple[TargetSpec, …]

Raises:

ValueError – A coupling target mode is not one of "chi", "zz", "g"; or any "chi" target in the merged result — from an auto device-implied default, a coupling_targets entry, or an explicit observable_targets entry — does not resolve to a coupling with exactly one computational endpoint (see _validate_chi_target()).

Parameters:
  • coupling_targets (dict)

  • observable_targets (dict | None)