quchip.inverse_design.types

Classes

FitADressResult(chip, loss, history, ...)

Result of a fit_a_dress() optimization run.

ObservableReport(kind, label, target, ...)

Per-target record from a fit_a_dress run.

class quchip.inverse_design.types.ObservableReport(kind, label, target, initial, final, evaluator)[source]

Bases: object

Per-target record from a fit_a_dress run.

Parameters:
kind

Observable kind: "freq", "anharmonicity", "chi", "zz", "exchange", or "g".

Type:

str

label

Target locator — a device label for single-device observables, a (label_a, label_b) tuple for pair observables, or a coupling label for coupling-keyed observables.

Type:

Any

target

The value the optimizer tried to match (GHz).

Type:

float

initial

Observable value at the seed chip, before optimization (GHz).

Type:

float

final

Observable value at the fitted chip, after optimization (GHz).

Type:

float

evaluator

"full" if this target was evaluated on the whole chip or "local" if it was evaluated on a one-hop subsystem (see max_hilbert_dim in fit_a_dress()).

Type:

str

kind: str
label: Any
target: float
initial: float
final: float
evaluator: str
class quchip.inverse_design.types.FitADressResult(chip, loss, history, initial_targets, final_targets, initial_params, final_params, solver_info)[source]

Bases: object

Result of a fit_a_dress() optimization run.

Parameters:
chip

Fitted chip — a clone of the seed with updated freq/anharmonicity and coupling-strength values. The seed chip is never mutated. Exposing .chip makes this satisfy ChipTransform structurally, with no inheritance required.

Type:

Chip

loss

Final objective (sum of squared, scale-normalized residuals).

Type:

float

history

1-D numpy array holding [loss_initial, loss_final]. A compact record of how far the solver moved; it is not a per-iteration trace because scipy.optimize.least_squares does not expose one.

Type:

Any

initial_targets

One ObservableReport per target, evaluated on the seed chip.

Type:

tuple[ObservableReport, …]

final_targets

One ObservableReport per target, evaluated on the fitted chip.

Type:

tuple[ObservableReport, …]

initial_params

{parameter_name: seed_value} — the starting point passed to the optimizer.

Type:

dict[str, float]

final_params

{parameter_name: fitted_value} — the optimizer output. Parameter names follow "<device>.freq", "<device>.anharmonicity", and "<coupling>.<coupling_strength_name>""<coupling>.g" for Capacitive, "<coupling>.g_0" for TunableCapacitive, "<coupling>.chi" for CrossKerr.

Type:

dict[str, float]

solver_info

scipy solver metadata (method, status, message, nfev, jacobian), plus the identifiability receipt recorded for every fit_a_dress() call: n_free_parameters (length of final_params), n_target_residuals (length of final_targets), and underdetermined_by_count (True when the former exceeds the latter — a necessary, not sufficient, identifiability condition; no Jacobian-rank analysis is performed). jacobian is "jax" when a JAX-native backend supplies the exact residual Jacobian and "finite-difference" otherwise.

Type:

dict[str, Any]

chip: Chip
loss: float
history: Any
initial_targets: tuple[ObservableReport, ...]
final_targets: tuple[ObservableReport, ...]
initial_params: dict[str, float]
final_params: dict[str, float]
solver_info: dict[str, Any]
rebind(seed: BaseDevice | str, /) BaseDevice[source]
rebind(seed: BaseDevice | str, /, *more: BaseDevice | str) tuple[BaseDevice, ...]

Look up the fitted clones matching one or more seed devices.

fit.rebind(qb, tc, cr) replaces the qb_f = chip.device_map[qb.label] triple most tutorials opened with.

Parameters:

*seeds (BaseDevice or str) – One or more devices (or their labels) from the seed chip passed to fit_a_dress(). At least one is required.

Returns:

The matching device(s) on chip (the fitted clone), in input order. A single positional seed returns that device directly; two or more return a tuple.

Return type:

BaseDevice or tuple[BaseDevice, …]

Raises:

ValueError – No seeds were given.