quchip.inverse_design.types¶
Classes
|
Result of a |
|
Record one fitted bare parameter. |
|
Per-target record from a |
- class quchip.inverse_design.types.ObservableReport(kind, label, target, initial, final, evaluator, source='explicit')[source]¶
Bases:
objectPer-target record from a
fit_a_dressrun.- Variables:
kind (str) – Canonical desired-chip kind (
"freq","anharmonicity","cross_kerr","exchange_rate", or"coupling_strength").label (Any) – 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.target (float) – Value the optimizer tried to match (GHz).
initial (float) – Observable value at the seed chip, before optimization (GHz).
final (float) – Observable value at the fitted chip, after optimization (GHz).
evaluator (str) –
"full"for evaluation on the whole chip or"local"for evaluation on a one-hop subsystem (seeevaluatorinfit_a_dress()).source (str) –
"component default"or"explicit".
- class quchip.inverse_design.types.FitParameterReport(name, initial, final, lower_bound, upper_bound, seed_source, sign_choice=None)[source]¶
Bases:
objectRecord one fitted bare parameter.
- Variables:
name (str) – Path in
chip.parameters.final (initial,) – Seed and fitted values in the parameter’s native units.
upper_bound (lower_bound,) – Bounds used by the optimizer, in the same units.
seed_source (str) – Origin of the starting value, as recorded by the fitter.
sign_choice (str or None) – Coupling-sign decision, or
Nonewhen no decision was necessary.
- class quchip.inverse_design.types.FitADressResult(chip, loss, history, initial_targets, final_targets, initial_params, final_params, solver_info, parameter_reports=(), history_params=(), history_residuals=None)[source]¶
Bases:
objectResult of a
fit_a_dress()optimization run.- Variables:
chip (Chip) – Fitted chip: a clone of the desired specification with updated device and coupling parameters. The fit never mutates the input chip. Because the result exposes
.chip, it satisfiesChipTransformstructurally, without inheritance.loss (float) – Final objective (sum of squared, scale-normalized residuals).
history (Any) – One-dimensional
numpyarray with the normalized objective at each distinct parameter vector passed to the residual function. The first entry is the seed and the last entry isloss. With a numerical Jacobian, the intermediate entries include finite-difference probes and accepted solver iterates. For a monotone best-so-far convergence curve, usenumpy.minimum.accumulate(history).history_params (tuple[dict[str, float], ...]) – One
{parameter_name: value}dict perhistoryentry, named likefinal_params. The first entry equalsinitial_paramsand the last entry equalsfinal_params.history_residuals (Any) – Array of shape
(len(history), len(final_targets)). Each row holds the observed minus the target value of each target (GHz) at thathistoryentry, infinal_targetsorder. The sum of the squared residuals, each divided bymax(abs(target), 1e-9), is the matchinghistoryentry.initial_targets (tuple[ObservableReport, ...]) – One
ObservableReportper target, evaluated on the optimizer’s initial candidate.final_targets (tuple[ObservableReport, ...]) – One
ObservableReportper target, evaluated on the fitted chip.initial_params (dict[str, float]) –
{parameter_name: seed_value}, the optimizer’s starting point.final_params (dict[str, float]) –
{parameter_name: fitted_value}, the optimizer output. Parameter names follow"<device>.freq","<device>.anharmonicity", and"<coupling>.<coupling_strength_name>". The coupling names are"<coupling>.g"forCapacitive,"<coupling>.g_0"forTunableCapacitive,"<coupling>.chi"forCrossKerr.parameter_reports (tuple[FitParameterReport, ...]) – One
FitParameterReportper varied bare parameter, with its bounds, the source of its starting point, and any coupling-sign choice.solver_info (dict[str, Any]) –
scipysolver metadata (method,status,message,nfev,jacobian). It also holds the identifiability receipt that eachfit_a_dress()call records. The receipt containsn_free_parameters(length offinal_params) andn_target_residuals(length offinal_targets). Itsunderdetermined_by_countisTruewhen the former exceeds the latter, a necessary but not sufficient identifiability condition. The receipt also contains the final scaled-Jacobian rank, the condition number, the singular values, and any weak parameter directions.Rank uses normalized residuals in the solver’s scaled parameter coordinates.
history_axisnames the sampling axis used byhistory, andn_recorded_evaluationsgives its length.jacobianis"jax"when a JAX-native backend supplies the exact residual Jacobian and"finite-difference"otherwise.
- history: Any¶
- initial_targets: tuple[ObservableReport, ...]¶
- final_targets: tuple[ObservableReport, ...]¶
- parameter_reports: tuple[FitParameterReport, ...] = ()¶
- history_residuals: Any = None¶
- property converged: bool | None¶
Convergence flag of the optimizer, or None when the status is not available.
- rebind(seed: BaseDevice | str, /) BaseDevice[source]¶
- rebind(seed: BaseDevice | str, /, *more: BaseDevice | str) tuple[BaseDevice, ...]
Find the fitted clones that match one or more seed devices.
For example, call
fit.rebind(qb, tc, cr).- Parameters:
*seeds (BaseDevice or str) – One or more devices (or their labels) from the seed chip passed to
fit_a_dress(). You must give at least one.- Returns:
The matching device(s) on
chip(the fitted clone), in input order. A single positionalseedreturns that device directly, and two or more seeds return a tuple.- Return type:
BaseDevice or tuple[BaseDevice, …]
- Raises:
ValueError – No seeds were given.