quantcore_circuits.optimise¶
Closed-loop design feedback: tune geometry knobs in design.json until extracted parameters hit targets.
Knobs are dotted paths into the design: "Q1.cross_length" (instance parameter), "R1.length" (route field),
"R1.to.length" (nested route field, e.g. a hanger coupler length), "Q1.junction.Lj_nH" (an instance field).
Parameter paths may go deeper (get_knob()): "Q2.cpl_length.1" (an element of a list parameter),
"Q2.arm_length.*" (every element of a list, scaled together; the knob value is their mean) and
"Q11.connection_pads.readout.pad_width" (a nested option, e.g. a Metal connection pad; unset options take the
cell’s default). Lengths with a unit (Metal "30um", "0.1mm") read as µm and are written back in their unit.
Targets are "<instance>.<quantity>", e.g. "Q1.f_q_GHz". The evaluator maps a design to extracted parameters
({"Q1": {"f_q_GHz": ...}}); the default pipeline_evaluator() runs build → simulation job → solver → parse →
extract.
Few, expensive evaluations: 1 knob uses a bounded secant method, n knobs a finite-difference Gauss-Newton step.
Attributes¶
Classes¶
Functions¶
|
The value of |
|
A knob value as a float: a number, a numeric string or a length with a unit ( |
|
Where |
|
Tune |
|
build → sim job → run (local solver) → parse → extract, for use with |
|
|
Module Contents¶
- class quantcore_circuits.optimise.Iteration¶
- design_hash: str¶
- error: dict¶
- knobs: dict¶
- metrics: dict¶
- class quantcore_circuits.optimise.OptimiseResult¶
- converged: bool¶
- design: quantcore_circuits.design.Design¶
- quantcore_circuits.optimise.get_knob(design: quantcore_circuits.design.Design, knob: str)¶
The value of
knob(module docstring): the design’s own value, else the cell default (Metal: the class’s default options, and for a nested option such asconnection_pads.<pad>.<option>its_default_*template). Numbers come back as they are stored; lengths with a unit and*(list) knobs as floats (µm).
- quantcore_circuits.optimise.knob_number(value) float¶
A knob value as a float: a number, a numeric string or a length with a unit (
"30um","0.1mm"→ µm); a list: the mean of its elements (the value of a"<param>.*"knob).
- quantcore_circuits.optimise.knob_path(design: quantcore_circuits.design.Design, knob: str) tuple¶
Where
knoblives indesign.to_json_dict()(list indices as ints, without a trailing*): the leaf changes a proposal makes to the knob are under this path.
- quantcore_circuits.optimise.optimise(source, knobs: dict[str, tuple[float, float]], targets: dict[str, float], evaluate: Evaluator, tolerance: dict[str, float] | None = None, max_iter: int = 6, step: float = 0.02, log=print) OptimiseResult¶
Tune
knobs(with bounds) so thattargetsare met withintolerance(absolute, per target).
- quantcore_circuits.optimise.pipeline_evaluator(group: str, analysis: str, job_root: str | pathlib.Path = 'build/jobs', **settings) Evaluator¶
build → sim job → run (local solver) → parse → extract, for use with
optimise().
- quantcore_circuits.optimise.set_knob(design: quantcore_circuits.design.Design, knob: str, value) quantcore_circuits.design.Design¶
designwithknobset tovalue(a copy). A length stored with a unit keeps its unit;*scales every element of the list so that their mean isvalue; an unset parameter or option is created.
- quantcore_circuits.optimise.Evaluator¶
- quantcore_circuits.optimise.INSTANCE_FIELDS = ('cell', 'params', 'place', 'ports', 'junction')¶